English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to write an assembly language program to perform the logical AND operation on two operands. One operand should be the word (16 bits) held in memory locations 1000 and 1001.
The other operand should be the word held in memory locations 1002 and 1003. Place the results in location 1004 and 1005. What should this look like?

2007-03-04 09:24:37 · 1 answers · asked by Princess Peach 3 in Computers & Internet Hardware Other - Hardware

1 answers

You don't say what CPU chip, however (at the most primative level) the general form of the code will be as follows :-

LDw #1000, regA ; load word from location 1000 to register A

LDw #1002, regB ; load word from location 1002 to register B

AND regA,regB,regC ; AND words in A & B to form result in C

LDw regC, #1004 ;store word from C to memory location 1004

This uses CPU Registers A, B & C. If the CPU supports direct memory addressing you could write :-

ANDw #1000, #1002, #1004

(w means word operation, # means absolute addressing - the exact syntax will depend on the Assembler and CPU architecture)

2007-03-05 22:45:51 · answer #1 · answered by Steve B 7 · 0 0

fedest.com, questions and answers