From 59e96ef74035fac5d42e82b98d7969101533c8c6 Mon Sep 17 00:00:00 2001 From: "ol.sc" Date: Sun, 30 Sep 2012 18:20:15 +0000 Subject: [PATCH] Turned the 'ST' status byte into a symbol resolved by the linker in order to allow to use it from code living in the 'cbm' directory. Moved getdevice.s from 'c64'/'c128' to 'cbm' making use of the new 'ST' setup. git-svn-id: svn://svn.cc65.org/cc65/trunk@5834 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/c128/Makefile | 2 +- libsrc/c128/crt0.s | 1 + libsrc/c128/getdevice.s | 67 --------------------------------- libsrc/c128/status.s | 5 +++ libsrc/c16/Makefile | 1 + libsrc/c16/crt0.s | 1 + libsrc/c16/status.s | 5 +++ libsrc/c64/Makefile | 2 +- libsrc/c64/crt0.s | 1 + libsrc/c64/status.s | 5 +++ libsrc/cbm/Makefile | 1 + libsrc/{c64 => cbm}/getdevice.s | 3 +- libsrc/pet/Makefile | 1 + libsrc/pet/checkst.s | 5 +-- libsrc/pet/crt0.s | 1 + libsrc/pet/kreadst.s | 3 +- libsrc/pet/status.s | 5 +++ libsrc/plus4/Makefile | 1 + libsrc/plus4/crt0.s | 1 + libsrc/plus4/status.s | 5 +++ libsrc/vic20/Makefile | 1 + libsrc/vic20/crt0.s | 1 + libsrc/vic20/status.s | 5 +++ 23 files changed, 46 insertions(+), 77 deletions(-) delete mode 100644 libsrc/c128/getdevice.s create mode 100644 libsrc/c128/status.s create mode 100644 libsrc/c16/status.s create mode 100644 libsrc/c64/status.s rename libsrc/{c64 => cbm}/getdevice.s (97%) create mode 100644 libsrc/pet/status.s create mode 100644 libsrc/plus4/status.s create mode 100644 libsrc/vic20/status.s diff --git a/libsrc/c128/Makefile b/libsrc/c128/Makefile index a6dc0f2b1..b5b2a8a2a 100644 --- a/libsrc/c128/Makefile +++ b/libsrc/c128/Makefile @@ -56,7 +56,6 @@ OBJS = _scrsize.o \ devnum.o \ fast.o \ get_tv.o \ - getdevice.o \ joy_stddrv.o \ kbhit.o \ kernal.o \ @@ -66,6 +65,7 @@ OBJS = _scrsize.o \ randomize.o \ revers.o \ slow.o \ + status.o \ systime.o \ sysuname.o \ tgi_colors.o \ diff --git a/libsrc/c128/crt0.s b/libsrc/c128/crt0.s index 5185e2c83..64fec19a0 100644 --- a/libsrc/c128/crt0.s +++ b/libsrc/c128/crt0.s @@ -10,6 +10,7 @@ .import RESTOR, BSOUT, CLRCH .import __INTERRUPTOR_COUNT__ .import __RAM_START__, __RAM_SIZE__, __STACKSIZE__ + .importzp ST .include "zeropage.inc" .include "c128.inc" diff --git a/libsrc/c128/getdevice.s b/libsrc/c128/getdevice.s deleted file mode 100644 index 9ec2abe69..000000000 --- a/libsrc/c128/getdevice.s +++ /dev/null @@ -1,67 +0,0 @@ -; -; Oliver Schmidt, 2012-09-04 -; -; unsigned char getfirstdevice (void); -; unsigned char __fastcall__ getnextdevice (unsigned char device); -; - - .export _getfirstdevice - .export _getnextdevice - - .import isdisk - .import opencmdchannel - .import closecmdchannel - .importzp tmp2 - - .include "c128.inc" - -;------------------------------------------------------------------------------ -; _getfirstdevice - -_getfirstdevice: - lda #$FF - ; Fall through - -;------------------------------------------------------------------------------ -; _getnextdevice - -_getnextdevice: - tax -next: inx - cpx #$FF - beq done - -; [open|close]cmdchannel already call isdisk internally but they -; interpret a non-disk as a no-op while we need to interpret it -; as an error here - - jsr isdisk - bcs next - -; [open|close]cmdchannel don't call into the Kernal at all if they -; only [in|de]crement the reference count of the shared cmdchannel -; so we need to explicitly initialize ST here - - lda #$00 - sta ST - - stx tmp2 - jsr opencmdchannel - ldx tmp2 - jsr closecmdchannel - ldx tmp2 - -; As we had to reference ST above anyway we can as well do so -; here too (instead of calling READST) - - lda ST - -; Either the Kernal calls above were successfull or there was -; already a cmdchannel to the device open - which is a pretty -; good indication of its existence ;-) - - bmi next - -done: txa - ldx #$00 - rts diff --git a/libsrc/c128/status.s b/libsrc/c128/status.s new file mode 100644 index 000000000..3620c9107 --- /dev/null +++ b/libsrc/c128/status.s @@ -0,0 +1,5 @@ +; +; Oliver Schmidt, 2012-09-30 +; + + .exportzp ST := $90 ; IEC status byte diff --git a/libsrc/c16/Makefile b/libsrc/c16/Makefile index eca4991c4..4019154a6 100644 --- a/libsrc/c16/Makefile +++ b/libsrc/c16/Makefile @@ -61,6 +61,7 @@ OBJS = _scrsize.o \ mainargs.o \ randomize.o \ revers.o \ + status.o \ systime.o \ sysuname.o diff --git a/libsrc/c16/crt0.s b/libsrc/c16/crt0.s index 71e7b0cf8..88b328afd 100644 --- a/libsrc/c16/crt0.s +++ b/libsrc/c16/crt0.s @@ -11,6 +11,7 @@ .import callmain, zerobss .import MEMTOP, RESTOR, BSOUT, CLRCH .import __INTERRUPTOR_COUNT__ + .importzp ST .include "zeropage.inc" .include "plus4.inc" diff --git a/libsrc/c16/status.s b/libsrc/c16/status.s new file mode 100644 index 000000000..3620c9107 --- /dev/null +++ b/libsrc/c16/status.s @@ -0,0 +1,5 @@ +; +; Oliver Schmidt, 2012-09-30 +; + + .exportzp ST := $90 ; IEC status byte diff --git a/libsrc/c64/Makefile b/libsrc/c64/Makefile index 2c952b7c0..5d4b16aed 100644 --- a/libsrc/c64/Makefile +++ b/libsrc/c64/Makefile @@ -55,7 +55,6 @@ OBJS = _scrsize.o \ devnum.o \ get_ostype.o \ get_tv.o \ - getdevice.o \ joy_stddrv.o \ kbhit.o \ kernal.o \ @@ -65,6 +64,7 @@ OBJS = _scrsize.o \ mouse_stddrv.o \ randomize.o \ revers.o \ + status.o \ systime.o \ sysuname.o \ tgi_colors.o \ diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s index c9fee2031..16d2fb367 100644 --- a/libsrc/c64/crt0.s +++ b/libsrc/c64/crt0.s @@ -11,6 +11,7 @@ .import __INTERRUPTOR_COUNT__ .import __RAM_START__, __RAM_SIZE__ ; Linker generated .import __STACKSIZE__ ; Linker generated + .importzp ST .include "zeropage.inc" .include "c64.inc" diff --git a/libsrc/c64/status.s b/libsrc/c64/status.s new file mode 100644 index 000000000..3620c9107 --- /dev/null +++ b/libsrc/c64/status.s @@ -0,0 +1,5 @@ +; +; Oliver Schmidt, 2012-09-30 +; + + .exportzp ST := $90 ; IEC status byte diff --git a/libsrc/cbm/Makefile b/libsrc/cbm/Makefile index 639d69424..1b1a6a4cb 100644 --- a/libsrc/cbm/Makefile +++ b/libsrc/cbm/Makefile @@ -76,6 +76,7 @@ S_OBJS = c_acptr.o \ filename.o \ filetype.o \ filevars.o \ + getdevice.o \ gotox.o \ gotoxy.o \ gotoy.o \ diff --git a/libsrc/c64/getdevice.s b/libsrc/cbm/getdevice.s similarity index 97% rename from libsrc/c64/getdevice.s rename to libsrc/cbm/getdevice.s index 90bf6ba47..87f990bf1 100644 --- a/libsrc/c64/getdevice.s +++ b/libsrc/cbm/getdevice.s @@ -11,10 +11,9 @@ .import isdisk .import opencmdchannel .import closecmdchannel + .importzp ST .importzp tmp2 - .include "c64.inc" - ;------------------------------------------------------------------------------ ; _getfirstdevice diff --git a/libsrc/pet/Makefile b/libsrc/pet/Makefile index 041643d40..8ecf018c1 100644 --- a/libsrc/pet/Makefile +++ b/libsrc/pet/Makefile @@ -70,6 +70,7 @@ OBJS = _scrsize.o \ mainargs.o \ randomize.o \ revers.o \ + status.o \ sysuname.o #-------------------------------------------------------------------------- diff --git a/libsrc/pet/checkst.s b/libsrc/pet/checkst.s index 9996d0ed4..8d9d9a4f3 100644 --- a/libsrc/pet/checkst.s +++ b/libsrc/pet/checkst.s @@ -6,8 +6,7 @@ ; .export checkst - - .include "pet.inc" + .importzp ST .proc checkst @@ -22,5 +21,3 @@ rts .endproc - - diff --git a/libsrc/pet/crt0.s b/libsrc/pet/crt0.s index 564e9ce77..121f4c492 100644 --- a/libsrc/pet/crt0.s +++ b/libsrc/pet/crt0.s @@ -9,6 +9,7 @@ .import callmain .import CLRCH, BSOUT .import __INTERRUPTOR_COUNT__ + .importzp ST .include "zeropage.inc" .include "pet.inc" diff --git a/libsrc/pet/kreadst.s b/libsrc/pet/kreadst.s index 56a491e5d..38f6bfb19 100644 --- a/libsrc/pet/kreadst.s +++ b/libsrc/pet/kreadst.s @@ -5,8 +5,7 @@ ; .export READST - - .include "pet.inc" + .importzp ST .proc READST diff --git a/libsrc/pet/status.s b/libsrc/pet/status.s new file mode 100644 index 000000000..bb72817ce --- /dev/null +++ b/libsrc/pet/status.s @@ -0,0 +1,5 @@ +; +; Oliver Schmidt, 2012-09-30 +; + + .exportzp ST := $96 ; IEC status byte diff --git a/libsrc/plus4/Makefile b/libsrc/plus4/Makefile index d6a852e21..4dc01c96b 100644 --- a/libsrc/plus4/Makefile +++ b/libsrc/plus4/Makefile @@ -82,6 +82,7 @@ OBJS = _scrsize.o \ mainargs.o \ randomize.o \ revers.o \ + status.o \ systime.o \ sysuname.o diff --git a/libsrc/plus4/crt0.s b/libsrc/plus4/crt0.s index 0592cca7e..73460d82b 100644 --- a/libsrc/plus4/crt0.s +++ b/libsrc/plus4/crt0.s @@ -11,6 +11,7 @@ .import __INTERRUPTOR_COUNT__ .import __RAM_START__, __RAM_SIZE__ ; Linker generated .import __STACKSIZE__ ; Linker generated + .importzp ST .include "zeropage.inc" .include "plus4.inc" diff --git a/libsrc/plus4/status.s b/libsrc/plus4/status.s new file mode 100644 index 000000000..3620c9107 --- /dev/null +++ b/libsrc/plus4/status.s @@ -0,0 +1,5 @@ +; +; Oliver Schmidt, 2012-09-30 +; + + .exportzp ST := $90 ; IEC status byte diff --git a/libsrc/vic20/Makefile b/libsrc/vic20/Makefile index 929a19aad..023f27a8f 100644 --- a/libsrc/vic20/Makefile +++ b/libsrc/vic20/Makefile @@ -61,6 +61,7 @@ OBJS = _scrsize.o \ mainargs.o \ randomize.o \ revers.o \ + status.o \ sysuname.o #-------------------------------------------------------------------------- diff --git a/libsrc/vic20/crt0.s b/libsrc/vic20/crt0.s index 944fabe48..170ac3a39 100644 --- a/libsrc/vic20/crt0.s +++ b/libsrc/vic20/crt0.s @@ -11,6 +11,7 @@ .import __INTERRUPTOR_COUNT__ .import __RAM_START__, __RAM_SIZE__ ; Linker generated .import __STACKSIZE__ ; Linker generated + .importzp ST .include "zeropage.inc" .include "vic20.inc" diff --git a/libsrc/vic20/status.s b/libsrc/vic20/status.s new file mode 100644 index 000000000..3620c9107 --- /dev/null +++ b/libsrc/vic20/status.s @@ -0,0 +1,5 @@ +; +; Oliver Schmidt, 2012-09-30 +; + + .exportzp ST := $90 ; IEC status byte -- 2.39.5