initial patch from #1972

This commit is contained in:
mrdudz
2025-06-30 18:39:33 +02:00
parent 4899b6dc0c
commit 26cf19642c
25 changed files with 133 additions and 53 deletions

View File

@@ -15,6 +15,8 @@ IndReg := $01 ; Controls indirect indexed load-store bank
TXTPTR := $85 ; Far pointer into BASIC source code TXTPTR := $85 ; Far pointer into BASIC source code
FNAM := $90 ; Far pointer to LOAD/SAVE file-name 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 FNAM_LEN := $9D ; Holds length of file-name
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------

View File

@@ -15,6 +15,8 @@ IndReg := $01 ; Controls indirect indexed load-store bank
TXTPTR := $85 ; Far pointer into BASIC source code TXTPTR := $85 ; Far pointer into BASIC source code
FNAM := $90 ; Far pointer to LOAD/SAVE file-name 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 FNAM_LEN := $9D ; Holds length of file-name
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------

View File

@@ -10,6 +10,7 @@ VARTAB := $2A ; Pointer to start of BASIC variables
MEMSIZE := $34 ; Size of memory installed MEMSIZE := $34 ; Size of memory installed
TXTPTR := $77 ; Pointer into BASIC source code TXTPTR := $77 ; Pointer into BASIC source code
TIME := $8D ; 60HZ clock TIME := $8D ; 60HZ clock
STATUS := $96 ; IEC status byte
KEY_COUNT := $9E ; Number of keys in input buffer KEY_COUNT := $9E ; Number of keys in input buffer
RVS := $9F ; Reverse flag RVS := $9F ; Reverse flag
CURS_FLAG := $A7 ; 1 = cursor off CURS_FLAG := $A7 ; 1 = cursor off

View File

@@ -9,7 +9,6 @@
.import push0, callmain .import push0, callmain
.import RESTOR, BSOUT, CLRCH .import RESTOR, BSOUT, CLRCH
.import __MAIN_START__, __MAIN_SIZE__, __STACKSIZE__ .import __MAIN_START__, __MAIN_SIZE__, __STACKSIZE__
.importzp ST
.include "zeropage.inc" .include "zeropage.inc"
.include "c128.inc" .include "c128.inc"
@@ -92,7 +91,7 @@ L2: lda zpsave,x
; Place the program return code into BASIC's status variable. ; Place the program return code into BASIC's status variable.
pla pla
sta ST sta STATUS
; Reset the stack and the memory configuration. ; Reset the stack and the memory configuration.

View File

@@ -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

View File

@@ -10,9 +10,9 @@
.import initlib, donelib .import initlib, donelib
.import callmain, zerobss .import callmain, zerobss
.import MEMTOP, RESTOR, BSOUT, CLRCH .import MEMTOP, RESTOR, BSOUT, CLRCH
.importzp ST
.include "zeropage.inc" .include "zeropage.inc"
.include "c16.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Startup code ; Startup code
@@ -76,7 +76,7 @@ L2: lda zpsave,x
; Store the return code into BASIC's status variable. ; Store the return code into BASIC's status variable.
pla pla
sta ST sta STATUS
; Restore the stack pointer. ; Restore the stack pointer.

View File

@@ -10,9 +10,9 @@
.import BSOUT .import BSOUT
.import __MAIN_START__, __MAIN_SIZE__ ; Linker generated .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated
.import __STACKSIZE__ ; from configure file .import __STACKSIZE__ ; from configure file
.importzp ST
.include "zeropage.inc" .include "zeropage.inc"
.include "c64.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@@ -62,7 +62,7 @@ L2: lda zpsave,x
; Place the program return code into BASIC's status variable. ; Place the program return code into BASIC's status variable.
pla pla
sta ST sta STATUS
; Restore the system stuff. ; Restore the system stuff.

View File

@@ -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

View File

@@ -10,7 +10,8 @@
.import isdisk .import isdisk
.import opencmdchannel .import opencmdchannel
.import closecmdchannel .import closecmdchannel
.importzp ST .import initst
.import READST
.importzp tmp2 .importzp tmp2
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@@ -40,8 +41,7 @@ next: inx
; only [in|de]crement the reference count of the shared cmdchannel ; only [in|de]crement the reference count of the shared cmdchannel
; so we need to explicitly initialize ST here ; so we need to explicitly initialize ST here
lda #$00 jsr initst
sta ST
stx tmp2 stx tmp2
jsr opencmdchannel jsr opencmdchannel
@@ -49,10 +49,7 @@ next: inx
jsr closecmdchannel jsr closecmdchannel
ldx tmp2 ldx tmp2
; As we had to reference ST above anyway we can as well do so jsr READST
; here too (instead of calling READST)
lda ST
; Either the Kernal calls above were successful or there was ; Either the Kernal calls above were successful or there was
; already a cmdchannel to the device open - which is a pretty ; already a cmdchannel to the device open - which is a pretty

View File

@@ -16,11 +16,9 @@
jsr sys_bank jsr sys_bank
sty ktmp ; Save Y register sty ktmp ; Save Y register
ldy #$9C ; STATUS ldy #STATUS
lda (sysp0),y ; Load STATUS from system bank lda (sysp0),y ; Load STATUS from system bank
ldy ktmp ldy ktmp
jmp restore_bank ; Will set condition codes on A jmp restore_bank ; Will set condition codes on A
.endproc .endproc

View File

@@ -22,7 +22,7 @@
sty ktmp sty ktmp
txa txa
ldy #$90 ; FNAM ldy #FNAM
sta (sysp0),y sta (sysp0),y
lda ktmp lda ktmp
@@ -33,13 +33,10 @@
ldy #$92 ; FNAM_SEG ldy #$92 ; FNAM_SEG
sta (sysp0),y sta (sysp0),y
ldy #$9D ; FNAM_LEN ldy #FNAM_LEN
pla pla
sta (sysp0),y sta (sysp0),y
ldy ktmp ldy ktmp
jmp restore_bank jmp restore_bank
.endproc .endproc

21
libsrc/cbm510/status.s Normal file
View File

@@ -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

View File

@@ -394,7 +394,7 @@ _exit: pha ; Save the return code
; Place the program return code into BASIC's status variable. ; Place the program return code into BASIC's status variable.
pla pla
ldy #$9C ; ST ldy #STATUS
sta (sysp0),y sta (sysp0),y
; Set up the welcome code at the stack bottom in the system bank. ; Set up the welcome code at the stack bottom in the system bank.

View File

@@ -16,11 +16,9 @@
jsr sys_bank jsr sys_bank
sty ktmp ; Save Y register sty ktmp ; Save Y register
ldy #$9C ; STATUS ldy #STATUS
lda (sysp0),y ; Load STATUS from system bank lda (sysp0),y ; Load STATUS from system bank
ldy ktmp ldy ktmp
jmp restore_bank ; Will set condition codes on A jmp restore_bank ; Will set condition codes on A
.endproc .endproc

View File

@@ -22,7 +22,7 @@
sty ktmp sty ktmp
txa txa
ldy #$90 ; FNAM ldy #FNAM
sta (sysp0),y sta (sysp0),y
lda ktmp lda ktmp
@@ -30,14 +30,13 @@
sta (sysp0),y sta (sysp0),y
lda ExecReg ; Assume name is always in this segment lda ExecReg ; Assume name is always in this segment
ldy #$92 ; FNAM_SEG ldy #FNAM_SEG
sta (sysp0),y sta (sysp0),y
ldy #$9D ; FNAM_LEN ldy #FNAM_LEN
pla pla
sta (sysp0),y sta (sysp0),y
ldy ktmp ldy ktmp
jmp restore_bank jmp restore_bank
.endproc .endproc

21
libsrc/cbm610/status.s Normal file
View File

@@ -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

View File

@@ -6,12 +6,12 @@
; ;
.export checkst .export checkst
.importzp ST
.include "pet.inc"
.proc checkst .proc checkst
lda ST lda STATUS
beq @L1 beq @L1
lda #5 ; ### Device not present lda #5 ; ### Device not present
sec sec

View File

@@ -8,7 +8,6 @@
.import zerobss, push0 .import zerobss, push0
.import callmain .import callmain
.import CLRCH, BSOUT .import CLRCH, BSOUT
.importzp ST
.include "zeropage.inc" .include "zeropage.inc"
.include "pet.inc" .include "pet.inc"
@@ -80,7 +79,7 @@ L2: lda zpsave,x
; Store the program return code into BASIC's status variable. ; Store the program return code into BASIC's status variable.
pla pla
sta ST sta STATUS
; Restore the stack pointer. ; Restore the stack pointer.

View File

@@ -5,14 +5,12 @@
; ;
.export READST .export READST
.importzp ST
.include "pet.inc"
.proc READST .proc READST
lda ST lda STATUS
rts rts
.endproc .endproc

View File

@@ -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

View File

@@ -10,7 +10,6 @@
.import callmain, zerobss .import callmain, zerobss
.import __INTERRUPTOR_COUNT__ .import __INTERRUPTOR_COUNT__
.import __HIMEM__ ; Linker generated .import __HIMEM__ ; Linker generated
.importzp ST
.include "zeropage.inc" .include "zeropage.inc"
.include "plus4.inc" .include "plus4.inc"
@@ -121,7 +120,7 @@ L2: lda zpsave,x
; Place the program return code into BASIC's status variable. ; Place the program return code into BASIC's status variable.
pla pla
sta ST sta STATUS
; Restore the stack pointer. ; Restore the stack pointer.

View File

@@ -7,12 +7,11 @@
.export READST .export READST
.include "plus4.inc" .include "plus4.inc"
.importzp ST
; Read the status byte from the zero page instead of banking in the ROM ; Read the status byte from the zero page instead of banking in the ROM
.proc READST .proc READST
lda ST ; Load status lda STATUS ; Load status
rts ; Return to caller rts ; Return to caller
.endproc .endproc

View File

@@ -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

View File

@@ -10,9 +10,9 @@
.import RESTOR, BSOUT, CLRCH .import RESTOR, BSOUT, CLRCH
.import __MAIN_START__, __MAIN_SIZE__ ; Linker generated .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated
.import __STACKSIZE__ ; Linker generated .import __STACKSIZE__ ; Linker generated
.importzp ST
.include "zeropage.inc" .include "zeropage.inc"
.include "vic20.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Startup code ; Startup code
@@ -72,7 +72,7 @@ L2: lda zpsave,x
; Place the program return code into BASIC's status variable. ; Place the program return code into BASIC's status variable.
pla pla
sta ST sta STATUS
; Restore the stack pointer. ; Restore the stack pointer.

View File

@@ -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