mirror of
https://github.com/cc65/cc65.git
synced 2025-01-03 01:31:55 +00:00
Added wrappers for the kernal functions
git-svn-id: svn://svn.cc65.org/cc65/trunk@1587 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
df42c5943d
commit
b7e7864fc5
@ -19,8 +19,29 @@ OBJS = _scrsize.o \
|
||||
conio.o \
|
||||
cputc.o \
|
||||
crt0.o \
|
||||
kacptr.o \
|
||||
kbasin.o \
|
||||
kbhit.o \
|
||||
kernal.o \
|
||||
kbsout.o \
|
||||
kchkin.o \
|
||||
kciout.o \
|
||||
kckout.o \
|
||||
kclall.o \
|
||||
kclose.o \
|
||||
kclrch.o \
|
||||
kiobase.o \
|
||||
klisten.o \
|
||||
kload.o \
|
||||
kopen.o \
|
||||
krdtim.o \
|
||||
kreadst.o \
|
||||
ksave.o \
|
||||
ksetlfs.o \
|
||||
ksetnam.o \
|
||||
ksettim.s \
|
||||
ktalk.o \
|
||||
kunlsn.o \
|
||||
kuntlk.o \
|
||||
randomize.o \
|
||||
readjoy.o \
|
||||
tgi_mode_table.o
|
||||
|
@ -9,9 +9,10 @@
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
|
||||
.segment "LOWMEM" ; Accesses the ROM - must go into low mem
|
||||
|
||||
_cgetc: lda KEY_COUNT ; Get number of characters
|
||||
ora FKEY_COUNT ; Or with number of function key chars
|
||||
bne L2 ; Jump if there are already chars waiting
|
||||
@ -44,7 +45,9 @@ L1: lda KEY_COUNT
|
||||
sta TED_CURSLO ; Cursor off
|
||||
sta TED_CURSHI
|
||||
|
||||
L2: jsr KBDREAD ; Read char and return in A
|
||||
L2: sta ENABLE_ROM ; Bank in the ROM
|
||||
jsr KBDREAD ; Read char and return in A (ROM routine)
|
||||
sta ENABLE_RAM ; Reenable the RAM
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
@ -56,6 +59,8 @@ L2: jsr KBDREAD ; Read char and return in A
|
||||
.constructor initkbd
|
||||
.destructor donekbd
|
||||
|
||||
.code ; Can go into the normal code segment
|
||||
|
||||
.proc initkbd
|
||||
|
||||
ldy #15
|
||||
@ -68,13 +73,17 @@ L2: jsr KBDREAD ; Read char and return in A
|
||||
.endproc
|
||||
|
||||
|
||||
.segment "LOWMEM" ; Accesses the ROM - must go into low mem
|
||||
|
||||
.proc donekbd
|
||||
|
||||
ldx #$39 ; Copy the original function keys
|
||||
sta ENABLE_ROM ; Bank in the ROM
|
||||
@L1: lda FKEY_ORIG,x
|
||||
sta FKEY_SPACE,x
|
||||
dex
|
||||
bpl @L1
|
||||
sta ENABLE_RAM ; Bank out the ROM
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
@ -8,7 +8,16 @@
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
_clrscr = CLRSCR
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc _clrscr
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr CLRSCR ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7,61 +7,71 @@
|
||||
.export _exit
|
||||
.import initlib, donelib
|
||||
.import push0, _main, zerobss
|
||||
.import MEMTOP, RESTOR, BSOUT, CLRCH
|
||||
.import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "plus4.inc"
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; BASIC header with a SYS call
|
||||
; Place the startup code in a special segment to cope with the quirks of
|
||||
; plus/4 banking.
|
||||
|
||||
.code
|
||||
.segment "STARTUP"
|
||||
|
||||
.org $0FFF
|
||||
.word Head ; Load address
|
||||
Head: .word @Next
|
||||
.word 1000 ; Line number
|
||||
.byte $9E,"4109" ; SYS 4109
|
||||
.byte $00 ; End of BASIC line
|
||||
@Next: .word 0 ; BASIC end marker
|
||||
.reloc
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Actual code
|
||||
|
||||
sei ; No interrupts since we're banking out the ROM
|
||||
sta ENABLE_RAM
|
||||
ldx #zpspace-1
|
||||
L1: lda sp,x
|
||||
sta zpsave,x ; save the zero page locations we need
|
||||
dex
|
||||
bpl L1
|
||||
sta ENABLE_ROM
|
||||
cli
|
||||
|
||||
; Close open files
|
||||
|
||||
jsr CLRCH
|
||||
jsr $FFCC ; CLRCH
|
||||
|
||||
; Switch to second charset
|
||||
|
||||
lda #14
|
||||
jsr BSOUT
|
||||
jsr $FFD2 ; BSOUT
|
||||
|
||||
; Setup the IRQ vector in the banked RAM and switch off the ROM
|
||||
|
||||
sei ; No ints, handler not yet in place
|
||||
sta ENABLE_RAM
|
||||
lda #<IRQ
|
||||
sta $FFFE ; Install interrupt handler
|
||||
lda #>IRQ
|
||||
sta $FFFF
|
||||
cli ; Allow interrupts
|
||||
|
||||
; Clear the BSS data
|
||||
|
||||
jsr zerobss
|
||||
|
||||
; Save system stuff and setup the stack
|
||||
; Save system stuff and setup the stack. The stack starts at the top of the
|
||||
; usable RAM.
|
||||
|
||||
tsx
|
||||
stx spsave ; save system stk ptr
|
||||
|
||||
sec
|
||||
jsr MEMTOP ; Get top memory
|
||||
cpy #$80 ; We can only use the low 32K :-(
|
||||
bcc MemOk
|
||||
ldy #$80
|
||||
ldx #$00
|
||||
MemOk: stx sp
|
||||
sty sp+1 ; set argument stack ptr
|
||||
lda #<$FD00
|
||||
sta sp
|
||||
lda #>$FD00
|
||||
sta sp+1
|
||||
|
||||
; Call module constructors
|
||||
|
||||
@ -92,11 +102,41 @@ L2: lda zpsave,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Reset changed vectors
|
||||
; Enable the ROM, reset changed vectors and return to BASIC
|
||||
|
||||
jmp RESTOR
|
||||
sta ENABLE_ROM
|
||||
jmp $FF8A ; RESTOR
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; IRQ handler
|
||||
|
||||
.segment "LOWCODE"
|
||||
|
||||
IRQ: pha
|
||||
txa
|
||||
pha
|
||||
tsx ; Get the stack pointer
|
||||
lda $0103,x ; Get the saved status register
|
||||
tax
|
||||
lda #>irqret ; Push new return address
|
||||
pha
|
||||
lda #<irqret
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
sta ENABLE_ROM ; Switch to ROM
|
||||
jmp ($FFFE) ; Jump to kernal irq handler
|
||||
|
||||
irqret: sta ENABLE_RAM ; Switch back to RAM
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
rti
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data
|
||||
|
||||
.data
|
||||
zpsave: .res zpspace
|
||||
|
||||
|
20
libsrc/plus4/kacptr.s
Normal file
20
libsrc/plus4/kacptr.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; ACPTR replacement function
|
||||
;
|
||||
|
||||
.export ACPTR
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc ACPTR
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFA5 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kbasin.s
Normal file
20
libsrc/plus4/kbasin.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; BASIN replacement function
|
||||
;
|
||||
|
||||
.export BASIN
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc BASIN
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFCF ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kbsout.s
Normal file
20
libsrc/plus4/kbsout.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; BSOUT replacement function
|
||||
;
|
||||
|
||||
.export BSOUT
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc BSOUT
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFD2 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kchkin.s
Normal file
20
libsrc/plus4/kchkin.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; CHKIN replacement function
|
||||
;
|
||||
|
||||
.export CHKIN
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc CHKIN
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFC6 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kciout.s
Normal file
20
libsrc/plus4/kciout.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; CIOUT replacement function
|
||||
;
|
||||
|
||||
.export CIOUT
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc CIOUT
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFA8 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kckout.s
Normal file
20
libsrc/plus4/kckout.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; CKOUT replacement function
|
||||
;
|
||||
|
||||
.export CKOUT
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc CKOUT
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFC9 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kclall.s
Normal file
20
libsrc/plus4/kclall.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; CLALL replacement function
|
||||
;
|
||||
|
||||
.export CLALL
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc CLALL
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFE7 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kclose.s
Normal file
20
libsrc/plus4/kclose.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; CLOSE replacement function
|
||||
;
|
||||
|
||||
.export CLOSE
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc CLOSE
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFC3 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kclrch.s
Normal file
20
libsrc/plus4/kclrch.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; CLRCH replacement function
|
||||
;
|
||||
|
||||
.export CLRCH
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc CLRCH
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFCC ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
@ -1,90 +0,0 @@
|
||||
;
|
||||
; 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
|
||||
|
20
libsrc/plus4/kiobase.s
Normal file
20
libsrc/plus4/kiobase.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; IOBASE replacement function
|
||||
;
|
||||
|
||||
.export IOBASE
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc IOBASE
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFF3 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/klisten.s
Normal file
20
libsrc/plus4/klisten.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; LISTEN replacement function
|
||||
;
|
||||
|
||||
.export LISTEN
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc LISTEN
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFB1 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kload.s
Normal file
20
libsrc/plus4/kload.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; LOAD replacement function
|
||||
;
|
||||
|
||||
.export LOAD
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc LOAD
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFD5 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kopen.s
Normal file
20
libsrc/plus4/kopen.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; OPEN replacement function
|
||||
;
|
||||
|
||||
.export OPEN
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc OPEN
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFC0 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
22
libsrc/plus4/krdtim.s
Normal file
22
libsrc/plus4/krdtim.s
Normal file
@ -0,0 +1,22 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; RDTIM replacement function
|
||||
;
|
||||
|
||||
.export RDTIM
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
; Read the clock from the zero page to avoid banking in the ROM
|
||||
|
||||
.proc RDTIM
|
||||
sei ; No interrupts
|
||||
lda TIME+2
|
||||
ldx TIME+1
|
||||
ldy TIME ; Read the time
|
||||
cli ; Allow interrupts
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
18
libsrc/plus4/kreadst.s
Normal file
18
libsrc/plus4/kreadst.s
Normal file
@ -0,0 +1,18 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; READST replacement function
|
||||
;
|
||||
|
||||
.export READST
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
; Read the status byte from the zero page instead of banking in the ROM
|
||||
|
||||
.proc READST
|
||||
lda ST ; Load status
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/ksave.s
Normal file
20
libsrc/plus4/ksave.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; SAVE replacement function
|
||||
;
|
||||
|
||||
.export SAVE
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc SAVE
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFD8 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/ksetlfs.s
Normal file
20
libsrc/plus4/ksetlfs.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; SETLFS replacement function
|
||||
;
|
||||
|
||||
.export SETLFS
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
; Write directly to the zero page to avoid banking in the ROM
|
||||
|
||||
.proc SETLFS
|
||||
sta LFN
|
||||
stx DEVNUM
|
||||
sty SECADR
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
62
libsrc/plus4/ksetnam.s
Normal file
62
libsrc/plus4/ksetnam.s
Normal file
@ -0,0 +1,62 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; SETNAM replacement function
|
||||
;
|
||||
|
||||
.export SETNAM
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
; This function is special in that the name must reside in low memory,
|
||||
; otherwise it is not accessible by the ROM code.
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc SETNAM
|
||||
|
||||
; Limit the length of the name and store it into the zero page
|
||||
|
||||
cmp #16+1
|
||||
bcc @L1
|
||||
lda #16 ; Use a maximum of 16 chars
|
||||
@L1: sta FNAM_LEN
|
||||
|
||||
; Check if we have to copy the name to low memory
|
||||
|
||||
cmp #$00 ; Length zero?
|
||||
beq @L3 ; Yes: Copying not needed
|
||||
cpy #$00 ; Is the name in low memory?
|
||||
bpl @L3 ; Yes: Copying not needed
|
||||
|
||||
; Store the length and the pointer to the name
|
||||
|
||||
stx TMPPTR
|
||||
sty TMPPTR+1 ; Store pointer to name in TMPPTR
|
||||
|
||||
; Copy the given name into DOS_FN1
|
||||
|
||||
ldy #$00
|
||||
@L2: lda (TMPPTR),y
|
||||
sta DOS_FN1,y
|
||||
iny
|
||||
cpy FNAM_LEN
|
||||
bne @L2
|
||||
|
||||
; Load the new parameters for the low memory buffer
|
||||
|
||||
ldx #<DOS_FN1
|
||||
ldy #>DOS_FN1
|
||||
|
||||
; Instead of banking in the ROM, store the values directly into the zeropage
|
||||
|
||||
@L3: stx FNAM_ADR
|
||||
sty FNAM_ADR+1
|
||||
|
||||
; Return to caller
|
||||
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
22
libsrc/plus4/ksettim.s
Normal file
22
libsrc/plus4/ksettim.s
Normal file
@ -0,0 +1,22 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; SETTIM replacement function
|
||||
;
|
||||
|
||||
.export SETTIM
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
; Set the clock by writing directly to zero page to avoid banking in the ROM
|
||||
|
||||
.proc SETTIM
|
||||
sei ; No interrupts
|
||||
sta TIME+2
|
||||
stx TIME+1
|
||||
sty TIME ; Set the time
|
||||
cli ; Allow interrupts
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/ktalk.s
Normal file
20
libsrc/plus4/ktalk.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; TALK replacement function
|
||||
;
|
||||
|
||||
.export TALK
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc TALK
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFB4 ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kunlsn.s
Normal file
20
libsrc/plus4/kunlsn.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; UNLSN replacement function
|
||||
;
|
||||
|
||||
.export UNLSN
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc UNLSN
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFAE ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
20
libsrc/plus4/kuntlk.s
Normal file
20
libsrc/plus4/kuntlk.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 22.11.2002
|
||||
;
|
||||
; UNTLK replacement function
|
||||
;
|
||||
|
||||
.export UNTLK
|
||||
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
|
||||
.proc UNTLK
|
||||
sta ENABLE_ROM ; Enable the ROM
|
||||
jsr $FFAB ; Call the ROM routine
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
@ -6,18 +6,22 @@
|
||||
; ---------------------------------------------------------------------------
|
||||
; Zero page, Commodore stuff
|
||||
|
||||
TMPPTR = $22 ; Temporary ptr used by BASIC
|
||||
ST = $90 ; IEC status byte
|
||||
|
||||
TIME = $A3 ; 60HZ clock
|
||||
FNAM_LEN = $AB ; Length of filename
|
||||
LFN = $AC ; Logical file number
|
||||
SECADR = $AD ; Secondary address
|
||||
DEVNUM = $AE ; Device number
|
||||
FNAM_ADR = $AF ; Pointer to filename for OPEN
|
||||
KEY_COUNT = $EF ; Number of keys in input buffer
|
||||
CURS_X = $CA ; Cursor column
|
||||
CURS_Y = $CD ; Cursor row
|
||||
SCREEN_PTR = $C8 ; Pointer to current char in text screen
|
||||
CRAM_PTR = $EA ; Pointer to current char in color RAM
|
||||
|
||||
DOS_FN1 = $25E ; DOS filename buffer #1
|
||||
DOS_FN1LEN = $26E ; DOS filename length #1
|
||||
CHARCOLOR = $53B
|
||||
FKEY_COUNT = $55D ; Characters for function key
|
||||
FKEY_SPACE = $55F ; Function key definitions
|
||||
@ -63,5 +67,10 @@ TED_HPOS = $FF1E
|
||||
TED_ROMSEL = $FF3E
|
||||
TED_RAMSEL = $FF3F
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; RAM/ROM selection addresses
|
||||
|
||||
ENABLE_ROM = $FF3E
|
||||
ENABLE_RAM = $FF3F
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user