diff --git a/asminc/cbm510.inc b/asminc/cbm510.inc index e1a86c487..627ba4991 100644 --- a/asminc/cbm510.inc +++ b/asminc/cbm510.inc @@ -15,6 +15,8 @@ IndReg := $01 ; Controls indirect indexed load-store bank TXTPTR := $85 ; Far pointer into BASIC source code FNAM := $90 ; Far pointer to LOAD/SAVE file-name +FNAM_SEG := $92 +STATUS := $9C ; Kernal I/O completion status FNAM_LEN := $9D ; Holds length of file-name ; --------------------------------------------------------------------------- diff --git a/asminc/cbm610.inc b/asminc/cbm610.inc index b1b03eb1d..b031b2e9f 100644 --- a/asminc/cbm610.inc +++ b/asminc/cbm610.inc @@ -15,6 +15,8 @@ IndReg := $01 ; Controls indirect indexed load-store bank TXTPTR := $85 ; Far pointer into BASIC source code FNAM := $90 ; Far pointer to LOAD/SAVE file-name +FNAM_SEG := $92 +STATUS := $9C ; Kernal I/O completion status FNAM_LEN := $9D ; Holds length of file-name ; --------------------------------------------------------------------------- diff --git a/asminc/pet.inc b/asminc/pet.inc index ee96d378c..c51010210 100644 --- a/asminc/pet.inc +++ b/asminc/pet.inc @@ -10,6 +10,7 @@ VARTAB := $2A ; Pointer to start of BASIC variables MEMSIZE := $34 ; Size of memory installed TXTPTR := $77 ; Pointer into BASIC source code TIME := $8D ; 60HZ clock +STATUS := $96 ; IEC status byte KEY_COUNT := $9E ; Number of keys in input buffer RVS := $9F ; Reverse flag CURS_FLAG := $A7 ; 1 = cursor off diff --git a/libsrc/c128/crt0.s b/libsrc/c128/crt0.s index ba6a78ac5..b7e760176 100644 --- a/libsrc/c128/crt0.s +++ b/libsrc/c128/crt0.s @@ -9,7 +9,6 @@ .import push0, callmain .import RESTOR, BSOUT, CLRCH .import __MAIN_START__, __MAIN_SIZE__, __STACKSIZE__ - .importzp ST .include "zeropage.inc" .include "c128.inc" @@ -92,7 +91,7 @@ L2: lda zpsave,x ; Place the program return code into BASIC's status variable. pla - sta ST + sta STATUS ; Reset the stack and the memory configuration. diff --git a/libsrc/c128/status.s b/libsrc/c128/status.s index c6f279230..eae91fb4d 100644 --- a/libsrc/c128/status.s +++ b/libsrc/c128/status.s @@ -1,5 +1,15 @@ ; -; Oliver Schmidt, 2012-09-30 +; Stefan Haubenthal, 2023-01-16 ; - .exportzp ST := $90 ; IEC status byte + .export initst + + .include "c128.inc" + +.proc initst + + lda #$00 + sta STATUS + rts + +.endproc diff --git a/libsrc/c16/crt0.s b/libsrc/c16/crt0.s index 1df1e5c62..35ececb9a 100644 --- a/libsrc/c16/crt0.s +++ b/libsrc/c16/crt0.s @@ -10,9 +10,9 @@ .import initlib, donelib .import callmain, zerobss .import MEMTOP, RESTOR, BSOUT, CLRCH - .importzp ST .include "zeropage.inc" + .include "c16.inc" ; ------------------------------------------------------------------------ ; Startup code @@ -76,7 +76,7 @@ L2: lda zpsave,x ; Store the return code into BASIC's status variable. pla - sta ST + sta STATUS ; Restore the stack pointer. diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s index 4e5c7c9d4..d57391b83 100644 --- a/libsrc/c64/crt0.s +++ b/libsrc/c64/crt0.s @@ -10,9 +10,9 @@ .import BSOUT .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated .import __STACKSIZE__ ; from configure file - .importzp ST .include "zeropage.inc" + .include "c64.inc" ; ------------------------------------------------------------------------ @@ -62,7 +62,7 @@ L2: lda zpsave,x ; Place the program return code into BASIC's status variable. pla - sta ST + sta STATUS ; Restore the system stuff. diff --git a/libsrc/c64/status.s b/libsrc/c64/status.s index c6f279230..79d703489 100644 --- a/libsrc/c64/status.s +++ b/libsrc/c64/status.s @@ -1,5 +1,15 @@ ; -; Oliver Schmidt, 2012-09-30 +; Stefan Haubenthal, 2023-01-16 ; - .exportzp ST := $90 ; IEC status byte + .export initst + + .include "c64.inc" + +.proc initst + + lda #$00 + sta STATUS + rts + +.endproc diff --git a/libsrc/cbm/getdevice.s b/libsrc/cbm/getdevice.s index 08ba6d5f8..947ffbdc2 100644 --- a/libsrc/cbm/getdevice.s +++ b/libsrc/cbm/getdevice.s @@ -10,7 +10,8 @@ .import isdisk .import opencmdchannel .import closecmdchannel - .importzp ST + .import initst + .import READST .importzp tmp2 ;------------------------------------------------------------------------------ @@ -40,8 +41,7 @@ next: inx ; only [in|de]crement the reference count of the shared cmdchannel ; so we need to explicitly initialize ST here - lda #$00 - sta ST + jsr initst stx tmp2 jsr opencmdchannel @@ -49,10 +49,7 @@ next: inx jsr closecmdchannel ldx tmp2 -; As we had to reference ST above anyway we can as well do so -; here too (instead of calling READST) - - lda ST + jsr READST ; Either the Kernal calls above were successfull or there was ; already a cmdchannel to the device open - which is a pretty diff --git a/libsrc/cbm510/kreadst.s b/libsrc/cbm510/kreadst.s index 66c0b880f..cb9363d42 100644 --- a/libsrc/cbm510/kreadst.s +++ b/libsrc/cbm510/kreadst.s @@ -16,11 +16,9 @@ jsr sys_bank sty ktmp ; Save Y register - ldy #$9C ; STATUS + ldy #STATUS lda (sysp0),y ; Load STATUS from system bank ldy ktmp jmp restore_bank ; Will set condition codes on A .endproc - - diff --git a/libsrc/cbm510/ksetnam.s b/libsrc/cbm510/ksetnam.s index c338c0de4..e0e488b9e 100644 --- a/libsrc/cbm510/ksetnam.s +++ b/libsrc/cbm510/ksetnam.s @@ -22,7 +22,7 @@ sty ktmp txa - ldy #$90 ; FNAM + ldy #FNAM sta (sysp0),y lda ktmp @@ -33,13 +33,10 @@ ldy #$92 ; FNAM_SEG sta (sysp0),y - ldy #$9D ; FNAM_LEN + ldy #FNAM_LEN pla sta (sysp0),y ldy ktmp jmp restore_bank .endproc - - - diff --git a/libsrc/cbm510/status.s b/libsrc/cbm510/status.s new file mode 100644 index 000000000..a21105710 --- /dev/null +++ b/libsrc/cbm510/status.s @@ -0,0 +1,21 @@ +; +; Stefan Haubenthal, 2023-01-16 +; + + .export initst + + .include "extzp.inc" + .include "cbm510.inc" + +.proc initst + + ldx IndReg + ldy #$0F + sty IndReg ; Switch to the system bank + ldy #STATUS + lda #$00 ; Initialize value + sta (sysp0),y + stx IndReg + rts + +.endproc diff --git a/libsrc/cbm610/crt0.s b/libsrc/cbm610/crt0.s index 0ad343d7f..15f1dfb7b 100644 --- a/libsrc/cbm610/crt0.s +++ b/libsrc/cbm610/crt0.s @@ -394,7 +394,7 @@ _exit: pha ; Save the return code ; Place the program return code into BASIC's status variable. pla - ldy #$9C ; ST + ldy #STATUS sta (sysp0),y ; Set up the welcome code at the stack bottom in the system bank. diff --git a/libsrc/cbm610/kreadst.s b/libsrc/cbm610/kreadst.s index d9bbf7c2d..44dc1ebab 100644 --- a/libsrc/cbm610/kreadst.s +++ b/libsrc/cbm610/kreadst.s @@ -16,11 +16,9 @@ jsr sys_bank sty ktmp ; Save Y register - ldy #$9C ; STATUS + ldy #STATUS lda (sysp0),y ; Load STATUS from system bank ldy ktmp jmp restore_bank ; Will set condition codes on A .endproc - - diff --git a/libsrc/cbm610/ksetnam.s b/libsrc/cbm610/ksetnam.s index 97ecf0126..d3542c83d 100644 --- a/libsrc/cbm610/ksetnam.s +++ b/libsrc/cbm610/ksetnam.s @@ -22,7 +22,7 @@ sty ktmp txa - ldy #$90 ; FNAM + ldy #FNAM sta (sysp0),y lda ktmp @@ -30,14 +30,13 @@ sta (sysp0),y lda ExecReg ; Assume name is always in this segment - ldy #$92 ; FNAM_SEG + ldy #FNAM_SEG sta (sysp0),y - ldy #$9D ; FNAM_LEN + ldy #FNAM_LEN pla sta (sysp0),y ldy ktmp jmp restore_bank .endproc - diff --git a/libsrc/cbm610/status.s b/libsrc/cbm610/status.s new file mode 100644 index 000000000..b8583159e --- /dev/null +++ b/libsrc/cbm610/status.s @@ -0,0 +1,21 @@ +; +; Stefan Haubenthal, 2023-01-16 +; + + .export initst + + .include "extzp.inc" + .include "cbm610.inc" + +.proc initst + + ldx IndReg + ldy #$0F + sty IndReg ; Switch to the system bank + ldy #STATUS + lda #$00 ; Initialize value + sta (sysp0),y + stx IndReg + rts + +.endproc diff --git a/libsrc/pet/checkst.s b/libsrc/pet/checkst.s index 8d9d9a4f3..146a358e2 100644 --- a/libsrc/pet/checkst.s +++ b/libsrc/pet/checkst.s @@ -6,12 +6,12 @@ ; .export checkst - .importzp ST + .include "pet.inc" .proc checkst - lda ST + lda STATUS beq @L1 lda #5 ; ### Device not present sec diff --git a/libsrc/pet/crt0.s b/libsrc/pet/crt0.s index e56a7eca4..18b9f7e05 100644 --- a/libsrc/pet/crt0.s +++ b/libsrc/pet/crt0.s @@ -8,7 +8,6 @@ .import zerobss, push0 .import callmain .import CLRCH, BSOUT - .importzp ST .include "zeropage.inc" .include "pet.inc" @@ -80,7 +79,7 @@ L2: lda zpsave,x ; Store the program return code into BASIC's status variable. pla - sta ST + sta STATUS ; Restore the stack pointer. diff --git a/libsrc/pet/kreadst.s b/libsrc/pet/kreadst.s index 38f6bfb19..38e399bae 100644 --- a/libsrc/pet/kreadst.s +++ b/libsrc/pet/kreadst.s @@ -5,14 +5,12 @@ ; .export READST - .importzp ST + .include "pet.inc" .proc READST - lda ST + lda STATUS rts .endproc - - diff --git a/libsrc/pet/status.s b/libsrc/pet/status.s index 2e2e858a0..d7324b93c 100644 --- a/libsrc/pet/status.s +++ b/libsrc/pet/status.s @@ -1,5 +1,15 @@ ; -; Oliver Schmidt, 2012-09-30 +; Stefan Haubenthal, 2023-01-16 ; - .exportzp ST := $96 ; IEC status byte + .export initst + + .include "pet.inc" + +.proc initst + + lda #$00 + sta STATUS + rts + +.endproc diff --git a/libsrc/plus4/crt0.s b/libsrc/plus4/crt0.s index 6b44a2b7e..71e734353 100644 --- a/libsrc/plus4/crt0.s +++ b/libsrc/plus4/crt0.s @@ -11,7 +11,6 @@ .import __INTERRUPTOR_COUNT__ .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated .import __STACKSIZE__ ; Linker generated - .importzp ST .include "zeropage.inc" .include "plus4.inc" @@ -106,7 +105,7 @@ L2: lda zpsave,x ; Place the program return code into BASIC's status variable. pla - sta ST + sta STATUS ; Restore the stack pointer. diff --git a/libsrc/plus4/kreadst.s b/libsrc/plus4/kreadst.s index 2571f80f5..f833b8126 100644 --- a/libsrc/plus4/kreadst.s +++ b/libsrc/plus4/kreadst.s @@ -7,12 +7,11 @@ .export READST .include "plus4.inc" - .importzp ST ; Read the status byte from the zero page instead of banking in the ROM .proc READST - lda ST ; Load status + lda STATUS ; Load status rts ; Return to caller .endproc diff --git a/libsrc/plus4/status.s b/libsrc/plus4/status.s index c6f279230..0eceb6ba9 100644 --- a/libsrc/plus4/status.s +++ b/libsrc/plus4/status.s @@ -1,5 +1,15 @@ ; -; Oliver Schmidt, 2012-09-30 +; Stefan Haubenthal, 2023-01-16 ; - .exportzp ST := $90 ; IEC status byte + .export initst + + .include "plus4.inc" + +.proc initst + + lda #$00 + sta STATUS + rts + +.endproc diff --git a/libsrc/vic20/crt0.s b/libsrc/vic20/crt0.s index c5486063b..a98a1acb3 100644 --- a/libsrc/vic20/crt0.s +++ b/libsrc/vic20/crt0.s @@ -10,9 +10,9 @@ .import RESTOR, BSOUT, CLRCH .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated .import __STACKSIZE__ ; Linker generated - .importzp ST .include "zeropage.inc" + .include "vic20.inc" ; ------------------------------------------------------------------------ ; Startup code @@ -72,7 +72,7 @@ L2: lda zpsave,x ; Place the program return code into BASIC's status variable. pla - sta ST + sta STATUS ; Restore the stack pointer. diff --git a/libsrc/vic20/status.s b/libsrc/vic20/status.s index c6f279230..17c015a1f 100644 --- a/libsrc/vic20/status.s +++ b/libsrc/vic20/status.s @@ -1,5 +1,15 @@ ; -; Oliver Schmidt, 2012-09-30 +; Stefan Haubenthal, 2023-01-16 ; - .exportzp ST := $90 ; IEC status byte + .export initst + + .include "vic20.inc" + +.proc initst + + lda #$00 + sta STATUS + rts + +.endproc