1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00

Added kernal replacement routines

git-svn-id: svn://svn.cc65.org/cc65/trunk@1546 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-11-20 01:31:56 +00:00
parent 6d498d8187
commit ae38242db9
9 changed files with 145 additions and 11 deletions

View File

@ -14,13 +14,19 @@
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 \

26
libsrc/pet/checkst.s Normal file
View File

@ -0,0 +1,26 @@
;
; 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

19
libsrc/pet/kbsout.s Normal file
View File

@ -0,0 +1,19 @@
;
; 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

18
libsrc/pet/kchkin.s Normal file
View File

@ -0,0 +1,18 @@
;
; 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

19
libsrc/pet/kckout.s Normal file
View File

@ -0,0 +1,19 @@
;
; 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

22
libsrc/pet/kclose.s Normal file
View File

@ -0,0 +1,22 @@
;
; 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

View File

@ -4,13 +4,8 @@
; PET kernal functions
;
.export OPEN
.export CLOSE
.export CHKIN
.export CKOUT
.export CLRCH
.export BASIN
.export BSOUT
.export STOP
.export GETIN
.export CLALL
@ -24,13 +19,8 @@
;-----------------------------------------------------------------------------
; 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

26
libsrc/pet/kopen.s Normal file
View File

@ -0,0 +1,26 @@
;
; 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

View File

@ -26,8 +26,16 @@ FNADR = $DA ; Pointer to file name
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