You are on page 1of 1

* This is my second assembly language program.

*
* Your program must be in range $1000 - $1FFF.
* Your variables and constants must be in range $0800 - $0BFF.
*
*
* Add two numbers stored in memory location ($0800) and ($0801).
* The result of addition is stored in memory location ($0803).
* Suppose the numbers in ($0800) = @12 (octal num) and ($0801) = $34 (hex num).
firstnum equ $0800
secondnum equ $0801
result equ $0803

org $0800
dc.b @12 ; assembler directive to store @12 in ($0800)
dc.b $34 ; assembler directive to store $34 in ($0801)
dc.w $5678 ; $56 in ($0802)
; $78 in ($0803)

org $1000 ; assembler directive telling MiniIDE to store


; subsequent instructions starting at RAM addres
s $1000
ldaa firstnum ; A <-- ($0800) first number to A
adda secondnum ; A <-- A + ($0801) firstnum + secondnum
staa result ; ($0803) <-- A result store in ($0803)

here bra here ; infinite loop to prevent your program from


; executing beyond this point.
end ; assembler directive to indicate end of our pro
gram.

You might also like