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

@@ -20,6 +20,7 @@ OBJS = _scrsize.o \
color.o \ color.o \
cputc.o \ cputc.o \
kbhit.o \ kbhit.o \
kernal.o \
mouse.o \ mouse.o \
randomize.o \ randomize.o \
readjoy.o \ readjoy.o \

View File

@@ -5,9 +5,9 @@
; ;
.export xsize, ysize .export xsize, ysize
.import SCREEN
.constructor initscrsize .constructor initscrsize
.include "../cbm/cbm.inc"
.code .code

View File

@@ -9,9 +9,10 @@
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize, revers
.import PLOT
.include "c128.inc" .include "c128.inc"
.include "../cbm/cbm.inc"
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C

View File

@@ -9,12 +9,13 @@
.import condes, initlib, donelib .import condes, initlib, donelib
.import initconio, doneconio, zerobss .import initconio, doneconio, zerobss
.import push0, _main .import push0, _main
.import RESTOR, BSOUT, CLRCH
.import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__ .import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
.import __RAM_START__, __RAM_SIZE__ .import __RAM_START__, __RAM_SIZE__
.include "zeropage.inc" .include "zeropage.inc"
.include "c128.inc" .include "c128.inc"
.include "../cbm/cbm.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Constants ; Constants

90
libsrc/c128/kernal.s Normal file
View File

@@ -0,0 +1,90 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; C128 kernal functions
;
.export CINT
.export IOINIT
.export RAMTAS
.export RESTOR
.export VECTOR
.export SETMSG
.export SECOND
.export TKSA
.export MEMTOP
.export MEMBOT
.export SCNKEY
.export SETTMO
.export ACPTR
.export CIOUT
.export UNTLK
.export UNLSN
.export LISTEN
.export TALK
.export READST
.export SETLFS
.export SETNAM
.export OPEN
.export CLOSE
.export CHKIN
.export CKOUT
.export CLRCH
.export BASIN
.export BSOUT
.export LOAD
.export SAVE
.export SETTIM
.export RDTIM
.export STOP
.export GETIN
.export CLALL
.export UDTIM
.export SCREEN
.export PLOT
.export IOBASE
;-----------------------------------------------------------------------------
; All functions are available in the kernal 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

View File

@@ -23,6 +23,7 @@ OBJS = _scrsize.o \
conio.o \ conio.o \
cputc.o \ cputc.o \
kbhit.o \ kbhit.o \
kernal.o \
mouse.o \ mouse.o \
randomize.o \ randomize.o \
readjoy.o \ readjoy.o \

View File

@@ -5,9 +5,9 @@
; ;
.export xsize, ysize .export xsize, ysize
.import SCREEN
.constructor initscrsize .constructor initscrsize
.include "../cbm/cbm.inc"
.code .code

View File

@@ -9,9 +9,10 @@
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize, revers
.import PLOT
.include "c64.inc" .include "c64.inc"
.include "../cbm/cbm.inc"
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C

View File

@@ -8,11 +8,12 @@
.import initlib, donelib .import initlib, donelib
.import zerobss, push0 .import zerobss, push0
.import _main .import _main
.import RESTOR, BSOUT, CLRCH
.import __RAM_START__, __RAM_SIZE__ ; Linker generated .import __RAM_START__, __RAM_SIZE__ ; Linker generated
.include "zeropage.inc" .include "zeropage.inc"
.include "c64.inc" .include "c64.inc"
.include "../cbm/cbm.inc"
.code .code

90
libsrc/c64/kernal.s Normal file
View File

@@ -0,0 +1,90 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; C64 kernal functions
;
.export CINT
.export IOINIT
.export RAMTAS
.export RESTOR
.export VECTOR
.export SETMSG
.export SECOND
.export TKSA
.export MEMTOP
.export MEMBOT
.export SCNKEY
.export SETTMO
.export ACPTR
.export CIOUT
.export UNTLK
.export UNLSN
.export LISTEN
.export TALK
.export READST
.export SETLFS
.export SETNAM
.export OPEN
.export CLOSE
.export CHKIN
.export CKOUT
.export CLRCH
.export BASIN
.export BSOUT
.export LOAD
.export SAVE
.export SETTIM
.export RDTIM
.export STOP
.export GETIN
.export CLALL
.export UDTIM
.export SCREEN
.export PLOT
.export IOBASE
;-----------------------------------------------------------------------------
; All functions are available in the kernal 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

View File

@@ -17,7 +17,7 @@
.rodata .rodata
_tgi_mode_table: _tgi_mode_table:
.byte TGI_MODE_320_200_2, "c64-320-200-2.tgi", 0 .byte TGI_MODE_320_200_2, "c64-high.tgi", 0
.byte 0 ; End marker .byte 0 ; End marker

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -31,10 +31,12 @@
.include "cbm.inc" .include "cbm.inc"
.export _cbm_write .export _cbm_write
.import CKOUT, READST, BSOUT, CLRCH
.importzp ptr1, ptr2, ptr3 .importzp ptr1, ptr2, ptr3
.import popax, popa .import popax, popa
.import __oserror .import __oserror
_cbm_write: _cbm_write:
sta ptr3 sta ptr3
stx ptr3+1 ; Save size stx ptr3+1 ; Save size

View File

@@ -5,9 +5,9 @@
; ;
.export _clock .export _clock
.import RDTIM
.importzp sreg .importzp sreg
.include "cbm.inc"
.proc _clock .proc _clock

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,6 +7,7 @@
.export _read .export _read
.constructor initstdin .constructor initstdin
.import SETLFS, OPEN, CHKIN, BASIN, CLRCH, READST
.import rwcommon .import rwcommon
.import popax .import popax
.import __errno, __oserror .import __errno, __oserror

View File

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

View File

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

View File

@@ -7,11 +7,12 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.import PLOT
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize, revers
.include "cbm510.inc" .include "cbm510.inc"
.include "../cbm/cbm.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; ;

View File

@@ -13,7 +13,7 @@
.import __CHARRAM_START__, __CHARRAM_SIZE__, __VIDRAM_START__ .import __CHARRAM_START__, __CHARRAM_SIZE__, __VIDRAM_START__
.import __BSS_RUN__, __BSS_SIZE__ .import __BSS_RUN__, __BSS_SIZE__
.import irq, nmi .import irq, nmi
.import k_irq, k_nmi, k_plot, k_udtim, k_scnkey .import k_irq, k_nmi, PLOT, UDTIM, SCNKEY
.include "zeropage.inc" .include "zeropage.inc"
.include "cbm510.inc" .include "cbm510.inc"
@@ -319,7 +319,7 @@ vectable:
jmp $0000 ; TKSA jmp $0000 ; TKSA
jmp $0000 ; MEMTOP jmp $0000 ; MEMTOP
jmp $0000 ; MEMBOT jmp $0000 ; MEMBOT
jmp k_scnkey ; SCNKEY jmp SCNKEY
jmp $0000 ; SETTMO jmp $0000 ; SETTMO
jmp $0000 ; ACPTR jmp $0000 ; ACPTR
jmp $0000 ; CIOUT jmp $0000 ; CIOUT
@@ -328,8 +328,8 @@ vectable:
jmp $0000 ; LISTEN jmp $0000 ; LISTEN
jmp $0000 ; TALK jmp $0000 ; TALK
jmp $0000 ; READST jmp $0000 ; READST
jmp k_setlfs ; SETLFS jmp SETLFS
jmp k_setnam ; SETNAM jmp SETNAM
jmp $0000 ; OPEN jmp $0000 ; OPEN
jmp $0000 ; CLOSE jmp $0000 ; CLOSE
jmp $0000 ; CHKIN jmp $0000 ; CHKIN
@@ -339,15 +339,15 @@ vectable:
jmp $0000 ; BSOUT jmp $0000 ; BSOUT
jmp $0000 ; LOAD jmp $0000 ; LOAD
jmp $0000 ; SAVE jmp $0000 ; SAVE
jmp k_settim ; SETTIM jmp SETTIM
jmp k_rdtim ; RDTIM jmp RDTIM
jmp $0000 ; STOP jmp $0000 ; STOP
jmp $0000 ; GETIN jmp $0000 ; GETIN
jmp $0000 ; CLALL jmp $0000 ; CLALL
jmp k_udtim ; UDTIM jmp UDTIM
jmp k_screen ; SCREEN jmp SCREEN
jmp k_plot ; PLOT jmp PLOT
jmp k_iobase ; IOBASE jmp IOBASE
sta ExecReg sta ExecReg
rts rts
.byte $01 ; Filler .byte $01 ; Filler
@@ -437,23 +437,30 @@ reset_size = * - reset
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Code for a few simpler kernal calls goes here ; Code for a few simpler kernal calls goes here
k_iobase: .export IOBASE
.proc IOBASE
ldx cia2 ldx cia2
ldy cia2+1 ldy cia2+1
rts rts
.endproc
k_screen: .export SCREEN
.proc SCREEN
ldx #40 ; Columns ldx #40 ; Columns
ldy #25 ; Lines ldy #25 ; Lines
rts rts
.endproc
k_setlfs: .export SETLFS
.proc SETLFS
sta LogicalAdr sta LogicalAdr
stx FirstAdr stx FirstAdr
sty SecondAdr sty SecondAdr
rts rts
.endproc
k_setnam: .export SETNAM
.proc SETNAM
sta FileNameLen sta FileNameLen
lda $00,x lda $00,x
sta FileNameAdrLo sta FileNameAdrLo
@@ -462,22 +469,27 @@ k_setnam:
lda $02,x lda $02,x
sta FileNameAdrSeg sta FileNameAdrSeg
rts rts
.endproc
k_rdtim: .export RDTIM
.proc RDTIM
sei sei
lda time+0 lda time+0
ldx time+1 ldx time+1
ldy time+2 ldy time+2
cli cli
rts rts
.endproc
k_settim: .export SETTIM
.proc SETTIM
sei sei
sta time+0 sta time+0
stx time+1 stx time+1
sty time+2 sty time+2
cli cli
rts rts
.endproc
; ------------------------------------------------------------------------- ; -------------------------------------------------------------------------
; Data area - switch back to relocatable mode ; Data area - switch back to relocatable mode

View File

@@ -4,7 +4,7 @@
; PLOT routine for the 510. ; PLOT routine for the 510.
; ;
.export k_plot .export PLOT
.import __VIDRAM_START__ .import __VIDRAM_START__
.importzp crtc .importzp crtc
@@ -15,7 +15,7 @@
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; ;
.proc k_plot .proc PLOT
bcs get bcs get
@@ -63,3 +63,4 @@ LineLSBTab: LineLoTab
LineMSBTab: LineHiTab LineMSBTab: LineHiTab

View File

@@ -4,13 +4,13 @@
; Keyboard polling stuff for the 510. ; Keyboard polling stuff for the 510.
; ;
.export k_scnkey .export SCNKEY
.importzp tpi2, ktab1, ktab2, ktab3, ktab4 .importzp tpi2, ktab1, ktab2, ktab3, ktab4
.include "cbm510.inc" .include "cbm510.inc"
.proc k_scnkey .proc SCNKEY
lda #$FF lda #$FF
sta ModKey sta ModKey

View File

@@ -5,11 +5,11 @@
; C programs will not use it. ; C programs will not use it.
; ;
.export k_udtim .export UDTIM
.importzp time .importzp time
.proc k_udtim .proc UDTIM
inc time inc time
bne L9 bne L9
@@ -23,3 +23,4 @@ L9: rts
.endproc .endproc

View File

@@ -8,12 +8,14 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.exportzp CURS_X, CURS_Y .exportzp CURS_X, CURS_Y
.import PLOT
.import _gotoxy .import _gotoxy
.import popa .import popa
.import xsize, revers .import xsize, revers
.include "cbm610.inc" .include "cbm610.inc"
.include "../cbm/cbm.inc"
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C

View File

@@ -12,7 +12,7 @@
.import push0, _main .import push0, _main
.import __BSS_RUN__, __BSS_SIZE__ .import __BSS_RUN__, __BSS_SIZE__
.import irq, nmi .import irq, nmi
.import k_irq, k_nmi, k_plot, k_udtim, k_scnkey .import k_irq, k_nmi, PLOT, UDTIM, SCNKEY
.include "zeropage.inc" .include "zeropage.inc"
.include "cbm610.inc" .include "cbm610.inc"
@@ -238,7 +238,7 @@ vectable:
jmp $0000 ; TKSA jmp $0000 ; TKSA
jmp $0000 ; MEMTOP jmp $0000 ; MEMTOP
jmp $0000 ; MEMBOT jmp $0000 ; MEMBOT
jmp k_scnkey ; SCNKEY jmp SCNKEY
jmp $0000 ; SETTMO jmp $0000 ; SETTMO
jmp $0000 ; ACPTR jmp $0000 ; ACPTR
jmp $0000 ; CIOUT jmp $0000 ; CIOUT
@@ -247,8 +247,8 @@ vectable:
jmp $0000 ; LISTEN jmp $0000 ; LISTEN
jmp $0000 ; TALK jmp $0000 ; TALK
jmp $0000 ; READST jmp $0000 ; READST
jmp k_setlfs ; SETLFS jmp SETLFS
jmp k_setnam ; SETNAM jmp SETNAM
jmp $0000 ; OPEN jmp $0000 ; OPEN
jmp $0000 ; CLOSE jmp $0000 ; CLOSE
jmp $0000 ; CHKIN jmp $0000 ; CHKIN
@@ -258,15 +258,15 @@ vectable:
jmp $0000 ; BSOUT jmp $0000 ; BSOUT
jmp $0000 ; LOAD jmp $0000 ; LOAD
jmp $0000 ; SAVE jmp $0000 ; SAVE
jmp k_settim ; SETTIM jmp SETTIM
jmp k_rdtim ; RDTIM jmp RDTIM
jmp $0000 ; STOP jmp $0000 ; STOP
jmp $0000 ; GETIN jmp $0000 ; GETIN
jmp $0000 ; CLALL jmp $0000 ; CLALL
jmp k_udtim ; UDTIM jmp UDTIM
jmp k_screen ; SCREEN jmp SCREEN
jmp k_plot ; PLOT jmp PLOT
jmp k_iobase ; IOBASE jmp IOBASE
sta ExecReg sta ExecReg
rts rts
.byte $01 ; Filler .byte $01 ; Filler
@@ -339,23 +339,30 @@ reset_size = * - reset
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Code for a few simpler kernal calls goes here ; Code for a few simpler kernal calls goes here
k_iobase: .export IOBASE
.proc IOBASE
ldx cia ldx cia
ldy cia+1 ldy cia+1
rts rts
.endproc
k_screen: .export SCREEN
.proc SCREEN
ldx #80 ; Columns ldx #80 ; Columns
ldy #25 ; Lines ldy #25 ; Lines
rts rts
.endproc
k_setlfs: .export SETLFS
.proc SETLFS
sta LogicalAdr sta LogicalAdr
stx FirstAdr stx FirstAdr
sty SecondAdr sty SecondAdr
rts rts
.endproc
k_setnam: .export SETNAM
.proc SETNAM
sta FileNameLen sta FileNameLen
lda $00,x lda $00,x
sta FileNameAdrLo sta FileNameAdrLo
@@ -364,22 +371,27 @@ k_setnam:
lda $02,x lda $02,x
sta FileNameAdrSeg sta FileNameAdrSeg
rts rts
.endproc
k_rdtim: .export RDTIM
.proc RDTIM
sei sei
lda time+0 lda time+0
ldx time+1 ldx time+1
ldy time+2 ldy time+2
cli cli
rts rts
.endproc
k_settim: .export SETTIM
.proc SETTIM
sei sei
sta time+0 sta time+0
stx time+1 stx time+1
sty time+2 sty time+2
cli cli
rts rts
.endproc
; ------------------------------------------------------------------------- ; -------------------------------------------------------------------------
; Data area - switch back to relocatable mode ; Data area - switch back to relocatable mode

View File

@@ -4,13 +4,13 @@
; PLOT routine for the 610. ; PLOT routine for the 610.
; ;
.export k_plot .export PLOT
.importzp crtc .importzp crtc
.include "cbm610.inc" .include "cbm610.inc"
.proc k_plot .proc PLOT
bcc set bcc set
ldx CURS_Y ldx CURS_Y

View File

@@ -4,13 +4,13 @@
; Keyboard polling stuff for the 610. ; Keyboard polling stuff for the 610.
; ;
.export k_scnkey .export SCNKEY
.importzp tpi2, ktab1, ktab2, ktab3, ktab4 .importzp tpi2, ktab1, ktab2, ktab3, ktab4
.include "cbm610.inc" .include "cbm610.inc"
.proc k_scnkey .proc SCNKEY
lda #$FF lda #$FF
sta ModKey sta ModKey

View File

@@ -5,11 +5,11 @@
; C programs will not use it. ; C programs will not use it.
; ;
.export k_udtim .export UDTIM
.importzp time .importzp time
.proc k_udtim .proc UDTIM
inc time inc time
bne L9 bne L9

View File

@@ -20,6 +20,11 @@ OBJS = _scrsize.o \
cputc.o \ cputc.o \
crt0.o \ crt0.o \
kbhit.o \ kbhit.o \
kernal.o \
krdtim.o \
kreadst.o \
ksetlfs.o \
ksetnam.o \
randomize.o randomize.o
all: $(OBJS) all: $(OBJS)

View File

@@ -8,6 +8,7 @@
.import initlib, donelib .import initlib, donelib
.import zerobss, push0 .import zerobss, push0
.import _main .import _main
.import CLRCH, BSOUT
.include "zeropage.inc" .include "zeropage.inc"
.include "pet.inc" .include "pet.inc"

38
libsrc/pet/kernal.s Normal file
View File

@@ -0,0 +1,38 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; PET kernal functions
;
.export OPEN
.export CLOSE
.export CHKIN
.export CKOUT
.export CLRCH
.export BASIN
.export BSOUT
.export STOP
.export GETIN
.export CLALL
.export UDTIM
;-----------------------------------------------------------------------------
; 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
UDTIM = $FFEA

23
libsrc/pet/krdtim.s Normal file
View File

@@ -0,0 +1,23 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; RDTIM replacement function for the PETs
;
.export RDTIM
.include "pet.inc"
.proc RDTIM
sei
lda TIME+2
ldx TIME+1
ldy TIME
cli
rts
.endproc

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

@@ -0,0 +1,19 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; READST replacement function for the PETs
;
.export READST
.include "pet.inc"
.proc READST
lda ST
rts
.endproc

21
libsrc/pet/ksetlfs.s Normal file
View File

@@ -0,0 +1,21 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; SETLFS replacement function for the PETs
;
.export SETLFS
.include "pet.inc"
.proc SETLFS
sta LFN ; LFN
stx DEVNUM ; Device address
sty SECADR ; Secondary address
rts
.endproc

21
libsrc/pet/ksetnam.s Normal file
View File

@@ -0,0 +1,21 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; SETNAM replacement function for the PETs
;
.export SETNAM
.include "pet.inc"
.proc SETNAM
sta FNLEN
stx FNADR
sty FNADR+1
rts
.endproc

View File

@@ -6,11 +6,9 @@
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Zero page, Commodore stuff ; Zero page, Commodore stuff
TIME = $8D ; 60HZ clock
MEMSIZE = $34 ; Size of memory installed MEMSIZE = $34 ; Size of memory installed
TIME = $8D ; 60HZ clock
ST = $96 ; IEC status byte ST = $96 ; IEC status byte
SECADR = $D3 ; Secondary address
DEVNUM = $D4 ; Device number
KEY_COUNT = $9E ; Number of keys in input buffer KEY_COUNT = $9E ; Number of keys in input buffer
CURS_FLAG = $A7 ; 1 = cursor off CURS_FLAG = $A7 ; 1 = cursor off
CURS_BLINK = $A8 ; Blink counter CURS_BLINK = $A8 ; Blink counter
@@ -18,8 +16,13 @@ CURS_CHAR = $A9 ; Character under the cursor
CURS_STATE = $AA ; Cursor blink state CURS_STATE = $AA ; Cursor blink state
SCREEN_PTR = $C4 ; Pointer to current char in text screen SCREEN_PTR = $C4 ; Pointer to current char in text screen
CURS_X = $C6 ; Cursor column CURS_X = $C6 ; Cursor column
CURS_Y = $D8 ; Cursor row FNLEN = $D1 ; Length of filename
LFN = $D2 ; Current Logical File Number
SECADR = $D3 ; Secondary address
DEVNUM = $D4 ; Device number
SCR_LINELEN = $D5 ; Screen line length SCR_LINELEN = $D5 ; Screen line length
CURS_Y = $D8 ; Cursor row
FNADR = $DA ; Pointer to file name
KEY_BUF = $26F ; Keyboard buffer KEY_BUF = $26F ; Keyboard buffer

View File

@@ -20,6 +20,7 @@ OBJS = _scrsize.o \
cputc.o \ cputc.o \
crt0.o \ crt0.o \
kbhit.o \ kbhit.o \
kernal.o \
randomize.o \ randomize.o \
readjoy.o \ readjoy.o \
tgi_mode_table.o tgi_mode_table.o

View File

@@ -5,9 +5,9 @@
; ;
.export xsize, ysize .export xsize, ysize
.import SCREEN
.constructor initscrsize .constructor initscrsize
.include "../cbm/cbm.inc"
.code .code

View File

@@ -9,9 +9,10 @@
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize, revers
.import PLOT
.include "plus4.inc" .include "plus4.inc"
.include "../cbm/cbm.inc"
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C

View File

@@ -7,10 +7,11 @@
.export _exit .export _exit
.import initlib, donelib .import initlib, donelib
.import push0, _main, zerobss .import push0, _main, zerobss
.import MEMTOP, RESTOR, BSOUT, CLRCH
.include "zeropage.inc" .include "zeropage.inc"
.include "plus4.inc" .include "plus4.inc"
.include "../cbm/cbm.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; BASIC header with a SYS call ; BASIC header with a SYS call

90
libsrc/plus4/kernal.s Normal file
View File

@@ -0,0 +1,90 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; Plus/4 kernal functions
;
.export CINT
.export IOINIT
.export RAMTAS
.export RESTOR
.export VECTOR
.export SETMSG
.export SECOND
.export TKSA
.export MEMTOP
.export MEMBOT
.export SCNKEY
.export SETTMO
.export ACPTR
.export CIOUT
.export UNTLK
.export UNLSN
.export LISTEN
.export TALK
.export READST
.export SETLFS
.export SETNAM
.export OPEN
.export CLOSE
.export CHKIN
.export CKOUT
.export CLRCH
.export BASIN
.export BSOUT
.export LOAD
.export SAVE
.export SETTIM
.export RDTIM
.export STOP
.export GETIN
.export CLALL
.export UDTIM
.export SCREEN
.export PLOT
.export IOBASE
;-----------------------------------------------------------------------------
; All functions are available in the kernal 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

View File

@@ -20,6 +20,7 @@ OBJS = _scrsize.o \
conio.o \ conio.o \
cputc.o \ cputc.o \
kbhit.o \ kbhit.o \
kernal.o \
randomize.o \ randomize.o \
readjoy.o readjoy.o

View File

@@ -5,9 +5,9 @@
; ;
.export xsize, ysize .export xsize, ysize
.import SCREEN
.constructor initscrsize .constructor initscrsize
.include "../cbm/cbm.inc"
.code .code

View File

@@ -9,9 +9,10 @@
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize, revers
.import PLOT
.include "vic20.inc" .include "vic20.inc"
.include "../cbm/cbm.inc"
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C

View File

@@ -8,6 +8,7 @@
.import initlib, donelib .import initlib, donelib
.import zerobss, push0 .import zerobss, push0
.import _main .import _main
.import RESTOR, BSOUT, CLRCH
.import __RAM_START__, __RAM_SIZE__ ; Linker generated .import __RAM_START__, __RAM_SIZE__ ; Linker generated
.include "zeropage.inc" .include "zeropage.inc"

90
libsrc/vic20/kernal.s Normal file
View File

@@ -0,0 +1,90 @@
;
; Ullrich von Bassewitz, 19.11.2002
;
; VIC20 kernal functions
;
.export CINT
.export IOINIT
.export RAMTAS
.export RESTOR
.export VECTOR
.export SETMSG
.export SECOND
.export TKSA
.export MEMTOP
.export MEMBOT
.export SCNKEY
.export SETTMO
.export ACPTR
.export CIOUT
.export UNTLK
.export UNLSN
.export LISTEN
.export TALK
.export READST
.export SETLFS
.export SETNAM
.export OPEN
.export CLOSE
.export CHKIN
.export CKOUT
.export CLRCH
.export BASIN
.export BSOUT
.export LOAD
.export SAVE
.export SETTIM
.export RDTIM
.export STOP
.export GETIN
.export CLALL
.export UDTIM
.export SCREEN
.export PLOT
.export IOBASE
;-----------------------------------------------------------------------------
; All functions are available in the kernal 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