OBJS = _scrsize.o \
break.o \
cgetc.o \
+ checkst.o \
clrscr.o \
color.o \
conio.o \
cputc.o \
crt0.o \
kbhit.o \
+ kbsout.o \
+ kchkin.o \
+ kckout.o \
+ kclose.o \
kernal.o \
+ kopen.o \
krdtim.o \
kreadst.o \
ksetlfs.o \
--- /dev/null
+;
+; Ullrich von Bassewitz, 19.11.2002
+;
+; The kernal open routines do not return a carry on error, so check the IEEE
+; status, set carry flag and return
+;
+
+ .export checkst
+
+ .include "pet.inc"
+
+
+.proc checkst
+
+ lda ST
+ beq @L1
+ lda #5 ; ### Device not present
+ sec
+ rts
+
+@L1: clc
+ rts
+
+.endproc
+
+
--- /dev/null
+;
+; Ullrich von Bassewitz, 19.11.2002
+;
+; BSOUT replacement function for the PETs
+;
+
+ .export BSOUT
+ .import checkst
+
+
+.proc BSOUT
+
+ jsr $FFD2 ; Call kernal function
+ jmp checkst ; Check status, return carry on error
+
+.endproc
+
+
+
--- /dev/null
+;
+; Ullrich von Bassewitz, 19.11.2002
+;
+; CHKIN replacement function for the PETs
+;
+
+ .export CHKIN
+ .import checkst
+
+
+.proc CHKIN
+
+ jsr $FFC6 ; Call kernal function
+ jmp checkst ; Check status, return carry on error
+
+.endproc
+
+
--- /dev/null
+;
+; Ullrich von Bassewitz, 19.11.2002
+;
+; CKOUT replacement function for the PETs
+;
+
+ .export CKOUT
+ .import checkst
+
+
+.proc CKOUT
+
+ jsr $FFC9 ; Call kernal function
+ jmp checkst ; Check status, return carry on error
+
+.endproc
+
+
+
--- /dev/null
+;
+; Ullrich von Bassewitz, 19.11.2002
+;
+; CLOSE replacement function for the PETs
+;
+
+ .export CLOSE
+
+ .include "pet.inc"
+
+
+.proc CLOSE
+
+ ldx PET_DETECT
+ cpx #PET_4000
+ bne @L1
+ jmp $F2E2 ; BASIC 4
+@L1: jmp $F2AE ; BASIC 2&3
+
+.endproc
+
+
; PET kernal functions
;
- .export OPEN
- .export CLOSE
- .export CHKIN
- .export CKOUT
.export CLRCH
.export BASIN
- .export BSOUT
.export STOP
.export GETIN
.export CLALL
;-----------------------------------------------------------------------------
; Functions that are available in the kernal jump table
-OPEN = $FFC0
-CLOSE = $FFC3
-CHKIN = $FFC6
-CKOUT = $FFC9
CLRCH = $FFCC
BASIN = $FFCF
-BSOUT = $FFD2
STOP = $FFE1
GETIN = $FFE4
CLALL = $FFE7
--- /dev/null
+;
+; Ullrich von Bassewitz, 19.11.2002
+;
+; OPEN replacement function for the PETs
+;
+
+ .export OPEN
+ .import checkst
+
+ .include "pet.inc"
+
+
+.proc OPEN
+
+ lda PET_DETECT
+ cmp #PET_4000
+ bne @L1
+ jsr $F563 ; BASIC 4
+ jmp checkst
+
+@L1: jsr $F524 ; BASIC 2&3
+ jmp checkst
+
+.endproc
+
+
KEY_BUF = $26F ; Keyboard buffer
+;----------------------------------------------------------------------------
+; PET ROM type detection
-; ---------------------------------------------------------------------------
+PET_DETECT = $FFFB
+PET_2000 = $CA
+PET_3000 = $FC
+PET_4000 = $FD
+
+
+;----------------------------------------------------------------------------
; Vector and other locations
IRQVec = $0090