C64/VIC20 - Clear stop key flag on exit

This commit is contained in:
Curtis F Kaylor 2021-09-04 17:03:07 -04:00
parent 4958e3c432
commit e8777b6077
3 changed files with 14 additions and 8 deletions

View File

@ -22,6 +22,7 @@ TEMP2 EQU $65 ;Temporary Variable [Floating Point Accumulator]
TEMP3 EQU $67 ;Temporary Variable [Floating Point Accumulator]
TMPPTR EQU $69 ;Temporary Pointer [Floating Point Argument]
; $6A-$70 ;[Floating Point Argument]
.STKEY EQU $91 ;Stop Key flag
RDSEED EQU $A2 ;Random Seed [Software Jiffy Clock (Low Byte)]
; $FB-$FE ;Unused Zero Page for Applications
@ -35,7 +36,7 @@ BLKEND EQU $0336 ;Block Start [Unused Byte]
BLKLEN EQU $0338 ;Block Length [Unused Byte]
RANDOM EQU $0339 ;Random Number Storage [Unused Byte]
STKSAV EQU $033A ;Machine Stack Storage [Unused Byte]
.STKSAV EQU $033A ;Machine Stack Storage [Unused Byte]
; $033B ;Free Byte for User Programs
TBFFR EQU $033C ;Cassette I/O Buffer
@ -61,10 +62,12 @@ BASIC: DC $0C, $08 ;Pointer to Next Line
DC $00, $00 ;End of Basic Program
START: TSX ;Get Stack Pointer
STX STKSAV ;and Save for Exit
STX .STKSAV ;and Save for Exit
JMP MAIN ;Execute Program
EXIT: LDX STKSAV ;Retrieve Saved Stack Pointer
EXIT: LDA #0 ;Clear Stop Key Flag
STA .STKEY
LDX .STKSAV ;Retrieve Saved Stack Pointer
TXS ;and Restore It
RTS

View File

@ -1,10 +1,12 @@
;c02 Program Initialization Code for Vic-20 - Common Code
START: TSX ;Get Stack Pointer
STX STKSAV ;and Save for Exit
STX .STKSAV ;and Save for Exit
JMP MAIN ;Execute Program
EXIT: LDX STKSAV ;Retrieve Saved Stack Pointer
EXIT: LDA #0 ;Clear Stop Key Flag
STA .STKEY
LDX .STKSAV ;Retrieve Saved Stack Pointer
TXS ;and Restore It
RTS ;Return to BASIC

View File

@ -6,8 +6,8 @@ ESCKEY EQU $03 ;Escape/Stop Key (RUN/STOP)
RTNKEY EQU $0D ;Return/Enter Key (RETURN)
;Zero Page Locations
XMBANK EQU $0A ;Extended Memory Bank [Load/Verify Flag]
XMADDR EQU $0B ;Extended Memory Address [Array Index/Flags]
XMADDR EQU $0A ;Extended Memory Address [VERCKB and COUNT]
XMBANK EQU $0C ;Extended Memory Bank [DIMFLG and VALTYP]
; $16 ;[Temporary String Stack Pointer]
SRCPTR EQU $17 ;Source Pointer [Temporary String Space Pointer]
DSTPTR EQU $19 ;Destination Pointer [Temporary String Stack]
@ -22,6 +22,7 @@ TEMP2 EQU $65 ;Temporary Variable [Floating Point Accumulator]
TEMP3 EQU $67 ;Temporary Variable [Floating Point Accumulator]
TMPPTR EQU $69 ;Temporary Pointer [Floating Point Argument]
; $6A-$70 ;[Floating Point Argument]
.STKEY EQU $91 ;Stop Key flag
RDSEED EQU $A2 ;Random Seed [Software Jiffy Clock (Low Byte)
; $FB-$FE ;Unused Zero Page for Applications
@ -38,7 +39,7 @@ BLKEND EQU $0336 ;Block Start [Unused Byte]
BLKLEN EQU $0338 ;Block Length [Unused Byte]
RANDOM EQU $0339 ;Random Number Storage [Unused Byte]
STKSAV EQU $033A ;Machine Stack Storage [Unused Byte]
.STKSAV EQU $033A ;Machine Stack Storage [Unused Byte]
USER11 EQU $033B ;Free Byte for User Programs
TBFFR EQU $033C ;Cassette I/O Buffer