Jason12345
Newbie level 5
- Joined
- Jan 29, 2015
- Messages
- 8
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 58
IN A, (0xff)
XOR A, 0x1b
JP LOOP1
OUT (0xfb), 0xaa
You don't want a hardcoded address, use a label, let the assembler figure out the adddress to put in the instruction.JP Z, 4 - this jumps to the output on line 4 i think
When a jump instruction isn't taken (jump condition is not met) the program execution "falls through" (i.e. goes to the next instruction), so following the jump instruction you want to add code that say what you do when the input byte does not match 0x1b. See line 4 in post #5.Jason12345 said:im not sure what "fall through, z not set jump back to 1. read input" means or the instruction to do it,
im really sorry if its fustrating when im not getting it right but im trying my hardest, please bare with me, i am very thankful of you helping me
START: IN A, (0xff) # read input from port 0xff
ADD 0x80 # add 0x80 to A
?? ?, CARRY # if there is a carry (i.e. A+0x80 has a result with 0x1??)
OUT (0xfb), A # spit out the sum on port 0xfb when there isn't a carry
?? START # look for more inputs
CARRY: OUT (0xfb), 0x01 # spit out carry
OUT (0xfb), A # then the sum on port 0xfb when there is a carry
?? START # look for more inputs
You don't want a hardcoded address, use a label, let the assembler figure out the adddress to put in the instruction.
Ok thankyou very much for your time i am determinded to get this right
IN A, (0xff) - ok this reads the input from port 0xff
CP A, 0x1b - this compares that value to 0x1b
JP Z, 4 - this jumps to the output on line 4 i think
OUT (0xfb), 0xaa - this will output the value 0xaa to port 0xfb
JP LOOP1 - this will loop back around
im not sure what "fall through, z not set jump back to 1. read input" means or the instruction to do it,
im really sorry if its fustrating when im not getting it right but im trying my hardest, please bare with me, i am very thankful of you helping me
LOOP1: IN A, (0XFF) ;GET INPUT IN ACC
CP A, 0X1B ;COMPARE WITH 0X1B
JNZ LOOP1 ;IF NOT SAME THEN GO BACK
LD A, 0XAA ; LOAD ACC WITH 0XAA
OUT A,(0XFB) ;OUT 0XAA TO PORT FB
END
START: IN A, (0xff) # port 0xff => A
CP 0x1b # compare A with 0x1b (sets/clears Z flag)
JP NZ NOTEQUAL # if Z == 0, jump to START
LD A, 0xaa # thanks Allen, didn't look at these instructions
OUT A, (0xfb) # ...Z==1, output 0xaa
NOTEQUAL: JP START # jump back to START
thankyou both of you for helping me, i will show my computer architecture teacher and see what he thinks. Without u guys im sure i wouldnt of got this so your help is very much appriciated :smile::thumbsup:
LOOP1: IN A, (0xFF) ;GET INPUT IN ACC
CP 0x1B ;COMPARE WITH 0x1B
JP NZ, LOOP1 ;IF NOT SAME THEN GO BACK
LD A, 0xAA ;LOAD ACC WITH 0XAA
OUT (0xFB),A ;OUT 0xAA TO PORT FB
END
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?