;Program to test serial port. ;To be entered with ROM Program_loader. ;Includes port initialization commands ;When running, should echo typed characters to display. ;Sends entered characters to output port 0 LEDs also. org 0800h ;org not really needed, all jumps relative ld a,04eh ;1 stop bit, no parity, 8-bit char, 16x baud out (3),a ;write to control port ld a,037h ;enable receive and transmit out (3),a ;write to control port echo_loop_1: in a,(3) ;get status and 002h ;check RxRDY bit jr z,echo_loop_1 ;not ready, loop in a,(2) ;get char out (0),a ;data to LEDs ld b,a ;save received char in b reg echo_loop_2: in a,(3) ;get status and 001h ;check TxRDY bit jr z,echo_loop_2 ;loop if not set ld a,b ;get char back out (2),a ;send to output jr echo_loop_1 ;start over