I can't seem to get Addition running properly without using Basic as in the Tutorial.
The result always seems to 'overflow'.
My Code:
Code: Select all
PrintChar equ &BB5A ;AMSTRAD Firmware Function prints a
WaitChar equ &BB06 ;AMSTRAD Firmware Function waits for input and sets to a
org &8000
;First Operand
Call WaitChar
Call PrintChar
ld (&9000), a
;Print +
ld a,'+'
Call PrintChar
;Second Operand
Call WaitChar
Call PrintChar
ld (&9001), a
;Print =
ld a,'='
Call PrintChar
ld bc,(&9000)
ld a,c
add b ;DOES NOT WORK?!?!?!?!
Call PrintChar
ret
Code: Select all
ld a,b
Call PrintChar
ld a,c
Call PrintChar
My understanding:
I use the Firmware Function to get user input and assign that to 9000 and 9001.
By using bc c should contain the value of 9000 and b should contain the value of 9001.
But when I add these two values, the result always is some letter.
So for instance 5+2=k
What am I doing wrong here?