- #1
leo255
- 57
- 2
CHARI 0xFE,d ; read 1stchar
CHARI 0xFF,d ; read 2ndchar
LDBYTEA 0xFE,d ; load 1stchar
ADDA 0xFE,d ; add 2ndchar to low byte(big endian!)
ANDA 0x0F,i ; keep low 4 bits
ORA 0x30,i ; convert to ascii
STBYTEA 0xFD,d ; store for output
CHARO 0xFD,d ; write result
STOP.END
Hello, I mostly understand this assembly code, but am confused with this line: "ANDA 0x0F,i".
This program inputs two single-digit numbers, adds them and then outputs their single-digit sum. Apparently, we are keeping the low 4 bits. What exactly is meant by this, specifically with what the program is trying to accomplish?
CHARI 0xFF,d ; read 2ndchar
LDBYTEA 0xFE,d ; load 1stchar
ADDA 0xFE,d ; add 2ndchar to low byte(big endian!)
ANDA 0x0F,i ; keep low 4 bits
ORA 0x30,i ; convert to ascii
STBYTEA 0xFD,d ; store for output
CHARO 0xFD,d ; write result
STOP.END
Hello, I mostly understand this assembly code, but am confused with this line: "ANDA 0x0F,i".
This program inputs two single-digit numbers, adds them and then outputs their single-digit sum. Apparently, we are keeping the low 4 bits. What exactly is meant by this, specifically with what the program is trying to accomplish?