0 Members and 1 Guest are viewing this topic.
Start: db $ef,$40,$45 ld b,100 ld a,0Loop: add a,myNum djnz Loop ld l,a db $21,$01,$00 db $ef,$07,$45 B_CALL (_GetKey) ;ef4972 retmyNum: db 3
Start: db $ef,$40,$45 ld b,100 ld a,0Loop: add a,myNum djnz Loop ld l,a db $21,$01,$00 db $ef,$07,$45 B_CALL (_GetKey) ;ef4972 retmyNum: db 1
Just a question. Why are you doing in-line assembly in assembly? Why not just type out the bcall? It makes it easier for the non-xeda's to read
You can use ld a,(Address) instead of loading the address to HL first.
add a,(mynum)
Thanks, I actually though stuff inside parentheses were adresses and without parentheses were values. Is it different for variables??
XOR A LD H,0 LD B,100Loop INC A DJNZ LoopEnd LD L,A RST 28h .dw DispHL RET
Quote from: ralphdspamYou can use ld a,(Address) instead of loading the address to HL first. It needs to be added to A, though.Quote from: Scoutadd a,(mynum)See my post above -- ADD A,(n) isn't valid.Quote from: ScoutThanks, I actually though stuff inside parentheses were adresses and without parentheses were values. Is it different for variables??That's exactly it. myNum is a pointer that points to a byte that has a value of 3.I don't think you understand what "variables" are in ASM. In ASM, a "variable" is just a byte (or two bytes) of data reserved for a purpose. In this case, you use .db to reserve a byte that has a value of 3, and you label it as myNum -- the pointer of that byte.