Use external symbols for the CBM kernal jump table functions. This allows

to emulate these functions on platforms where one or more of these functions
are not available (PET, CBM-II).


git-svn-id: svn://svn.cc65.org/cc65/trunk@1544 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-11-19 23:02:47 +00:00
parent 3b081086f3
commit 6d498d8187
70 changed files with 720 additions and 187 deletions

View File

@@ -4,13 +4,13 @@
; unsigned char __fastcall__ cbm_acptr (void);
;
.include "cbm.inc"
.export _cbm_acptr
.import ACPTR
_cbm_acptr:
jsr ACPTR
ldx #0
rts

View File

@@ -4,8 +4,7 @@
; unsigned char __fastcall__ cbm_k_basin (void);
;
.include "cbm.inc"
.export _cbm_k_basin
.import BASIN
_cbm_k_basin = BASIN

View File

@@ -4,8 +4,7 @@
; void __fastcall__ cbm_k_bsout (unsigned char C);
;
.include "cbm.inc"
.export _cbm_k_bsout
.import BSOUT
_cbm_k_bsout = BSOUT

View File

@@ -4,9 +4,8 @@
; unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);
;
.include "cbm.inc"
.export _cbm_k_chkin
.import CHKIN
_cbm_k_chkin:
tax

View File

@@ -4,9 +4,8 @@
; void __fastcall__ cbm_ciout (unsigned char C);
;
.include "cbm.inc"
.export _cbm_ciout
.import CIOUT
_cbm_ciout = CIOUT

View File

@@ -4,9 +4,9 @@
; unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);
;
.include "cbm.inc"
.export _cbm_k_ckout
.import CKOUT
_cbm_k_ckout:
tax

View File

@@ -4,9 +4,9 @@
; void __fastcall__ cbm_clall (void);
;
.include "cbm.inc"
.export _cbm_clall
.import CLALL
_cbm_clall = CLALL

View File

@@ -4,12 +4,11 @@
; void __fastcall__ cbm_k_close (unsigned char FN);
;
.include "cbm.inc"
.export _cbm_k_close
.import CLOSE
_cbm_k_close:
clc
clc
jmp CLOSE

View File

@@ -4,9 +4,8 @@
; void __fastcall__ cbm_k_clrch (void);
;
.include "cbm.inc"
.export _cbm_k_clrch
.import CLRCH
_cbm_k_clrch = CLRCH

View File

@@ -4,9 +4,8 @@
; unsigned __fastcall__ cbm_iobase (void);
;
.include "cbm.inc"
.export _cbm_iobase
.import IOBASE
_cbm_iobase:
jsr IOBASE

View File

@@ -4,9 +4,8 @@
; void __fastcall__ cbm_listen (unsigned char dev);
;
.include "cbm.inc"
.export _cbm_listen
.import LISTEN
_cbm_listen = LISTEN

View File

@@ -4,9 +4,8 @@
; unsigned int __fastcall__ cbm_k_load (unsigned char flag, unsigned addr);
;
.include "cbm.inc"
.export _cbm_k_load
.import LOAD
.import __oserror
.import popa
.importzp ptr1
@@ -28,4 +27,4 @@ _cbm_k_load:
tax
pla
rts

View File

@@ -4,9 +4,9 @@
; unsigned char __fastcall__ cbm_k_open (void);
;
.include "cbm.inc"
.export _cbm_k_open
.import OPEN
_cbm_k_open:
jsr OPEN

View File

@@ -4,8 +4,8 @@
; unsigned char __fastcall__ cbm_k_readst (void);
;
.include "cbm.inc"
.export _cbm_k_readst
.import READST
_cbm_k_readst = READST

View File

@@ -4,11 +4,11 @@
; unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end);
;
.include "cbm.inc"
.export _cbm_k_save
.import SAVE
.import popax
.importzp ptr1, tmp1
_cbm_k_save:
sta tmp1 ; store end address

View File

@@ -6,11 +6,11 @@
; unsigned char SA);
;
.include "cbm.inc"
.export _cbm_k_setlfs
.import SETLFS
.import popa
.importzp tmp1
_cbm_k_setlfs:
sta tmp1 ; Save SA

View File

@@ -4,10 +4,10 @@
; void __fastcall__ cbm_k_setnam (const char* Name);
;
.include "cbm.inc"
.export _cbm_k_setnam
.import SETNAM
.importzp ptr1
_cbm_k_setnam:
sta ptr1 ; Store pointer to file name

View File

@@ -4,9 +4,9 @@
; void __fastcall__ cbm_talk (unsigned char dev);
;
.include "cbm.inc"
.export _cbm_talk
.import TALK
_cbm_talk = TALK

View File

@@ -4,9 +4,9 @@
; void __fastcall__ cbm_unlsn (void);
;
.include "cbm.inc"
.export _cbm_unlsn
.import UNLSN
_cbm_unlsn = UNLSN

View File

@@ -4,9 +4,9 @@
; void __fastcall__ cbm_untlk (void);
;
.include "cbm.inc"
.export _cbm_untlk
.import UNTLK
_cbm_untlk = UNTLK

View File

@@ -7,45 +7,45 @@
; Subroutines available in the CBM jump table
;
CINT = $FF81
IOINIT = $FF84
RAMTAS = $FF87
RESTOR = $FF8A
VECTOR = $FF8D
SETMSG = $FF90
SECOND = $FF93
TKSA = $FF96
MEMTOP = $FF99
MEMBOT = $FF9C
SCNKEY = $FF9F
SETTMO = $FFA2
ACPTR = $FFA5
CIOUT = $FFA8
UNTLK = $FFAB
UNLSN = $FFAE
LISTEN = $FFB1
TALK = $FFB4
READST = $FFB7
SETLFS = $FFBA
SETNAM = $FFBD
OPEN = $FFC0
CLOSE = $FFC3
CHKIN = $FFC6
CKOUT = $FFC9
CLRCH = $FFCC
BASIN = $FFCF
BSOUT = $FFD2
LOAD = $FFD5
SAVE = $FFD8
SETTIM = $FFDB
RDTIM = $FFDE
STOP = $FFE1
GETIN = $FFE4
CLALL = $FFE7
UDTIM = $FFEA
SCREEN = $FFED
PLOT = $FFF0
IOBASE = $FFF3
;CINT = $FF81
;IOINIT = $FF84
;RAMTAS = $FF87
;RESTOR = $FF8A
;VECTOR = $FF8D
;SETMSG = $FF90
;SECOND = $FF93
;TKSA = $FF96
;MEMTOP = $FF99
;MEMBOT = $FF9C
;SCNKEY = $FF9F
;SETTMO = $FFA2
;ACPTR = $FFA5
;CIOUT = $FFA8
;UNTLK = $FFAB
;UNLSN = $FFAE
;LISTEN = $FFB1
;TALK = $FFB4
;READST = $FFB7
;SETLFS = $FFBA
;SETNAM = $FFBD
;OPEN = $FFC0
;CLOSE = $FFC3
;CHKIN = $FFC6
;CKOUT = $FFC9
;CLRCH = $FFCC
;BASIN = $FFCF
;BSOUT = $FFD2
;LOAD = $FFD5
;SAVE = $FFD8
;SETTIM = $FFDB
;RDTIM = $FFDE
;STOP = $FFE1
;GETIN = $FFE4
;CLALL = $FFE7
;UDTIM = $FFEA
;SCREEN = $FFED
;PLOT = $FFF0
;IOBASE = $FFF3
;-----------------------------------------------------------------------------
@@ -60,7 +60,7 @@ CBMDEV_SCREEN = 3
;-----------------------------------------------------------------------------
; Disk stuff
;
MAX_DRIVES = 24
FIRST_DRIVE = 8

View File

@@ -38,10 +38,12 @@
.include "cbm.inc"
.export _cbm_read
.import CHKIN, READST, BASIN, CLRCH
.importzp ptr1, ptr2, ptr3, tmp1
.import popax, popa
.import __oserror
_cbm_read:
eor #$FF
sta ptr1

View File

@@ -3,9 +3,9 @@
;
; Original C code by Marc 'BlackJack' Rintsch, 25.03.2001
;
; int __fastcall__ cbm_write(unsigned char lfn, void* buffer, unsigned int size)
; int __fastcall__ cbm_write(unsigned char lfn, void* buffer, unsigned int size)
; {
;
;
; static unsigned int byteswritten;
;
; /* if we can't change to the outputchannel #lfn then return an error */
@@ -31,9 +31,11 @@
.include "cbm.inc"
.export _cbm_write
.import CKOUT, READST, BSOUT, CLRCH
.importzp ptr1, ptr2, ptr3
.import popax, popa
.import __oserror
_cbm_write:
sta ptr3

View File

@@ -5,9 +5,9 @@
;
.export _clock
.import RDTIM
.importzp sreg
.include "cbm.inc"
.proc _clock
@@ -16,7 +16,7 @@
sta sreg+1
jsr RDTIM
sty sreg
rts
rts
.endproc

View File

@@ -6,6 +6,7 @@
.export _close
.import CLOSE
.import readdiskerror, closecmdchannel
.import __errno, __oserror
.importzp tmp2

View File

@@ -10,6 +10,8 @@
.export readdiskerror
.export writediskcmd
.import SETLFS, SETNAM, OPEN, CLOSE, BSOUT, BASIN
.import CHKIN, CKOUT, CLRCH
.importzp tmp1, ptr1
.include "cbm.inc"
@@ -203,7 +205,7 @@ writediskcmd:
rts
;--------------------------------------------------------------------------
; Data

View File

@@ -7,11 +7,11 @@
.export fnparse, fnset, fncomplete
.export fnunit, fnlen, fncmd, fnbuf
.import SETNAM
.import __curunit, __filetype
.importzp ptr1
.include "ctype.inc"
.include "cbm.inc"
;--------------------------------------------------------------------------

View File

@@ -6,6 +6,7 @@
.export _open
.import SETLFS, OPEN, CLOSE
.import addysp, popax
.import scratch, fnparse, fncomplete, fnset
.import opencmdchannel, closecmdchannel, readdiskerror
@@ -15,7 +16,6 @@
.include "errno.inc"
.include "fcntl.inc"
.include "cbm.inc"
.include "filedes.inc"

View File

@@ -6,7 +6,8 @@
.export _read
.constructor initstdin
.import SETLFS, OPEN, CHKIN, BASIN, CLRCH, READST
.import rwcommon
.import popax
.import __errno, __oserror
@@ -135,7 +136,7 @@ invalidfd:
notopen:
lda #3 ; File not open
bne error
; Error entry, status not ok
error5: lda #5 ; Device not present

View File

@@ -4,9 +4,10 @@
; unsigned char wherex (void);
; unsigned char wherey (void);
.export _wherex, _wherey
.include "cbm.inc"
.import PLOT
_wherex:
sec

View File

@@ -7,6 +7,7 @@
.export _write
.constructor initstdout
.import SETLFS, OPEN, CKOUT, BSOUT, CLRCH
.import rwcommon
.import __errno, __oserror
.importzp sp, ptr1, ptr2, ptr3