ex_code SEGMENT ; Beginning of the code segment
org 0150h ; originate code at 0250h as the SDK sees it
; remember, the SDK adds 100h to our addresses
;
Begin: mov ax,0010h ; point to beginning of data segment
mov ds,ax ; initialize ds register
mov ax,0010h ; point to beginning of stack segment
mov ss,ax ; set the ss register
mov sp, offset st_top ; initialize the sp for empty stack
;
call cdisp ; clear display
kbdrt: mov al,40h ; setup control code for keys
mov dx,cntrl ; dx = cntrl for 8279
out dx,al ; do it
next: in al,dx ; check if key is pressed
and al,0Fh ; mask lower nibble
jz next ; jump back if nothing there
mov dx,buffer ; key pressed, read buffer
in al,dx ; read it
cmp al,0dh ; check to see if D is pressed
je dpress ; yes it did
cmp al,0ch ; check to see if C is pressed
je cpress ; yes it did
cmp al,0eh ; check to see if E is pressed
je epress ; yes it did
jmp kbdrt ; go back since invalid key pressed