1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

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 \
cputc.o \
kbhit.o \
kernal.o \
mouse.o \
randomize.o \
readjoy.o \

View File

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

View File

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

View File

@ -9,12 +9,13 @@
.import condes, initlib, donelib
.import initconio, doneconio, zerobss
.import push0, _main
.import RESTOR, BSOUT, CLRCH
.import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
.import __RAM_START__, __RAM_SIZE__
.include "zeropage.inc"
.include "c128.inc"
.include "../cbm/cbm.inc"
; ------------------------------------------------------------------------
; 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 \
cputc.o \
kbhit.o \
kernal.o \
mouse.o \
randomize.o \
readjoy.o \

View File

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

View File

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

View File

@ -8,11 +8,12 @@
.import initlib, donelib
.import zerobss, push0
.import _main
.import RESTOR, BSOUT, CLRCH
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
.include "zeropage.inc"
.include "c64.inc"
.include "../cbm/cbm.inc"
.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
_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

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,16 @@
;
;
; Ullrich von Bassewitz, 13.09.2001
;
; Keyboard polling stuff for the 510.
;
.export k_scnkey
.export SCNKEY
.importzp tpi2, ktab1, ktab2, ktab3, ktab4
.include "cbm510.inc"
.proc k_scnkey
.proc SCNKEY
lda #$FF
sta ModKey
@ -50,7 +50,7 @@ L4: lsr a
sec
ldy #tpiPortB
lda (tpi2),y
rol a
rol a
sta (tpi2),y
ldy #tpiPortA
lda (tpi2),y
@ -102,7 +102,7 @@ End: lda #$7F
sta (tpi2),y
ldy #tpiPortB
lda #$FF
sta (tpi2),y
sta (tpi2),y
rts
Repeat: dec RepeatDelay
@ -130,7 +130,7 @@ PutKey: sta KeyBuf,x
ldy #tpiPortC
L1: lda (tpi2),y
sta KeySave
lda (tpi2),y
lda (tpi2),y
cmp KeySave
bne L1
rts

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@
.import initlib, donelib
.import zerobss, push0
.import _main
.import CLRCH, BSOUT
.include "zeropage.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
MEMSIZE = $34 ; Size of memory installed
TIME = $8D ; 60HZ clock
MEMSIZE = $34 ; Size of memory installed
ST = $96 ; IEC status byte
SECADR = $D3 ; Secondary address
DEVNUM = $D4 ; Device number
KEY_COUNT = $9E ; Number of keys in input buffer
CURS_FLAG = $A7 ; 1 = cursor off
CURS_BLINK = $A8 ; Blink counter
@ -18,8 +16,13 @@ CURS_CHAR = $A9 ; Character under the cursor
CURS_STATE = $AA ; Cursor blink state
SCREEN_PTR = $C4 ; Pointer to current char in text screen
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
CURS_Y = $D8 ; Cursor row
FNADR = $DA ; Pointer to file name
KEY_BUF = $26F ; Keyboard buffer

View File

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

View File

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

View File

@ -9,9 +9,10 @@
.export newline, plot
.import popa, _gotoxy
.import xsize, revers
.import PLOT
.include "plus4.inc"
.include "../cbm/cbm.inc"
_cputcxy:
pha ; Save C
@ -28,7 +29,7 @@ _cputc: cmp #$0A ; CR?
beq plot ; Recalculate pointers
L1: cmp #$0D ; LF?
beq newline ; Recalculate pointers
beq newline ; Recalculate pointers
; Printable char of some sort
@ -88,7 +89,7 @@ L11: ora #$40
plot: ldy CURS_X
ldx CURS_Y
clc
clc
jmp PLOT ; Set the new cursor

View File

@ -7,10 +7,11 @@
.export _exit
.import initlib, donelib
.import push0, _main, zerobss
.import MEMTOP, RESTOR, BSOUT, CLRCH
.include "zeropage.inc"
.include "plus4.inc"
.include "../cbm/cbm.inc"
; ------------------------------------------------------------------------
; 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,8 +20,9 @@ OBJS = _scrsize.o \
conio.o \
cputc.o \
kbhit.o \
kernal.o \
randomize.o \
readjoy.o
readjoy.o
all: $(OBJS)

View File

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

View File

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

View File

@ -8,6 +8,7 @@
.import initlib, donelib
.import zerobss, push0
.import _main
.import RESTOR, BSOUT, CLRCH
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
.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