Upload files to "kernal"
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
.segment "NBASIN"
|
||||||
|
;***************************************
|
||||||
|
;* clall -- close all logical files *
|
||||||
|
;* deletes all table entries and*
|
||||||
|
;* restores default i/o channels *
|
||||||
|
;* and clears ieee port devices *
|
||||||
|
;*************************************
|
||||||
|
;
|
||||||
|
nclall lda #0
|
||||||
|
sta ldtnd ;forget all files
|
||||||
|
|
||||||
|
;********************************************
|
||||||
|
;* clrch -- clear channels *
|
||||||
|
;* unlisten or untalk ieee devices, but *
|
||||||
|
;* leave others alone. default channels *
|
||||||
|
;* are restored. *
|
||||||
|
;********************************************
|
||||||
|
;
|
||||||
|
nclrch ldx #3
|
||||||
|
cpx dflto ;is output channel ieee?
|
||||||
|
bcs jx750 ;no...
|
||||||
|
;
|
||||||
|
jsr unlsn ;yes...unlisten it
|
||||||
|
;
|
||||||
|
jx750 cpx dfltn ;is input channel ieee?
|
||||||
|
bcs clall2 ;no...
|
||||||
|
;
|
||||||
|
jsr untlk ;yes...untalk it
|
||||||
|
;
|
||||||
|
;restore default values
|
||||||
|
;
|
||||||
|
;
|
||||||
|
clall2 stx dflto ;output chan=3=screen
|
||||||
|
lda #0
|
||||||
|
sta dfltn ;input chan=0=keyboard
|
||||||
|
rts
|
||||||
|
|
||||||
+111
@@ -0,0 +1,111 @@
|
|||||||
|
.segment "CLOSE"
|
||||||
|
;***************************************
|
||||||
|
;* close -- close logical file *
|
||||||
|
;* *
|
||||||
|
;* the logical file number of the*
|
||||||
|
;* file to be closed is passed in .a.*
|
||||||
|
;* keyboard, screen, and files not *
|
||||||
|
;* open pass straight through. tape *
|
||||||
|
;* files open for write are closed by*
|
||||||
|
;* dumping the last buffer and *
|
||||||
|
;* conditionally writing an end of *
|
||||||
|
;* tape block.serial files are closed*
|
||||||
|
;* by sending a close file command if*
|
||||||
|
;* a secondary address was specified *
|
||||||
|
;* in its open command. *
|
||||||
|
;***************************************
|
||||||
|
;
|
||||||
|
nclose jsr jltlk ;look file up
|
||||||
|
beq jx050 ;open...
|
||||||
|
clc ;else return
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
jx050 jsr jz100 ;extract table data
|
||||||
|
txa ;save table index
|
||||||
|
pha
|
||||||
|
;
|
||||||
|
lda fa ;check device number
|
||||||
|
beq jx150 ;is keyboard...done
|
||||||
|
cmp #3
|
||||||
|
beq jx150 ;is screen...done
|
||||||
|
bcs jx120 ;is serial...process
|
||||||
|
cmp #2 ;rs232?
|
||||||
|
;
|
||||||
|
; rs-232 close
|
||||||
|
;
|
||||||
|
; remove file from tables
|
||||||
|
pla
|
||||||
|
jsr jxrmv
|
||||||
|
;
|
||||||
|
jsr cln232 ;clean up rs232 for close
|
||||||
|
;
|
||||||
|
; deallocate buffers
|
||||||
|
;
|
||||||
|
jsr gettop ;get memsiz
|
||||||
|
lda ribuf+1 ;check input allocation
|
||||||
|
beq cls010 ;not...allocated
|
||||||
|
iny
|
||||||
|
cls010 lda robuf+1 ;check output allocation
|
||||||
|
beq cls020
|
||||||
|
iny
|
||||||
|
cls020 lda #00 ;deallocate
|
||||||
|
sta ribuf+1
|
||||||
|
sta robuf+1
|
||||||
|
; flag top of memory change
|
||||||
|
jmp memtcf ;go set new top
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;close an serial file
|
||||||
|
;
|
||||||
|
jx120 jsr clsei
|
||||||
|
;
|
||||||
|
;entry to remove a give logical file
|
||||||
|
;from table of logical, primary,
|
||||||
|
;and secondary addresses
|
||||||
|
;
|
||||||
|
jx150 pla ;get table index off stack
|
||||||
|
;
|
||||||
|
; jxrmv - entry to use as an rs-232 subroutine
|
||||||
|
;
|
||||||
|
jxrmv tax
|
||||||
|
dec ldtnd
|
||||||
|
cpx ldtnd ;is deleted file at end?
|
||||||
|
beq jx170 ;yes...done
|
||||||
|
;
|
||||||
|
;delete entry in middle by moving
|
||||||
|
;last entry to that position.
|
||||||
|
;
|
||||||
|
ldy ldtnd
|
||||||
|
lda lat,y
|
||||||
|
sta lat,x
|
||||||
|
lda fat,y
|
||||||
|
sta fat,x
|
||||||
|
lda sat,y
|
||||||
|
sta sat,x
|
||||||
|
;
|
||||||
|
jx170 clc ;close exit
|
||||||
|
jx175 rts
|
||||||
|
|
||||||
|
;lookup tablized logical file data
|
||||||
|
;
|
||||||
|
lookup lda #0
|
||||||
|
sta status
|
||||||
|
txa
|
||||||
|
jltlk ldx ldtnd
|
||||||
|
jx600 dex
|
||||||
|
bmi jz101
|
||||||
|
cmp lat,x
|
||||||
|
bne jx600
|
||||||
|
rts
|
||||||
|
|
||||||
|
;routine to fetch table entries
|
||||||
|
;
|
||||||
|
jz100 lda lat,x
|
||||||
|
sta la
|
||||||
|
lda fat,x
|
||||||
|
sta fa
|
||||||
|
lda sat,x
|
||||||
|
sta sa
|
||||||
|
jz101 rts
|
||||||
|
|
||||||
|
; rsr 5/12/82 - modify for cln232
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.segment "CRAP"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
.segment "CUNLSN"
|
||||||
|
cunlsn jsr unlsn
|
||||||
|
clc
|
||||||
|
rts
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
;declare 6510 ports
|
||||||
|
d6510 = 0 ;6510 data direction register
|
||||||
|
r6510 = 1 ;6510 data register
|
||||||
|
|
||||||
|
.segment "ZPKERNAL" : zeropage
|
||||||
|
status .res 1 ;i/o operation status byte
|
||||||
|
; crfac .res 2 ;correction factor (unused)
|
||||||
|
stkey .res 1 ;stop key flag
|
||||||
|
svxt .res 1 ;temporary
|
||||||
|
verck .res 1 ;load or verify flag
|
||||||
|
c3p0 .res 1 ;ieee buffered char flag
|
||||||
|
bsour .res 1 ;char buffer for ieee
|
||||||
|
syno .res 1 ;cassette sync #
|
||||||
|
xsav .res 1 ;temp for basin
|
||||||
|
ldtnd .res 1 ;index to logical file
|
||||||
|
dfltn .res 1 ;default input device #
|
||||||
|
dflto .res 1 ;default output device #
|
||||||
|
prty .res 1 ;cassette parity
|
||||||
|
dpsw .res 1 ;cassette dipole switch
|
||||||
|
msgflg .res 1 ;os message flag
|
||||||
|
ptr1 ;cassette error pass1
|
||||||
|
t1 .res 1 ;temporary 1
|
||||||
|
tmpc
|
||||||
|
ptr2 ;cassette error pass2
|
||||||
|
t2 .res 1 ;temporary 2
|
||||||
|
time .res 3 ;24 hour clock in 1/60th seconds
|
||||||
|
r2d2 ;serial bus usage
|
||||||
|
pcntr .res 1 ;cassette stuff
|
||||||
|
; ptch .res 1 (unused)
|
||||||
|
bsour1 ;temp used by serial routine
|
||||||
|
firt .res 1
|
||||||
|
count ;temp used by serial routine
|
||||||
|
cntdn .res 1 ;cassette sync countdown
|
||||||
|
bufpt .res 1 ;cassette buffer pointer
|
||||||
|
inbit ;rs-232 rcvr input bit storage
|
||||||
|
shcnl .res 1 ;cassette short count
|
||||||
|
bitci ;rs-232 rcvr bit count in
|
||||||
|
rer .res 1 ;cassette read error
|
||||||
|
rinone ;rs-232 rcvr flag for start bit check
|
||||||
|
rez .res 1 ;cassete reading zeroes
|
||||||
|
ridata ;rs-232 rcvr byte buffer
|
||||||
|
rdflg .res 1 ;cassette read mode
|
||||||
|
riprty ;rs-232 rcvr parity storage
|
||||||
|
shcnh .res 1 ;cassette short cnt
|
||||||
|
sal .res 1
|
||||||
|
sah .res 1
|
||||||
|
eal .res 1
|
||||||
|
eah .res 1
|
||||||
|
cmp0 .res 1
|
||||||
|
temp .res 1
|
||||||
|
tape1 .res 2 ;address of tape buffer #1y.
|
||||||
|
bitts ;rs-232 trns bit count
|
||||||
|
snsw1 .res 1
|
||||||
|
nxtbit ;rs-232 trns next bit to be sent
|
||||||
|
diff .res 1
|
||||||
|
rodata ;rs-232 trns byte buffer
|
||||||
|
prp .res 1
|
||||||
|
fnlen .res 1 ;length current file n str
|
||||||
|
la .res 1 ;current file logical addr
|
||||||
|
sa .res 1 ;current file 2nd addr
|
||||||
|
fa .res 1 ;current file primary addr
|
||||||
|
fnadr .res 2 ;addr current file name str
|
||||||
|
roprty ;rs-232 trns parity buffer
|
||||||
|
ochar .res 1
|
||||||
|
fsblk .res 1 ;cassette read block count
|
||||||
|
mych .res 1
|
||||||
|
cas1 .res 1 ;cassette manual/controlled switch
|
||||||
|
tmp0
|
||||||
|
stal .res 1
|
||||||
|
stah .res 1
|
||||||
|
memuss ;cassette load temps (2 bytes)
|
||||||
|
tmp2 .res 2
|
||||||
|
;
|
||||||
|
;variables for screen editor
|
||||||
|
;
|
||||||
|
lstx .res 1 ;key scan index
|
||||||
|
; sfst .res 1 ;keyboard shift flag (unused)
|
||||||
|
ndx .res 1 ;index to keyboard q
|
||||||
|
rvs .res 1 ;rvs field on flag
|
||||||
|
indx .res 1
|
||||||
|
lsxp .res 1 ;x pos at start
|
||||||
|
lstp .res 1
|
||||||
|
sfdx .res 1 ;shift mode on print
|
||||||
|
blnsw .res 1 ;cursor blink enab
|
||||||
|
blnct .res 1 ;count to toggle cur
|
||||||
|
gdbln .res 1 ;char before cursor
|
||||||
|
blnon .res 1 ;on/off blink flag
|
||||||
|
crsw .res 1 ;input vs get flag
|
||||||
|
pnt .res 2 ;pointer to row
|
||||||
|
; point .res 1 (unused)
|
||||||
|
pntr .res 1 ;pointer to column
|
||||||
|
qtsw .res 1 ;quote switch
|
||||||
|
lnmx .res 1 ;40/80 max positon
|
||||||
|
tblx .res 1
|
||||||
|
data .res 1
|
||||||
|
insrt .res 1 ;insert mode flag
|
||||||
|
ldtb1 .res 26 ;line flags+endspace
|
||||||
|
user .res 2 ;screen editor color ip
|
||||||
|
keytab .res 2 ;keyscan table indirect
|
||||||
|
;rs-232 z-page
|
||||||
|
ribuf .res 2 ;rs-232 input buffer pointer
|
||||||
|
robuf .res 2 ;rs-232 output buffer pointer
|
||||||
|
frekzp .res 4 ;free kernal zero page 9/24/80
|
||||||
|
baszpt .res 1 ;location ($00ff) used by basic
|
||||||
|
|
||||||
|
.segment "STACK"
|
||||||
|
bad .res 1
|
||||||
|
.segment "KVAR"
|
||||||
|
buf .res 89 ;basic/monitor buffer
|
||||||
|
|
||||||
|
; tables for open files
|
||||||
|
;
|
||||||
|
lat .res 10 ;logical file numbers
|
||||||
|
fat .res 10 ;primary device numbers
|
||||||
|
sat .res 10 ;secondary addresses
|
||||||
|
|
||||||
|
; system storage
|
||||||
|
;
|
||||||
|
keyd .res 10 ;irq keyboard buffer
|
||||||
|
memstr .res 2 ;start of memory
|
||||||
|
memsiz .res 2 ;top of memory
|
||||||
|
timout .res 1 ;ieee timeout flag
|
||||||
|
|
||||||
|
; screen editor storage
|
||||||
|
;
|
||||||
|
color .res 1 ;activ color nybble
|
||||||
|
gdcol .res 1 ;original color before cursor
|
||||||
|
hibase .res 1 ;base location of screen (top)
|
||||||
|
xmax .res 1
|
||||||
|
rptflg .res 1 ;key repeat flag
|
||||||
|
kount .res 1
|
||||||
|
delay .res 1
|
||||||
|
shflag .res 1 ;shift flag byte
|
||||||
|
lstshf .res 1 ;last shift pattern
|
||||||
|
keylog .res 2 ;indirect for keyboard table setup
|
||||||
|
mode .res 1 ;0-pet mode, 1-cattacanna
|
||||||
|
autodn .res 1 ;auto scroll down flag(=0 on,<>0 off)
|
||||||
|
|
||||||
|
; rs-232 storage
|
||||||
|
;
|
||||||
|
m51ctr .res 1 ;6551 control register
|
||||||
|
m51cdr .res 1 ;6551 command register
|
||||||
|
m51ajb .res 2 ;non standard (bittime/2-100)
|
||||||
|
rsstat .res 1 ; rs-232 status register
|
||||||
|
bitnum .res 1 ;number of bits to send (fast response)
|
||||||
|
baudof .res 2 ;baud rate full bit time (created by open)
|
||||||
|
;
|
||||||
|
; reciever storage
|
||||||
|
;
|
||||||
|
; inbit .res 1 ;input bit storage
|
||||||
|
; bitci .res 1 ;bit count in
|
||||||
|
; rinone .res 1 ;flag for start bit check
|
||||||
|
; ridata .res 1 ;byte in buffer
|
||||||
|
; riprty .res 1 ;byte in parity storage
|
||||||
|
ridbe .res 1 ;input buffer index to end
|
||||||
|
ridbs .res 1 ;input buffer pointer to start
|
||||||
|
;
|
||||||
|
; transmitter storage
|
||||||
|
;
|
||||||
|
; bitts .res 1 ;# of bits to be sent
|
||||||
|
; nxtbit .res 1 ;next bit to be sent
|
||||||
|
; roprty .res 1 ;parity of byte sent
|
||||||
|
; rodata .res 1 ;byte buffer out
|
||||||
|
rodbs .res 1 ;output buffer index to start
|
||||||
|
rodbe .res 1 ;output buffer index to end
|
||||||
|
;
|
||||||
|
irqtmp .res 2 ;holds irq during tape ops
|
||||||
|
;
|
||||||
|
; temp space for vic-40 variables ****
|
||||||
|
;
|
||||||
|
enabl .res 1 ;rs-232 enables (replaces ier)
|
||||||
|
caston .res 1 ;tod sense during cassettes
|
||||||
|
kika26 .res 1 ;temp storage for cassette read routine
|
||||||
|
stupid .res 1 ;temp d1irq indicator for cassette read
|
||||||
|
lintmp .res 1 ;temporary for line index
|
||||||
|
palnts .res 1 ;pal vs ntsc flag 0=ntsc 1=pal
|
||||||
|
|
||||||
|
.segment "KVECTORS";rem kernal/os indirects(20)
|
||||||
|
cinv .res 2 ;irq ram vector
|
||||||
|
cbinv .res 2 ;brk instr ram vector
|
||||||
|
nminv .res 2 ;nmi ram vector
|
||||||
|
iopen .res 2 ;indirects for code
|
||||||
|
iclose .res 2 ; conforms to kernal spec 8/19/80
|
||||||
|
ichkin .res 2
|
||||||
|
ickout .res 2
|
||||||
|
iclrch .res 2
|
||||||
|
ibasin .res 2
|
||||||
|
ibsout .res 2
|
||||||
|
istop .res 2
|
||||||
|
igetin .res 2
|
||||||
|
iclall .res 2
|
||||||
|
usrcmd .res 2
|
||||||
|
iload .res 2
|
||||||
|
isave .res 2 ;savesp
|
||||||
|
|
||||||
|
tbuffr =$033C ;cassette data buffer
|
||||||
|
|
||||||
|
vicscn =$0400
|
||||||
|
|
||||||
|
; i/o devices
|
||||||
|
;
|
||||||
|
vicreg =$d000
|
||||||
|
|
||||||
|
sidreg =$d400
|
||||||
|
|
||||||
|
viccol =$d800 ;vic color nybbles
|
||||||
|
|
||||||
|
cia1 =$dc00 ;device1 6526 (page1 irq)
|
||||||
|
d1pra =cia1+0
|
||||||
|
colm =d1pra ;keyboard matrix
|
||||||
|
d1prb =cia1+1
|
||||||
|
rows =d1prb ;keyboard matrix
|
||||||
|
d1ddra =cia1+2
|
||||||
|
d1ddrb =cia1+3
|
||||||
|
d1t1l =cia1+4
|
||||||
|
d1t1h =cia1+5
|
||||||
|
d1t2l =cia1+6
|
||||||
|
d1t2h =cia1+7
|
||||||
|
d1tod1 =cia1+8
|
||||||
|
d1tods =cia1+9
|
||||||
|
d1todm =cia1+10
|
||||||
|
d1todh =cia1+11
|
||||||
|
d1sdr =cia1+12
|
||||||
|
d1icr =cia1+13
|
||||||
|
d1cra =cia1+14
|
||||||
|
d1crb =cia1+15
|
||||||
|
|
||||||
|
cia2 =$dd00 ;device2 6526 (page2 nmi)
|
||||||
|
d2pra =cia2+0
|
||||||
|
d2prb =cia2+1
|
||||||
|
d2ddra =cia2+2
|
||||||
|
d2ddrb =cia2+3
|
||||||
|
d2t1l =cia2+4
|
||||||
|
d2t1h =cia2+5
|
||||||
|
d2t2l =cia2+6
|
||||||
|
d2t2h =cia2+7
|
||||||
|
d2tod1 =cia2+8
|
||||||
|
d2tods =cia2+9
|
||||||
|
d2todm =cia2+10
|
||||||
|
d2todh =cia2+11
|
||||||
|
d2sdr =cia2+12
|
||||||
|
d2icr =cia2+13
|
||||||
|
d2cra =cia2+14
|
||||||
|
d2crb =cia2+15
|
||||||
|
|
||||||
|
timrb =$19 ;6526 crb enable one-shot tb
|
||||||
|
|
||||||
|
;tape block types
|
||||||
|
;
|
||||||
|
eot =5 ;end of tape
|
||||||
|
blf =1 ;basic load file
|
||||||
|
bdf =2 ;basic data file
|
||||||
|
plf =3 ;fixed program type
|
||||||
|
bdfh =4 ;basic data file header
|
||||||
|
bufsz =192 ;buffer size
|
||||||
|
;
|
||||||
|
;screen editor constants
|
||||||
|
;
|
||||||
|
llen =40 ;single line 40 columns
|
||||||
|
llen2 =80 ;double line = 80 columns
|
||||||
|
nlines =25 ;25 rows on screen
|
||||||
|
white =$01 ;white screen color
|
||||||
|
blue =$06 ;blue char color
|
||||||
|
cr =$d ;carriage return
|
||||||
|
|
||||||
|
;rsr 8/3/80 add & change z-page
|
||||||
|
;rsr 8/11/80 add memuss & plf type
|
||||||
|
;rsr 8/22/80 add rs-232 routines
|
||||||
|
;rsr 8/24/80 add open variables
|
||||||
|
;rsr 8/29/80 add baud space move rs232 to z-page
|
||||||
|
;rsr 9/2/80 add screen editor vars&con
|
||||||
|
;rsr 12/7/81 modify for vic-40
|
||||||
@@ -0,0 +1,615 @@
|
|||||||
|
.segment "EDITOR"
|
||||||
|
maxchr=80
|
||||||
|
nwrap=2 ;max number of physical lines per logical line
|
||||||
|
;
|
||||||
|
;undefined function entry
|
||||||
|
;
|
||||||
|
; undefd ldx #0
|
||||||
|
; undef2 lda unmsg,x
|
||||||
|
; jsr prt
|
||||||
|
; inx
|
||||||
|
; cpx #unmsg2-unmsg
|
||||||
|
; bne undef2
|
||||||
|
; sec
|
||||||
|
; rts
|
||||||
|
;
|
||||||
|
; unmsg .byt $d,'?advanced function not available',$d
|
||||||
|
; unmsg2
|
||||||
|
;
|
||||||
|
;return address of 6526
|
||||||
|
;
|
||||||
|
iobase ldx #<d1pra
|
||||||
|
ldy #>d1pra
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
;return max rows,cols of screen
|
||||||
|
;
|
||||||
|
scrorg ldx #llen
|
||||||
|
ldy #nlines
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
;read/plot cursor position
|
||||||
|
;
|
||||||
|
plot bcs plot10
|
||||||
|
stx tblx
|
||||||
|
sty pntr
|
||||||
|
jsr stupt
|
||||||
|
plot10 ldx tblx
|
||||||
|
ldy pntr
|
||||||
|
rts
|
||||||
|
|
||||||
|
;initialize i/o
|
||||||
|
;
|
||||||
|
cint
|
||||||
|
;
|
||||||
|
; establish screen memory
|
||||||
|
;
|
||||||
|
jsr panic ;set up vic
|
||||||
|
;
|
||||||
|
lda #0 ;make sure we're in pet mode
|
||||||
|
sta mode
|
||||||
|
sta blnon ;we dont have a good char from the screen yet
|
||||||
|
|
||||||
|
lda #<shflog ;set shift logic indirects
|
||||||
|
sta keylog
|
||||||
|
lda #>shflog
|
||||||
|
sta keylog+1
|
||||||
|
lda #10
|
||||||
|
sta xmax ;maximum type ahead buffer size
|
||||||
|
sta delay
|
||||||
|
lda #$13 ;init color to light blue<<<<<<<<<< changed to green
|
||||||
|
sta color
|
||||||
|
lda #4
|
||||||
|
sta kount ;delay between key repeats
|
||||||
|
lda #$c
|
||||||
|
sta blnct
|
||||||
|
sta blnsw
|
||||||
|
clsr lda hibase ;fill hi byte ptr table
|
||||||
|
ora #$80
|
||||||
|
tay
|
||||||
|
lda #0
|
||||||
|
tax
|
||||||
|
lps1 sty ldtb1,x
|
||||||
|
clc
|
||||||
|
adc #llen
|
||||||
|
bcc lps2
|
||||||
|
iny ;carry bump hi byte
|
||||||
|
lps2 inx
|
||||||
|
cpx #nlines+1 ;done # of lines?
|
||||||
|
bne lps1 ;no...
|
||||||
|
lda #$ff ;tag end of line table
|
||||||
|
sta ldtb1,x
|
||||||
|
ldx #nlines-1 ;clear from the bottom line up
|
||||||
|
clear1 jsr clrln ;see scroll routines
|
||||||
|
dex
|
||||||
|
bpl clear1
|
||||||
|
|
||||||
|
;home function
|
||||||
|
;
|
||||||
|
nxtd ldy #0
|
||||||
|
sty pntr ;left column
|
||||||
|
sty tblx ;top line
|
||||||
|
;
|
||||||
|
;move cursor to tblx,pntr
|
||||||
|
;
|
||||||
|
stupt
|
||||||
|
ldx tblx ;get curent line index
|
||||||
|
lda pntr ;get character pointer
|
||||||
|
fndstr ldy ldtb1,x ;find begining of line
|
||||||
|
bmi stok ;branch if start found
|
||||||
|
clc
|
||||||
|
adc #llen ;adjust pointer
|
||||||
|
sta pntr
|
||||||
|
dex
|
||||||
|
bpl fndstr
|
||||||
|
;
|
||||||
|
stok jsr setpnt ;set up pnt indirect 901227-03**********
|
||||||
|
;
|
||||||
|
lda #llen-1
|
||||||
|
inx
|
||||||
|
fndend ldy ldtb1,x
|
||||||
|
bmi stdone
|
||||||
|
clc
|
||||||
|
adc #llen
|
||||||
|
inx
|
||||||
|
bpl fndend
|
||||||
|
stdone
|
||||||
|
sta lnmx
|
||||||
|
jmp scolor ;make color pointer follow 901227-03**********
|
||||||
|
|
||||||
|
; this is a patch for input logic 901227-03**********
|
||||||
|
; fixes input"xxxxxxx-40-xxxxx";a$ problem
|
||||||
|
;
|
||||||
|
finput cpx lsxp ;check if on same line
|
||||||
|
beq finpux ;yes..return to send
|
||||||
|
jmp findst ;check if we wrapped down...
|
||||||
|
finpux rts
|
||||||
|
nop ;keep the space the same...
|
||||||
|
|
||||||
|
;panic nmi entry
|
||||||
|
;
|
||||||
|
vpan jsr panic ;fix vic screen
|
||||||
|
jmp nxtd ;home cursor
|
||||||
|
|
||||||
|
panic lda #3 ;reset default i/o
|
||||||
|
sta dflto
|
||||||
|
lda #0
|
||||||
|
sta dfltn
|
||||||
|
|
||||||
|
;init vic
|
||||||
|
;
|
||||||
|
initv ldx #47 ;load all vic regs ***
|
||||||
|
px4 lda tvic-1,x
|
||||||
|
sta vicreg-1,x
|
||||||
|
dex
|
||||||
|
bne px4
|
||||||
|
rts
|
||||||
|
|
||||||
|
;
|
||||||
|
;remove character from queue
|
||||||
|
;
|
||||||
|
lp2 ldy keyd
|
||||||
|
ldx #0
|
||||||
|
lp1 lda keyd+1,x
|
||||||
|
sta keyd,x
|
||||||
|
inx
|
||||||
|
cpx ndx
|
||||||
|
bne lp1
|
||||||
|
dec ndx
|
||||||
|
tya
|
||||||
|
cli
|
||||||
|
clc ;good return
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
loop4 jsr prt
|
||||||
|
loop3
|
||||||
|
lda ndx
|
||||||
|
sta blnsw
|
||||||
|
sta autodn ;turn on auto scroll down
|
||||||
|
beq loop3
|
||||||
|
sei
|
||||||
|
lda blnon
|
||||||
|
beq lp21
|
||||||
|
lda gdbln
|
||||||
|
ldx gdcol ;restore original color
|
||||||
|
ldy #0
|
||||||
|
sty blnon
|
||||||
|
jsr dspp
|
||||||
|
;lp21 subroutine for shift-runstop, removed load from tape function, now jumps to wozmon
|
||||||
|
lp21 jsr lp2
|
||||||
|
cmp #$83 ;run key?
|
||||||
|
bne lp22
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
jmp WOZMON_ENTRY
|
||||||
|
lp23 lda runtb-1,x
|
||||||
|
sta keyd-1,x
|
||||||
|
dex
|
||||||
|
bne lp23
|
||||||
|
beq loop3
|
||||||
|
lp22 cmp #$d
|
||||||
|
bne loop4
|
||||||
|
ldy lnmx
|
||||||
|
sty crsw
|
||||||
|
clp5 lda (pnt),y
|
||||||
|
cmp #' '
|
||||||
|
bne clp6
|
||||||
|
dey
|
||||||
|
bne clp5
|
||||||
|
clp6 iny
|
||||||
|
sty indx
|
||||||
|
ldy #0
|
||||||
|
sty autodn ;turn off auto scroll down
|
||||||
|
sty pntr
|
||||||
|
sty qtsw
|
||||||
|
lda lsxp
|
||||||
|
bmi lop5
|
||||||
|
ldx tblx
|
||||||
|
jsr finput ;check for same line as start 901227-03**********
|
||||||
|
cpx lsxp
|
||||||
|
bne lop5
|
||||||
|
lda lstp
|
||||||
|
sta pntr
|
||||||
|
cmp indx
|
||||||
|
bcc lop5
|
||||||
|
bcs clp2
|
||||||
|
|
||||||
|
;input a line until carriage return
|
||||||
|
;
|
||||||
|
loop5 tya
|
||||||
|
pha
|
||||||
|
txa
|
||||||
|
pha
|
||||||
|
lda crsw
|
||||||
|
beq loop3
|
||||||
|
lop5 ldy pntr
|
||||||
|
lda (pnt),y
|
||||||
|
notone
|
||||||
|
sta data
|
||||||
|
lop51 and #$3f
|
||||||
|
asl data
|
||||||
|
bit data
|
||||||
|
bpl lop54
|
||||||
|
ora #$80
|
||||||
|
lop54 bcc lop52
|
||||||
|
ldx qtsw
|
||||||
|
bne lop53
|
||||||
|
lop52 bvs lop53
|
||||||
|
ora #$40
|
||||||
|
lop53 inc pntr
|
||||||
|
jsr qtswc
|
||||||
|
cpy indx
|
||||||
|
bne clp1
|
||||||
|
clp2 lda #0
|
||||||
|
sta crsw
|
||||||
|
lda #$d
|
||||||
|
ldx dfltn ;fix gets from screen
|
||||||
|
cpx #3 ;is it the screen?
|
||||||
|
beq clp2a
|
||||||
|
ldx dflto
|
||||||
|
cpx #3
|
||||||
|
beq clp21
|
||||||
|
clp2a jsr prt
|
||||||
|
clp21 lda #$d
|
||||||
|
clp1 sta data
|
||||||
|
pla
|
||||||
|
tax
|
||||||
|
pla
|
||||||
|
tay
|
||||||
|
lda data
|
||||||
|
cmp #$de ;is it <pi> ?
|
||||||
|
bne clp7
|
||||||
|
lda #$ff
|
||||||
|
clp7 clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
qtswc cmp #$22
|
||||||
|
bne qtswl
|
||||||
|
lda qtsw
|
||||||
|
eor #$1
|
||||||
|
sta qtsw
|
||||||
|
lda #$22
|
||||||
|
qtswl rts
|
||||||
|
|
||||||
|
nxt33 ora #$40
|
||||||
|
nxt3 ldx rvs
|
||||||
|
beq nvs
|
||||||
|
nc3 ora #$80
|
||||||
|
nvs ldx insrt
|
||||||
|
beq nvs1
|
||||||
|
dec insrt
|
||||||
|
nvs1 ldx color ;put color on screen
|
||||||
|
jsr dspp
|
||||||
|
jsr wlogic ;check for wraparound
|
||||||
|
loop2 pla
|
||||||
|
tay
|
||||||
|
lda insrt
|
||||||
|
beq lop2
|
||||||
|
lsr qtsw
|
||||||
|
lop2 pla
|
||||||
|
tax
|
||||||
|
pla
|
||||||
|
clc ;good return
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
wlogic
|
||||||
|
jsr chkdwn ;maybe we should we increment tblx
|
||||||
|
inc pntr ;bump charcter pointer
|
||||||
|
lda lnmx ;
|
||||||
|
cmp pntr ;if lnmx is less than pntr
|
||||||
|
bcs wlgrts ;branch if lnmx>=pntr
|
||||||
|
cmp #maxchr-1 ;past max characters
|
||||||
|
beq wlog10 ;branch if so
|
||||||
|
lda autodn ;should we auto scroll down?
|
||||||
|
beq wlog20 ;branch if not
|
||||||
|
jmp bmt1 ;else decide which way to scroll
|
||||||
|
|
||||||
|
wlog20
|
||||||
|
ldx tblx ;see if we should scroll down
|
||||||
|
cpx #nlines
|
||||||
|
bcc wlog30 ;branch if not
|
||||||
|
jsr scrol ;else do the scrol up
|
||||||
|
dec tblx ;and adjust curent line#
|
||||||
|
ldx tblx
|
||||||
|
wlog30 asl ldtb1,x ;wrap the line
|
||||||
|
lsr ldtb1,x
|
||||||
|
inx ;index to next lline
|
||||||
|
lda ldtb1,x ;get high order byte of address
|
||||||
|
ora #$80 ;make it a non-continuation line
|
||||||
|
sta ldtb1,x ;and put it back
|
||||||
|
dex ;get back to current line
|
||||||
|
lda lnmx ;continue the bytes taken out
|
||||||
|
clc
|
||||||
|
adc #llen
|
||||||
|
sta lnmx
|
||||||
|
findst
|
||||||
|
lda ldtb1,x ;is this the first line?
|
||||||
|
bmi finx ;branch if so
|
||||||
|
dex ;else backup 1
|
||||||
|
bne findst
|
||||||
|
finx
|
||||||
|
jmp setpnt ;make sure pnt is right
|
||||||
|
|
||||||
|
wlog10 dec tblx
|
||||||
|
jsr nxln
|
||||||
|
lda #0
|
||||||
|
sta pntr ;point to first byte
|
||||||
|
wlgrts rts
|
||||||
|
|
||||||
|
bkln ldx tblx
|
||||||
|
bne bkln1
|
||||||
|
stx pntr
|
||||||
|
pla
|
||||||
|
pla
|
||||||
|
bne loop2
|
||||||
|
;
|
||||||
|
bkln1 dex
|
||||||
|
stx tblx
|
||||||
|
jsr stupt
|
||||||
|
ldy lnmx
|
||||||
|
sty pntr
|
||||||
|
rts
|
||||||
|
|
||||||
|
;print routine
|
||||||
|
;
|
||||||
|
prt pha
|
||||||
|
sta data
|
||||||
|
txa
|
||||||
|
pha
|
||||||
|
tya
|
||||||
|
pha
|
||||||
|
lda #0
|
||||||
|
sta crsw
|
||||||
|
ldy pntr
|
||||||
|
lda data
|
||||||
|
bpl *+5
|
||||||
|
jmp nxtx
|
||||||
|
cmp #$d
|
||||||
|
bne njt1
|
||||||
|
jmp nxt1
|
||||||
|
njt1 cmp #' '
|
||||||
|
bcc ntcn
|
||||||
|
cmp #$60 ;lower case?
|
||||||
|
bcc njt8 ;no...
|
||||||
|
and #$df ;yes...make screen lower
|
||||||
|
bne njt9 ;always
|
||||||
|
njt8 and #$3f
|
||||||
|
njt9 jsr qtswc
|
||||||
|
jmp nxt3
|
||||||
|
ntcn ldx insrt
|
||||||
|
beq cnc3x
|
||||||
|
jmp nc3
|
||||||
|
cnc3x cmp #$14
|
||||||
|
bne ntcn1
|
||||||
|
tya
|
||||||
|
bne bak1up
|
||||||
|
jsr bkln
|
||||||
|
jmp bk2
|
||||||
|
bak1up jsr chkbak ;should we dec tblx
|
||||||
|
dey
|
||||||
|
sty pntr
|
||||||
|
bk1 jsr scolor ;fix color ptrs
|
||||||
|
bk15 iny
|
||||||
|
lda (pnt),y
|
||||||
|
dey
|
||||||
|
sta (pnt),y
|
||||||
|
iny
|
||||||
|
lda (user),y
|
||||||
|
dey
|
||||||
|
sta (user),y
|
||||||
|
iny
|
||||||
|
cpy lnmx
|
||||||
|
bne bk15
|
||||||
|
bk2 lda #' '
|
||||||
|
sta (pnt),y
|
||||||
|
lda color
|
||||||
|
sta (user),y
|
||||||
|
bpl jpl3
|
||||||
|
ntcn1 ldx qtsw
|
||||||
|
beq nc3w
|
||||||
|
cnc3 jmp nc3
|
||||||
|
nc3w cmp #$12
|
||||||
|
bne nc1
|
||||||
|
sta rvs
|
||||||
|
nc1 cmp #$13
|
||||||
|
bne nc2
|
||||||
|
jsr nxtd
|
||||||
|
nc2 cmp #$1d
|
||||||
|
bne ncx2
|
||||||
|
iny
|
||||||
|
jsr chkdwn
|
||||||
|
sty pntr
|
||||||
|
dey
|
||||||
|
cpy lnmx
|
||||||
|
bcc ncz2
|
||||||
|
dec tblx
|
||||||
|
jsr nxln
|
||||||
|
ldy #0
|
||||||
|
jpl4 sty pntr
|
||||||
|
ncz2 jmp loop2
|
||||||
|
ncx2 cmp #$11
|
||||||
|
bne colr1
|
||||||
|
clc
|
||||||
|
tya
|
||||||
|
adc #llen
|
||||||
|
tay
|
||||||
|
inc tblx
|
||||||
|
cmp lnmx
|
||||||
|
bcc jpl4
|
||||||
|
beq jpl4
|
||||||
|
dec tblx
|
||||||
|
curs10 sbc #llen
|
||||||
|
bcc gotdwn
|
||||||
|
sta pntr
|
||||||
|
bne curs10
|
||||||
|
gotdwn jsr nxln
|
||||||
|
jpl3 jmp loop2
|
||||||
|
colr1 jsr chkcol ;check for a color
|
||||||
|
jmp lower ;was jmp loop2
|
||||||
|
|
||||||
|
;check color
|
||||||
|
;
|
||||||
|
|
||||||
|
;shifted keys
|
||||||
|
;
|
||||||
|
nxtx
|
||||||
|
keepit
|
||||||
|
and #$7f
|
||||||
|
cmp #$7f
|
||||||
|
bne nxtx1
|
||||||
|
lda #$5e
|
||||||
|
nxtx1
|
||||||
|
nxtxa
|
||||||
|
cmp #$20 ;is it a function key
|
||||||
|
bcc uhuh
|
||||||
|
jmp nxt33
|
||||||
|
uhuh
|
||||||
|
cmp #$d
|
||||||
|
bne up5
|
||||||
|
jmp nxt1
|
||||||
|
up5 ldx qtsw
|
||||||
|
bne up6
|
||||||
|
cmp #$14
|
||||||
|
bne up9
|
||||||
|
ldy lnmx
|
||||||
|
lda (pnt),y
|
||||||
|
cmp #' '
|
||||||
|
bne ins3
|
||||||
|
cpy pntr
|
||||||
|
bne ins1
|
||||||
|
ins3 cpy #maxchr-1
|
||||||
|
beq insext ;exit if line too long
|
||||||
|
jsr newlin ;scroll down 1
|
||||||
|
ins1 ldy lnmx
|
||||||
|
jsr scolor
|
||||||
|
ins2 dey
|
||||||
|
lda (pnt),y
|
||||||
|
iny
|
||||||
|
sta (pnt),y
|
||||||
|
dey
|
||||||
|
lda (user),y
|
||||||
|
iny
|
||||||
|
sta (user),y
|
||||||
|
dey
|
||||||
|
cpy pntr
|
||||||
|
bne ins2
|
||||||
|
lda #$20
|
||||||
|
sta (pnt),y
|
||||||
|
lda color
|
||||||
|
sta (user),y
|
||||||
|
inc insrt
|
||||||
|
insext jmp loop2
|
||||||
|
up9 ldx insrt
|
||||||
|
beq up2
|
||||||
|
up6 ora #$40
|
||||||
|
jmp nc3
|
||||||
|
up2 cmp #$11
|
||||||
|
bne nxt2
|
||||||
|
ldx tblx
|
||||||
|
beq jpl2
|
||||||
|
dec tblx
|
||||||
|
lda pntr
|
||||||
|
sec
|
||||||
|
sbc #llen
|
||||||
|
bcc upalin
|
||||||
|
sta pntr
|
||||||
|
bpl jpl2
|
||||||
|
upalin jsr stupt
|
||||||
|
bne jpl2
|
||||||
|
nxt2 cmp #$12
|
||||||
|
bne nxt6
|
||||||
|
lda #0
|
||||||
|
sta rvs
|
||||||
|
nxt6 cmp #$1d
|
||||||
|
bne nxt61
|
||||||
|
tya
|
||||||
|
beq bakbak
|
||||||
|
jsr chkbak
|
||||||
|
dey
|
||||||
|
sty pntr
|
||||||
|
jmp loop2
|
||||||
|
bakbak jsr bkln
|
||||||
|
jmp loop2
|
||||||
|
nxt61 cmp #$13
|
||||||
|
bne sccl
|
||||||
|
jsr clsr
|
||||||
|
jpl2 jmp loop2
|
||||||
|
sccl
|
||||||
|
ora #$80 ;make it upper case
|
||||||
|
jsr chkcol ;try for color
|
||||||
|
jmp upper ;was jmp loop2
|
||||||
|
;
|
||||||
|
nxln lsr lsxp
|
||||||
|
ldx tblx
|
||||||
|
nxln2 inx
|
||||||
|
cpx #nlines ;off bottom?
|
||||||
|
bne nxln1 ;no...
|
||||||
|
jsr scrol ;yes...scroll
|
||||||
|
nxln1 lda ldtb1,x ;double line?
|
||||||
|
bpl nxln2 ;yes...scroll again
|
||||||
|
stx tblx
|
||||||
|
jmp stupt
|
||||||
|
nxt1
|
||||||
|
ldx #0
|
||||||
|
stx insrt
|
||||||
|
stx rvs
|
||||||
|
stx qtsw
|
||||||
|
stx pntr
|
||||||
|
jsr nxln
|
||||||
|
jpl5 jmp loop2
|
||||||
|
;
|
||||||
|
;
|
||||||
|
; check for a decrement tblx
|
||||||
|
;
|
||||||
|
chkbak ldx #nwrap
|
||||||
|
lda #0
|
||||||
|
chklup cmp pntr
|
||||||
|
beq back
|
||||||
|
clc
|
||||||
|
adc #llen
|
||||||
|
dex
|
||||||
|
bne chklup
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
back dec tblx
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
; check for increment tblx
|
||||||
|
;
|
||||||
|
chkdwn ldx #nwrap
|
||||||
|
lda #llen-1
|
||||||
|
dwnchk cmp pntr
|
||||||
|
beq dnline
|
||||||
|
clc
|
||||||
|
adc #llen
|
||||||
|
dex
|
||||||
|
bne dwnchk
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
dnline ldx tblx
|
||||||
|
cpx #nlines
|
||||||
|
beq dwnbye
|
||||||
|
inc tblx
|
||||||
|
;
|
||||||
|
dwnbye rts
|
||||||
|
|
||||||
|
chkcol
|
||||||
|
ldx #15 ;there's 15 colors
|
||||||
|
chk1a cmp coltab,x
|
||||||
|
beq chk1b
|
||||||
|
dex
|
||||||
|
bpl chk1a
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
chk1b
|
||||||
|
stx color ;change the color
|
||||||
|
rts
|
||||||
|
|
||||||
|
coltab
|
||||||
|
;blk,wht,red,cyan,magenta,grn,blue,yellow
|
||||||
|
.byt $90,$05,$1c,$9f,$9c,$1e,$1f,$9e
|
||||||
|
.byt $81,$95,$96,$97,$98,$99,$9a,$9b
|
||||||
|
|
||||||
|
; rsr modify for vic-40 system
|
||||||
|
; rsr 12/31/81 add 8 more colors
|
||||||
@@ -0,0 +1,407 @@
|
|||||||
|
;screen scroll routine
|
||||||
|
;
|
||||||
|
scrol lda sal
|
||||||
|
pha
|
||||||
|
lda sah
|
||||||
|
pha
|
||||||
|
lda eal
|
||||||
|
pha
|
||||||
|
lda eah
|
||||||
|
pha
|
||||||
|
;
|
||||||
|
; s c r o l l u p
|
||||||
|
;
|
||||||
|
scro0 ldx #$ff
|
||||||
|
dec tblx
|
||||||
|
dec lsxp
|
||||||
|
dec lintmp
|
||||||
|
scr10 inx ;goto next line
|
||||||
|
jsr setpnt ;point to 'to' line
|
||||||
|
cpx #nlines-1 ;done?
|
||||||
|
bcs scr41 ;branch if so
|
||||||
|
;
|
||||||
|
lda ldtb2+1,x ;setup from pntr
|
||||||
|
sta sal
|
||||||
|
lda ldtb1+1,x
|
||||||
|
jsr scrlin ;scroll this line up1
|
||||||
|
bmi scr10
|
||||||
|
;
|
||||||
|
scr41
|
||||||
|
jsr clrln
|
||||||
|
;
|
||||||
|
ldx #0 ;scroll hi byte pointers
|
||||||
|
scrl5 lda ldtb1,x
|
||||||
|
and #$7f
|
||||||
|
ldy ldtb1+1,x
|
||||||
|
bpl scrl3
|
||||||
|
ora #$80
|
||||||
|
scrl3 sta ldtb1,x
|
||||||
|
inx
|
||||||
|
cpx #nlines-1
|
||||||
|
bne scrl5
|
||||||
|
;
|
||||||
|
lda ldtb1+nlines-1
|
||||||
|
ora #$80
|
||||||
|
sta ldtb1+nlines-1
|
||||||
|
lda ldtb1 ;double line?
|
||||||
|
bpl scro0 ;yes...scroll again
|
||||||
|
;
|
||||||
|
inc tblx
|
||||||
|
inc lintmp
|
||||||
|
lda #$7f ;check for control key
|
||||||
|
sta colm ;drop line 2 on port b
|
||||||
|
lda rows
|
||||||
|
cmp #$fb ;slow scroll key?(control)
|
||||||
|
php ;save status. restore port b
|
||||||
|
lda #$7f ;for stop key check
|
||||||
|
sta colm
|
||||||
|
plp
|
||||||
|
bne mlp42
|
||||||
|
;
|
||||||
|
ldy #0
|
||||||
|
mlp4 nop ;delay
|
||||||
|
dex
|
||||||
|
bne mlp4
|
||||||
|
dey
|
||||||
|
bne mlp4
|
||||||
|
sty ndx ;clear key queue buffer
|
||||||
|
;
|
||||||
|
mlp42 ldx tblx
|
||||||
|
;
|
||||||
|
pulind pla ;restore old indirects
|
||||||
|
sta eah
|
||||||
|
pla
|
||||||
|
sta eal
|
||||||
|
pla
|
||||||
|
sta sah
|
||||||
|
pla
|
||||||
|
sta sal
|
||||||
|
rts
|
||||||
|
|
||||||
|
newlin
|
||||||
|
ldx tblx
|
||||||
|
bmt1 inx
|
||||||
|
; cpx #nlines ;exceded the number of lines ???
|
||||||
|
; beq bmt2 ;vic-40 code
|
||||||
|
lda ldtb1,x ;find last display line of this line
|
||||||
|
bpl bmt1 ;table end mark=>$ff will abort...also
|
||||||
|
bmt2 stx lintmp ;found it
|
||||||
|
;generate a new line
|
||||||
|
cpx #nlines-1 ;is one line from bottom?
|
||||||
|
beq newlx ;yes...just clear last
|
||||||
|
bcc newlx ;<nlines...insert line
|
||||||
|
jsr scrol ;scroll everything
|
||||||
|
ldx lintmp
|
||||||
|
dex
|
||||||
|
dec tblx
|
||||||
|
jmp wlog30
|
||||||
|
newlx lda sal
|
||||||
|
pha
|
||||||
|
lda sah
|
||||||
|
pha
|
||||||
|
lda eal
|
||||||
|
pha
|
||||||
|
lda eah
|
||||||
|
pha
|
||||||
|
ldx #nlines
|
||||||
|
scd10 dex
|
||||||
|
jsr setpnt ;set up to addr
|
||||||
|
cpx lintmp
|
||||||
|
bcc scr40
|
||||||
|
beq scr40 ;branch if finished
|
||||||
|
lda ldtb2-1,x ;set from addr
|
||||||
|
sta sal
|
||||||
|
lda ldtb1-1,x
|
||||||
|
jsr scrlin ;scroll this line down
|
||||||
|
bmi scd10
|
||||||
|
scr40
|
||||||
|
jsr clrln
|
||||||
|
ldx #nlines-2
|
||||||
|
scrd21
|
||||||
|
cpx lintmp ;done?
|
||||||
|
bcc scrd22 ;branch if so
|
||||||
|
lda ldtb1+1,x
|
||||||
|
and #$7f
|
||||||
|
ldy ldtb1,x ;was it continued
|
||||||
|
bpl scrd19 ;branch if so
|
||||||
|
ora #$80
|
||||||
|
scrd19 sta ldtb1+1,x
|
||||||
|
dex
|
||||||
|
bne scrd21
|
||||||
|
scrd22
|
||||||
|
ldx lintmp
|
||||||
|
jsr wlog30
|
||||||
|
;
|
||||||
|
jmp pulind ;go pul old indirects and return
|
||||||
|
;
|
||||||
|
; scroll line from sal to pnt
|
||||||
|
; and colors from eal to user
|
||||||
|
;
|
||||||
|
scrlin
|
||||||
|
and #$03 ;clear any garbage stuff
|
||||||
|
ora hibase ;put in hiorder bits
|
||||||
|
sta sal+1
|
||||||
|
jsr tofrom ;color to & from addrs
|
||||||
|
ldy #llen-1
|
||||||
|
scd20
|
||||||
|
lda (sal),y
|
||||||
|
sta (pnt),y
|
||||||
|
lda (eal),y
|
||||||
|
sta (user),y
|
||||||
|
dey
|
||||||
|
bpl scd20
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
; do color to and from addresses
|
||||||
|
; from character to and from adrs
|
||||||
|
;
|
||||||
|
tofrom
|
||||||
|
jsr scolor
|
||||||
|
lda sal ;character from
|
||||||
|
sta eal ;make color from
|
||||||
|
lda sal+1
|
||||||
|
and #$03
|
||||||
|
ora #>viccol
|
||||||
|
sta eal+1
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
; set up pnt and y
|
||||||
|
; from .x
|
||||||
|
;
|
||||||
|
setpnt lda ldtb2,x
|
||||||
|
sta pnt
|
||||||
|
lda ldtb1,x
|
||||||
|
and #$03
|
||||||
|
ora hibase
|
||||||
|
sta pnt+1
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
; clear the line pointed to by .x
|
||||||
|
;
|
||||||
|
clrln ldy #llen-1
|
||||||
|
jsr setpnt
|
||||||
|
jsr scolor
|
||||||
|
clr10 jsr cpatch ;reversed order from 901227-02
|
||||||
|
lda #$20 ;store a space
|
||||||
|
sta (pnt),y ;to display
|
||||||
|
dey
|
||||||
|
bpl clr10
|
||||||
|
rts
|
||||||
|
nop
|
||||||
|
|
||||||
|
;
|
||||||
|
;put a char on the screen
|
||||||
|
;
|
||||||
|
dspp tay ;save char
|
||||||
|
lda #2
|
||||||
|
sta blnct ;blink cursor
|
||||||
|
jsr scolor ;set color ptr
|
||||||
|
tya ;restore color
|
||||||
|
dspp2 ldy pntr ;get column
|
||||||
|
sta (pnt),y ;char to screen
|
||||||
|
txa
|
||||||
|
sta (user),y ;color to screen
|
||||||
|
rts
|
||||||
|
|
||||||
|
scolor lda pnt ;generate color ptr
|
||||||
|
sta user
|
||||||
|
lda pnt+1
|
||||||
|
and #$03
|
||||||
|
ora #>viccol ;vic color ram
|
||||||
|
sta user+1
|
||||||
|
rts
|
||||||
|
|
||||||
|
key jsr $ffea ;update jiffy clock
|
||||||
|
lda blnsw ;blinking crsr ?
|
||||||
|
bne key4 ;no
|
||||||
|
dec blnct ;time to blink ?
|
||||||
|
bne key4 ;no
|
||||||
|
lda #20 ;reset blink counter
|
||||||
|
repdo sta blnct
|
||||||
|
ldy pntr ;cursor position
|
||||||
|
lsr blnon ;carry set if original char
|
||||||
|
ldx gdcol ;get char original color
|
||||||
|
lda (pnt),y ;get character
|
||||||
|
bcs key5 ;branch if not needed
|
||||||
|
;
|
||||||
|
inc blnon ;set to 1
|
||||||
|
sta gdbln ;save original char
|
||||||
|
jsr scolor
|
||||||
|
lda (user),y ;get original color
|
||||||
|
sta gdcol ;save it
|
||||||
|
ldx color ;blink in this color
|
||||||
|
lda gdbln ;with original character
|
||||||
|
;
|
||||||
|
key5 eor #$80 ;blink it
|
||||||
|
jsr dspp2 ;display it
|
||||||
|
;
|
||||||
|
key4 lda r6510 ;get cassette switches
|
||||||
|
and #$10 ;is switch down ?
|
||||||
|
beq key3 ;branch if so
|
||||||
|
;
|
||||||
|
ldy #0
|
||||||
|
sty cas1 ;cassette off switch
|
||||||
|
;
|
||||||
|
lda r6510
|
||||||
|
ora #$20
|
||||||
|
bne kl24 ;branch if motor is off
|
||||||
|
;
|
||||||
|
key3 lda cas1
|
||||||
|
bne kl2
|
||||||
|
;
|
||||||
|
lda r6510
|
||||||
|
and #%011111 ;turn motor on
|
||||||
|
;
|
||||||
|
kl24
|
||||||
|
; sta r6510
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
;
|
||||||
|
kl2 jsr scnkey ;scan keyboard
|
||||||
|
;
|
||||||
|
kprend lda d1icr ;clear interupt flags
|
||||||
|
pla ;restore registers
|
||||||
|
tay
|
||||||
|
pla
|
||||||
|
tax
|
||||||
|
pla
|
||||||
|
rti ;exit from irq routines
|
||||||
|
|
||||||
|
; ****** general keyboard scan ******
|
||||||
|
;
|
||||||
|
scnkey lda #$00
|
||||||
|
sta shflag
|
||||||
|
ldy #64 ;last key index
|
||||||
|
sty sfdx ;null key found
|
||||||
|
sta colm ;raise all lines
|
||||||
|
ldx rows ;check for a key down
|
||||||
|
cpx #$ff ;no keys down?
|
||||||
|
beq scnout ;branch if none
|
||||||
|
tay ;.a=0 ldy #0
|
||||||
|
lda #<mode1
|
||||||
|
sta keytab
|
||||||
|
lda #>mode1
|
||||||
|
sta keytab+1
|
||||||
|
lda #$fe ;start with 1st column
|
||||||
|
sta colm
|
||||||
|
scn20 ldx #8 ;8 row keyboard
|
||||||
|
pha ;save column output info
|
||||||
|
scn22 lda rows
|
||||||
|
cmp rows ;debounce keyboard
|
||||||
|
bne scn22
|
||||||
|
scn30 lsr a ;look for key down
|
||||||
|
bcs ckit ;none
|
||||||
|
pha
|
||||||
|
lda (keytab),y ;get char code
|
||||||
|
cmp #$05
|
||||||
|
bcs spck2 ;if not special key go on
|
||||||
|
cmp #$03 ;could it be a stop key?
|
||||||
|
beq spck2 ;branch if so
|
||||||
|
ora shflag
|
||||||
|
sta shflag ;put shift bit in flag byte
|
||||||
|
bpl ckut
|
||||||
|
spck2
|
||||||
|
sty sfdx ;save key number
|
||||||
|
ckut pla
|
||||||
|
ckit iny
|
||||||
|
cpy #65
|
||||||
|
bcs ckit1 ;branch if finished
|
||||||
|
dex
|
||||||
|
bne scn30
|
||||||
|
sec
|
||||||
|
pla ;reload column info
|
||||||
|
rol a
|
||||||
|
sta colm ;next column on keyboard
|
||||||
|
bne scn20 ;always branch
|
||||||
|
ckit1 pla ;dump column output...all done
|
||||||
|
jmp (keylog) ;evaluate shift functions
|
||||||
|
rekey ldy sfdx ;get key index
|
||||||
|
lda (keytab),y ;get char code
|
||||||
|
tax ;save the char
|
||||||
|
cpy lstx ;same as prev char index?
|
||||||
|
beq rpt10 ;yes
|
||||||
|
ldy #$10 ;no - reset delay before repeat
|
||||||
|
sty delay
|
||||||
|
bne ckit2 ;always
|
||||||
|
rpt10 and #$7f ;unshift it
|
||||||
|
bit rptflg ;check for repeat disable
|
||||||
|
bmi rpt20 ;yes
|
||||||
|
bvs scnrts
|
||||||
|
cmp #$7f ;no keys ?
|
||||||
|
scnout beq ckit2 ;yes - get out
|
||||||
|
cmp #$14 ;an inst/del key ?
|
||||||
|
beq rpt20 ;yes - repeat it
|
||||||
|
cmp #$20 ;a space key ?
|
||||||
|
beq rpt20 ;yes
|
||||||
|
cmp #$1d ;a crsr left/right ?
|
||||||
|
beq rpt20 ;yes
|
||||||
|
cmp #$11 ;a crsr up/dwn ?
|
||||||
|
bne scnrts ;no - exit
|
||||||
|
rpt20 ldy delay ;time to repeat ?
|
||||||
|
beq rpt40 ;yes
|
||||||
|
dec delay
|
||||||
|
bne scnrts
|
||||||
|
rpt40 dec kount ;time for next repeat ?
|
||||||
|
bne scnrts ;no
|
||||||
|
ldy #4 ;yes - reset ctr
|
||||||
|
sty kount
|
||||||
|
ldy ndx ;no repeat if queue full
|
||||||
|
dey
|
||||||
|
bpl scnrts
|
||||||
|
ckit2
|
||||||
|
ldy sfdx ;get index of key
|
||||||
|
sty lstx ;save this index to key found
|
||||||
|
ldy shflag ;update shift status
|
||||||
|
sty lstshf
|
||||||
|
ckit3 cpx #$ff ;a null key or no key ?
|
||||||
|
beq scnrts ;branch if so
|
||||||
|
txa ;need x as index so...
|
||||||
|
ldx ndx ;get # of chars in key queue
|
||||||
|
cpx xmax ;irq buffer full ?
|
||||||
|
bcs scnrts ;yes - no more insert
|
||||||
|
putque
|
||||||
|
sta keyd,x ;put raw data here
|
||||||
|
inx
|
||||||
|
stx ndx ;update key queue count
|
||||||
|
scnrts lda #$7f ;setup pb7 for stop key sense
|
||||||
|
sta colm
|
||||||
|
rts
|
||||||
|
|
||||||
|
;
|
||||||
|
; shift logic
|
||||||
|
;
|
||||||
|
shflog
|
||||||
|
lda shflag
|
||||||
|
cmp #$03 ;commodore shift combination?
|
||||||
|
bne keylg2 ;branch if not
|
||||||
|
cmp lstshf ;did i do this already
|
||||||
|
beq scnrts ;branch if so
|
||||||
|
lda mode
|
||||||
|
bmi shfout ;dont shift if its minus
|
||||||
|
|
||||||
|
switch lda vicreg+24 ;**********************************:
|
||||||
|
eor #$02 ;turn on other case
|
||||||
|
sta vicreg+24 ;point the vic there
|
||||||
|
jmp shfout
|
||||||
|
|
||||||
|
;
|
||||||
|
keylg2
|
||||||
|
asl a
|
||||||
|
cmp #$08 ;was it a control key
|
||||||
|
bcc nctrl ;branch if not
|
||||||
|
lda #6 ;else use table #4
|
||||||
|
;
|
||||||
|
nctrl
|
||||||
|
notkat
|
||||||
|
tax
|
||||||
|
lda keycod,x
|
||||||
|
sta keytab
|
||||||
|
lda keycod+1,x
|
||||||
|
sta keytab+1
|
||||||
|
shfout
|
||||||
|
jmp rekey
|
||||||
|
|
||||||
|
; rsr 12/08/81 modify for vic-40
|
||||||
|
; rsr 2/18/82 modify for 6526 input pad sense
|
||||||
|
; rsr 3/11/82 fix keyboard debounce, repair file
|
||||||
|
; rsr 3/11/82 modify for commodore 64
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
keycod ;keyboard mode 'dispatch'
|
||||||
|
.word mode1
|
||||||
|
.word mode2
|
||||||
|
.word mode3
|
||||||
|
.word contrl ;control keys
|
||||||
|
;
|
||||||
|
; cottaconna mode
|
||||||
|
;
|
||||||
|
;.word mode1 ;pet mode1
|
||||||
|
;.word mode2 ;pet mode2
|
||||||
|
;.word cctta3 ;dummy word
|
||||||
|
;.word contrl
|
||||||
|
;
|
||||||
|
; extended katakana mode
|
||||||
|
;
|
||||||
|
;.word cctta2 ;katakana characters
|
||||||
|
;.word cctta3 ;limited graphics
|
||||||
|
;.word cctta3 ;dummy
|
||||||
|
;.word contrl
|
||||||
|
|
||||||
|
mode1
|
||||||
|
;del,3,5,7,9,+,yen sign,1
|
||||||
|
.byt $14,$0d,$1d,$88,$85,$86,$87,$11
|
||||||
|
;return,w,r,y,i,p,*,left arrow
|
||||||
|
.byt $33,$57,$41,$34,$5a,$53,$45,$01
|
||||||
|
;rt crsr,a,d,g,j,l,;,ctrl
|
||||||
|
.byt $35,$52,$44,$36,$43,$46,$54,$58
|
||||||
|
;f4,4,6,8,0,-,home,2
|
||||||
|
.byt $37,$59,$47,$38,$42,$48,$55,$56
|
||||||
|
;f1,z,c,b,m,.,r.shiftt,space
|
||||||
|
.byt $39,$49,$4a,$30,$4d,$4b,$4f,$4e
|
||||||
|
;f2,s,f,h,k,:,=,com.key
|
||||||
|
.byt $2b,$50,$4c,$2d,$2e,$3a,$40,$2c
|
||||||
|
;f3,e,t,u,o,@,exp,q
|
||||||
|
.byt $5c,$2a,$3b,$13,$01,$3d,$5e,$2f
|
||||||
|
;crsr dwn,l.shift,x,v,n,,,/,stop
|
||||||
|
.byt $31,$5f,$04,$32,$20,$02,$51,$03
|
||||||
|
.byt $ff ;end of table null
|
||||||
|
|
||||||
|
mode2 ;shift
|
||||||
|
;ins,%,',),+,yen,!
|
||||||
|
.byt $94,$8d,$9d,$8c,$89,$8a,$8b,$91
|
||||||
|
;sreturn,w,r,y,i,p,*,sleft arrow
|
||||||
|
.byt $23,$d7,$c1,$24,$da,$d3,$c5,$01
|
||||||
|
;lf.crsr,a,d,g,j,l,;,ctrl
|
||||||
|
.byt $25,$d2,$c4,$26,$c3,$c6,$d4,$d8
|
||||||
|
;,$,&,(, ,"
|
||||||
|
.byt $27,$d9,$c7,$28,$c2,$c8,$d5,$d6
|
||||||
|
;f5,z,c,b,m,.,r.shift,sspace
|
||||||
|
.byt $29,$c9,$ca,$30,$cd,$cb,$cf,$ce
|
||||||
|
;f6,s,f,h,k,:,=,scom.key
|
||||||
|
.byt $db,$d0,$cc,$dd,$3e,$5b,$ba,$3c
|
||||||
|
;f7,e,t,u,o,@,pi,g
|
||||||
|
.byt $a9,$c0,$5d,$93,$01,$3d,$de,$3f
|
||||||
|
;crsr dwn,l.shift,x,v,n,,,/,run
|
||||||
|
.byt $21,$5f,$04,$22,$a0,$02,$d1,$83
|
||||||
|
.byt $ff ;end of table null
|
||||||
|
;
|
||||||
|
mode3 ;left window grahpics
|
||||||
|
;ins,c10,c12,c14,9,+,pound sign,c8
|
||||||
|
.byt $94,$8d,$9d,$8c,$89,$8a,$8b,$91
|
||||||
|
;return,w,r,y,i,p,*,lft.arrow
|
||||||
|
.byt $96,$b3,$b0,$97,$ad,$ae,$b1,$01
|
||||||
|
;lf.crsr,a,d,g,j,l,;,ctrl
|
||||||
|
.byt $98,$b2,$ac,$99,$bc,$bb,$a3,$bd
|
||||||
|
;f8,c11,c13,c15,0,-,home,c9
|
||||||
|
.byt $9a,$b7,$a5,$9b,$bf,$b4,$b8,$be
|
||||||
|
;f2,z,c,b,m,.,r.shift,space
|
||||||
|
.byt $29,$a2,$b5,$30,$a7,$a1,$b9,$aa
|
||||||
|
;f4,s,f,h,k,:,=,com.key
|
||||||
|
.byt $a6,$af,$b6,$dc,$3e,$5b,$a4,$3c
|
||||||
|
;f6,e,t,u,o,@,pi,q
|
||||||
|
.byt $a8,$df,$5d,$93,$01,$3d,$de,$3f
|
||||||
|
;crsr.up,l.shift,x,v,n,,,/,stop
|
||||||
|
.byt $81,$5f,$04,$95,$a0,$02,$ab,$83
|
||||||
|
.byt $ff ;end of table null
|
||||||
|
;cctta2 ;was cctta2 in japanese version
|
||||||
|
lower
|
||||||
|
cmp #$0e ;does he want lower case?
|
||||||
|
bne upper ;branch if not
|
||||||
|
lda vicreg+24 ;else set vic to point to lower case
|
||||||
|
ora #$02
|
||||||
|
bne ulset ;jmp
|
||||||
|
|
||||||
|
upper
|
||||||
|
cmp #$8e ;does he want upper case
|
||||||
|
bne lock ;branch if not
|
||||||
|
lda vicreg+24 ;make sure vic point to upper/pet set
|
||||||
|
and #$ff-$02
|
||||||
|
ulset sta vicreg+24
|
||||||
|
outhre jmp loop2
|
||||||
|
|
||||||
|
lock
|
||||||
|
cmp #8 ;does he want to lock in this mode?
|
||||||
|
bne unlock ;branch if not
|
||||||
|
lda #$80 ;else set lock switch on
|
||||||
|
ora mode ;don't hurt anything - just in case
|
||||||
|
bmi lexit
|
||||||
|
|
||||||
|
unlock
|
||||||
|
cmp #9 ;does he want to unlock the keyboard?
|
||||||
|
bne outhre ;branch if not
|
||||||
|
lda #$7f ;clear the lock switch
|
||||||
|
and mode ;dont hurt anything
|
||||||
|
lexit sta mode
|
||||||
|
jmp loop2 ;get out
|
||||||
|
;cctta3
|
||||||
|
;.byt $04,$ff,$ff,$ff,$ff,$ff,$e2,$9d
|
||||||
|
;run-k24-k31
|
||||||
|
;.byt $83,$01,$ff,$ff,$ff,$ff,$ff,$91
|
||||||
|
;k32-k39.f5
|
||||||
|
;.byt $a0,$ff,$ff,$ff,$ff,$ee,$01,$89
|
||||||
|
;co.key,k40-k47.f6
|
||||||
|
;.byt $02,$ff,$ff,$ff,$ff,$e1,$fd,$8a
|
||||||
|
;k48-k55
|
||||||
|
;.byt $ff,$ff,$ff,$ff,$ff,$b0,$e0,$8b
|
||||||
|
;k56-k63
|
||||||
|
;.byt $f2,$f4,$f6,$ff,$f0,$ed,$93,$8c
|
||||||
|
;.byt $ff ;end of table null
|
||||||
|
|
||||||
|
contrl
|
||||||
|
;null,red,purple,blue,rvs ,null,null,black
|
||||||
|
.byt $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
|
||||||
|
;null, w ,reverse, y , i , p ,null,music
|
||||||
|
.byt $1c,$17,$01,$9f,$1a,$13,$05,$ff
|
||||||
|
.byt $9c,$12,$04,$1e,$03,$06,$14,$18
|
||||||
|
;null,cyan,green,yellow,rvs off,null,null,white
|
||||||
|
.byt $1f,$19,$07,$9e,$02,$08,$15,$16
|
||||||
|
.byt $12,$09,$0a,$92,$0d,$0b,$0f,$0e
|
||||||
|
.byt $ff,$10,$0c,$ff,$ff,$1b,$00,$ff
|
||||||
|
.byt $1c,$ff,$1d,$ff,$ff,$1f,$1e,$ff
|
||||||
|
.byt $90,$06,$ff,$05,$ff,$ff,$11,$ff
|
||||||
|
.byt $ff ;end of table null
|
||||||
|
tvic
|
||||||
|
.byt 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;sprites (0-16)
|
||||||
|
.byt $9b,55,0,0,0,$08,0,$14,$0f,0,0,0,0,0,0 ;data (17-31)
|
||||||
|
; .byt 14,6,1,2,3,4,0,1,2,3,4,5,6,7 ;32-46 - change 1st two bytes of this line for border and background colour
|
||||||
|
.byt 11,0,1,2,3,4,0,1,2,3,4,5,6,7
|
||||||
|
;
|
||||||
|
runtb .byt "LOAD",$d,"RUN",$d
|
||||||
|
;
|
||||||
|
linz0 = vicscn
|
||||||
|
linz1 = linz0+llen
|
||||||
|
linz2 = linz1+llen
|
||||||
|
linz3 = linz2+llen
|
||||||
|
linz4 = linz3+llen
|
||||||
|
linz5 = linz4+llen
|
||||||
|
linz6 = linz5+llen
|
||||||
|
linz7 = linz6+llen
|
||||||
|
linz8 = linz7+llen
|
||||||
|
linz9 = linz8+llen
|
||||||
|
linz10 = linz9+llen
|
||||||
|
linz11 = linz10+llen
|
||||||
|
linz12 = linz11+llen
|
||||||
|
linz13 = linz12+llen
|
||||||
|
linz14 = linz13+llen
|
||||||
|
linz15 = linz14+llen
|
||||||
|
linz16 = linz15+llen
|
||||||
|
linz17 = linz16+llen
|
||||||
|
linz18 = linz17+llen
|
||||||
|
linz19 = linz18+llen
|
||||||
|
linz20 = linz19+llen
|
||||||
|
linz21 = linz20+llen
|
||||||
|
linz22 = linz21+llen
|
||||||
|
linz23 = linz22+llen
|
||||||
|
linz24 = linz23+llen
|
||||||
|
|
||||||
|
;****** screen lines lo byte table ******
|
||||||
|
;
|
||||||
|
ldtb2
|
||||||
|
.byte <linz0
|
||||||
|
.byte <linz1
|
||||||
|
.byte <linz2
|
||||||
|
.byte <linz3
|
||||||
|
.byte <linz4
|
||||||
|
.byte <linz5
|
||||||
|
.byte <linz6
|
||||||
|
.byte <linz7
|
||||||
|
.byte <linz8
|
||||||
|
.byte <linz9
|
||||||
|
.byte <linz10
|
||||||
|
.byte <linz11
|
||||||
|
.byte <linz12
|
||||||
|
.byte <linz13
|
||||||
|
.byte <linz14
|
||||||
|
.byte <linz15
|
||||||
|
.byte <linz16
|
||||||
|
.byte <linz17
|
||||||
|
.byte <linz18
|
||||||
|
.byte <linz19
|
||||||
|
.byte <linz20
|
||||||
|
.byte <linz21
|
||||||
|
.byte <linz22
|
||||||
|
.byte <linz23
|
||||||
|
.byte <linz24
|
||||||
|
|
||||||
|
; rsr 12/08/81 modify for vic-40 keyscan
|
||||||
|
; rsr 2/17/81 modify for the stinking 6526r2 chip
|
||||||
|
; rsr 3/11/82 modify for commodore 64
|
||||||
|
; rsr 3/28/82 modify for new pla
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
.segment "ERROR"
|
||||||
|
;***************************************
|
||||||
|
;* stop -- check stop key flag and *
|
||||||
|
;* return z flag set if flag true. *
|
||||||
|
;* also closes active channels and *
|
||||||
|
;* flushes keyboard queue. *
|
||||||
|
;* also returns key downs from last *
|
||||||
|
;* keyboard row in .a. *
|
||||||
|
;***************************************
|
||||||
|
nstop lda stkey ;value of last row
|
||||||
|
cmp #$7f ;check stop key position
|
||||||
|
bne stop2 ;not down
|
||||||
|
php
|
||||||
|
jsr clrch ;clear channels
|
||||||
|
sta ndx ;flush queue
|
||||||
|
plp
|
||||||
|
stop2 rts
|
||||||
|
|
||||||
|
;************************************
|
||||||
|
;* *
|
||||||
|
;* error handler *
|
||||||
|
;* *
|
||||||
|
;* prints kernal error message if *
|
||||||
|
;* bit 6 of msgflg set. returns *
|
||||||
|
;* with error # in .a and carry. *
|
||||||
|
;* *
|
||||||
|
;************************************
|
||||||
|
;
|
||||||
|
error1 lda #1 ;too many files
|
||||||
|
.byt $2c
|
||||||
|
error2 lda #2 ;file open
|
||||||
|
.byt $2c
|
||||||
|
error3 lda #3 ;file not open
|
||||||
|
.byt $2c
|
||||||
|
error4 lda #4 ;file not found
|
||||||
|
.byt $2c
|
||||||
|
error5 lda #5 ;device not present
|
||||||
|
.byt $2c
|
||||||
|
error6 lda #6 ;not input file
|
||||||
|
.byt $2c
|
||||||
|
error7 lda #7 ;not output file
|
||||||
|
.byt $2c
|
||||||
|
error8 lda #8 ;missing file name
|
||||||
|
.byt $2c
|
||||||
|
error9 lda #9 ;bad device #
|
||||||
|
;
|
||||||
|
pha ;error number on stack
|
||||||
|
jsr clrch ;restore i/o channels
|
||||||
|
;
|
||||||
|
ldy #ms1-ms1
|
||||||
|
bit msgflg ;are we printing error?
|
||||||
|
bvc erexit ;no...
|
||||||
|
;
|
||||||
|
jsr msg ;print "cbm i/o error #"
|
||||||
|
pla
|
||||||
|
pha
|
||||||
|
ora #$30 ;make error # ascii
|
||||||
|
jsr bsout ;print it
|
||||||
|
;
|
||||||
|
erexit pla
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
|
||||||
+244
@@ -0,0 +1,244 @@
|
|||||||
|
.segment "INIT"
|
||||||
|
; start - system reset
|
||||||
|
; will goto rom at $8000...
|
||||||
|
; if locs $8004-$8008
|
||||||
|
; = 'cbm80'
|
||||||
|
; ^^^ > these have msb set
|
||||||
|
; kernal expects...
|
||||||
|
; $8000- .word initilize (hard start)
|
||||||
|
; $8002- .word panic (warm start)
|
||||||
|
; ... else basic system used
|
||||||
|
; ******************testing only***************
|
||||||
|
; use auto disk/cassette load when developed...
|
||||||
|
;
|
||||||
|
start ldx #$ff
|
||||||
|
sei
|
||||||
|
txs
|
||||||
|
cld
|
||||||
|
jsr a0int ;test for $a0 rom in
|
||||||
|
bne start1
|
||||||
|
jmp ($8000) ; go init as $a000 rom wants
|
||||||
|
start1 stx vicreg+22 ;set up refresh (.x=<5)
|
||||||
|
jsr ioinit ;go initilize i/o devices
|
||||||
|
jsr ramtas ;go ram test and set
|
||||||
|
jsr restor ;go set up os vectors
|
||||||
|
;
|
||||||
|
jsr pcint ;go initilize screen newxxx
|
||||||
|
cli ;interrupts okay now
|
||||||
|
jmp ($a000) ;go to basic system
|
||||||
|
|
||||||
|
; a0int - test for an $8000 rom
|
||||||
|
; returns z - $8000 in
|
||||||
|
;
|
||||||
|
a0int ldx #tbla0e-tbla0r ;check for $8000
|
||||||
|
a0in1 lda tbla0r-1,x
|
||||||
|
cmp $8004-1,x
|
||||||
|
bne a0in2
|
||||||
|
dex
|
||||||
|
bne a0in1
|
||||||
|
a0in2 rts
|
||||||
|
;
|
||||||
|
tbla0r .byt $c3,$c2,$cd,"80" ;..cbm80..
|
||||||
|
tbla0e
|
||||||
|
|
||||||
|
; restor - set kernal indirects and vectors (system)
|
||||||
|
;
|
||||||
|
restor ldx #<vectss
|
||||||
|
ldy #>vectss
|
||||||
|
clc
|
||||||
|
;
|
||||||
|
; vector - set kernal indirect and vectors (user)
|
||||||
|
;
|
||||||
|
vector stx tmp2
|
||||||
|
sty tmp2+1
|
||||||
|
ldy #vectse-vectss-1
|
||||||
|
movos1 lda cinv,y ;get from storage
|
||||||
|
bcs movos2 ;c...want storage to user
|
||||||
|
lda (tmp2),y ;...want user to storage
|
||||||
|
movos2 sta (tmp2),y ;put in user
|
||||||
|
sta cinv,y ;put in storage
|
||||||
|
dey
|
||||||
|
bpl movos1
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
vectss .word key,timb,nnmi
|
||||||
|
.word nopen,nclose,nchkin
|
||||||
|
.word nckout,nclrch,nbasin
|
||||||
|
.word nbsout,nstop,ngetin
|
||||||
|
.word nclall,timb ;goto break on a usrcmd jmp
|
||||||
|
.word nload,nsave
|
||||||
|
vectse
|
||||||
|
|
||||||
|
; ramtas - memory size check and set
|
||||||
|
;
|
||||||
|
ramtas lda #0 ;zero low memory
|
||||||
|
tay ;start at 0002
|
||||||
|
ramtz0 sta $0002,y ;zero page
|
||||||
|
sta $0200,y ;user buffers and vars
|
||||||
|
sta $0300,y ;system space and user space
|
||||||
|
iny
|
||||||
|
bne ramtz0
|
||||||
|
;
|
||||||
|
;allocate tape buffers
|
||||||
|
;
|
||||||
|
ldx #<tbuffr
|
||||||
|
ldy #>tbuffr
|
||||||
|
stx tape1
|
||||||
|
sty tape1+1
|
||||||
|
;
|
||||||
|
; set top of memory
|
||||||
|
;
|
||||||
|
ramtbt
|
||||||
|
tay ;move $00 to .y
|
||||||
|
lda #3 ;set high inital index
|
||||||
|
sta tmp0+1
|
||||||
|
;
|
||||||
|
ramtz1 inc tmp0+1 ;move index thru memory
|
||||||
|
ramtz2 lda (tmp0),y ;get present data
|
||||||
|
tax ;save in .x
|
||||||
|
lda #$55 ;do a $55,$aa test
|
||||||
|
sta (tmp0),y
|
||||||
|
cmp (tmp0),y
|
||||||
|
bne size
|
||||||
|
rol a
|
||||||
|
sta (tmp0),y
|
||||||
|
cmp (tmp0),y
|
||||||
|
bne size
|
||||||
|
txa ;restore old data
|
||||||
|
sta (tmp0),y
|
||||||
|
iny
|
||||||
|
bne ramtz2
|
||||||
|
beq ramtz1
|
||||||
|
;
|
||||||
|
size tya ;set top of memory
|
||||||
|
tax
|
||||||
|
ldy tmp0+1
|
||||||
|
clc
|
||||||
|
jsr settop
|
||||||
|
lda #$08 ;set bottom of memory
|
||||||
|
sta memstr+1 ;always at $0800
|
||||||
|
lda #$04 ;screen always at $400
|
||||||
|
sta hibase ;set base of screen
|
||||||
|
rts
|
||||||
|
|
||||||
|
bsit .word wrtz,wrtn,key,read ;table of indirects for cassette irq's
|
||||||
|
|
||||||
|
; ioinit - initilize io devices
|
||||||
|
;
|
||||||
|
ioinit lda #$7f ;kill interrupts
|
||||||
|
sta d1icr
|
||||||
|
sta d2icr
|
||||||
|
sta d1pra ;turn on stop key
|
||||||
|
lda #%00001000 ;shut off timers
|
||||||
|
sta d1cra
|
||||||
|
sta d2cra
|
||||||
|
sta d1crb
|
||||||
|
sta d2crb
|
||||||
|
; configure ports
|
||||||
|
ldx #$00 ;set up keyboard inputs
|
||||||
|
stx d1ddrb ;keyboard inputs
|
||||||
|
stx d2ddrb ;user port (no rs-232)
|
||||||
|
stx sidreg+24 ;turn off sid
|
||||||
|
dex
|
||||||
|
stx d1ddra ;keyboard outputs
|
||||||
|
lda #%00000111 ;set serial/va14/15 (clkhi)
|
||||||
|
sta d2pra
|
||||||
|
lda #%00111111 ;set serial in/out, va14/15out
|
||||||
|
sta d2ddra
|
||||||
|
;
|
||||||
|
; set up the 6510 lines
|
||||||
|
;
|
||||||
|
lda #%00111111 ;motor on, hiram lowram charen high
|
||||||
|
sta r6510
|
||||||
|
lda #%00111111 ;mtr out,sw in,wr out,control out
|
||||||
|
sta d6510
|
||||||
|
;
|
||||||
|
;jsr clkhi ;clkhi to release serial devices ^
|
||||||
|
;
|
||||||
|
iokeys lda palnts ;pal or ntsc
|
||||||
|
beq i0010 ;ntsc
|
||||||
|
lda #<sixtyp
|
||||||
|
sta d1t1l
|
||||||
|
lda #>sixtyp
|
||||||
|
jmp i0020
|
||||||
|
i0010 lda #<sixty ;keyboard scan irq's
|
||||||
|
sta d1t1l
|
||||||
|
lda #>sixty
|
||||||
|
i0020 sta d1t1h
|
||||||
|
jmp piokey
|
||||||
|
; lda #$81 ;enable t1 irq's
|
||||||
|
; sta d1icr
|
||||||
|
; lda d1cra
|
||||||
|
; and #$80 ;save only tod bit
|
||||||
|
; ora #%00010001 ;enable timer1
|
||||||
|
; sta d1cra
|
||||||
|
; jmp clklo ;release the clock line
|
||||||
|
;
|
||||||
|
; sixty hertz value
|
||||||
|
;
|
||||||
|
sixty = 17045 ; ntsc
|
||||||
|
sixtyp = 16421 ; pal
|
||||||
|
|
||||||
|
setnam sta fnlen
|
||||||
|
stx fnadr
|
||||||
|
sty fnadr+1
|
||||||
|
rts
|
||||||
|
|
||||||
|
setlfs sta la
|
||||||
|
stx fa
|
||||||
|
sty sa
|
||||||
|
rts
|
||||||
|
|
||||||
|
readss lda fa ;see which devices' to read
|
||||||
|
cmp #2 ;is it rs-232?
|
||||||
|
bne readst ;no...read serial/cass
|
||||||
|
lda rsstat ;yes...get rs-232 up
|
||||||
|
pha
|
||||||
|
lda #00 ;clear rs232 status when read
|
||||||
|
sta rsstat
|
||||||
|
pla
|
||||||
|
rts
|
||||||
|
setmsg sta msgflg
|
||||||
|
readst lda status
|
||||||
|
udst ora status
|
||||||
|
sta status
|
||||||
|
rts
|
||||||
|
|
||||||
|
settmo sta timout
|
||||||
|
rts
|
||||||
|
|
||||||
|
memtop bcc settop
|
||||||
|
;
|
||||||
|
;carry set--read top of memory
|
||||||
|
;
|
||||||
|
gettop ldx memsiz
|
||||||
|
ldy memsiz+1
|
||||||
|
;
|
||||||
|
;carry clear--set top of memory
|
||||||
|
;
|
||||||
|
settop stx memsiz
|
||||||
|
sty memsiz+1
|
||||||
|
rts
|
||||||
|
|
||||||
|
;manage bottom of memory
|
||||||
|
;
|
||||||
|
membot bcc setbot
|
||||||
|
;
|
||||||
|
;carry set--read bottom of memory
|
||||||
|
;
|
||||||
|
ldx memstr
|
||||||
|
ldy memstr+1
|
||||||
|
;
|
||||||
|
;carry clear--set bottom of memory
|
||||||
|
;
|
||||||
|
setbot stx memstr
|
||||||
|
sty memstr+1
|
||||||
|
rts
|
||||||
|
|
||||||
|
; rsr 8/5/80 change io structure
|
||||||
|
; rsr 8/15/80 add memory test
|
||||||
|
; rsr 8/21/80 change i/o for mod
|
||||||
|
; rsr 8/25/80 change i/o for mod2
|
||||||
|
; rsr 8/29/80 change ramtest for hardware mistake
|
||||||
|
; rsr 9/22/80 change so ram hang rs232 status read
|
||||||
|
; rsr 5/12/82 change start1 order to remove disk problem
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
.segment "IRQFILE"
|
||||||
|
; simirq - simulate an irq (for cassette read)
|
||||||
|
; enter by a jsr simirq
|
||||||
|
;
|
||||||
|
simirq php
|
||||||
|
pla ;fix the break flag
|
||||||
|
and #$ef
|
||||||
|
pha
|
||||||
|
; puls - checks for real irq's or breaks
|
||||||
|
;
|
||||||
|
puls pha
|
||||||
|
txa
|
||||||
|
pha
|
||||||
|
tya
|
||||||
|
pha
|
||||||
|
tsx
|
||||||
|
lda $104,x ;get old p status
|
||||||
|
and #$10 ;break flag?
|
||||||
|
beq puls1 ;...no
|
||||||
|
jmp (cbinv) ;...yes...break instr
|
||||||
|
puls1 jmp (cinv) ;...irq
|
||||||
|
|
||||||
|
; pcint - add universal to cinit
|
||||||
|
;
|
||||||
|
pcint jsr cint
|
||||||
|
p0010 lda vicreg+18 ;check raster compare for zero
|
||||||
|
bne p0010 ;if it's zero then check value
|
||||||
|
lda vicreg+25 ;get raster irq value
|
||||||
|
and #$01
|
||||||
|
sta palnts ;place in pal/ntsc indicator
|
||||||
|
jmp iokeys
|
||||||
|
;
|
||||||
|
; piokey - add universal to iokeys
|
||||||
|
;
|
||||||
|
piokey lda #$81 ;enable t1 irq's
|
||||||
|
sta d1icr
|
||||||
|
lda d1cra
|
||||||
|
and #$80 ;save only tod bit
|
||||||
|
ora #%00010001 ;enable timer1
|
||||||
|
sta d1cra
|
||||||
|
jmp clklo ;release the clock line***901227-03***
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
.feature labels_without_colons, pc_assignment
|
||||||
|
|
||||||
|
.include "declare.s"
|
||||||
|
.include "editor.1.s"
|
||||||
|
.include "editor.2.s"
|
||||||
|
.include "editor.3.s"
|
||||||
|
.include "serial4.0.s"
|
||||||
|
.include "messages.s"
|
||||||
|
.include "clall.s"
|
||||||
|
.include "ngetin.s"
|
||||||
|
.include "nbasin.s"
|
||||||
|
.include "nbsout.s"
|
||||||
|
.include "openchannel.s"
|
||||||
|
.include "close.s"
|
||||||
|
.include "open.s"
|
||||||
|
.include "load.s"
|
||||||
|
.include "save.s"
|
||||||
|
.include "cunlsn.s"
|
||||||
|
.include "time.s"
|
||||||
|
.include "errorhandler.s"
|
||||||
|
.include "crap.s"
|
||||||
|
.include "init.s"
|
||||||
|
.include "nmi.s"
|
||||||
|
.include "irqfile.s"
|
||||||
|
.include "patches.s"
|
||||||
|
.include "vectors.s"
|
||||||
|
.include "wozmon.s"
|
||||||
+180
@@ -0,0 +1,180 @@
|
|||||||
|
.segment "LOAD"
|
||||||
|
;**********************************
|
||||||
|
;* load ram function *
|
||||||
|
;* *
|
||||||
|
;* loads from cassette 1 or 2, or *
|
||||||
|
;* serial bus devices >=4 to 31 *
|
||||||
|
;* as determined by contents of *
|
||||||
|
;* variable fa. verify flag in .a *
|
||||||
|
;* *
|
||||||
|
;* alt load if sa=0, normal sa=1 *
|
||||||
|
;* .x , .y load address if sa=0 *
|
||||||
|
;* .a=0 performs load,<> is verify*
|
||||||
|
;* *
|
||||||
|
;* high load return in x,y. *
|
||||||
|
;* *
|
||||||
|
;**********************************
|
||||||
|
|
||||||
|
loadsp stx memuss ;.x has low alt start
|
||||||
|
sty memuss+1
|
||||||
|
load jmp (iload) ;monitor load entry
|
||||||
|
;
|
||||||
|
nload sta verck ;store verify flag
|
||||||
|
lda #0
|
||||||
|
sta status
|
||||||
|
;
|
||||||
|
lda fa ;check device number
|
||||||
|
bne ld20
|
||||||
|
;
|
||||||
|
ld10 jmp error9 ;bad device #-keyboard
|
||||||
|
;
|
||||||
|
ld20 cmp #3
|
||||||
|
beq ld10 ;disallow screen load
|
||||||
|
bcc ld10 ;handle tapes different
|
||||||
|
;
|
||||||
|
;load from cbm ieee device
|
||||||
|
;
|
||||||
|
ldy fnlen ;must have file name
|
||||||
|
bne ld25 ;yes...ok
|
||||||
|
;
|
||||||
|
jmp error8 ;missing file name
|
||||||
|
;
|
||||||
|
ld25 ldx sa ;save sa in .x
|
||||||
|
jsr luking ;tell user looking
|
||||||
|
lda #$60 ;special load command
|
||||||
|
sta sa
|
||||||
|
jsr openi ;open the file
|
||||||
|
;
|
||||||
|
lda fa
|
||||||
|
jsr talk ;establish the channel
|
||||||
|
lda sa
|
||||||
|
jsr tksa ;tell it to load
|
||||||
|
;
|
||||||
|
jsr acptr ;get first byte
|
||||||
|
sta eal
|
||||||
|
;
|
||||||
|
lda status ;test status for error
|
||||||
|
lsr a
|
||||||
|
lsr a
|
||||||
|
bcs ld90 ;file not found...
|
||||||
|
jsr acptr
|
||||||
|
sta eah
|
||||||
|
;
|
||||||
|
txa ;find out old sa
|
||||||
|
bne ld30 ;sa<>0 use disk address
|
||||||
|
lda memuss ;else load where user wants
|
||||||
|
sta eal
|
||||||
|
lda memuss+1
|
||||||
|
sta eah
|
||||||
|
ld30 jsr loding ;tell user loading
|
||||||
|
;
|
||||||
|
ld40 lda #$fd ;mask off timeout
|
||||||
|
and status
|
||||||
|
sta status
|
||||||
|
;
|
||||||
|
jsr stop ;stop key?
|
||||||
|
bne ld45 ;no...
|
||||||
|
;
|
||||||
|
jmp break ;stop key pressed
|
||||||
|
;
|
||||||
|
ld45 jsr acptr ;get byte off ieee
|
||||||
|
tax
|
||||||
|
lda status ;was there a timeout?
|
||||||
|
lsr a
|
||||||
|
lsr a
|
||||||
|
bcs ld40 ;yes...try again
|
||||||
|
txa
|
||||||
|
ldy verck ;performing verify?
|
||||||
|
beq ld50 ;no...load
|
||||||
|
ldy #0
|
||||||
|
cmp (eal),y ;verify it
|
||||||
|
beq ld60 ;o.k....
|
||||||
|
; lda #sperr ;no good...verify error
|
||||||
|
nop
|
||||||
|
jsr udst ;update status
|
||||||
|
.byt $2c ;skip next store
|
||||||
|
;
|
||||||
|
ld50 sta (eal),y
|
||||||
|
ld60 inc eal ;increment store addr
|
||||||
|
bne ld64
|
||||||
|
inc eah
|
||||||
|
ld64 bit status ;eoi?
|
||||||
|
bvc ld40 ;no...continue load
|
||||||
|
;
|
||||||
|
jsr untlk ;close channel
|
||||||
|
jsr clsei ;close the file
|
||||||
|
bcc ld180 ;branch always
|
||||||
|
;
|
||||||
|
ld90 jmp error4 ;file not found
|
||||||
|
;
|
||||||
|
;load from tape
|
||||||
|
;
|
||||||
|
;carry set by cpx's
|
||||||
|
lda (tape1),y
|
||||||
|
ldy #1
|
||||||
|
sbc (tape1),y
|
||||||
|
tax ;low to .x
|
||||||
|
ldy #4
|
||||||
|
lda (tape1),y
|
||||||
|
ldy #2
|
||||||
|
sbc (tape1),y
|
||||||
|
tay ;high to .y
|
||||||
|
;
|
||||||
|
clc ;ea = sta+(tapea-tapesta)
|
||||||
|
txa
|
||||||
|
adc memuss ;
|
||||||
|
sta eal
|
||||||
|
tya
|
||||||
|
adc memuss+1
|
||||||
|
sta eah
|
||||||
|
lda memuss ;set up starting address
|
||||||
|
sta stal
|
||||||
|
lda memuss+1
|
||||||
|
sta stah
|
||||||
|
jsr loding ;tell user loading
|
||||||
|
;
|
||||||
|
ld180 clc ;good exit
|
||||||
|
;
|
||||||
|
; set up end load address
|
||||||
|
;
|
||||||
|
ldx eal
|
||||||
|
ldy eah
|
||||||
|
;
|
||||||
|
ld190 rts
|
||||||
|
|
||||||
|
;subroutine to print to console:
|
||||||
|
;
|
||||||
|
;searching [for name]
|
||||||
|
;
|
||||||
|
luking lda msgflg ;supposed to print?
|
||||||
|
bpl ld115 ;...no
|
||||||
|
ldy #ms5-ms1 ;"searching"
|
||||||
|
jsr msg
|
||||||
|
lda fnlen
|
||||||
|
beq ld115
|
||||||
|
ldy #ms6-ms1 ;"for"
|
||||||
|
jsr msg
|
||||||
|
|
||||||
|
;subroutine to output file name
|
||||||
|
;
|
||||||
|
outfn ldy fnlen ;is there a name?
|
||||||
|
beq ld115 ;no...done
|
||||||
|
ldy #0
|
||||||
|
ld110 lda (fnadr),y
|
||||||
|
jsr bsout
|
||||||
|
iny
|
||||||
|
cpy fnlen
|
||||||
|
bne ld110
|
||||||
|
;
|
||||||
|
ld115 rts
|
||||||
|
|
||||||
|
;subroutine to print:
|
||||||
|
;
|
||||||
|
;loading/verifing
|
||||||
|
;
|
||||||
|
loding ldy #ms10-ms1 ;assume 'loading'
|
||||||
|
lda verck ;check flag
|
||||||
|
beq ld410 ;are doing load
|
||||||
|
ldy #ms21-ms1 ;are 'verifying'
|
||||||
|
ld410 jmp spmsg
|
||||||
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
.segment "MESSAGES"
|
||||||
|
ms1 .byt $d,"I/O ERROR ",$a3
|
||||||
|
ms5 .byt $d,"SEARCHING",$a0
|
||||||
|
ms6 .byt "FOR",$a0
|
||||||
|
;ms7 .byt $d,"PRESS PLAY ON TAP",$c5
|
||||||
|
;ms8 .byt "PRESS RECORD & PLAY ON TAP",$c5
|
||||||
|
ms10 .byt $d,"LOADIN",$c7
|
||||||
|
ms11 .byt $d,"SAVING",$a0
|
||||||
|
ms21 .byt $d,"VERIFYIN",$c7
|
||||||
|
ms17 .byt $d,"FOUND",$a0
|
||||||
|
ms18 .byt $d,"OK",$8d
|
||||||
|
; ms34 .byt $d,"MONITOR",$8d
|
||||||
|
; ms36 .byt $d,"BREA",$cb
|
||||||
|
|
||||||
|
;print message to screen only if
|
||||||
|
;output enabled
|
||||||
|
;
|
||||||
|
spmsg bit msgflg ;printing messages?
|
||||||
|
bpl msg10 ;no...
|
||||||
|
msg lda ms1,y
|
||||||
|
php
|
||||||
|
and #$7f
|
||||||
|
jsr bsout
|
||||||
|
iny
|
||||||
|
plp
|
||||||
|
bpl msg
|
||||||
|
msg10 clc
|
||||||
|
rts
|
||||||
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
.segment "NBASIN"
|
||||||
|
;***************************************
|
||||||
|
;* basin-- input character from channel*
|
||||||
|
;* input differs from get on device*
|
||||||
|
;* #0 function which is keyboard. the *
|
||||||
|
;* screen editor makes ready an entire *
|
||||||
|
;* line which is passed char by char *
|
||||||
|
;* up to the carriage return. other *
|
||||||
|
;* devices are: *
|
||||||
|
;* 0 -- keyboard *
|
||||||
|
;* 1 -- cassette #1 *
|
||||||
|
;* 2 -- rs232 *
|
||||||
|
;* 3 -- screen *
|
||||||
|
;* 4-31 -- serial bus *
|
||||||
|
;***************************************
|
||||||
|
;
|
||||||
|
nbasin lda dfltn ;check device
|
||||||
|
bne bn10 ;is not keyboard...
|
||||||
|
;
|
||||||
|
;input from keyboard
|
||||||
|
;
|
||||||
|
lda pntr ;save current...
|
||||||
|
sta lstp ;... cursor column
|
||||||
|
lda tblx ;save current...
|
||||||
|
sta lsxp ;... line number
|
||||||
|
jmp loop5 ;blink cursor until return
|
||||||
|
;
|
||||||
|
bn10 cmp #3 ;is input from screen?
|
||||||
|
bne bn20 ;no...
|
||||||
|
;
|
||||||
|
sta crsw ;fake a carriage return
|
||||||
|
lda lnmx ;say we ended...
|
||||||
|
sta indx ;...up on this line
|
||||||
|
jmp loop5 ;pick up characters
|
||||||
|
;
|
||||||
|
bn20 bcs bn30 ;devices >3
|
||||||
|
cmp #2 ;rs232?
|
||||||
|
;input from serial bus
|
||||||
|
bn30 lda status ;status from last
|
||||||
|
beq bn35 ;was good
|
||||||
|
bn31 lda #$d ;bad...all done
|
||||||
|
bn32 clc ;valid data
|
||||||
|
bn33 rts
|
||||||
|
;
|
||||||
|
bn35 jmp acptr ;good...handshake
|
||||||
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
.segment "NBSOUT"
|
||||||
|
;***************************************
|
||||||
|
;* bsout -- out character to channel *
|
||||||
|
;* determined by variable dflto: *
|
||||||
|
;* 0 -- invalid *
|
||||||
|
;* 1 -- cassette #1 *
|
||||||
|
;* 2 -- rs232 *
|
||||||
|
;* 3 -- screen *
|
||||||
|
;* 4-31 -- serial bus *
|
||||||
|
;***************************************
|
||||||
|
;
|
||||||
|
nbsout pha ;preserve .a
|
||||||
|
lda dflto ;check device
|
||||||
|
cmp #3 ;is it the screen?
|
||||||
|
;print to crt
|
||||||
|
;
|
||||||
|
pla ;restore data
|
||||||
|
jmp prt ;print on crt
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;print to serial bus
|
||||||
|
;
|
||||||
|
pla
|
||||||
|
jmp ciout
|
||||||
|
bcs rstor ;abort on stop key
|
||||||
|
;
|
||||||
|
;reset buffer pointer
|
||||||
|
;
|
||||||
|
iny ;make .y=1
|
||||||
|
sty bufpt ;bufpt=1
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;print to crt
|
||||||
|
;
|
||||||
|
pla ;restore data
|
||||||
|
jmp prt ;print on crt
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;print to serial bus
|
||||||
|
;
|
||||||
|
pla
|
||||||
|
jmp ciout
|
||||||
|
bcs rstor ;abort on stop key
|
||||||
|
;
|
||||||
|
;reset buffer pointer
|
||||||
|
;
|
||||||
|
iny ;make .y=1
|
||||||
|
sty bufpt ;bufpt=1
|
||||||
|
;
|
||||||
|
;restore .x and .y
|
||||||
|
;
|
||||||
|
rstoa clc ;good return
|
||||||
|
rstor pla
|
||||||
|
tay
|
||||||
|
pla
|
||||||
|
tax
|
||||||
|
lda t1 ;get .a for return
|
||||||
|
bcc rstor1 ;no error
|
||||||
|
lda #00 ;stop error if c-set
|
||||||
|
rstor1 rts
|
||||||
|
read rts
|
||||||
|
wrtn rts
|
||||||
|
wrtz rts
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
.segment "NGETIN"
|
||||||
|
;***************************************
|
||||||
|
;* getin -- get character from channel *
|
||||||
|
;* channel is determined by dfltn.*
|
||||||
|
;* if device is 0, keyboard queue is *
|
||||||
|
;* examined and a character removed if *
|
||||||
|
;* available. if queue is empty, z *
|
||||||
|
;* flag is returned set. devices 1-31 *
|
||||||
|
;* advance to basin. *
|
||||||
|
;***************************************
|
||||||
|
;
|
||||||
|
ngetin lda dfltn ;check device
|
||||||
|
bne gn10 ;not keyboard
|
||||||
|
;
|
||||||
|
lda ndx ;queue index
|
||||||
|
beq gn20 ;nobody there...exit
|
||||||
|
;
|
||||||
|
sei
|
||||||
|
jmp lp2 ;go remove a character
|
||||||
|
;
|
||||||
|
;gn10 cmp #2 ;is it rs-232
|
||||||
|
; bne bn10 ;no...use basin
|
||||||
|
gn10 jmp bn10
|
||||||
|
;
|
||||||
|
gn20 clc ;good return
|
||||||
|
rts
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
.segment "NMI"
|
||||||
|
nmi sei ;no irq's allowed...
|
||||||
|
jmp (nminv) ;...could mess up cassettes
|
||||||
|
nnmi pha
|
||||||
|
txa
|
||||||
|
pha
|
||||||
|
tya
|
||||||
|
pha
|
||||||
|
nnmi10 lda #$7f ;disable all nmi's
|
||||||
|
sta d2icr
|
||||||
|
ldy d2icr ;check if real nmi...
|
||||||
|
bmi nnmi20 ;no...rs232/other
|
||||||
|
;
|
||||||
|
nnmi18 jsr a0int ;check if $a0 in...no .y
|
||||||
|
bne nnmi19 ;...no
|
||||||
|
jmp ($8002) ;...yes
|
||||||
|
;
|
||||||
|
; check for stop key down
|
||||||
|
;
|
||||||
|
nnmi19
|
||||||
|
jsr ud60 ;no .y
|
||||||
|
jsr stop ;no .y
|
||||||
|
bne nnmi20 ;no stop key...test for rs232
|
||||||
|
;
|
||||||
|
; timb - where system goes on a brk instruction
|
||||||
|
;
|
||||||
|
timb jsr restor ;restore system indirects
|
||||||
|
jsr ioinit ;restore i/o for basic
|
||||||
|
jsr cint ;restore screen for basic
|
||||||
|
jmp ($a002) ;...no, so basic warm start
|
||||||
|
|
||||||
|
; disable nmi's untill ready
|
||||||
|
; save on stack
|
||||||
|
;
|
||||||
|
nnmi20 tya ;.y saved through restore
|
||||||
|
and enabl ;show only enables
|
||||||
|
tax ;save in .x for latter
|
||||||
|
;
|
||||||
|
; t1 nmi check - transmitt a bit
|
||||||
|
;
|
||||||
|
and #$01 ;check for t1
|
||||||
|
beq nnmi30 ;no...
|
||||||
|
;
|
||||||
|
lda d2pra
|
||||||
|
and #$ff-$04 ;fix for current i/o
|
||||||
|
ora nxtbit ;load data and...
|
||||||
|
sta d2pra ;...send it
|
||||||
|
;
|
||||||
|
lda enabl ;restore nmi's
|
||||||
|
sta d2icr ;ready for next...
|
||||||
|
;
|
||||||
|
; because of 6526 icr structure...
|
||||||
|
; handle another nmi as a subroutine
|
||||||
|
;
|
||||||
|
txa ;test for another nmi
|
||||||
|
and #$12 ;test for t2 or flag
|
||||||
|
beq nnmi25
|
||||||
|
and #$02 ;check for t2
|
||||||
|
;
|
||||||
|
jmp nnmi25 ;...then continue output
|
||||||
|
;
|
||||||
|
nnmi25 jmp nmirti
|
||||||
|
;
|
||||||
|
|
||||||
|
; t2 nmi check - recieve a bit
|
||||||
|
;
|
||||||
|
nnmi30 txa
|
||||||
|
and #$02 ;mask to t2
|
||||||
|
beq nnmi40 ;no...
|
||||||
|
;
|
||||||
|
jmp nmirti
|
||||||
|
|
||||||
|
; flag nmi handler - recieve a start bit
|
||||||
|
;
|
||||||
|
nnmi40 txa ;check for edge
|
||||||
|
and #$10 ;on flag...
|
||||||
|
beq nmirti ;no...
|
||||||
|
;
|
||||||
|
|
||||||
|
nmirti lda enabl ;restore nmi's
|
||||||
|
sta d2icr
|
||||||
|
prend pla ;because of missing screen editor
|
||||||
|
tay
|
||||||
|
pla
|
||||||
|
tax
|
||||||
|
pla
|
||||||
|
rti
|
||||||
+246
@@ -0,0 +1,246 @@
|
|||||||
|
.segment "OPEN"
|
||||||
|
;***********************************
|
||||||
|
;* *
|
||||||
|
;* open function *
|
||||||
|
;* *
|
||||||
|
;* creates an entry in the logical *
|
||||||
|
;* files tables consisting of *
|
||||||
|
;* logical file number--la, device *
|
||||||
|
;* number--fa, and secondary cmd-- *
|
||||||
|
;* sa. *
|
||||||
|
;* *
|
||||||
|
;* a file name descriptor, fnadr & *
|
||||||
|
;* fnlen are passed to this routine*
|
||||||
|
;* *
|
||||||
|
;***********************************
|
||||||
|
;
|
||||||
|
nopen ldx la ;check file #
|
||||||
|
bne op98 ;is not the keyboard
|
||||||
|
;
|
||||||
|
jmp error6 ;not input file...
|
||||||
|
;
|
||||||
|
op98 jsr lookup ;see if in table
|
||||||
|
bne op100 ;not found...o.k.
|
||||||
|
;
|
||||||
|
jmp error2 ;file open
|
||||||
|
;
|
||||||
|
op100 ldx ldtnd ;logical device table end
|
||||||
|
cpx #10 ;maximum # of open files
|
||||||
|
bcc op110 ;less than 10...o.k.
|
||||||
|
;
|
||||||
|
jmp error1 ;too many files
|
||||||
|
;
|
||||||
|
op110 inc ldtnd ;new file
|
||||||
|
lda la
|
||||||
|
sta lat,x ;store logical file #
|
||||||
|
lda sa
|
||||||
|
ora #$60 ;make sa an serial command
|
||||||
|
sta sa
|
||||||
|
sta sat,x ;store command #
|
||||||
|
lda fa
|
||||||
|
sta fat,x ;store device #
|
||||||
|
;
|
||||||
|
;perform device specific open tasks
|
||||||
|
;
|
||||||
|
beq op175 ;is keyboard...done.
|
||||||
|
cmp #3
|
||||||
|
beq op175 ;is screen...done.
|
||||||
|
; bcc op150 ;are cassettes 1 & 2
|
||||||
|
;
|
||||||
|
jsr openi ;is on serial...open it
|
||||||
|
bcc op175 ;branch always...done
|
||||||
|
;
|
||||||
|
;perform tape open stuff
|
||||||
|
;
|
||||||
|
;op150 cmp #2
|
||||||
|
; jmp opn232
|
||||||
|
;
|
||||||
|
;op155 lda sa
|
||||||
|
and #$f ;mask off command
|
||||||
|
;
|
||||||
|
;op160 jmp error4 ;file not found
|
||||||
|
;
|
||||||
|
;op170
|
||||||
|
; beq op180 ;stop key pressed
|
||||||
|
; bcc op171 ;all o.k.
|
||||||
|
; bcs op160 ;file not found...
|
||||||
|
;
|
||||||
|
;open cassette tape for write
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;finish open for tape read/write
|
||||||
|
;
|
||||||
|
;op171 lda #bufsz-1 ;assume force read
|
||||||
|
;
|
||||||
|
; ldy sa
|
||||||
|
; cpy #$60 ;open for read?
|
||||||
|
; beq op172
|
||||||
|
;
|
||||||
|
;set pointers for buffering data
|
||||||
|
;
|
||||||
|
; ldy #0
|
||||||
|
; lda #bdf ;type flag for block
|
||||||
|
; sta (tape1),y ;to begin of buffer
|
||||||
|
; tya
|
||||||
|
;
|
||||||
|
;op172 sta bufpt ;point to data
|
||||||
|
op175 clc ;flag good open
|
||||||
|
op180 rts ;exit in peace
|
||||||
|
|
||||||
|
openi lda sa
|
||||||
|
bmi op175 ;no sa...done
|
||||||
|
;
|
||||||
|
ldy fnlen
|
||||||
|
beq op175 ;no file name...done
|
||||||
|
;
|
||||||
|
lda #0 ;clear the serial status
|
||||||
|
sta status
|
||||||
|
;
|
||||||
|
lda fa
|
||||||
|
jsr listn ;device la to listen
|
||||||
|
;
|
||||||
|
lda sa
|
||||||
|
ora #$f0
|
||||||
|
jsr secnd
|
||||||
|
;
|
||||||
|
lda status ;anybody home?
|
||||||
|
bpl op35 ;yes...continue
|
||||||
|
;
|
||||||
|
;this routine is called by other
|
||||||
|
;kernal routines which are called
|
||||||
|
;directly by os. kill return
|
||||||
|
;address to return to os.
|
||||||
|
;
|
||||||
|
pla
|
||||||
|
pla
|
||||||
|
jmp error5 ;device not present
|
||||||
|
;
|
||||||
|
op35 lda fnlen
|
||||||
|
beq op45 ;no name...done sequence
|
||||||
|
;
|
||||||
|
;send file name over serial
|
||||||
|
;
|
||||||
|
ldy #0
|
||||||
|
op40 lda (fnadr),y
|
||||||
|
jsr ciout
|
||||||
|
iny
|
||||||
|
cpy fnlen
|
||||||
|
bne op40
|
||||||
|
;
|
||||||
|
op45 jmp cunlsn ;jsr unlsn: clc: rts
|
||||||
|
|
||||||
|
; opn232 - open an rs-232 or parallel port file
|
||||||
|
;
|
||||||
|
; variables initilized
|
||||||
|
; bitnum - # of bits to be sent calc from m51ctr
|
||||||
|
; baudof - baud rate full
|
||||||
|
; rsstat - rs-232 status reg
|
||||||
|
; m51ctr - 6551 control reg
|
||||||
|
; m51cdr - 6551 command reg
|
||||||
|
; m51ajb - user baud rate (clock/baud/2-100)
|
||||||
|
; enabl - 6526 nmi enables (1-nmi bit on)
|
||||||
|
;
|
||||||
|
;opn232 jsr cln232 ;set up rs232, .y=0 on return
|
||||||
|
;
|
||||||
|
; pass prams to m51regs
|
||||||
|
;
|
||||||
|
; sty rsstat ;clear status
|
||||||
|
;
|
||||||
|
;opn020 cpy fnlen ;check if at end of filename
|
||||||
|
; beq opn025 ;yes...
|
||||||
|
;
|
||||||
|
; lda (fnadr),y ;move data
|
||||||
|
; sta m51ctr,y ;to m51regs
|
||||||
|
; iny
|
||||||
|
; cpy #4 ;only 4 possible prams
|
||||||
|
; bne opn020
|
||||||
|
;
|
||||||
|
; calc # of bits
|
||||||
|
;
|
||||||
|
;opn025 jsr bitcnt
|
||||||
|
; stx bitnum
|
||||||
|
;
|
||||||
|
; calc baud rate
|
||||||
|
;
|
||||||
|
; lda m51ctr
|
||||||
|
; and #$0f
|
||||||
|
; beq opn028
|
||||||
|
;
|
||||||
|
; calculate start-test rate...
|
||||||
|
; different than original release 901227-01
|
||||||
|
;
|
||||||
|
; asl a ;get offset into tables
|
||||||
|
; tax
|
||||||
|
; lda palnts ;get tv standard
|
||||||
|
; bne opn026
|
||||||
|
; ldy baudo-1,x ;ntsc standard
|
||||||
|
; lda baudo-2,x
|
||||||
|
; jmp opn027
|
||||||
|
;
|
||||||
|
;opn026 ldy baudop-1,x ;pal standard
|
||||||
|
; lda baudop-2,x
|
||||||
|
opn027 sty m51ajb+1 ;hold start rate in m51ajb
|
||||||
|
sta m51ajb
|
||||||
|
opn028 lda m51ajb ;calculate baud rate
|
||||||
|
asl
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
; check for 3/x line response
|
||||||
|
;
|
||||||
|
opn030 lda m51cdr ;bit 0 of m51cdr
|
||||||
|
lsr a
|
||||||
|
bcc opn050 ;...3 line
|
||||||
|
;
|
||||||
|
; check for x line proper states
|
||||||
|
;
|
||||||
|
lda d2prb
|
||||||
|
asl a
|
||||||
|
bcs opn050
|
||||||
|
; jsr ckdsrx ;change from jmp to prevent system
|
||||||
|
;
|
||||||
|
; set up buffer pointers (dbe=dbs)
|
||||||
|
;
|
||||||
|
opn050 lda ridbe
|
||||||
|
sta ridbs
|
||||||
|
lda rodbe
|
||||||
|
sta rodbs
|
||||||
|
;
|
||||||
|
; allocate buffers
|
||||||
|
;
|
||||||
|
opn055 jsr gettop ;get memsiz
|
||||||
|
lda ribuf+1 ;in allocation...
|
||||||
|
bne opn060 ;already
|
||||||
|
dey ;there goes 256 bytes
|
||||||
|
sty ribuf+1
|
||||||
|
stx ribuf
|
||||||
|
opn060 lda robuf+1 ;out allocation...
|
||||||
|
bne memtcf ;alreay
|
||||||
|
dey ;there goes 256 bytes
|
||||||
|
sty robuf+1
|
||||||
|
stx robuf
|
||||||
|
memtcf sec ;signal top of memory change
|
||||||
|
lda #$f0
|
||||||
|
jmp settop ;top changed
|
||||||
|
;
|
||||||
|
; cln232 - clean up 232 system for open/close
|
||||||
|
; set up ddrb and cb2 for rs-232
|
||||||
|
;
|
||||||
|
cln232 lda #$7f ;clear nmi's
|
||||||
|
sta d2icr
|
||||||
|
lda #%00000110 ;ddrb
|
||||||
|
sta d2ddrb
|
||||||
|
sta d2prb ;dtr,rts high
|
||||||
|
lda #$04 ;output high pa2
|
||||||
|
ora d2pra
|
||||||
|
sta d2pra
|
||||||
|
ldy #00
|
||||||
|
sty enabl ;clear enabls
|
||||||
|
rts
|
||||||
|
|
||||||
|
; rsr 8/25/80 - add rs-232 code
|
||||||
|
; rsr 8/26/80 - top of memory handler
|
||||||
|
; rsr 8/29/80 - add filename to m51regs
|
||||||
|
; rsr 9/02/80 - fix ordering of rs-232 routines
|
||||||
|
; rsr 12/11/81 - modify for vic-40 i/o
|
||||||
|
; rsr 2/08/82 - clear status in openi
|
||||||
|
; rsr 5/12/82 - compact rs232 open/close code
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
.segment "OPENC"
|
||||||
|
;***************************************
|
||||||
|
;* chkin -- open channel for input *
|
||||||
|
;* *
|
||||||
|
;* the number of the logical file to be*
|
||||||
|
;* opened for input is passed in .x. *
|
||||||
|
;* chkin searches the logical file *
|
||||||
|
;* to look up device and command info. *
|
||||||
|
;* errors are reported if the device *
|
||||||
|
;* was not opened for input ,(e.g. *
|
||||||
|
;* cassette write file), or the logical*
|
||||||
|
;* file has no reference in the tables.*
|
||||||
|
;* device 0, (keyboard), and device 3 *
|
||||||
|
;* (screen), require no table entries *
|
||||||
|
;* and are handled separate. *
|
||||||
|
;***************************************
|
||||||
|
;
|
||||||
|
nchkin jsr lookup ;see if file known
|
||||||
|
beq jx310 ;yup...
|
||||||
|
;
|
||||||
|
jmp error3 ;no...file not open
|
||||||
|
;
|
||||||
|
jx310 jsr jz100 ;extract file info
|
||||||
|
;
|
||||||
|
lda fa
|
||||||
|
beq jx320 ;is keyboard...done.
|
||||||
|
;
|
||||||
|
;could be screen, keyboard, or serial
|
||||||
|
;
|
||||||
|
cmp #3
|
||||||
|
beq jx320 ;is screen...done.
|
||||||
|
bcs jx330 ;is serial...address it
|
||||||
|
cmp #2 ;rs232?
|
||||||
|
bne jx315 ;no...
|
||||||
|
;
|
||||||
|
; jmp cki232
|
||||||
|
;
|
||||||
|
;some extra checks for tape
|
||||||
|
;
|
||||||
|
jx315 ldx sa
|
||||||
|
cpx #$60 ;is command a read?
|
||||||
|
beq jx320 ;yes...o.k....done
|
||||||
|
;
|
||||||
|
jmp error6 ;not input file
|
||||||
|
;
|
||||||
|
jx320 sta dfltn ;all input come from here
|
||||||
|
;
|
||||||
|
clc ;good exit
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
;an serial device has to be a talker
|
||||||
|
;
|
||||||
|
jx330 tax ;device # for dflto
|
||||||
|
jsr talk ;tell him to talk
|
||||||
|
;
|
||||||
|
lda sa ;a second?
|
||||||
|
bpl jx340 ;yes...send it
|
||||||
|
jsr tkatn ;no...let go
|
||||||
|
jmp jx350
|
||||||
|
;
|
||||||
|
jx340 jsr tksa ;send second
|
||||||
|
;
|
||||||
|
jx350 txa
|
||||||
|
bit status ;did he listen?
|
||||||
|
bpl jx320 ;yes
|
||||||
|
;
|
||||||
|
jmp error5 ;device not present
|
||||||
|
|
||||||
|
;***************************************
|
||||||
|
;* chkout -- open channel for output *
|
||||||
|
;* *
|
||||||
|
;* the number of the logical file to be*
|
||||||
|
;* opened for output is passed in .x. *
|
||||||
|
;* chkout searches the logical file *
|
||||||
|
;* to look up device and command info. *
|
||||||
|
;* errors are reported if the device *
|
||||||
|
;* was not opened for input ,(e.g. *
|
||||||
|
;* keyboard), or the logical file has *
|
||||||
|
;* reference in the tables. *
|
||||||
|
;* device 0, (keyboard), and device 3 *
|
||||||
|
;* (screen), require no table entries *
|
||||||
|
;* and are handled separate. *
|
||||||
|
;***************************************
|
||||||
|
;
|
||||||
|
nckout jsr lookup ;is file in table?
|
||||||
|
beq ck5 ;yes...
|
||||||
|
;
|
||||||
|
jmp error3 ;no...file not open
|
||||||
|
;
|
||||||
|
ck5 jsr jz100 ;extract table info
|
||||||
|
;
|
||||||
|
lda fa ;is it keyboard?
|
||||||
|
bne ck10 ;no...something else.
|
||||||
|
;
|
||||||
|
ck20 jmp error7 ;yes...not output file
|
||||||
|
;
|
||||||
|
;could be screen,serial,or tapes
|
||||||
|
;
|
||||||
|
ck10 cmp #3
|
||||||
|
beq ck30 ;is screen...done
|
||||||
|
bcs ck40 ;is serial...address it
|
||||||
|
; cmp #2 ;rs232?
|
||||||
|
; bne ck15
|
||||||
|
;
|
||||||
|
; jmp cko232
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;special tape channel handling
|
||||||
|
;
|
||||||
|
ck15 ldx sa
|
||||||
|
cpx #$60 ;is command read?
|
||||||
|
beq ck20 ;yes...error
|
||||||
|
;
|
||||||
|
ck30 sta dflto ;all output goes here
|
||||||
|
;
|
||||||
|
clc ;good exit
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
ck40 tax ;save device for dflto
|
||||||
|
jsr listn ;tell him to listen
|
||||||
|
;
|
||||||
|
lda sa ;is there a second?
|
||||||
|
bpl ck50 ;yes...
|
||||||
|
;
|
||||||
|
jsr scatn ;no...release lines
|
||||||
|
bne ck60 ;branch always
|
||||||
|
;
|
||||||
|
ck50 jsr secnd ;send second...
|
||||||
|
;
|
||||||
|
ck60 txa
|
||||||
|
bit status ;did he listen?
|
||||||
|
bpl ck30 ;yes...finish up
|
||||||
|
;
|
||||||
|
jmp error5 ;no...device not present
|
||||||
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
.segment "KPATCH"
|
||||||
|
|
||||||
|
; unused patch area
|
||||||
|
.res 28, $aa
|
||||||
|
|
||||||
|
; prtyp - rs232 parity patch...added 901227-03
|
||||||
|
;
|
||||||
|
prtyp sta rinone ;good receiver start...disable flag
|
||||||
|
lda #1 ;set parity to 1 always
|
||||||
|
sta riprty
|
||||||
|
rts
|
||||||
|
|
||||||
|
; cpatch - fix to clear line...modified 901227-03
|
||||||
|
; prevents white character flash...
|
||||||
|
cpatch ;always clear to current foregnd color
|
||||||
|
lda color
|
||||||
|
sta (user),y
|
||||||
|
rts
|
||||||
|
|
||||||
|
; fpatch - tape filename timeout
|
||||||
|
;
|
||||||
|
fpatch adc #2 ;time is (8 to 13 sec of display)
|
||||||
|
fpat00 ldy stkey ;check for key down on last row...
|
||||||
|
iny
|
||||||
|
bne fpat01 ;key...exit loop
|
||||||
|
cmp time+1 ;watch timer
|
||||||
|
bne fpat00
|
||||||
|
fpat01 rts
|
||||||
|
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
.segment "SAVE"
|
||||||
|
;***********************************
|
||||||
|
;* save *
|
||||||
|
;* *
|
||||||
|
;* saves to cassette 1 or 2, or *
|
||||||
|
;* ieee devices 4>=n>=31 as select-*
|
||||||
|
;* ed by variable fa. *
|
||||||
|
;* *
|
||||||
|
;*start of save is indirect at .a *
|
||||||
|
;*end of save is .x,.y *
|
||||||
|
;***********************************
|
||||||
|
|
||||||
|
savesp stx eal
|
||||||
|
sty eah
|
||||||
|
tax ;set up start
|
||||||
|
lda $00,x
|
||||||
|
sta stal
|
||||||
|
lda $01,x
|
||||||
|
sta stah
|
||||||
|
;
|
||||||
|
save jmp (isave)
|
||||||
|
nsave lda fa ;***monitor entry
|
||||||
|
bne sv20
|
||||||
|
;
|
||||||
|
sv10 jmp error9 ;bad device #
|
||||||
|
;
|
||||||
|
sv20 cmp #3
|
||||||
|
beq sv10
|
||||||
|
bcc sv10
|
||||||
|
lda #$61
|
||||||
|
sta sa
|
||||||
|
ldy fnlen
|
||||||
|
bne sv25
|
||||||
|
jmp error8 ;missing file name
|
||||||
|
;
|
||||||
|
sv25 jsr openi
|
||||||
|
jsr saving
|
||||||
|
lda fa
|
||||||
|
jsr listn
|
||||||
|
lda sa
|
||||||
|
jsr secnd
|
||||||
|
ldy #0
|
||||||
|
lda sal
|
||||||
|
jsr ciout
|
||||||
|
lda sah
|
||||||
|
jsr ciout
|
||||||
|
;
|
||||||
|
sv30 jsr unlsn
|
||||||
|
lda (sal),y
|
||||||
|
jsr ciout
|
||||||
|
jsr stop
|
||||||
|
bne sv30
|
||||||
|
;
|
||||||
|
break jsr clsei
|
||||||
|
lda #0
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
clsei bit sa
|
||||||
|
bmi clsei2
|
||||||
|
lda fa
|
||||||
|
jsr listn
|
||||||
|
lda sa
|
||||||
|
and #$ef
|
||||||
|
ora #$e0
|
||||||
|
jsr secnd
|
||||||
|
;
|
||||||
|
clsei2 clc
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
;sv115 rts
|
||||||
|
|
||||||
|
;subroutine to output:
|
||||||
|
;'saving <file name>'
|
||||||
|
;
|
||||||
|
saving lda msgflg
|
||||||
|
; bpl sv115 ;no print
|
||||||
|
ldy #ms11-ms1 ;'saving'
|
||||||
|
jsr msg
|
||||||
|
jmp outfn ;<file name>
|
||||||
|
|
||||||
@@ -0,0 +1,310 @@
|
|||||||
|
.segment "SERIAL"
|
||||||
|
;command serial bus device to talk
|
||||||
|
;
|
||||||
|
talk ora #$40 ;make a talk adr
|
||||||
|
.byt $2c ;skip two bytes
|
||||||
|
|
||||||
|
;command serial bus device to listen
|
||||||
|
;
|
||||||
|
listn ora #$20 ;make a listen adr
|
||||||
|
; jsr rsp232 ;protect self from rs232 nmi's
|
||||||
|
list1 pha
|
||||||
|
;
|
||||||
|
;
|
||||||
|
bit c3p0 ;character left in buf?
|
||||||
|
bpl list2 ;no...
|
||||||
|
;
|
||||||
|
;send buffered character
|
||||||
|
;
|
||||||
|
sec ;set eoi flag
|
||||||
|
ror r2d2
|
||||||
|
;
|
||||||
|
jsr isour ;send last character
|
||||||
|
;
|
||||||
|
lsr c3p0 ;buffer clear flag
|
||||||
|
lsr r2d2 ;clear eoi flag
|
||||||
|
;
|
||||||
|
;
|
||||||
|
list2 pla ;talk/listen address
|
||||||
|
sta bsour
|
||||||
|
sei
|
||||||
|
jsr datahi
|
||||||
|
cmp #$3f ;clkhi only on unlisten
|
||||||
|
bne list5
|
||||||
|
jsr clkhi
|
||||||
|
;
|
||||||
|
list5 lda d2pra ;assert attention
|
||||||
|
ora #$08
|
||||||
|
sta d2pra
|
||||||
|
;
|
||||||
|
|
||||||
|
isoura sei
|
||||||
|
jsr clklo ;set clock line low
|
||||||
|
jsr datahi
|
||||||
|
jsr w1ms ;delay 1 ms
|
||||||
|
|
||||||
|
isour sei ;no irq's allowed
|
||||||
|
jsr datahi ;make sure data is released
|
||||||
|
jsr debpia ;data should be low
|
||||||
|
bcs nodev
|
||||||
|
jsr clkhi ;clock line high
|
||||||
|
bit r2d2 ;eoi flag test
|
||||||
|
bpl noeoi
|
||||||
|
; do the eoi
|
||||||
|
isr02 jsr debpia ;wait for data to go high
|
||||||
|
bcc isr02
|
||||||
|
;
|
||||||
|
isr03 jsr debpia ;wait for data to go low
|
||||||
|
bcs isr03
|
||||||
|
;
|
||||||
|
noeoi jsr debpia ;wait for data high
|
||||||
|
bcc noeoi
|
||||||
|
jsr clklo ;set clock low
|
||||||
|
;
|
||||||
|
; set to send data
|
||||||
|
;
|
||||||
|
lda #$08 ;count 8 bits
|
||||||
|
sta count
|
||||||
|
;
|
||||||
|
isr01
|
||||||
|
lda d2pra ;debounce the bus
|
||||||
|
cmp d2pra
|
||||||
|
bne isr01
|
||||||
|
asl a ;set the flags
|
||||||
|
bcc frmerr ;data must be hi
|
||||||
|
;
|
||||||
|
ror bsour ;next bit into carry
|
||||||
|
bcs isrhi
|
||||||
|
jsr datalo
|
||||||
|
bne isrclk
|
||||||
|
isrhi jsr datahi
|
||||||
|
isrclk jsr clkhi ;clock hi
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
lda d2pra
|
||||||
|
and #$ff-$20 ;data high
|
||||||
|
ora #$10 ;clock low
|
||||||
|
sta d2pra
|
||||||
|
dec count
|
||||||
|
bne isr01
|
||||||
|
lda #$04 ;set timer for 1ms
|
||||||
|
sta d1t2h
|
||||||
|
lda #timrb ;trigger timer
|
||||||
|
sta d1crb
|
||||||
|
lda d1icr ;clear the timer flags<<<<<<<<<<<<<
|
||||||
|
isr04 lda d1icr
|
||||||
|
and #$02
|
||||||
|
bne frmerr
|
||||||
|
jsr debpia
|
||||||
|
bcs isr04
|
||||||
|
cli ;let irq's continue
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
nodev ;device not present error
|
||||||
|
lda #$80
|
||||||
|
.byt $2c
|
||||||
|
frmerr ;framing error
|
||||||
|
lda #$03
|
||||||
|
csberr jsr udst ;commodore serial buss error entry
|
||||||
|
cli ;irq's were off...turn on
|
||||||
|
clc ;make sure no kernal error returned
|
||||||
|
bcc dlabye ;turn atn off ,release all lines
|
||||||
|
;
|
||||||
|
|
||||||
|
;send secondary address after listen
|
||||||
|
;
|
||||||
|
secnd sta bsour ;buffer character
|
||||||
|
jsr isoura ;send it
|
||||||
|
|
||||||
|
;release attention after listen
|
||||||
|
;
|
||||||
|
scatn lda d2pra
|
||||||
|
and #$ff-$08
|
||||||
|
sta d2pra ;release attention
|
||||||
|
rts
|
||||||
|
|
||||||
|
;talk second address
|
||||||
|
;
|
||||||
|
tksa sta bsour ;buffer character
|
||||||
|
jsr isoura ;send second addr
|
||||||
|
|
||||||
|
tkatn ;shift over to listener
|
||||||
|
sei ;no irq's here
|
||||||
|
jsr datalo ;data line low
|
||||||
|
jsr scatn
|
||||||
|
jsr clkhi ;clock line high jsr/rts
|
||||||
|
tkatn1 jsr debpia ;wait for clock to go low
|
||||||
|
bmi tkatn1
|
||||||
|
cli ;irq's okay now
|
||||||
|
rts
|
||||||
|
|
||||||
|
;buffered output to serial bus
|
||||||
|
;
|
||||||
|
ciout bit c3p0 ;buffered char?
|
||||||
|
bmi ci2 ;yes...send last
|
||||||
|
;
|
||||||
|
sec ;no...
|
||||||
|
ror c3p0 ;set buffered char flag
|
||||||
|
bne ci4 ;branch always
|
||||||
|
;
|
||||||
|
ci2 pha ;save current char
|
||||||
|
jsr isour ;send last char
|
||||||
|
pla ;restore current char
|
||||||
|
ci4 sta bsour ;buffer current char
|
||||||
|
clc ;carry-good exit
|
||||||
|
rts
|
||||||
|
|
||||||
|
;send untalk command on serial bus
|
||||||
|
;
|
||||||
|
untlk sei
|
||||||
|
jsr clklo
|
||||||
|
lda d2pra ;pull atn
|
||||||
|
ora #$08
|
||||||
|
sta d2pra
|
||||||
|
lda #$5f ;untalk command
|
||||||
|
.byt $2c ;skip two bytes
|
||||||
|
|
||||||
|
;send unlisten command on serial bus
|
||||||
|
;
|
||||||
|
unlsn lda #$3f ;unlisten command
|
||||||
|
jsr list1 ;send it
|
||||||
|
;
|
||||||
|
; release all lines
|
||||||
|
dlabye jsr scatn ;always release atn
|
||||||
|
; delay then release clock and data
|
||||||
|
;
|
||||||
|
dladlh txa ;delay approx 60 us
|
||||||
|
ldx #10
|
||||||
|
dlad00 dex
|
||||||
|
bne dlad00
|
||||||
|
tax
|
||||||
|
jsr clkhi
|
||||||
|
jmp datahi
|
||||||
|
|
||||||
|
;input a byte from serial bus
|
||||||
|
;
|
||||||
|
acptr
|
||||||
|
sei ;no irq allowed
|
||||||
|
lda #$00 ;set eoi/error flag
|
||||||
|
sta count
|
||||||
|
jsr clkhi ;make sure clock line is released
|
||||||
|
acp00a jsr debpia ;wait for clock high
|
||||||
|
bpl acp00a
|
||||||
|
;
|
||||||
|
eoiacp
|
||||||
|
lda #$01 ;set timer 2 for 256us
|
||||||
|
sta d1t2h
|
||||||
|
lda #timrb
|
||||||
|
sta d1crb
|
||||||
|
jsr datahi ;data line high (makes timming more like vic-20
|
||||||
|
lda d1icr ;clear the timer flags<<<<<<<<<<<<
|
||||||
|
acp00 lda d1icr
|
||||||
|
and #$02 ;check the timer
|
||||||
|
bne acp00b ;ran out.....
|
||||||
|
jsr debpia ;check the clock line
|
||||||
|
bmi acp00 ;no not yet
|
||||||
|
bpl acp01 ;yes.....
|
||||||
|
;
|
||||||
|
acp00b lda count ;check for error (twice thru timeouts)
|
||||||
|
beq acp00c
|
||||||
|
lda #2
|
||||||
|
jmp csberr ; st = 2 read timeout
|
||||||
|
;
|
||||||
|
; timer ran out do an eoi thing
|
||||||
|
;
|
||||||
|
acp00c jsr datalo ;data line low
|
||||||
|
jsr clkhi ; delay and then set datahi (fix for 40us c64)
|
||||||
|
lda #$40
|
||||||
|
jsr udst ;or an eoi bit into status
|
||||||
|
inc count ;go around again for error check on eoi
|
||||||
|
bne eoiacp
|
||||||
|
;
|
||||||
|
; do the byte transfer
|
||||||
|
;
|
||||||
|
acp01 lda #08 ;set up counter
|
||||||
|
sta count
|
||||||
|
;
|
||||||
|
acp03 lda d2pra ;wait for clock high
|
||||||
|
cmp d2pra ;debounce
|
||||||
|
bne acp03
|
||||||
|
asl a ;shift data into carry
|
||||||
|
bpl acp03 ;clock still low...
|
||||||
|
ror bsour1 ;rotate data in
|
||||||
|
;
|
||||||
|
acp03a lda d2pra ;wait for clock low
|
||||||
|
cmp d2pra ;debounce
|
||||||
|
bne acp03a
|
||||||
|
asl a
|
||||||
|
bmi acp03a
|
||||||
|
dec count
|
||||||
|
bne acp03 ;more bits.....
|
||||||
|
;...exit...
|
||||||
|
jsr datalo ;data low
|
||||||
|
bit status ;check for eoi
|
||||||
|
bvc acp04 ;none...
|
||||||
|
;
|
||||||
|
jsr dladlh ;delay then set data high
|
||||||
|
;
|
||||||
|
acp04 lda bsour1
|
||||||
|
cli ;irq is ok
|
||||||
|
clc ;good exit
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
clkhi ;set clock line high (inverted)
|
||||||
|
lda d2pra
|
||||||
|
and #$ff-$10
|
||||||
|
sta d2pra
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
clklo ;set clock line low (inverted)
|
||||||
|
lda d2pra
|
||||||
|
ora #$10
|
||||||
|
sta d2pra
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
;
|
||||||
|
datahi ;set data line high (inverted)
|
||||||
|
lda d2pra
|
||||||
|
and #$ff-$20
|
||||||
|
sta d2pra
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
datalo ;set data line low (inverted)
|
||||||
|
lda d2pra
|
||||||
|
ora #$20
|
||||||
|
sta d2pra
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
debpia lda d2pra ;debounce the pia
|
||||||
|
cmp d2pra
|
||||||
|
bne debpia
|
||||||
|
asl a ;shift the data bit into the carry...
|
||||||
|
rts ;...and the clock into neg flag
|
||||||
|
;
|
||||||
|
w1ms ;delay 1ms using loop
|
||||||
|
txa ;save .x
|
||||||
|
ldx #200-16 ;1000us-(1000/500*8=#40us holds)
|
||||||
|
w1ms1 dex ;5us loop
|
||||||
|
bne w1ms1
|
||||||
|
tax ;restore .x
|
||||||
|
rts
|
||||||
|
|
||||||
|
;*******************************
|
||||||
|
;written 8/11/80 bob fairbairn
|
||||||
|
;test serial0.6 8/12/80 rjf
|
||||||
|
;change i/o structure 8/21/80 rjf
|
||||||
|
;more i/o changes 8/24/80 rjf
|
||||||
|
;final release into kernal 8/26/80 rjf
|
||||||
|
;some clean up 9/8/80 rsr
|
||||||
|
;add irq protect on isour and tkatn 9/22/80 rsr
|
||||||
|
;fix untalk 10/7/80 rsr
|
||||||
|
;modify for vic-40 i/o system 12/08/81 rsr
|
||||||
|
;add sei to (untlk,isoura,list2) 12/14/81 rsr
|
||||||
|
;modify for 6526 flags fix errs 12/31/81 rsr
|
||||||
|
;modify for commodore 64 i/o 3/11/82 rsr
|
||||||
|
;change acptr eoi for better response 3/28/82 rsr
|
||||||
|
;change wait 1 ms routine for less code 4/8/82 rsr
|
||||||
|
;******************************
|
||||||
|
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
.segment "TIME"
|
||||||
|
;***********************************
|
||||||
|
;* *
|
||||||
|
;* time *
|
||||||
|
;* *
|
||||||
|
;*consists of three functions: *
|
||||||
|
;* (1) udtim-- update time. usually*
|
||||||
|
;* called every 60th second. *
|
||||||
|
;* (2) settim-- set time. .y=msd, *
|
||||||
|
;* .x=next significant,.a=lsd *
|
||||||
|
;* (3) rdtim-- read time. .y=msd, *
|
||||||
|
;* .x=next significant,.a=lsd *
|
||||||
|
;* *
|
||||||
|
;***********************************
|
||||||
|
|
||||||
|
;interrupts are coming from the 6526 timers
|
||||||
|
;
|
||||||
|
udtim ldx #0 ;pre-load for later
|
||||||
|
;
|
||||||
|
;here we proceed with an increment
|
||||||
|
;of the time register.
|
||||||
|
;
|
||||||
|
ud20 inc time+2
|
||||||
|
bne ud30
|
||||||
|
inc time+1
|
||||||
|
bne ud30
|
||||||
|
inc time
|
||||||
|
;
|
||||||
|
;here we check for roll-over 23:59:59
|
||||||
|
;and reset the clock to zero if true
|
||||||
|
;
|
||||||
|
ud30 sec
|
||||||
|
lda time+2
|
||||||
|
sbc #$01
|
||||||
|
lda time+1
|
||||||
|
sbc #$1a
|
||||||
|
lda time
|
||||||
|
sbc #$4f
|
||||||
|
bcc ud60
|
||||||
|
;
|
||||||
|
;time has rolled--zero register
|
||||||
|
;
|
||||||
|
stx time
|
||||||
|
stx time+1
|
||||||
|
stx time+2
|
||||||
|
;
|
||||||
|
;set stop key flag here
|
||||||
|
;
|
||||||
|
ud60 lda rows ;wait for it to settle
|
||||||
|
cmp rows
|
||||||
|
bne ud60 ;still bouncing
|
||||||
|
tax ;set flags...
|
||||||
|
bmi ud80 ;no stop key...exit stop key=$7f
|
||||||
|
ldx #$ff-$42 ;check for a shift key (c64 keyboard)
|
||||||
|
stx colm
|
||||||
|
ud70 ldx rows ;wait to settle...
|
||||||
|
cpx rows
|
||||||
|
bne ud70
|
||||||
|
sta colm ;!!!!!watch out...stop key .a=$7f...same as colms was...
|
||||||
|
inx ;any key down aborts
|
||||||
|
bne ud90 ;leave same as before...
|
||||||
|
ud80 sta stkey ;save for other routines
|
||||||
|
ud90 rts
|
||||||
|
|
||||||
|
rdtim sei ;keep time from rolling
|
||||||
|
lda time+2 ;get lsd
|
||||||
|
ldx time+1 ;get next most sig.
|
||||||
|
ldy time ;get msd
|
||||||
|
|
||||||
|
settim sei ;keep time from changing
|
||||||
|
sta time+2 ;store lsd
|
||||||
|
stx time+1 ;next most significant
|
||||||
|
sty time ;store msd
|
||||||
|
cli
|
||||||
|
rts
|
||||||
|
|
||||||
|
; rsr 8/21/80 remove crfac change stop
|
||||||
|
; rsr 3/29/82 add shit key check for commodore 64
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
.segment "JMPTBL"
|
||||||
|
|
||||||
|
;KERNAL revision
|
||||||
|
.byte 3
|
||||||
|
|
||||||
|
jmp pcint
|
||||||
|
jmp ioinit
|
||||||
|
jmp ramtas
|
||||||
|
|
||||||
|
jmp restor ;restore vectors to initial system
|
||||||
|
jmp vector ;change vectors for user
|
||||||
|
|
||||||
|
jmp setmsg ;control o.s. messages
|
||||||
|
jmp secnd ;send sa after listen
|
||||||
|
jmp tksa ;send sa after talk
|
||||||
|
jmp memtop ;set/read top of memory
|
||||||
|
jmp membot ;set/read bottom of memory
|
||||||
|
jmp scnkey ;scan keyboard
|
||||||
|
jmp settmo ;set timeout in ieee
|
||||||
|
jmp acptr ;handshake ieee byte in
|
||||||
|
jmp ciout ;handshake ieee byte out
|
||||||
|
jmp untlk ;send untalk out ieee
|
||||||
|
jmp unlsn ;send unlisten out ieee
|
||||||
|
jmp listn ;send listen out ieee
|
||||||
|
jmp talk ;send talk out ieee
|
||||||
|
jmp readss ;return i/o status byte
|
||||||
|
jmp setlfs ;set la, fa, sa
|
||||||
|
jmp setnam ;set length and fn adr
|
||||||
|
open jmp (iopen) ;open logical file
|
||||||
|
close jmp (iclose) ;close logical file
|
||||||
|
chkin jmp (ichkin) ;open channel in
|
||||||
|
ckout jmp (ickout) ;open channel out
|
||||||
|
clrch jmp (iclrch) ;close i/o channel
|
||||||
|
basin jmp (ibasin) ;input from channel
|
||||||
|
bsout jmp (ibsout) ;output to channel
|
||||||
|
jmp loadsp ;load from file
|
||||||
|
jmp savesp ;save to file
|
||||||
|
jmp settim ;set internal clock
|
||||||
|
jmp rdtim ;read internal clock
|
||||||
|
stop jmp (istop) ;scan stop key
|
||||||
|
getin jmp (igetin) ;get char from q
|
||||||
|
clall jmp (iclall) ;close all files
|
||||||
|
jmp udtim ;increment clock
|
||||||
|
jscrog jmp scrorg ;screen org
|
||||||
|
jplot jmp plot ;read/set x,y coord
|
||||||
|
jiobas jmp iobase ;return i/o base
|
||||||
|
|
||||||
|
;signature
|
||||||
|
.byte "RRBY"
|
||||||
|
|
||||||
|
.segment "VECTORS"
|
||||||
|
.word nmi ;program defineable
|
||||||
|
.word start ;initialization code
|
||||||
|
.word puls ;interrupt handler
|
||||||
|
|
||||||
+200
@@ -0,0 +1,200 @@
|
|||||||
|
; wozmon.asm
|
||||||
|
;
|
||||||
|
; Originally from Apple-1 Operation Manual, Steve Wozniak, 1976
|
||||||
|
; Revised 2024 May 8 for Commodore 64/VIC/128 by David R. Van Wagner davevw.com
|
||||||
|
; Imported to integrated KERNAL segment by insanity213 youtube.com/@retrotechinsanity
|
||||||
|
; * Using C64 KERNAL (instead of MC6520 and KBD/CRT)
|
||||||
|
; * extra processing for expected mark parity, software caps lock, and revised newline/carriage return processing
|
||||||
|
; * revised to expect terminal line edit mode instead of echo off character processing
|
||||||
|
; * revised to acme syntax
|
||||||
|
; * different zero page usage
|
||||||
|
; * changed l/h to wl/wh because vice didn't like that symbol
|
||||||
|
; * reverse toggle instead of spaces only on vic-20 (like HESMON) because too few columns
|
||||||
|
|
||||||
|
; zero page usage - tape stuff on vic-20, 64, 128. Needs to change for PET, TED, Plus/4, 16, etc.
|
||||||
|
.segment "WOZMON"
|
||||||
|
.export WOZMON_ENTRY
|
||||||
|
xaml=$a3
|
||||||
|
xamh=$a4
|
||||||
|
stl=$a5
|
||||||
|
sth=$a6
|
||||||
|
wl=$a7
|
||||||
|
wh=$a8
|
||||||
|
ysav=$a9
|
||||||
|
wm_mode=$aa
|
||||||
|
|
||||||
|
in=$200 ; same as Commodore uses, should be fine to copy from/to this, will probably use slightly less
|
||||||
|
|
||||||
|
;** C64, etc. support added by David R. Van Wagner davevw.com ***************************************
|
||||||
|
; Commodore KENRAL
|
||||||
|
CHROUT=$FFD2
|
||||||
|
CHRIN=$FFCF
|
||||||
|
;** C64 etc. support added by David R. Van Wagner davevw.com ***************************************
|
||||||
|
|
||||||
|
|
||||||
|
WOZMON_ENTRY:
|
||||||
|
cld
|
||||||
|
cli
|
||||||
|
jmp escape
|
||||||
|
|
||||||
|
;** C64, etc. support added by David R. Van Wagner davevw.com ***************************************
|
||||||
|
KBD_IN:
|
||||||
|
sty $22
|
||||||
|
jsr CHRIN ; note: full screen editor
|
||||||
|
ldy $22
|
||||||
|
rts
|
||||||
|
;** C64, etc. support added by David R. Van Wagner davevw.com ***************************************
|
||||||
|
|
||||||
|
notcr:
|
||||||
|
cmp #$DF ; underscore or Commodore back arrow (rub out?)
|
||||||
|
beq backspace
|
||||||
|
cmp #$83
|
||||||
|
beq escape
|
||||||
|
iny
|
||||||
|
bpl nextchar
|
||||||
|
escape:
|
||||||
|
lda #$25 ; prompt
|
||||||
|
jsr echo
|
||||||
|
getline:
|
||||||
|
lda #13
|
||||||
|
jsr echo
|
||||||
|
ldy #1
|
||||||
|
backspace:
|
||||||
|
dey
|
||||||
|
bmi getline
|
||||||
|
nextchar:
|
||||||
|
jsr KBD_IN
|
||||||
|
ora #$80
|
||||||
|
sta in, y
|
||||||
|
;jsr echo - needed only if terminal echo off, line editing off
|
||||||
|
cmp #$8D
|
||||||
|
bne notcr
|
||||||
|
ldy #$ff
|
||||||
|
lda #$00
|
||||||
|
tax
|
||||||
|
setstor:
|
||||||
|
asl
|
||||||
|
setmode:
|
||||||
|
sta wm_mode
|
||||||
|
blskip:
|
||||||
|
iny
|
||||||
|
nextitem:
|
||||||
|
lda in, y
|
||||||
|
cmp #$8D
|
||||||
|
beq getline
|
||||||
|
cmp #$AE ; period
|
||||||
|
bcc blskip
|
||||||
|
beq setmode
|
||||||
|
cmp #$BA ; colon
|
||||||
|
beq setstor
|
||||||
|
cmp #$D2 ; R
|
||||||
|
beq run
|
||||||
|
stx wl
|
||||||
|
stx wh
|
||||||
|
sty ysav
|
||||||
|
nexthex:
|
||||||
|
lda in, y
|
||||||
|
eor #$B0
|
||||||
|
cmp #$0A
|
||||||
|
bcc dig
|
||||||
|
adc #$88
|
||||||
|
cmp #$FA
|
||||||
|
bcc nothex
|
||||||
|
dig:
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
ldx #4
|
||||||
|
hexshift:
|
||||||
|
asl
|
||||||
|
rol wl
|
||||||
|
rol wh
|
||||||
|
dex
|
||||||
|
bne hexshift
|
||||||
|
iny
|
||||||
|
bne nexthex
|
||||||
|
nothex:
|
||||||
|
cpy ysav
|
||||||
|
beq escape
|
||||||
|
bit wm_mode
|
||||||
|
bvc notstor
|
||||||
|
lda wl
|
||||||
|
sta (stl, x)
|
||||||
|
inc stl
|
||||||
|
bne nextitem
|
||||||
|
inc sth
|
||||||
|
tonextitem:
|
||||||
|
jmp nextitem
|
||||||
|
run:
|
||||||
|
jmp (xaml)
|
||||||
|
notstor:
|
||||||
|
bmi xamnext
|
||||||
|
ldx #2
|
||||||
|
setadr:
|
||||||
|
lda wl-1,x
|
||||||
|
sta stl-1,x
|
||||||
|
sta xaml-1,x
|
||||||
|
dex
|
||||||
|
bne setadr
|
||||||
|
nxtprnt:
|
||||||
|
bne prdata
|
||||||
|
lda #13
|
||||||
|
jsr echo
|
||||||
|
lda xamh
|
||||||
|
jsr prbyte
|
||||||
|
lda xaml
|
||||||
|
jsr prbyte
|
||||||
|
lda #$BA ; colon
|
||||||
|
jsr echo
|
||||||
|
prdata:
|
||||||
|
lda #32
|
||||||
|
jsr echo
|
||||||
|
lda (xaml,x)
|
||||||
|
jsr prbyte
|
||||||
|
xamnext:
|
||||||
|
stx wm_mode
|
||||||
|
lda xaml
|
||||||
|
cmp wl
|
||||||
|
lda xamh
|
||||||
|
sbc wh
|
||||||
|
bcs tonextitem
|
||||||
|
inc xaml
|
||||||
|
bne mod8chk
|
||||||
|
inc xamh
|
||||||
|
mod8chk:
|
||||||
|
lda xaml
|
||||||
|
and #7
|
||||||
|
bpl nxtprnt ; should always branch
|
||||||
|
prbyte:
|
||||||
|
pha
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
jsr prhex
|
||||||
|
pla
|
||||||
|
prhex:
|
||||||
|
and #$0F
|
||||||
|
ora #$B0
|
||||||
|
cmp #$BA
|
||||||
|
bcc echo
|
||||||
|
adc #6
|
||||||
|
echo:
|
||||||
|
;** C64, etc. support added by David R. Van Wagner davevw.com ***************************************
|
||||||
|
and #$7f ; strip mark bit
|
||||||
|
cmp #32 ; space?
|
||||||
|
bne notspace
|
||||||
|
lda $FF80 ; Commodore ROM version
|
||||||
|
cmp #$16 ; VIC?
|
||||||
|
bne notvic
|
||||||
|
lda 199
|
||||||
|
eor #18 ; invert reverse state
|
||||||
|
sta 199
|
||||||
|
rts
|
||||||
|
notvic:
|
||||||
|
lda #32
|
||||||
|
notspace:
|
||||||
|
jmp CHROUT
|
||||||
|
;** C64, etc. support added by David R. Van Wagner davevw.com ***************************************
|
||||||
|
|
||||||
Reference in New Issue
Block a user