Clear the (D)HGR display before showing it, so we don't see garbage

during startup.

Clear keyboard strobe before exiting.
This commit is contained in:
kris 2019-06-20 21:23:18 +01:00
parent 7d041a6a84
commit b0e83d2faf

View File

@ -58,6 +58,7 @@ zpdummy = $08
dummy = $ffff dummy = $ffff
ptr = $06 ; TODO: we only use this for connection retry count ptr = $06 ; TODO: we only use this for connection retry count
HGRZP = $E6 ; ZP location used by HGR internals to track page to clear
; soft-switches ; soft-switches
KBD = $C000 KBD = $C000
@ -74,7 +75,7 @@ DHIRESON = $C05E
; MONITOR SUBROUTINES ; MONITOR SUBROUTINES
HGR = $F3E2 HGR = $F3E2
HGR0 = $F3EA ; internal entry point within HGR that doesn't set soft-switches HGR0 = $F3F2 ; internal entry point within HGR that doesn't set soft-switches
COUT = $FDED COUT = $FDED
PRBYTE = $FDDA PRBYTE = $FDDA
PRNTAX = $F941 PRNTAX = $F941
@ -311,30 +312,35 @@ op_header:
; Initialize (D)HGR in the CODE segment so we don't accidentally toast ourselves when ; Initialize (D)HGR in the CODE segment so we don't accidentally toast ourselves when
; erasing HGR ; erasing HGR
_op_header_hgr: _op_header_hgr:
; Co-opt HGR internals to clear screen without displaying it.
; nukes the startup code we placed in HGR segment
STA HIRESON
STA FULLSCR
LDA #$20
STA HGRZP ; ZP location used by HGR to track page to clear
JSR HGR0
LDA WDATA ; Video mode LDA WDATA ; Video mode
BEQ @1 ; 0 = HGR mode BEQ @1 ; 0 = HGR mode
; TODO: clear screen before displaying it to look cleaner
; DHGR mode ; DHGR mode
STA TEXTOFF
STA HIRESON
STA DHIRESON
STA COL80ON
STA STORE80ON STA STORE80ON
; Clear aux screen ; Clear aux screen
STA PAGE2ON ; AUX memory active STA PAGE2ON ; AUX memory active
; Co-opt HGR internals to clear AUX for us. ; Co-opt HGR internals to clear AUX for us.
LDA #$20 LDA #$20
STA HGRZP
JSR HGR0 JSR HGR0
STA PAGE2OFF ; MAIN memory active STA PAGE2OFF ; MAIN memory active
STA TEXTOFF ; now display empty (D)HGR screen. Doing this before the next instruction to make sure we don't see 80-column text garbage momentarily.
STA COL80ON
STA DHIRESON
@1: @1:
JSR HGR ; nukes the startup code we placed in HGR segment STA TEXTOFF ; now display empty HGR screen (NOP for DHGR since we've already done it)
STA FULLSCR
; establish invariants expected by decode loop ; establish invariants expected by decode loop
LDY #>RXBASE ; High byte of socket 0 receive buffer LDY #>RXBASE ; High byte of socket 0 receive buffer
@ -1278,6 +1284,7 @@ op_terminate:
LDA KBD LDA KBD
BPL @0 BPL @0
@1: ; key pressed @1: ; key pressed
LDA KBDSTRB ; clear strobe
JMP exit JMP exit
; Manage W5100 socket buffer and ACK TCP stream. ; Manage W5100 socket buffer and ACK TCP stream.