mirror of
https://github.com/cc65/cc65.git
synced 2025-02-26 23:30:03 +00:00
kiec.s
git-svn-id: svn://svn.cc65.org/cc65/trunk@2781 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
c92b4ac06c
commit
cbc53423c5
@ -33,10 +33,19 @@ OBJS = _scrsize.o \
|
|||||||
crt0.o \
|
crt0.o \
|
||||||
crtc.o \
|
crtc.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
|
kiec.o \
|
||||||
|
kiobase.o \
|
||||||
kirq.o \
|
kirq.o \
|
||||||
kplot.o \
|
kplot.o \
|
||||||
|
krdtim.o \
|
||||||
|
kreadst.o \
|
||||||
kscnkey.o \
|
kscnkey.o \
|
||||||
|
kscreen.o \
|
||||||
|
ksetlfs.o \
|
||||||
|
ksetnam.o \
|
||||||
|
ksettim.o \
|
||||||
kudtim.o \
|
kudtim.o \
|
||||||
|
kupdst.o \
|
||||||
mainargs.o \
|
mainargs.o \
|
||||||
peeksys.o \
|
peeksys.o \
|
||||||
pokesys.o \
|
pokesys.o \
|
||||||
|
@ -24,9 +24,8 @@ SendHead = $24 ; Head of send buffer
|
|||||||
SendTail = $25 ; Tail of send buffer
|
SendTail = $25 ; Tail of send buffer
|
||||||
SendFreeCnt = $26 ; Number of bytes free in send buffer
|
SendFreeCnt = $26 ; Number of bytes free in send buffer
|
||||||
|
|
||||||
FileNameAdrLo = $90
|
FNAM := $90 ; File name address
|
||||||
FileNameAdrHi = $91
|
FNAM_SEG := $92 ; Unused
|
||||||
FileNameAdrSeg = $92
|
|
||||||
SaveAdrLow = $93
|
SaveAdrLow = $93
|
||||||
SaveAdrHi = $94
|
SaveAdrHi = $94
|
||||||
SaveAdrSeg = $95
|
SaveAdrSeg = $95
|
||||||
@ -36,11 +35,11 @@ EndAdrSeg = $98
|
|||||||
StartAdrLow = $99
|
StartAdrLow = $99
|
||||||
StartAdrHi = $9A
|
StartAdrHi = $9A
|
||||||
StartAdrSeg = $9B
|
StartAdrSeg = $9B
|
||||||
Status = $9C
|
ST := $9C ; Status
|
||||||
FileNameLen = $9D
|
FNAM_LEN := $9D
|
||||||
LogicalAdr = $9E
|
LFN := $9E
|
||||||
FirstAdr = $9F
|
DEVNUM := $9F
|
||||||
SecondAdr = $A0
|
SECADR := $A0
|
||||||
DefInpDev = $A1
|
DefInpDev = $A1
|
||||||
DefOutDev = $A2
|
DefOutDev = $A2
|
||||||
TapeBufPtr = $A3
|
TapeBufPtr = $A3
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
.import push0, callmain
|
.import push0, callmain
|
||||||
.import __BSS_RUN__, __BSS_SIZE__
|
.import __BSS_RUN__, __BSS_SIZE__
|
||||||
.import irq, nmi
|
.import irq, nmi
|
||||||
.import k_irq, k_nmi, PLOT, UDTIM, SCNKEY
|
.import k_irq, k_nmi
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "cbm610.inc"
|
.include "cbm610.inc"
|
||||||
@ -102,17 +102,17 @@ Back: ldx spsave
|
|||||||
; use the stack (since it's in page 1)!
|
; use the stack (since it's in page 1)!
|
||||||
|
|
||||||
tsx
|
tsx
|
||||||
stx spsave ; Save the system stackpointer
|
stx spsave ; Save the system stackpointer
|
||||||
ldx #$FF
|
ldx #$FF
|
||||||
txs ; Set up our own stack
|
txs ; Set up our own stack
|
||||||
|
|
||||||
; Set the interrupt, NMI and other vectors
|
; Set the interrupt, NMI and other vectors
|
||||||
|
|
||||||
ldy #vectable_size
|
ldy #vectors_size-1
|
||||||
L0: lda vectable-1,y
|
L0: lda vectors,y
|
||||||
sta $FF80,y
|
sta $10000 - vectors_size,y
|
||||||
dey
|
dey
|
||||||
bne L0
|
bpl L0
|
||||||
|
|
||||||
; Switch the indirect segment to the system bank
|
; Switch the indirect segment to the system bank
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ L0: lda vectable-1,y
|
|||||||
|
|
||||||
lda #$90
|
lda #$90
|
||||||
sta ptr1
|
sta ptr1
|
||||||
lda #$00
|
lda #$00
|
||||||
sta ptr1+1
|
sta ptr1+1
|
||||||
ldy #$62-1
|
ldy #$62-1
|
||||||
L1: lda (ptr1),y
|
L1: lda (ptr1),y
|
||||||
@ -133,19 +133,19 @@ L1: lda (ptr1),y
|
|||||||
|
|
||||||
; Copy the page 3 vectors in place
|
; Copy the page 3 vectors in place
|
||||||
|
|
||||||
ldy #$00
|
ldy #$00
|
||||||
L2: lda p3vectable,y
|
L2: lda p3vectors,y
|
||||||
sta $300,y
|
sta $300,y
|
||||||
iny
|
iny
|
||||||
cpy #p3vectable_size
|
cpy #p3vectors_size
|
||||||
bne L2
|
bne L2
|
||||||
|
|
||||||
; Copy the rest of page 3 from the system bank
|
; Copy the rest of page 3 from the system bank
|
||||||
|
|
||||||
lda #$00
|
lda #$00
|
||||||
sta ptr1
|
sta ptr1
|
||||||
lda #$03
|
lda #$03
|
||||||
sta ptr1+1
|
sta ptr1+1
|
||||||
L3: lda (ptr1),y
|
L3: lda (ptr1),y
|
||||||
sta $300,y
|
sta $300,y
|
||||||
iny
|
iny
|
||||||
@ -153,8 +153,8 @@ L3: lda (ptr1),y
|
|||||||
|
|
||||||
; Set the indirect segment to bank we're executing in
|
; Set the indirect segment to bank we're executing in
|
||||||
|
|
||||||
lda ExecReg
|
lda ExecReg
|
||||||
sta IndReg
|
sta IndReg
|
||||||
|
|
||||||
; Zero the BSS segment. We will do that here instead calling the routine
|
; Zero the BSS segment. We will do that here instead calling the routine
|
||||||
; in the common library, since we have the memory anyway, and this way,
|
; in the common library, since we have the memory anyway, and this way,
|
||||||
@ -222,59 +222,20 @@ Z4:
|
|||||||
; Additional data that we need for initialization and that's overwritten
|
; Additional data that we need for initialization and that's overwritten
|
||||||
; later
|
; later
|
||||||
|
|
||||||
vectable:
|
vectors:
|
||||||
jmp $0000 ; CINT
|
sta ExecReg
|
||||||
jmp $0000 ; IOINIT
|
rts
|
||||||
jmp $0000 ; RAMTAS
|
.byte $01 ; Filler
|
||||||
jmp $0000 ; RESTOR
|
|
||||||
jmp $0000 ; VECTOR
|
|
||||||
jmp $0000 ; SETMSG
|
|
||||||
jmp $0000 ; SECOND
|
|
||||||
jmp $0000 ; TKSA
|
|
||||||
jmp $0000 ; MEMTOP
|
|
||||||
jmp $0000 ; MEMBOT
|
|
||||||
jmp SCNKEY
|
|
||||||
jmp $0000 ; SETTMO
|
|
||||||
jmp $0000 ; ACPTR
|
|
||||||
jmp $0000 ; CIOUT
|
|
||||||
jmp $0000 ; UNTLK
|
|
||||||
jmp $0000 ; UNLSN
|
|
||||||
jmp $0000 ; LISTEN
|
|
||||||
jmp $0000 ; TALK
|
|
||||||
jmp $0000 ; READST
|
|
||||||
jmp SETLFS
|
|
||||||
jmp SETNAM
|
|
||||||
jmp $0000 ; OPEN
|
|
||||||
jmp $0000 ; CLOSE
|
|
||||||
jmp $0000 ; CHKIN
|
|
||||||
jmp $0000 ; CKOUT
|
|
||||||
jmp $0000 ; CLRCH
|
|
||||||
jmp $0000 ; BASIN
|
|
||||||
jmp $0000 ; BSOUT
|
|
||||||
jmp $0000 ; LOAD
|
|
||||||
jmp $0000 ; SAVE
|
|
||||||
jmp SETTIM
|
|
||||||
jmp RDTIM
|
|
||||||
jmp $0000 ; STOP
|
|
||||||
jmp $0000 ; GETIN
|
|
||||||
jmp $0000 ; CLALL
|
|
||||||
jmp UDTIM
|
|
||||||
jmp SCREEN
|
|
||||||
jmp PLOT
|
|
||||||
jmp IOBASE
|
|
||||||
sta ExecReg
|
|
||||||
rts
|
|
||||||
.byte $01 ; Filler
|
|
||||||
.word nmi
|
.word nmi
|
||||||
.word 0 ; Reset - not used
|
.word 0 ; Reset - not used
|
||||||
.word irq
|
.word irq
|
||||||
vectable_size = * - vectable
|
vectors_size = * - vectors
|
||||||
|
|
||||||
p3vectable:
|
p3vectors:
|
||||||
.word k_irq ; IRQ user vector
|
.word k_irq ; IRQ user vector
|
||||||
.word k_brk ; BRK user vector
|
.word k_brk ; BRK user vector
|
||||||
.word k_nmi ; NMI user vector
|
.word k_nmi ; NMI user vector
|
||||||
p3vectable_size = * - p3vectable
|
p3vectors_size = * - p3vectors
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
@ -327,66 +288,9 @@ Clear: sta $02,x
|
|||||||
; Code that is copied into the system bank at $100 when switching back
|
; Code that is copied into the system bank at $100 when switching back
|
||||||
|
|
||||||
reset: cli
|
reset: cli
|
||||||
jmp $8000 ; BASIC cold start
|
jmp $8000 ; BASIC cold start
|
||||||
reset_size = * - reset
|
reset_size = * - reset
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
|
||||||
; Code for a few simpler kernal calls goes here
|
|
||||||
|
|
||||||
.export IOBASE
|
|
||||||
.proc IOBASE
|
|
||||||
ldx cia
|
|
||||||
ldy cia+1
|
|
||||||
rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
.export SCREEN
|
|
||||||
.proc SCREEN
|
|
||||||
ldx #80 ; Columns
|
|
||||||
ldy #25 ; Lines
|
|
||||||
rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
.export SETLFS
|
|
||||||
.proc SETLFS
|
|
||||||
sta LogicalAdr
|
|
||||||
stx FirstAdr
|
|
||||||
sty SecondAdr
|
|
||||||
rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
.export SETNAM
|
|
||||||
.proc SETNAM
|
|
||||||
sta FileNameLen
|
|
||||||
lda $00,x
|
|
||||||
sta FileNameAdrLo
|
|
||||||
lda $01,x
|
|
||||||
sta FileNameAdrHi
|
|
||||||
lda $02,x
|
|
||||||
sta FileNameAdrSeg
|
|
||||||
rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
.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
|
; Data area - switch back to relocatable mode
|
||||||
|
|
||||||
|
19
libsrc/cbm610/kiobase.s
Normal file
19
libsrc/cbm610/kiobase.s
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-12-19
|
||||||
|
;
|
||||||
|
; IOBASE kernal call
|
||||||
|
;
|
||||||
|
|
||||||
|
.export IOBASE
|
||||||
|
.import cia : zeropage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.proc IOBASE
|
||||||
|
|
||||||
|
ldx cia
|
||||||
|
ldy cia+1
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
21
libsrc/cbm610/krdtim.s
Normal file
21
libsrc/cbm610/krdtim.s
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-12-19
|
||||||
|
;
|
||||||
|
; RDTIM kernal call
|
||||||
|
;
|
||||||
|
|
||||||
|
.export RDTIM
|
||||||
|
.import time : zeropage
|
||||||
|
|
||||||
|
|
||||||
|
.proc RDTIM
|
||||||
|
|
||||||
|
sei
|
||||||
|
lda time+0
|
||||||
|
ldx time+1
|
||||||
|
ldy time+2
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
19
libsrc/cbm610/kreadst.s
Normal file
19
libsrc/cbm610/kreadst.s
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-12-19
|
||||||
|
;
|
||||||
|
; READST kernal call
|
||||||
|
;
|
||||||
|
|
||||||
|
.export READST
|
||||||
|
|
||||||
|
.include "cbm610.inc"
|
||||||
|
|
||||||
|
|
||||||
|
.proc READST
|
||||||
|
|
||||||
|
lda ST ; Load status
|
||||||
|
rts ; Return to caller
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
16
libsrc/cbm610/kscreen.s
Normal file
16
libsrc/cbm610/kscreen.s
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-12-19
|
||||||
|
;
|
||||||
|
; SCREEN kernal call
|
||||||
|
;
|
||||||
|
|
||||||
|
.export SCREEN
|
||||||
|
|
||||||
|
|
||||||
|
.proc SCREEN
|
||||||
|
|
||||||
|
ldx #80 ; Columns
|
||||||
|
ldy #25 ; Lines
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
19
libsrc/cbm610/ksetlfs.s
Normal file
19
libsrc/cbm610/ksetlfs.s
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-12-18
|
||||||
|
;
|
||||||
|
; SETLFS replacement function
|
||||||
|
;
|
||||||
|
|
||||||
|
.export SETLFS
|
||||||
|
|
||||||
|
.include "cbm610.inc"
|
||||||
|
|
||||||
|
|
||||||
|
.proc SETLFS
|
||||||
|
sta LFN
|
||||||
|
stx DEVNUM
|
||||||
|
sty SECADR
|
||||||
|
rts ; Return to caller
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
25
libsrc/cbm610/ksetnam.s
Normal file
25
libsrc/cbm610/ksetnam.s
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-12-18
|
||||||
|
;
|
||||||
|
; SETNAM kernal call.
|
||||||
|
;
|
||||||
|
; NOTE: The routine does not work like that in the CBM610 kernal (which works
|
||||||
|
; different than that on all other CBMs). Instead, it works like on all other
|
||||||
|
; Commodore machines. No segment has to be passed, the current segment is
|
||||||
|
; assumed.
|
||||||
|
|
||||||
|
.export SETNAM
|
||||||
|
|
||||||
|
.include "cbm610.inc"
|
||||||
|
|
||||||
|
.proc SETNAM
|
||||||
|
|
||||||
|
sta FileNameLen
|
||||||
|
stx FileNameAdrLo
|
||||||
|
sty FileNameAdrHi
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
21
libsrc/cbm610/ksettim.s
Normal file
21
libsrc/cbm610/ksettim.s
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-12-19
|
||||||
|
;
|
||||||
|
; SETTIM kernal call
|
||||||
|
;
|
||||||
|
|
||||||
|
.export SETTIM
|
||||||
|
.import time : zeropage
|
||||||
|
|
||||||
|
|
||||||
|
.proc SETTIM
|
||||||
|
|
||||||
|
sei
|
||||||
|
sta time+0
|
||||||
|
stx time+1
|
||||||
|
sty time+2
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
20
libsrc/cbm610/kupdst.s
Normal file
20
libsrc/cbm610/kupdst.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-12-18
|
||||||
|
;
|
||||||
|
; UPDST kernal call.
|
||||||
|
;
|
||||||
|
|
||||||
|
.export UPDST
|
||||||
|
|
||||||
|
.include "cbm610.inc"
|
||||||
|
|
||||||
|
.proc UPDST
|
||||||
|
|
||||||
|
ora ST
|
||||||
|
sta ST
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user