;---------------------------------------------------------------- ; LD231.ASM ; Detecting a keypress on a 4x4 keypad. ; ASM Code for the DECE Microprocessor. ; C.P. Diduch, 2001. ;---------------------------------------------------------------- .EQU OPORT 0x0002 ; #define OPORT 0x0002 .EQU IPORT 0x0001 ; #define IPORT 0x0000 .ORG 0x8000 ; ; void main() { ; do { K0: ADDL R0, NULL, 0 ; outport(OPORT, 0x0000); STOREP OPORT, R0 ; K1: LOADP R0, IPORT ; do {col = 0x00F0 ANDL R0, R0, 0x00F0 ; & inport(IPORT);} SUBL NULL, R0, 0x0F0 ; while (col == 0x0F0); JMPZ K1 ; ; STOREP 0x0003, R0 ; outport(0x0003, col); JMP K0 ; } ;----------------------------------------------------------------