From ae38242db9a8199c870acbda6284daa3cdf3f6f6 Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 20 Nov 2002 01:31:56 +0000 Subject: [PATCH] Added kernal replacement routines git-svn-id: svn://svn.cc65.org/cc65/trunk@1546 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/pet/Makefile | 6 ++++++ libsrc/pet/checkst.s | 26 ++++++++++++++++++++++++++ libsrc/pet/kbsout.s | 19 +++++++++++++++++++ libsrc/pet/kchkin.s | 18 ++++++++++++++++++ libsrc/pet/kckout.s | 19 +++++++++++++++++++ libsrc/pet/kclose.s | 22 ++++++++++++++++++++++ libsrc/pet/kernal.s | 10 ---------- libsrc/pet/kopen.s | 26 ++++++++++++++++++++++++++ libsrc/pet/pet.inc | 10 +++++++++- 9 files changed, 145 insertions(+), 11 deletions(-) create mode 100644 libsrc/pet/checkst.s create mode 100644 libsrc/pet/kbsout.s create mode 100644 libsrc/pet/kchkin.s create mode 100644 libsrc/pet/kckout.s create mode 100644 libsrc/pet/kclose.s create mode 100644 libsrc/pet/kopen.s diff --git a/libsrc/pet/Makefile b/libsrc/pet/Makefile index 4c3c44d0c..2ef302b20 100644 --- a/libsrc/pet/Makefile +++ b/libsrc/pet/Makefile @@ -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 \ diff --git a/libsrc/pet/checkst.s b/libsrc/pet/checkst.s new file mode 100644 index 000000000..9996d0ed4 --- /dev/null +++ b/libsrc/pet/checkst.s @@ -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 + + diff --git a/libsrc/pet/kbsout.s b/libsrc/pet/kbsout.s new file mode 100644 index 000000000..1e8912324 --- /dev/null +++ b/libsrc/pet/kbsout.s @@ -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 + + + diff --git a/libsrc/pet/kchkin.s b/libsrc/pet/kchkin.s new file mode 100644 index 000000000..f8b44cfc9 --- /dev/null +++ b/libsrc/pet/kchkin.s @@ -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 + + diff --git a/libsrc/pet/kckout.s b/libsrc/pet/kckout.s new file mode 100644 index 000000000..8c5f4d415 --- /dev/null +++ b/libsrc/pet/kckout.s @@ -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 + + + diff --git a/libsrc/pet/kclose.s b/libsrc/pet/kclose.s new file mode 100644 index 000000000..1da034017 --- /dev/null +++ b/libsrc/pet/kclose.s @@ -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 + + diff --git a/libsrc/pet/kernal.s b/libsrc/pet/kernal.s index 522f2ba3f..714f7ab08 100644 --- a/libsrc/pet/kernal.s +++ b/libsrc/pet/kernal.s @@ -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 diff --git a/libsrc/pet/kopen.s b/libsrc/pet/kopen.s new file mode 100644 index 000000000..c6b2e8f71 --- /dev/null +++ b/libsrc/pet/kopen.s @@ -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 + + diff --git a/libsrc/pet/pet.inc b/libsrc/pet/pet.inc index 0dca57a76..2bcbf5786 100644 --- a/libsrc/pet/pet.inc +++ b/libsrc/pet/pet.inc @@ -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 -- 2.39.5