I've written a tiny program that reads out a keypress, then displays the character and its binary value. It works just fine, but I'd really like some feedback on its structure and use of registers. Should I be using registers like this, or is there a "best practice" for it? If so, I'll gladly adapt to best practice. I'm just starting out, so I'm trying to get the basics just right.
Also, if the code can be quicker, better, faster, nicer, etc (which, looking at the mess I've made is probably the case): please post.
Well, here's the little bit of code:
ORG $C000 CHGET: EQU $9F CHPUT: EQU $A2 CALL CHGET CALL BITS RET BITS: LD B,8 LD C,A CALL CHPUT LD A,58 CALL CHPUT LD A,32 CALL CHPUT BITSL: RL C CALL C,BITSC CALL NC,BITSNC DEC B JP NZ,BITSL RET BITSC: LD A,49 CALL CHPUT RET BITSNC: LD A,48 CALL CHPUT RET
Entrar ou registrar-se para comentar