Merge pull request #2759 from mrdudz/test1972

Fixed #1970 (Missing definition for ST on cbm610 with getdevice) (was #1972)
This commit is contained in:
Bob Andrews
2025-07-04 17:03:47 +02:00
committed by GitHub
28 changed files with 166 additions and 61 deletions

View File

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

View File

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

View File

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

View File

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

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

View File

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

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

@@ -1,5 +1,15 @@
;
; Oliver Schmidt, 2012-09-30
; Stefan Haubenthal, 2023-01-16
;
.exportzp ST := $90 ; IEC status byte
.export initst
.include "c65.inc"
.proc initst
lda #$00
sta STATUS
rts
.endproc

View File

@@ -10,7 +10,8 @@
.import isdisk
.import opencmdchannel
.import closecmdchannel
.importzp ST
.import initst
.import READST
.importzp tmp2
;------------------------------------------------------------------------------
@@ -33,26 +34,25 @@ next: inx
; interpret a non-disk as a no-op while we need to interpret it
; as an error here
jsr isdisk
jsr isdisk ; carry clear if the unit number in X is a disk
bcs next
; [open|close]cmdchannel don't call into the Kernal at all if they
; only [in|de]crement the reference count of the shared cmdchannel
; so we need to explicitly initialize ST here
lda #$00
sta ST
stx tmp2 ; further calls my use X
stx tmp2
jsr initst
ldx tmp2 ; get unit number back
jsr opencmdchannel
ldx tmp2
ldx tmp2 ; get unit number back
jsr closecmdchannel
ldx tmp2
; As we had to reference ST above anyway we can as well do so
; here too (instead of calling READST)
ldx tmp2 ; get unit number back
lda ST
jsr READST ; preserves X, returns A and Flags
; Either the Kernal calls above were successful or there was
; already a cmdchannel to the device open - which is a pretty

View File

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

View File

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

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.
pla
ldy #$9C ; ST
ldy #STATUS
sta (sysp0),y
; Set up the welcome code at the stack bottom in the system bank.

View File

@@ -11,16 +11,14 @@
.include "cbm610.inc"
; preserves X and Y, returns status in A and in status flags
.proc READST
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

View File

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

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

@@ -1,5 +1,15 @@
;
; Oliver Schmidt, 2012-09-30
; Stefan Haubenthal, 2023-01-16
;
.exportzp ST := $90 ; IEC status byte
.export initst
.include "mega65.inc"
.proc initst
lda #$00
sta STATUS
rts
.endproc

View File

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

View File

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

View File

@@ -5,14 +5,12 @@
;
.export READST
.importzp ST
.include "pet.inc"
.proc READST
lda ST
lda STATUS
rts
.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 __INTERRUPTOR_COUNT__
.import __HIMEM__ ; Linker generated
.importzp ST
.include "zeropage.inc"
.include "plus4.inc"
@@ -121,7 +120,7 @@ L2: lda zpsave,x
; Place the program return code into BASIC's status variable.
pla
sta ST
sta STATUS
; Restore the stack pointer.

View File

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

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 __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.

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

View File

@@ -297,6 +297,7 @@ EXELIST_c16 = \
EXELIST_cbm510 = \
ascii \
checkversion \
enumdevdir \
gunzip65 \
hello \
joydemo \
@@ -308,6 +309,7 @@ EXELIST_cbm510 = \
EXELIST_cbm610 = \
ascii \
checkversion \
enumdevdir \
gunzip65 \
hello \
terminal \