

SCAN_P0:  JNB   TICK100ms, $    ; Wait for the 100ms tick
          CLR   TICK100ms       ; Ticked ON. Clear it
 
CASE_P0:  MOV   P0, #0FFH       ; All pins as input
          JNB   P0.0, SND_30H
          ...
          ...

          JNB   P0.7, SND_37H

NO_INPT:  JMP   SCAN_P0         ; No input active. Go wait

SND_30H:  MOV   A,  #30H
          CALL  SND232          ; 30H to PC
          JMP   SCAN_P0         ; Current state sent. Go wait for next.
          ...
          ...  

SND_37H:  MOV   A,  #37H
          CALL  SND232
          JMP   SCAN_P0  

SND232:   JNB  SCON.1, $        ; wait for previous character to go..
          CLR  SCON.1           ; and send current character to COMM
          MOV  SBUF,  A
          RET
;================================
