]> git.sur5r.net Git - cc65/commitdiff
Added kernal replacement routines
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 20 Nov 2002 01:31:56 +0000 (01:31 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 20 Nov 2002 01:31:56 +0000 (01:31 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1546 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/pet/Makefile
libsrc/pet/checkst.s [new file with mode: 0644]
libsrc/pet/kbsout.s [new file with mode: 0644]
libsrc/pet/kchkin.s [new file with mode: 0644]
libsrc/pet/kckout.s [new file with mode: 0644]
libsrc/pet/kclose.s [new file with mode: 0644]
libsrc/pet/kernal.s
libsrc/pet/kopen.s [new file with mode: 0644]
libsrc/pet/pet.inc

index 4c3c44d0ced9ce20e8edd107e51565c51e01c56d..2ef302b20ea79ff1eb6a967ca3b584a795655855 100644 (file)
 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 (file)
index 0000000..9996d0e
--- /dev/null
@@ -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 (file)
index 0000000..1e89123
--- /dev/null
@@ -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 (file)
index 0000000..f8b44cf
--- /dev/null
@@ -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 (file)
index 0000000..8c5f4d4
--- /dev/null
@@ -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 (file)
index 0000000..1da0340
--- /dev/null
@@ -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
+
+
index 522f2ba3f823ae5515775575e49d31ae42be8871..714f7ab0823c856cf3f483ae5de6ac1834c23299 100644 (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
 ;-----------------------------------------------------------------------------
 ; 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 (file)
index 0000000..c6b2e8f
--- /dev/null
@@ -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
+
+
index 0dca57a765075723412177444be748b3d26c5313..2bcbf57864f9cd8b11bafa6a68ab269eacb3f8fd 100644 (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