ROM Monitor clears remaining input buffer and waits for GPU to be ready before starting

This commit is contained in:
Dreaded_X 2021-01-18 16:27:00 +01:00
parent 8ee4201dc8
commit ae998ec3dc

View File

@ -25,11 +25,13 @@ ROM_monitor_stack: equ 0x10ff ;upper TPA in RAM, below RAM monitor
;Needs to be called only once after computer comes out of reset.
;If called while port is active will cause port to fail.
;16x = 9600 baud
initialize_port: 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
out (3),a ;write to control port
initialize: in a,(0x1E) ; Clear out input buffer
in a,(0x1F)
and 0x01
jp nz, initialize
initialize_2: in a,(3) ; Wait for GPU to be ready
and 0x02
jp nz, initialize_2
ret
;
;Puts a single char (byte value) on serial output
@ -455,7 +457,7 @@ decimal_error_msg: defm 13,10,"Error: invalid decimal number, try again: ",0
;
;Simple monitor program for CPUville Z80 computer with serial interface.
monitor_cold_start: ld sp,ROM_monitor_stack
call initialize_port
call initialize
ld hl,monitor_message
call write_string
monitor_warm_start: call write_newline ;routine program return here to avoid re-initialization of port