Professional Documents
Culture Documents
2)
1- Write a sequence of SIC instructions that move a value 15 of type word to the
memory location GAMMA.
2- Given that the ASCII code of character ‘A’ is 65 and using immediate
addressing mode, write a sequence of SIC/XE instructions that store the
character ‘A’ into memory location DELTA. Minimize your code as much as
you can.
3- Write a sequence of SIC instructions that calculate the expression ALPHA *
BETA + 10, where ALPHA and BETA are one-word variables. Store the result
of this expression into memory location GAMMA.
4- Write a sequence of SIC/XE instructions that calculate the expression ALPHA
+ BETA - 6, where ALPHA and BETA are one-word variables, and store the
result of this expression into memory location GAMMA. Use as many register-
to-register instructions as you can to make your code effective and minimized.
5- Write a sequence of SIC instructions that copy the ‘HELLO WORLD’ character
string form one memory location to another.
6- Write a sequence of SIC/XE instructions that copy the ‘COPY STRING’
character string form one memory location to another. Use as many register-to-
register instructions as you can to make your code effective and minimized.
1
Answer
1-
2-
LDCH #65 LOAD ASCII CODE OF ‘A’ INTO A
3-
LDA ALPHA LOAD ALPHA INTO A
MUL BETA MULTIPLY THE VALUE OF BETA
4-
LDS BETA LOAD INCR INTO S
LDA ALPHA LOAD ALPHA INTO A
ADDR S,A ADD THE VALUE OF BETA
2
SUB #1 SUBTRACT 1
STA GAMMA STORE IN DELTA
ALPHA RESW 1 ONE-WORD VARIABLE
BETA RESW 1 ONE-WORD VARIABLE
GAMMA RESW 1 ONE-WORD VARIABLE
5-
LDX ZERO SET INDEX REGISTER X TO 0
6-
LDT #11 SET REGISTER T TO 11
3
STR2 RESB 11 11-BYTE VARIABLE