Hello Michael,
I took your picture and typed it out so that
others could have a test listing of it rather
than a graphical listing.
I complied it with a51.exe and tested it with jsim.exe.
It worked successfully.
Regards,
Charles Bannister
.org 0x00
Reset: ljmp Main
.org 0x40
Main: acall decode
here: sjmp here
decode: mov a, p0
anl a, #0x0F
rl a
push acc
add a, #(lookup-lab1)
lab1: movc a, @a+pc
mov p2, a
pop acc
add a, #(lookup-lab2+1)
lab2: movc a, @a+pc
mov p1, a
ret
lookup:
.dw 0001h, 0002h, 0004h, 0008h
.dw 0010h, 0020h, 0040h, 0080h
.dw 0100h, 0200h, 0400h, 0800h
.dw 1000h, 2000h, 4000h, 8000h
;; hex file listing for above program
:03000000020040BB
:10004000114480FEE580540F23C0E0240B83F5A00B
:10005000D0E0240583F5902200010002000400088E
:100060000010002000400080010002000400080091
:08007000100020004000800098
:00000001FF