1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-26 17:36:57 +00:00
git-svn-id: svn://svn.cc65.org/cc65/trunk@2781 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-12-19 00:12:08 +00:00
parent c92b4ac06c
commit cbc53423c5
11 changed files with 203 additions and 131 deletions

View File

@ -33,10 +33,19 @@ OBJS = _scrsize.o \
crt0.o \
crtc.o \
kbhit.o \
kiec.o \
kiobase.o \
kirq.o \
kplot.o \
krdtim.o \
kreadst.o \
kscnkey.o \
kscreen.o \
ksetlfs.o \
ksetnam.o \
ksettim.o \
kudtim.o \
kupdst.o \
mainargs.o \
peeksys.o \
pokesys.o \

View File

@ -24,9 +24,8 @@ SendHead = $24 ; Head of send buffer
SendTail = $25 ; Tail of send buffer
SendFreeCnt = $26 ; Number of bytes free in send buffer
FileNameAdrLo = $90
FileNameAdrHi = $91
FileNameAdrSeg = $92
FNAM := $90 ; File name address
FNAM_SEG := $92 ; Unused
SaveAdrLow = $93
SaveAdrHi = $94
SaveAdrSeg = $95
@ -36,11 +35,11 @@ EndAdrSeg = $98
StartAdrLow = $99
StartAdrHi = $9A
StartAdrSeg = $9B
Status = $9C
FileNameLen = $9D
LogicalAdr = $9E
FirstAdr = $9F
SecondAdr = $A0
ST := $9C ; Status
FNAM_LEN := $9D
LFN := $9E
DEVNUM := $9F
SECADR := $A0
DefInpDev = $A1
DefOutDev = $A2
TapeBufPtr = $A3

View File

@ -12,7 +12,7 @@
.import push0, callmain
.import __BSS_RUN__, __BSS_SIZE__
.import irq, nmi
.import k_irq, k_nmi, PLOT, UDTIM, SCNKEY
.import k_irq, k_nmi
.include "zeropage.inc"
.include "cbm610.inc"
@ -102,17 +102,17 @@ Back: ldx spsave
; use the stack (since it's in page 1)!
tsx
stx spsave ; Save the system stackpointer
ldx #$FF
txs ; Set up our own stack
stx spsave ; Save the system stackpointer
ldx #$FF
txs ; Set up our own stack
; Set the interrupt, NMI and other vectors
ldy #vectable_size
L0: lda vectable-1,y
sta $FF80,y
ldy #vectors_size-1
L0: lda vectors,y
sta $10000 - vectors_size,y
dey
bne L0
bpl L0
; Switch the indirect segment to the system bank
@ -123,7 +123,7 @@ L0: lda vectable-1,y
lda #$90
sta ptr1
lda #$00
lda #$00
sta ptr1+1
ldy #$62-1
L1: lda (ptr1),y
@ -133,19 +133,19 @@ L1: lda (ptr1),y
; Copy the page 3 vectors in place
ldy #$00
L2: lda p3vectable,y
ldy #$00
L2: lda p3vectors,y
sta $300,y
iny
cpy #p3vectable_size
cpy #p3vectors_size
bne L2
; Copy the rest of page 3 from the system bank
lda #$00
sta ptr1
lda #$03
sta ptr1+1
lda #$03
sta ptr1+1
L3: lda (ptr1),y
sta $300,y
iny
@ -153,8 +153,8 @@ L3: lda (ptr1),y
; Set the indirect segment to bank we're executing in
lda ExecReg
sta IndReg
lda ExecReg
sta IndReg
; 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,
@ -222,59 +222,20 @@ Z4:
; Additional data that we need for initialization and that's overwritten
; later
vectable:
jmp $0000 ; CINT
jmp $0000 ; IOINIT
jmp $0000 ; RAMTAS
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
vectors:
sta ExecReg
rts
.byte $01 ; Filler
.word nmi
.word 0 ; Reset - not used
.word irq
vectable_size = * - vectable
vectors_size = * - vectors
p3vectable:
.word k_irq ; IRQ user vector
.word k_brk ; BRK user vector
.word k_nmi ; NMI user vector
p3vectable_size = * - p3vectable
p3vectors:
.word k_irq ; IRQ user vector
.word k_brk ; BRK user vector
.word k_nmi ; NMI user vector
p3vectors_size = * - p3vectors
; ------------------------------------------------------------------------
@ -327,66 +288,9 @@ Clear: sta $02,x
; Code that is copied into the system bank at $100 when switching back
reset: cli
jmp $8000 ; BASIC cold start
jmp $8000 ; BASIC cold start
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

19
libsrc/cbm610/kiobase.s Normal file
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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