From 6d498d81872e506d0e1f069d01a9d4d43a962639 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 19 Nov 2002 23:02:47 +0000 Subject: [PATCH] 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 --- libsrc/c128/Makefile | 1 + libsrc/c128/_scrsize.s | 4 +- libsrc/c128/cputc.s | 3 +- libsrc/c128/crt0.s | 3 +- libsrc/c128/kernal.s | 90 +++++++++++++++++++++++++++++++++++++ libsrc/c64/Makefile | 1 + libsrc/c64/_scrsize.s | 2 +- libsrc/c64/cputc.s | 3 +- libsrc/c64/crt0.s | 3 +- libsrc/c64/kernal.s | 90 +++++++++++++++++++++++++++++++++++++ libsrc/c64/tgi_mode_table.s | 2 +- libsrc/cbm/c_acptr.s | 6 +-- libsrc/cbm/c_basin.s | 3 +- libsrc/cbm/c_bsout.s | 3 +- libsrc/cbm/c_chkin.s | 3 +- libsrc/cbm/c_ciout.s | 3 +- libsrc/cbm/c_ckout.s | 4 +- libsrc/cbm/c_clall.s | 4 +- libsrc/cbm/c_close.s | 5 +-- libsrc/cbm/c_clrch.s | 3 +- libsrc/cbm/c_iobase.s | 3 +- libsrc/cbm/c_listen.s | 3 +- libsrc/cbm/c_load.s | 5 +-- libsrc/cbm/c_open.s | 4 +- libsrc/cbm/c_readst.s | 4 +- libsrc/cbm/c_save.s | 4 +- libsrc/cbm/c_setlfs.s | 4 +- libsrc/cbm/c_setnam.s | 4 +- libsrc/cbm/c_talk.s | 4 +- libsrc/cbm/c_unlsn.s | 4 +- libsrc/cbm/c_untlk.s | 4 +- libsrc/cbm/cbm.inc | 80 ++++++++++++++++----------------- libsrc/cbm/cbm_read.s | 2 + libsrc/cbm/cbm_write.s | 6 ++- libsrc/cbm/clock.s | 4 +- libsrc/cbm/close.s | 1 + libsrc/cbm/diskcmd.s | 4 +- libsrc/cbm/filename.s | 2 +- libsrc/cbm/open.s | 2 +- libsrc/cbm/read.s | 5 ++- libsrc/cbm/where.s | 5 ++- libsrc/cbm/write.s | 1 + libsrc/cbm510/cputc.s | 3 +- libsrc/cbm510/crt0.s | 74 +++++++++++++++++------------- libsrc/cbm510/kplot.s | 5 ++- libsrc/cbm510/kscnkey.s | 12 ++--- libsrc/cbm510/kudtim.s | 5 ++- libsrc/cbm610/cputc.s | 4 +- libsrc/cbm610/crt0.s | 58 ++++++++++++++---------- libsrc/cbm610/kplot.s | 4 +- libsrc/cbm610/kscnkey.s | 4 +- libsrc/cbm610/kudtim.s | 6 +-- libsrc/pet/Makefile | 7 ++- libsrc/pet/crt0.s | 1 + libsrc/pet/kernal.s | 38 ++++++++++++++++ libsrc/pet/krdtim.s | 23 ++++++++++ libsrc/pet/kreadst.s | 19 ++++++++ libsrc/pet/ksetlfs.s | 21 +++++++++ libsrc/pet/ksetnam.s | 21 +++++++++ libsrc/pet/pet.inc | 11 +++-- libsrc/plus4/Makefile | 1 + libsrc/plus4/_scrsize.s | 2 +- libsrc/plus4/cputc.s | 7 +-- libsrc/plus4/crt0.s | 3 +- libsrc/plus4/kernal.s | 90 +++++++++++++++++++++++++++++++++++++ libsrc/vic20/Makefile | 3 +- libsrc/vic20/_scrsize.s | 2 +- libsrc/vic20/cputc.s | 3 +- libsrc/vic20/crt0.s | 1 + libsrc/vic20/kernal.s | 90 +++++++++++++++++++++++++++++++++++++ 70 files changed, 721 insertions(+), 188 deletions(-) create mode 100644 libsrc/c128/kernal.s create mode 100644 libsrc/c64/kernal.s create mode 100644 libsrc/pet/kernal.s create mode 100644 libsrc/pet/krdtim.s create mode 100644 libsrc/pet/kreadst.s create mode 100644 libsrc/pet/ksetlfs.s create mode 100644 libsrc/pet/ksetnam.s create mode 100644 libsrc/plus4/kernal.s create mode 100644 libsrc/vic20/kernal.s diff --git a/libsrc/c128/Makefile b/libsrc/c128/Makefile index 555fe81eb..a7693b7ea 100644 --- a/libsrc/c128/Makefile +++ b/libsrc/c128/Makefile @@ -20,6 +20,7 @@ OBJS = _scrsize.o \ color.o \ cputc.o \ kbhit.o \ + kernal.o \ mouse.o \ randomize.o \ readjoy.o \ diff --git a/libsrc/c128/_scrsize.s b/libsrc/c128/_scrsize.s index d377be7df..dcbc4a2d9 100644 --- a/libsrc/c128/_scrsize.s +++ b/libsrc/c128/_scrsize.s @@ -5,9 +5,9 @@ ; .export xsize, ysize + .import SCREEN .constructor initscrsize - .include "../cbm/cbm.inc" .code @@ -26,4 +26,4 @@ ysize: .res 1 - + diff --git a/libsrc/c128/cputc.s b/libsrc/c128/cputc.s index 7f35ded29..318aa6175 100644 --- a/libsrc/c128/cputc.s +++ b/libsrc/c128/cputc.s @@ -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 diff --git a/libsrc/c128/crt0.s b/libsrc/c128/crt0.s index a35839914..b7309c9c2 100644 --- a/libsrc/c128/crt0.s +++ b/libsrc/c128/crt0.s @@ -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 diff --git a/libsrc/c128/kernal.s b/libsrc/c128/kernal.s new file mode 100644 index 000000000..4f7b20180 --- /dev/null +++ b/libsrc/c128/kernal.s @@ -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 + diff --git a/libsrc/c64/Makefile b/libsrc/c64/Makefile index 5b67a4b1c..10cd36fc2 100644 --- a/libsrc/c64/Makefile +++ b/libsrc/c64/Makefile @@ -23,6 +23,7 @@ OBJS = _scrsize.o \ conio.o \ cputc.o \ kbhit.o \ + kernal.o \ mouse.o \ randomize.o \ readjoy.o \ diff --git a/libsrc/c64/_scrsize.s b/libsrc/c64/_scrsize.s index 749226d36..c63df59d2 100644 --- a/libsrc/c64/_scrsize.s +++ b/libsrc/c64/_scrsize.s @@ -5,9 +5,9 @@ ; .export xsize, ysize + .import SCREEN .constructor initscrsize - .include "../cbm/cbm.inc" .code diff --git a/libsrc/c64/cputc.s b/libsrc/c64/cputc.s index 1efeaa701..7bdcdc859 100644 --- a/libsrc/c64/cputc.s +++ b/libsrc/c64/cputc.s @@ -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 diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s index 770297372..607f779be 100644 --- a/libsrc/c64/crt0.s +++ b/libsrc/c64/crt0.s @@ -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 diff --git a/libsrc/c64/kernal.s b/libsrc/c64/kernal.s new file mode 100644 index 000000000..ac39779a3 --- /dev/null +++ b/libsrc/c64/kernal.s @@ -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 + diff --git a/libsrc/c64/tgi_mode_table.s b/libsrc/c64/tgi_mode_table.s index 0f918f170..bed27a52b 100644 --- a/libsrc/c64/tgi_mode_table.s +++ b/libsrc/c64/tgi_mode_table.s @@ -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 diff --git a/libsrc/cbm/c_acptr.s b/libsrc/cbm/c_acptr.s index d77d6f1ce..e5c9852b6 100644 --- a/libsrc/cbm/c_acptr.s +++ b/libsrc/cbm/c_acptr.s @@ -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 - + diff --git a/libsrc/cbm/c_basin.s b/libsrc/cbm/c_basin.s index a852b6c5b..80dda8bdb 100644 --- a/libsrc/cbm/c_basin.s +++ b/libsrc/cbm/c_basin.s @@ -4,8 +4,7 @@ ; unsigned char __fastcall__ cbm_k_basin (void); ; - .include "cbm.inc" - .export _cbm_k_basin + .import BASIN _cbm_k_basin = BASIN diff --git a/libsrc/cbm/c_bsout.s b/libsrc/cbm/c_bsout.s index 9bb0430cd..14b1252a6 100644 --- a/libsrc/cbm/c_bsout.s +++ b/libsrc/cbm/c_bsout.s @@ -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 diff --git a/libsrc/cbm/c_chkin.s b/libsrc/cbm/c_chkin.s index 4febff74c..f687147ac 100644 --- a/libsrc/cbm/c_chkin.s +++ b/libsrc/cbm/c_chkin.s @@ -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 diff --git a/libsrc/cbm/c_ciout.s b/libsrc/cbm/c_ciout.s index b2c149fb1..72f42daf3 100644 --- a/libsrc/cbm/c_ciout.s +++ b/libsrc/cbm/c_ciout.s @@ -4,9 +4,8 @@ ; void __fastcall__ cbm_ciout (unsigned char C); ; - .include "cbm.inc" - .export _cbm_ciout + .import CIOUT _cbm_ciout = CIOUT diff --git a/libsrc/cbm/c_ckout.s b/libsrc/cbm/c_ckout.s index 148619d6b..299254c03 100644 --- a/libsrc/cbm/c_ckout.s +++ b/libsrc/cbm/c_ckout.s @@ -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 diff --git a/libsrc/cbm/c_clall.s b/libsrc/cbm/c_clall.s index d7c5625ee..b062c6ff3 100644 --- a/libsrc/cbm/c_clall.s +++ b/libsrc/cbm/c_clall.s @@ -4,9 +4,9 @@ ; void __fastcall__ cbm_clall (void); ; - .include "cbm.inc" - .export _cbm_clall + .import CLALL + _cbm_clall = CLALL diff --git a/libsrc/cbm/c_close.s b/libsrc/cbm/c_close.s index e2a559cc4..5a99f5057 100644 --- a/libsrc/cbm/c_close.s +++ b/libsrc/cbm/c_close.s @@ -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 diff --git a/libsrc/cbm/c_clrch.s b/libsrc/cbm/c_clrch.s index 632a9e2b2..7750fd811 100644 --- a/libsrc/cbm/c_clrch.s +++ b/libsrc/cbm/c_clrch.s @@ -4,9 +4,8 @@ ; void __fastcall__ cbm_k_clrch (void); ; - .include "cbm.inc" - .export _cbm_k_clrch + .import CLRCH _cbm_k_clrch = CLRCH diff --git a/libsrc/cbm/c_iobase.s b/libsrc/cbm/c_iobase.s index 58fb1598b..2780b0ca3 100644 --- a/libsrc/cbm/c_iobase.s +++ b/libsrc/cbm/c_iobase.s @@ -4,9 +4,8 @@ ; unsigned __fastcall__ cbm_iobase (void); ; - .include "cbm.inc" - .export _cbm_iobase + .import IOBASE _cbm_iobase: jsr IOBASE diff --git a/libsrc/cbm/c_listen.s b/libsrc/cbm/c_listen.s index a5cc4e0cb..9502c2d1a 100644 --- a/libsrc/cbm/c_listen.s +++ b/libsrc/cbm/c_listen.s @@ -4,9 +4,8 @@ ; void __fastcall__ cbm_listen (unsigned char dev); ; - .include "cbm.inc" - .export _cbm_listen + .import LISTEN _cbm_listen = LISTEN diff --git a/libsrc/cbm/c_load.s b/libsrc/cbm/c_load.s index 3424722db..821330704 100644 --- a/libsrc/cbm/c_load.s +++ b/libsrc/cbm/c_load.s @@ -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 - + diff --git a/libsrc/cbm/c_open.s b/libsrc/cbm/c_open.s index 23577f9d4..300aa54ad 100644 --- a/libsrc/cbm/c_open.s +++ b/libsrc/cbm/c_open.s @@ -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 diff --git a/libsrc/cbm/c_readst.s b/libsrc/cbm/c_readst.s index 4854ae25d..2a3075acc 100644 --- a/libsrc/cbm/c_readst.s +++ b/libsrc/cbm/c_readst.s @@ -4,8 +4,8 @@ ; unsigned char __fastcall__ cbm_k_readst (void); ; - .include "cbm.inc" - .export _cbm_k_readst + .import READST + _cbm_k_readst = READST diff --git a/libsrc/cbm/c_save.s b/libsrc/cbm/c_save.s index ec896d29a..e17471fa7 100644 --- a/libsrc/cbm/c_save.s +++ b/libsrc/cbm/c_save.s @@ -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 diff --git a/libsrc/cbm/c_setlfs.s b/libsrc/cbm/c_setlfs.s index 315a4fc50..5277cf453 100644 --- a/libsrc/cbm/c_setlfs.s +++ b/libsrc/cbm/c_setlfs.s @@ -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 diff --git a/libsrc/cbm/c_setnam.s b/libsrc/cbm/c_setnam.s index f3d571d28..8f35d37fb 100644 --- a/libsrc/cbm/c_setnam.s +++ b/libsrc/cbm/c_setnam.s @@ -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 diff --git a/libsrc/cbm/c_talk.s b/libsrc/cbm/c_talk.s index d9d709913..062b5e492 100644 --- a/libsrc/cbm/c_talk.s +++ b/libsrc/cbm/c_talk.s @@ -4,9 +4,9 @@ ; void __fastcall__ cbm_talk (unsigned char dev); ; - .include "cbm.inc" - .export _cbm_talk + .import TALK + _cbm_talk = TALK diff --git a/libsrc/cbm/c_unlsn.s b/libsrc/cbm/c_unlsn.s index bcf4e0be0..1b48cf9ab 100644 --- a/libsrc/cbm/c_unlsn.s +++ b/libsrc/cbm/c_unlsn.s @@ -4,9 +4,9 @@ ; void __fastcall__ cbm_unlsn (void); ; - .include "cbm.inc" - .export _cbm_unlsn + .import UNLSN + _cbm_unlsn = UNLSN diff --git a/libsrc/cbm/c_untlk.s b/libsrc/cbm/c_untlk.s index 4417188b3..b45997bb3 100644 --- a/libsrc/cbm/c_untlk.s +++ b/libsrc/cbm/c_untlk.s @@ -4,9 +4,9 @@ ; void __fastcall__ cbm_untlk (void); ; - .include "cbm.inc" - .export _cbm_untlk + .import UNTLK + _cbm_untlk = UNTLK diff --git a/libsrc/cbm/cbm.inc b/libsrc/cbm/cbm.inc index d0f0aad3c..8caaa66a8 100644 --- a/libsrc/cbm/cbm.inc +++ b/libsrc/cbm/cbm.inc @@ -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 diff --git a/libsrc/cbm/cbm_read.s b/libsrc/cbm/cbm_read.s index 20d3db124..5df18e34d 100644 --- a/libsrc/cbm/cbm_read.s +++ b/libsrc/cbm/cbm_read.s @@ -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 diff --git a/libsrc/cbm/cbm_write.s b/libsrc/cbm/cbm_write.s index 402cd3ea7..295ff2cd0 100644 --- a/libsrc/cbm/cbm_write.s +++ b/libsrc/cbm/cbm_write.s @@ -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 diff --git a/libsrc/cbm/clock.s b/libsrc/cbm/clock.s index 4e744dc89..71fa40336 100644 --- a/libsrc/cbm/clock.s +++ b/libsrc/cbm/clock.s @@ -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 diff --git a/libsrc/cbm/close.s b/libsrc/cbm/close.s index c521c0801..cb71224f9 100644 --- a/libsrc/cbm/close.s +++ b/libsrc/cbm/close.s @@ -6,6 +6,7 @@ .export _close + .import CLOSE .import readdiskerror, closecmdchannel .import __errno, __oserror .importzp tmp2 diff --git a/libsrc/cbm/diskcmd.s b/libsrc/cbm/diskcmd.s index 134622f20..c6f04e9fe 100644 --- a/libsrc/cbm/diskcmd.s +++ b/libsrc/cbm/diskcmd.s @@ -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 diff --git a/libsrc/cbm/filename.s b/libsrc/cbm/filename.s index 594c7da91..572be21e4 100644 --- a/libsrc/cbm/filename.s +++ b/libsrc/cbm/filename.s @@ -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" ;-------------------------------------------------------------------------- diff --git a/libsrc/cbm/open.s b/libsrc/cbm/open.s index 509951b0f..bb6c6188c 100644 --- a/libsrc/cbm/open.s +++ b/libsrc/cbm/open.s @@ -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" diff --git a/libsrc/cbm/read.s b/libsrc/cbm/read.s index 5a2157b99..0183946b5 100644 --- a/libsrc/cbm/read.s +++ b/libsrc/cbm/read.s @@ -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 diff --git a/libsrc/cbm/where.s b/libsrc/cbm/where.s index d9c0b61ed..a7bf17d3e 100644 --- a/libsrc/cbm/where.s +++ b/libsrc/cbm/where.s @@ -4,9 +4,10 @@ ; unsigned char wherex (void); ; unsigned char wherey (void); + .export _wherex, _wherey - - .include "cbm.inc" + .import PLOT + _wherex: sec diff --git a/libsrc/cbm/write.s b/libsrc/cbm/write.s index 7a1441fe0..64b3c580e 100644 --- a/libsrc/cbm/write.s +++ b/libsrc/cbm/write.s @@ -7,6 +7,7 @@ .export _write .constructor initstdout + .import SETLFS, OPEN, CKOUT, BSOUT, CLRCH .import rwcommon .import __errno, __oserror .importzp sp, ptr1, ptr2, ptr3 diff --git a/libsrc/cbm510/cputc.s b/libsrc/cbm510/cputc.s index 557beae31..8b832614b 100644 --- a/libsrc/cbm510/cputc.s +++ b/libsrc/cbm510/cputc.s @@ -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" ; ------------------------------------------------------------------------ ; diff --git a/libsrc/cbm510/crt0.s b/libsrc/cbm510/crt0.s index 6500397ae..a0b9c844b 100644 --- a/libsrc/cbm510/crt0.s +++ b/libsrc/cbm510/crt0.s @@ -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 - -k_settim: - sei - sta time+0 - stx time+1 - sty time+2 - cli - rts +.export RDTIM +.proc RDTIM + sei + lda time+0 + ldx time+1 + ldy time+2 + cli + rts +.endproc + +.export SETTIM +.proc SETTIM + sei + sta time+0 + stx time+1 + sty time+2 + cli + rts +.endproc ; ------------------------------------------------------------------------- ; Data area - switch back to relocatable mode diff --git a/libsrc/cbm510/kplot.s b/libsrc/cbm510/kplot.s index 3d16d578f..c5f52f85b 100644 --- a/libsrc/cbm510/kplot.s +++ b/libsrc/cbm510/kplot.s @@ -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 + diff --git a/libsrc/cbm510/kscnkey.s b/libsrc/cbm510/kscnkey.s index 0832a3461..95657508e 100644 --- a/libsrc/cbm510/kscnkey.s +++ b/libsrc/cbm510/kscnkey.s @@ -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 diff --git a/libsrc/cbm510/kudtim.s b/libsrc/cbm510/kudtim.s index e50e1cf71..54d6eb26e 100644 --- a/libsrc/cbm510/kudtim.s +++ b/libsrc/cbm510/kudtim.s @@ -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 + diff --git a/libsrc/cbm610/cputc.s b/libsrc/cbm610/cputc.s index aa94b8aa4..ac3224c6f 100644 --- a/libsrc/cbm610/cputc.s +++ b/libsrc/cbm610/cputc.s @@ -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 diff --git a/libsrc/cbm610/crt0.s b/libsrc/cbm610/crt0.s index c13bcb043..f2298bcd9 100644 --- a/libsrc/cbm610/crt0.s +++ b/libsrc/cbm610/crt0.s @@ -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 diff --git a/libsrc/cbm610/kplot.s b/libsrc/cbm610/kplot.s index 2a514185a..d972b6039 100644 --- a/libsrc/cbm610/kplot.s +++ b/libsrc/cbm610/kplot.s @@ -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 diff --git a/libsrc/cbm610/kscnkey.s b/libsrc/cbm610/kscnkey.s index ee30cf35a..ce9851731 100644 --- a/libsrc/cbm610/kscnkey.s +++ b/libsrc/cbm610/kscnkey.s @@ -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 diff --git a/libsrc/cbm610/kudtim.s b/libsrc/cbm610/kudtim.s index e100a84c6..a5f525660 100644 --- a/libsrc/cbm610/kudtim.s +++ b/libsrc/cbm610/kudtim.s @@ -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 - + diff --git a/libsrc/pet/Makefile b/libsrc/pet/Makefile index 4bc6c2212..4c3c44d0c 100644 --- a/libsrc/pet/Makefile +++ b/libsrc/pet/Makefile @@ -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) diff --git a/libsrc/pet/crt0.s b/libsrc/pet/crt0.s index fb1babc38..c1e5c009f 100644 --- a/libsrc/pet/crt0.s +++ b/libsrc/pet/crt0.s @@ -8,6 +8,7 @@ .import initlib, donelib .import zerobss, push0 .import _main + .import CLRCH, BSOUT .include "zeropage.inc" .include "pet.inc" diff --git a/libsrc/pet/kernal.s b/libsrc/pet/kernal.s new file mode 100644 index 000000000..522f2ba3f --- /dev/null +++ b/libsrc/pet/kernal.s @@ -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 + diff --git a/libsrc/pet/krdtim.s b/libsrc/pet/krdtim.s new file mode 100644 index 000000000..355cce3d8 --- /dev/null +++ b/libsrc/pet/krdtim.s @@ -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 + + diff --git a/libsrc/pet/kreadst.s b/libsrc/pet/kreadst.s new file mode 100644 index 000000000..56a491e5d --- /dev/null +++ b/libsrc/pet/kreadst.s @@ -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 + + diff --git a/libsrc/pet/ksetlfs.s b/libsrc/pet/ksetlfs.s new file mode 100644 index 000000000..6e9065ac7 --- /dev/null +++ b/libsrc/pet/ksetlfs.s @@ -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 + + diff --git a/libsrc/pet/ksetnam.s b/libsrc/pet/ksetnam.s new file mode 100644 index 000000000..0bf6411bd --- /dev/null +++ b/libsrc/pet/ksetnam.s @@ -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 + + diff --git a/libsrc/pet/pet.inc b/libsrc/pet/pet.inc index e83051222..0dca57a76 100644 --- a/libsrc/pet/pet.inc +++ b/libsrc/pet/pet.inc @@ -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 diff --git a/libsrc/plus4/Makefile b/libsrc/plus4/Makefile index 2c431741e..a503225af 100644 --- a/libsrc/plus4/Makefile +++ b/libsrc/plus4/Makefile @@ -20,6 +20,7 @@ OBJS = _scrsize.o \ cputc.o \ crt0.o \ kbhit.o \ + kernal.o \ randomize.o \ readjoy.o \ tgi_mode_table.o diff --git a/libsrc/plus4/_scrsize.s b/libsrc/plus4/_scrsize.s index 749226d36..c63df59d2 100644 --- a/libsrc/plus4/_scrsize.s +++ b/libsrc/plus4/_scrsize.s @@ -5,9 +5,9 @@ ; .export xsize, ysize + .import SCREEN .constructor initscrsize - .include "../cbm/cbm.inc" .code diff --git a/libsrc/plus4/cputc.s b/libsrc/plus4/cputc.s index eab31f0cd..1d3208c28 100644 --- a/libsrc/plus4/cputc.s +++ b/libsrc/plus4/cputc.s @@ -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 diff --git a/libsrc/plus4/crt0.s b/libsrc/plus4/crt0.s index 701b17258..9c8b66fea 100644 --- a/libsrc/plus4/crt0.s +++ b/libsrc/plus4/crt0.s @@ -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 diff --git a/libsrc/plus4/kernal.s b/libsrc/plus4/kernal.s new file mode 100644 index 000000000..78914c084 --- /dev/null +++ b/libsrc/plus4/kernal.s @@ -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 + diff --git a/libsrc/vic20/Makefile b/libsrc/vic20/Makefile index d3f42397d..8ffc8e886 100644 --- a/libsrc/vic20/Makefile +++ b/libsrc/vic20/Makefile @@ -20,8 +20,9 @@ OBJS = _scrsize.o \ conio.o \ cputc.o \ kbhit.o \ + kernal.o \ randomize.o \ - readjoy.o + readjoy.o all: $(OBJS) diff --git a/libsrc/vic20/_scrsize.s b/libsrc/vic20/_scrsize.s index 749226d36..c63df59d2 100644 --- a/libsrc/vic20/_scrsize.s +++ b/libsrc/vic20/_scrsize.s @@ -5,9 +5,9 @@ ; .export xsize, ysize + .import SCREEN .constructor initscrsize - .include "../cbm/cbm.inc" .code diff --git a/libsrc/vic20/cputc.s b/libsrc/vic20/cputc.s index 85a29f4ef..c788d32af 100644 --- a/libsrc/vic20/cputc.s +++ b/libsrc/vic20/cputc.s @@ -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 diff --git a/libsrc/vic20/crt0.s b/libsrc/vic20/crt0.s index 189a9d71b..286b0407c 100644 --- a/libsrc/vic20/crt0.s +++ b/libsrc/vic20/crt0.s @@ -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" diff --git a/libsrc/vic20/kernal.s b/libsrc/vic20/kernal.s new file mode 100644 index 000000000..885a2fca9 --- /dev/null +++ b/libsrc/vic20/kernal.s @@ -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 + -- 2.39.5