Browse Source

added DOS_1571CR

master
Michael Steil 3 months ago
parent
commit
5555684ac2
100 changed files with 20244 additions and 0 deletions
  1. 104
    0
      DOS_1571CR/addfil.src
  2. 178
    0
      DOS_1571CR/addrel.src
  3. 443
    0
      DOS_1571CR/block.src
  4. 109
    0
      DOS_1571CR/burstcr.src
  5. 221
    0
      DOS_1571CR/close.src
  6. 60
    0
      DOS_1571CR/com.src
  7. 104
    0
      DOS_1571CR/copall.src
  8. 80
    0
      DOS_1571CR/copset.src
  9. 308
    0
      DOS_1571CR/dskintsf.src
  10. 36
    0
      DOS_1571CR/duplct.src
  11. 70
    0
      DOS_1571CR/duplct1.src
  12. 439
    0
      DOS_1571CR/erproccr.src
  13. 309
    0
      DOS_1571CR/fastld.src
  14. 1362
    0
      DOS_1571CR/fastutl.src
  15. 185
    0
      DOS_1571CR/fndrel.src
  16. 379
    0
      DOS_1571CR/frets.src
  17. 248
    0
      DOS_1571CR/gcrcntrl.src
  18. 282
    0
      DOS_1571CR/gcrtable1.src
  19. 281
    0
      DOS_1571CR/gcrtable3.src
  20. 282
    0
      DOS_1571CR/gcrtable6.src
  21. 281
    0
      DOS_1571CR/gcrtable8.src
  22. 274
    0
      DOS_1571CR/gcrtables.src
  23. 90
    0
      DOS_1571CR/getact.src
  24. 138
    0
      DOS_1571CR/idlesf.src
  25. 33
    0
      DOS_1571CR/irq.src
  26. 55
    0
      DOS_1571CR/irq1541.src
  27. 46
    0
      DOS_1571CR/irq1571.src
  28. 360
    0
      DOS_1571CR/jobssf.src
  29. 258
    0
      DOS_1571CR/lccbingcr.src
  30. 219
    0
      DOS_1571CR/lcccntrl.src
  31. 58
    0
      DOS_1571CR/lccconhdr.src
  32. 232
    0
      DOS_1571CR/lccend.src
  33. 221
    0
      DOS_1571CR/lccfmt1.src
  34. 307
    0
      DOS_1571CR/lccfmt2.src
  35. 351
    0
      DOS_1571CR/lccfmt2a.src
  36. 106
    0
      DOS_1571CR/lccfmt3.src
  37. 89
    0
      DOS_1571CR/lccfmt3a.src
  38. 171
    0
      DOS_1571CR/lccfmt4.src
  39. 41
    0
      DOS_1571CR/lccfmt4a.src
  40. 287
    0
      DOS_1571CR/lccgcrbin.src
  41. 164
    0
      DOS_1571CR/lccgcrbn1.src
  42. 66
    0
      DOS_1571CR/lccinit.src
  43. 67
    0
      DOS_1571CR/lccio.src
  44. 138
    0
      DOS_1571CR/lccread.src
  45. 238
    0
      DOS_1571CR/lccread1.src
  46. 221
    0
      DOS_1571CR/lccseek.src
  47. 197
    0
      DOS_1571CR/lccseek1.src
  48. 58
    0
      DOS_1571CR/lccutil.src
  49. 209
    0
      DOS_1571CR/lccutil1.src
  50. 312
    0
      DOS_1571CR/lccwrt.src
  51. 287
    0
      DOS_1571CR/lccwrt1.src
  52. 51
    0
      DOS_1571CR/leds.src
  53. 409
    0
      DOS_1571CR/lookup.src
  54. 116
    0
      DOS_1571CR/lstdir.src
  55. 154
    0
      DOS_1571CR/m5710cr.src
  56. 37
    0
      DOS_1571CR/macroscr.src
  57. 133
    0
      DOS_1571CR/map.src
  58. 573
    0
      DOS_1571CR/mcntrlcr.src
  59. 62
    0
      DOS_1571CR/memrw.src
  60. 416
    0
      DOS_1571CR/msubr1cr.src
  61. 284
    0
      DOS_1571CR/msubr2cr.src
  62. 156
    0
      DOS_1571CR/msubr3cr.src
  63. 79
    0
      DOS_1571CR/msubrcr.src
  64. 122
    0
      DOS_1571CR/new.src
  65. 105
    0
      DOS_1571CR/newss.src
  66. 52
    0
      DOS_1571CR/newvec.src
  67. 46
    0
      DOS_1571CR/notescr.src
  68. 61
    0
      DOS_1571CR/nulbuf.src
  69. 425
    0
      DOS_1571CR/open.src
  70. 209
    0
      DOS_1571CR/opnchnl.src
  71. 285
    0
      DOS_1571CR/parsex.src
  72. 1458
    0
      DOS_1571CR/patchcr.src
  73. 144
    0
      DOS_1571CR/record.src
  74. 128
    0
      DOS_1571CR/rel1.src
  75. 148
    0
      DOS_1571CR/rel2.src
  76. 58
    0
      DOS_1571CR/rel3.src
  77. 84
    0
      DOS_1571CR/rel4.src
  78. 233
    0
      DOS_1571CR/rename.src
  79. 48
    0
      DOS_1571CR/romsf.src
  80. 84
    0
      DOS_1571CR/romtblsf.src
  81. 77
    0
      DOS_1571CR/scrtch.src
  82. 132
    0
      DOS_1571CR/seratn.src
  83. 182
    0
      DOS_1571CR/seratn1.src
  84. 135
    0
      DOS_1571CR/serlibcr.src
  85. 145
    0
      DOS_1571CR/serlistn.src
  86. 116
    0
      DOS_1571CR/serlistn1.src
  87. 133
    0
      DOS_1571CR/sertalk.src
  88. 136
    0
      DOS_1571CR/sertalk1.src
  89. 125
    0
      DOS_1571CR/setdrv.src
  90. 82
    0
      DOS_1571CR/signature.src
  91. 47
    0
      DOS_1571CR/ssend.src
  92. 42
    0
      DOS_1571CR/sstest.src
  93. 189
    0
      DOS_1571CR/ssutil.src
  94. 12
    0
      DOS_1571CR/system.src
  95. 34
    0
      DOS_1571CR/titlecr.src
  96. 257
    0
      DOS_1571CR/trnsfr.src
  97. 570
    0
      DOS_1571CR/tst2cr.src
  98. 371
    0
      DOS_1571CR/tst3.src
  99. 245
    0
      DOS_1571CR/tst4.src
  100. 0
    0
      DOS_1571CR/tstflg.src

+ 104
- 0
DOS_1571CR/addfil.src View File

@@ -0,0 +1,104 @@
.page
.subttl 'addfil.src'
; add file to directory

addfil lda sa ; save variables
pha
lda lindx
pha
lda sector
pha
lda track
pha
lda #irsa
sta sa
jsr curblk ; use last accessed search
lda type
pha
lda fildrv
and #1
sta drvnum
ldx jobnum
eor lstjob,x
lsr a
bcc af08 ; same drive as required

ldx #1
stx delind ; look for deleted entry
jsr srchst
beq af15 ; all full, new sector
bne af20 ; found one

af08 lda delsec
beq af10 ; deleted entry not located
cmp sector
beq af20 ; sector is resident
sta sector
jsr drtrd ; read sector in
jmp af20

af10 lda #1 ; find deleted entry
sta delind
jsr search
bne af20
af15 jsr nxdrbk ; all full, new sector
lda sector
sta delsec
lda #2
sta delind
af20 lda delind
jsr setpnt
pla
sta type ; set type
cmp #reltyp
bne af25
ora #$80
af25
jsr putbyt
pla
sta filtrk ; ...table & entry
jsr putbyt
pla
sta filsec ; set sector link in...
jsr putbyt ; ...table & entry
jsr getact
tay
lda filtbl
tax
lda #16
jsr trname ; transfer name
ldy #16
lda #0 ; clear # of blocks &...
af30 sta (dirbuf),y ; ...& replace links
iny
cpy #27
bcc af30
lda type ; a relative file ?
cmp #reltyp
bne af50 ; no
ldy #16 ; yes
lda trkss ; get ss track
sta (dirbuf),y ; put in directory
iny
lda secss ; get ss sector
sta (dirbuf),y ; put in
iny
lda rec ; get record size
sta (dirbuf),y
af50 jsr drtwrt ; write it out
pla
sta lindx
tax
pla
sta sa
lda delsec
sta entsec
sta dsec,x
lda delind
sta entind
sta dind,x
lda type
sta pattyp
lda drvnum
sta fildrv
rts

+ 178
- 0
DOS_1571CR/addrel.src View File

@@ -0,0 +1,178 @@
.page
.subttl 'addrel.src'
;*********************************
;* addrel: add blocks to relative*
;* file. *
;* vars: *
;* regs: *
;* *
;*********************************

addrel
jsr setdrn
jsr ssend ; set up end of file
jsr posbuf
jsr dbset
lda ssind
sta r1 ; save ss index
lda ssnum
sta r0 ; save ss number
lda #0
sta r2 ; clear flag for one block

lda #0 ; clear for calculation...
sta recptr ; ...to 1st byte in record
jsr fndrel ; calc ss ptrs
addr1 ; entry for rel record fix
jsr numfre ; calc available...

ldy lindx ; record span?
ldx rs,y
dex
txa
clc
adc relptr
bcc ar10 ; no span

inc ssind ; inc ss ptrs & check
inc ssind ; inc ss ptrs & check
bne ar10
inc ssnum
lda #ssioff
sta ssind
ar10
lda r1
clc
adc #2
jsr setssp

lda ssnum
cmp #nssl
bcc ar25 ; valid range

ar20
lda #bigfil
jsr cmderr ; too many ss's
ar25
lda ssind ; calc # blocks needed...
sec ; ...& check against avail.
sbc r1
bcs ar30
sbc #ssioff-1
clc
ar30
sta t3 ; # ss indices
lda ssnum
sbc r0
sta t4 ; # ss needed

ldx #0 ; clear accum.
stx t1
stx t2
tax ; .x=# ss
jsr sscalc ; calc # of blocks needed

lda t2
bne ar35
ldx t1
dex
bne ar35

inc r2
ar35
cmp nbtemp+1
bcc ar40 ; ok!!
bne ar20
lda nbtemp
cmp t1
bcc ar20 ; not enuf blocks
ar40
lda #1
jsr drdbyt ; look at sector link
clc
adc #1 ; +1 is nr
ldx lindx
sta nr,x
jsr nxtts ; get next block...
jsr setlnk ; ...& set link.
lda r2
bne ar50 ; add one block

jsr wrtout ; write current last rec
ar45
jsr dblbuf ; switch bufs
jsr sethdr ; set hdr from t & s
jsr nxtts ; get another
jsr setlnk ; set up link
jsr nulbuf ; clean it out
jmp ar55
ar50
jsr dblbuf ; switch bufs
jsr sethdr ; set hdr from t & s
jsr nulbuf ; clean buffer
jsr nullnk ; last block =0,lstchr
ar55
jsr wrtout ; write buffer
jsr getlnk ; get t&s from link
lda track
pha ; save 'em
lda sector
pha
jsr gethdr ; now get hdr t&s
lda sector
pha ; save 'em
lda track
pha
jsr gsspnt ; check ss ptr
tax
bne ar60

jsr newss ; need another ss
lda #ssioff
jsr setssp ; .a=bt val
inc r0 ; advance ss count
ar60
pla
jsr putss ; record t&s...
pla
jsr putss ; ...in ss.
pla ; get t&s from link
sta sector
pla
sta track
beq ar65 ; t=0: that's all!!

lda r0
cmp ssnum
bne ar45 ; not even done yet

jsr gsspnt
cmp ssind
bcc ar45 ; almost done
beq ar50 ; one more block left
ar65
jsr gsspnt
pha
lda #0
jsr ssdir
lda #0
tay
sta (dirbuf),y
iny
pla
sec
sbc #1
sta (dirbuf),y
jsr wrtss ; write ss
jsr watjob
jsr mapout
jsr fndrel
jsr dblbuf ; get back to leading buffer
jsr sspos
bvs ar70
jmp positn
ar70
lda #lrf
jsr setflg
lda #norec
jsr cmderr

+ 443
- 0
DOS_1571CR/block.src View File

@@ -0,0 +1,443 @@
.page
.subttl 'block.src'

; rom 1.1 additions
; user commands

user ldy cmdbuf+1
cpy #'0
bne us10 ; 0 resets pntr

usrint jmp burst_routines
nop ; fill
nop ; fill
nop ; fill
nop ; fill
nop ; fill
nop ; fill

; lda #<ublock ; set default block add
; sta usrjmp
; lda #>ublock
; sta usrjmp+1
; rts

us10 jsr usrexc ; execute code by table
jmp endcmd

usrexc dey ; entry is(((index-1)and$f)*2)
tya
and #$f
asl a
tay

lda (usrjmp),y
sta ip
iny
lda (usrjmp),y
sta ip+1

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

jmp ptch53 ; *** rom ds 05/21/85 ***
; jmp (ip)

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
.page
; open direct access buffer
; from open "#"

opnblk lda lstdrv
sta drvnum
lda sa ; sa is destroyed by this patch
pha
jsr autoi ; init disk for proper channel assignment
pla ; restore sa
sta sa
ldx cmdsiz
dex
bne ob10

lda #1 ; get any buffer
jsr getrch
jmp ob30

ob05 lda #nochnl
jmp cmderr

ob10 ldy #1 ; buffer # is requested
jsr bp05
ldx filsec
cpx #bfcnt ; must be less than 6.
bcs ob05

lda #0
sta temp
sta temp+1
sec

ob15
rol temp
rol temp+1
dex
bpl ob15

lda temp
and bufuse
bne ob05 ; buffer is used
lda temp+1
and bufuse+1
bne ob05 ; buf is used

lda temp
ora bufuse ; set buffer as used
sta bufuse
lda temp+1
ora bufuse+1
sta bufuse+1

lda #0 ; set up channel
jsr getrch
ldx lindx
lda filsec
sta buf0,x
tax
lda drvnum
sta jobs,x
sta lstjob,x

ob30 ldx sa
lda lintab,x ; set lindx table
ora #$40
sta lintab,x

ldy lindx
lda #$ff
sta lstchr,y

lda #rndrdy
sta chnrdy,y ; set channel ready

lda buf0,y
sta chndat,y ; buffer # as 1st char
asl a
tax
lda #1
sta buftab,x
lda #dirtyp+dirtyp
sta filtyp,y ; set direct file type
jmp endcmd
.page

; block commands

block ldy #0
ldx #0
lda #'- ; "-" separates cmd from subcmd
jsr parse ; locate sub-cmd
bne blk40

blk10 lda #badcmd
jmp cmderr

blk30 lda #badsyn
jmp cmderr

blk40 txa
bne blk30

ldx #nbcmds-1 ; find command
lda cmdbuf,y
blk50 cmp bctab,x
beq blk60
dex
bpl blk50
bmi blk10

blk60
txa
ora #$80
sta cmdnum
jsr blkpar ; parse parms

lda cmdnum
asl a
tax
lda bcjmp+1,x
sta temp+1
lda bcjmp,x
sta temp

jmp (temp) ; goto command

bctab .byte 'AFRWEP'
nbcmds =*-bctab

bcjmp .word blkalc ; block-allocate
.word blkfre ; block-free
.word blkrd ; block-read
.word blkwt ; block-write
.word blkexc ; block-execute
.word blkptr ; block-pointer

blkpar ldy #0 ; parse block parms
ldx #0
lda #':
jsr parse
bne bp05 ; found ":"

ldy #3 ; else char #3 is beginning
bp05 lda cmdbuf,y
cmp #'
beq bp10

cmp #29 ; skip character
beq bp10

cmp #',
bne bp20

bp10 iny
cpy cmdsiz
bcc bp05

rts ; that's all

bp20 jsr aschex
inc f1cnt
ldy f2ptr
cpx #mxfils-1
bcc bp10

bcs blk30 ; bad syntax

; convert ascii to hex (binary)
; & store conversion in tables
; .y= ptr into cmdbuf
aschex lda #0
sta temp
sta temp+1
sta temp+3

ldx #$ff
ah10 lda cmdbuf,y ; test for dec #
cmp #$40
bcs ah20 ; non-numeric terminates
cmp #$30
bcc ah20 ; non-numeric

and #$f
pha
lda temp+1 ; shift digits (*10)
sta temp+2
lda temp
sta temp+1
pla
sta temp
iny
cpy cmdsiz
bcc ah10 ; still in string

ah20 sty f2ptr ; convert digits to...
clc ; ...binary by dec table
lda #0

ah30 inx
cpx #3
bcs ah40

ldy temp,x
ah35 dey
bmi ah30

adc dectab,x
bcc ah35

clc
inc temp+3
bne ah35

ah40 pha
ldx f1cnt
lda temp+3
sta filtrk,x ; store result in table
pla
sta filsec,x
rts

dectab .byte 1,10,100 ; decimal table

;block-free
blkfre jsr blktst
jsr frets
jmp endcmd

;block-allocate

lda #1
sta wbam
blkalc
jsr blktst

ba10
lda sector
pha
jsr getsec
beq ba15 ; none greater on this track
pla
cmp sector
bne ba30 ; requested sector not avail
jsr wused
jmp endcmd

ba15
pla ; pop stack
ba20
lda #0
sta sector
inc track
lda track
cmp maxtrk
bcs ba40 ; gone all the way

jsr getsec
beq ba20
ba30
lda #noblk
jsr cmder2
ba40
lda #noblk
jsr cmderr ; t=0,s=0 :none left


; block read subs
blkrd2 jsr bkotst ; test parms
jmp drtrd

getsim jsr getpre ; get byte w/o inc
lda (buftab,x)
rts

; block read
blkrd3 jsr blkrd2
lda #0
jsr setpnt
jsr getsim ; y=lindx

sta lstchr,y
lda #rndrdy
sta chnrdy,y
rts
blkrd
jsr blkrd3
jsr rnget1
jmp endcmd

;user direct read, lstchr=$ff
ublkrd
jsr blkpar
jsr blkrd3
lda lstchr,y
sta chndat,y
lda #$ff
sta lstchr,y
jmp endcmd ; (rts)

;block-write
blkwt jsr bkotst

jsr getpnt
tay
dey
cmp #2
bcs bw10
ldy #1

bw10 lda #0 ; set record size
jsr setpnt
tya
jsr putbyt
txa
pha

bw20 jsr drtwrt ; write block
pla
tax

; jsr rnget2
jsr ptch15 ; fix for block read *rom ds 01/22/85*

jmp endcmd

;user dirct write, no lstchr
ublkwt jsr blkpar
jsr bkotst
jsr drtwrt
jmp endcmd

;block-execute
blkexc
jsr killp ; kill protect
jsr blkrd2 ; read block & execute
lda #0

be05 sta temp
ldx jobnum
lda bufind,x
sta temp+1
jsr be10 ; indirect jsr
jmp endcmd

be10 jmp (temp)

;buffer-pointer, set buffer pointer
blkptr jsr buftst
lda jobnum
asl a
tax
lda filsec+1
sta buftab,x
jsr getpre
jsr rnget2 ; set up get
jmp endcmd

;test for allocated buffer..
; ..related to sa
buftst ldx f1ptr
inc f1ptr
lda filsec,x
tay
dey
dey
cpy #$c ; set limit to # of sas
bcc bt20

bt15 lda #nochnl
jmp cmderr

bt20 sta sa
jsr fndrch
bcs bt15
jsr getact
sta jobnum
rts

;test block operation parms
bkotst jsr buftst
;
;test for legal block &..
; ..set up drv, trk, sec
blktst ldx f1ptr
lda filsec,x
and #1
sta drvnum
lda filsec+2,x
sta sector
lda filsec+1,x
sta track
bt05
jsr tschk
jmp setlds ; (rts)

; rsr 1/19/80 add autoi to #cmd

+ 109
- 0
DOS_1571CR/burstcr.src View File

@@ -0,0 +1,109 @@
.page
.subttl 'burst'
*=$8000

signature_lo *=*+1 ; <<<< TO BE DETERMINED
signature_hi *=*+1 ; <<<< TO BE DETERMINED


.byte 'S/W BY DAVID G SIRACUSA',$0D,"5710 BY C. HAUCK",$0D,'1986',$0D

burst_routines

lda cmdsiz ; check command size
cmp #3
bcc realus

lda cmdbuf+2 ; get command
sta switch ; save info
and #$1f
tax ; command info
asl a
tay
lda cmdtbb,y
sta ip
lda cmdtbb+1,y
sta ip+1
cpx #30 ; utload ok for 1541 mode
beq 1$

lda pota1
and #$20 ; 1/2 Mhz ?
beq realus ; 1541 mode...ignore

1$ lda fastsr ; clear clock & error return
and #$eb
sta fastsr

lda cmdctl,x ; most sig bit set set error recover
sta cmdbuf+2 ; save info here

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

jmp ptch65
; jmp (ip) ; *** rom ds 04/25/86 ***

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

realus lda #<ublock ; set default block add
sta usrjmp
lda #>ublock
sta usrjmp+1
unused rts

.page

; command tables and information

cmdctl .byte $80,$81,$90,$91,$b0,$b1,$f0,$f1,$00,$01,$B0,$01,$00,$01,$00,$01
.byte $80,$81,$90,$91,$b0,$b1,$f0,$f1,$00,$01,$B0,$01,$00,$01,$00,$80

cmdtbb .word fstrd ; fast read drv #0 - 0000
.word ndkrd ; fast read drv #1 - 0001

.word fstwrt ; fast write drv #0 - 0010
.word ndkwrt ; fast write drv #1 - 0011

.word fstsek ; seek disk drv #0 - 0100
.word ndkrd ; seek disk drv #1 - 0101

.word fstfmt ; format disk drv #0 - 0110
.word fstfmt ; format disk drv #1 - 0111

.word cpmint ; interleave disk drv #0 - 1000
.word cpmint ; interleave disk drv #1 - 1001

.word querdk ; query disk format - 1010
.word ndkrd ; seek disk drv #1 - 1011

.word inqst ; return disk status - 1100
.word ndkrd ; return disk status - 1101

.word duplc1 ; backup drv0 to drv1 - 1110
.word duplc1 ; backup drv1 to drv0 - 1111

; *****************************************************************
.word fstrd ; fast read drv #0 - 0000
.word ndkrd ; fast read drv #1 - 0001

.word fstwrt ; fast write drv #0 - 0010
.word ndkwrt ; fast write drv #1 - 0011

.word fstsek ; seek disk drv #0 - 0100
.word ndkrd ; seek disk drv #1 - 0101

.word fstfmt
.word fstfmt

.word unused
.word unused

.word querdk ; query disk format - 1010
.word ndkrd ; seek disk drv #1 - 1011

.word unused
.word unused

.word chgutl
.word fstload

+ 221
- 0
DOS_1571CR/close.src View File

@@ -0,0 +1,221 @@
.page
.subttl 'close.src'
; close the file associated with sa

close
lda #0
sta wbam
lda sa
bne cls10 ; directory close
lda #0
sta dirlst ; clear dir list
jsr frechn
cls05
jmp freich
cls10
cmp #$f
beq clsall ; close cmd chanl
jsr clschn ; close channel
lda sa
cmp #2
bcc cls05

lda erword
bne cls15 ; last command had an error
jmp endcmd
cls15
jmp scren1

clsall
lda #14
sta sa
cls20
jsr clschn
dec sa
bpl cls20
lda erword
bne cls25 ; last command had an error
jmp endcmd
cls25
jmp scren1

clschn
ldx sa
lda lintab,x
cmp #$ff
bne clsc28
rts
clsc28
and #$f
sta lindx

jsr typfil
cmp #dirtyp
beq clsc30 ; direct channel
cmp #reltyp
beq clsrel

jsr fndwch ; look for write channel
bcs clsc31

jsr clswrt ; close seq write
jsr clsdir ; close directory
clsc30
jsr mapout ; write bam
clsc31
jmp frechn

clsrel
jsr scrub
jsr dblbuf
jsr ssend
ldx ssnum
stx t4
inc t4
lda #0
sta t1
sta t2
lda ssind
sec
sbc #ssioff-2
sta t3
jsr sscalc
ldx lindx
lda t1
sta nbkl,x
lda t2
sta nbkh,x
lda #dyfile
jsr tstflg
beq clsr1
jsr clsdir
clsr1 jmp frechn

; close a write chanl

clswrt ; close seq write file
ldx lindx
lda nbkl,x
ora nbkh,x
bne clsw10 ; at least 1 block written

jsr getpnt
cmp #2
bne clsw10 ; at least 1 byte written

lda #cr
jsr putbyt
clsw10
jsr getpnt
cmp #2
bne clsw20 ; not mt buffer

jsr dblbuf ; switch bufs

ldx lindx
lda nbkl,x
bne clsw15
dec nbkh,x
clsw15
dec nbkl,x

lda #0
clsw20
sec
sbc #1 ; back up 1
pha ; save it
lda #0
jsr setpnt
jsr putbyt ; tlink=0
pla ; lstchr count
jsr putbyt

jsr wrtbuf ; write out last buffer
jsr watjob ; finish job up
jmp dblbuf ; make sure both bufs ok

; directory close on open write file

clsdir ldx lindx ; save lindx
stx wlindx ; &sa
lda sa
pha
lda dsec,x ; get directory sector
sta sector
lda dind,x ; get sector offset
sta index
lda filtyp,x ; drv # in filtyp
and #1
sta drvnum
lda dirtrk
sta track
jsr getact ; allocate a buffer
pha
sta jobnum
jsr drtrd ; read directory sector
ldy #0
lda bufind,x ; .x is job#
sta r0+1
lda index
sta r0
lda (r0),y
and #$20
beq clsd5
jsr typfil
cmp #reltyp
beq clsd6

lda (r0),y
and #$8f ; replace file
sta (r0),y
iny
lda (r0),y
sta track
sty temp+2
ldy #27 ; extract replacement link
lda (r0),y ; to last sector
pha
dey
lda (r0),y
bne clsd4
sta track
pla
sta sector
lda #$67
jsr cmder2
clsd4
pha
lda #0
sta (r0),y
iny
sta (r0),y
pla
ldy temp+2
sta (r0),y
iny
lda (r0),y
sta sector
pla
sta (r0),y
jsr delfil ; delete old file
jmp clsd6 ; set close bit
clsd5
lda (r0),y
and #$f
ora #$80
sta (r0),y
clsd6 ldx wlindx
ldy #28 ; set # of blocks
lda nbkl,x
sta (r0),y
iny
lda nbkh,x
sta (r0),y
pla
tax
lda #write ; write directory sector
ora drvnum
jsr doit
pla
sta sa
jmp fndwch ; restore lindx

+ 60
- 0
DOS_1571CR/com.src View File

@@ -0,0 +1,60 @@
.SUBTTL 'COM.SRC'
.PAGE
;**********************************************
;* *
;* COMMODORE BUSINESS MACHINES SOFTWARE *
;* *
;**********************************************
;* *
;* 11 55555 77777 11 *
;* 1 5 7 1 *
;* 1 5555 7 1 *
;* 1 5 7 1 *
;* 11111 5555 7 11111 *
;* *
;* FFFFFF AAAAAA SSSSSS TTTTTT *
;* F A A S T *
;* FFFF AAAAAA SSSSSS T *
;* F A A S T *
;* F A A SSSSSS T *
;* *
;* SSSSS EEEEE RRRRR IIIII AAAAA L *
;* S E R R I A A L *
;* SSSSS EEEE RRR I AAAAA L *
;* S E R R I A A L *
;* SSSSS EEEEE R R IIIII. A A LLLLL *
;* *
;* DDDD IIIII SSSSS K K *
;* D D I S K K *
;* D D I SSSSS KKK *
;* D D I S K K *
;* DDDD IIIII SSSSS K K *
;* *
;* *
;**********************************************
;* *
;* DISK OPERATING SYSTEM AND CONTROLLER *
;* ROUTINES. *
;* *
;* COPYRIGHT (C) 1986 BY *
;* COMMODORE BUSINESS MACHINES (CBM) *
;* *
;* DS *
;* *
;**********************************************
;
;**********************************************
;* THIS SOFTWARE IS FURNISHED FOR USE IN *
;* THE 1571 FAST SERIAL FLOPPY DISK DRIVE. *
;* *
;* COPIES THEREOF MAY NOT BE PROVIDED OR *
;* MADE AVAILABLE FOR USE ON ANY OTHER *
;* SYSTEM. *
;* *
;* THE INFORMATION IN THIS DOCUMENT IS *
;* SUBJECT TO CHANGE WITHOUT NOTICE. *
;* *
;* NO RESPONSIBILITY IS ASSUMED FOR *
;* RELIABILITY OF THIS SOFTWARE. *
;* *
;**********************************************

+ 104
- 0
DOS_1571CR/copall.src View File

@@ -0,0 +1,104 @@
.page
.subttl 'copall.src'

; set up subroutine

pups1 lda #0
sta rec
sta drvcnt
sta filtrk
sta filtrk+1
lda fildrv+1 ; get drive number
and #1 ; only
sta drvnum
ora #1
sta delsec ; nonzero
lda filtbl+1 ; fn1=fn2
sta filtbl
rts
.nlist
;.end
.page 'copy all'
;
; copy disk to disk routines
;
;cpydtd lda filtbl+1 ; save in temp
; sta temp
; ldy #40 ; 40 char buffer
; ldx cmdsiz ; prep to move
; sty cmdsiz ; end of filename2
;movlp1 dey
; dex
; lda cmdbuf,x ; mov fn lifo
; sta cmdbuf,y
; cpx temp ; actual f2 val
; bne movlp1
; sty filtbl+1 ; pointer to f2
;movlp2 jsr optsch
; jsr pups1 ; setup first pass
; jsr ffst ; first match
; bpl fixit ; entry found?
; bmi endit ; no
;;
;exlp0 pla ; pull needed vars
; sta dirsec
; pla
; sta filtbl+1
; pla
; sta lstbuf
; pla
; sta filcnt
; pla
; sta index
; pla
; sta found
; pla
; sta delind
; pla
; sta drvflg
;;
;exlp1 jsr pups1 ; set up vars
; jsr ffre ; next match
; bpl fixit ; found one?
;endit jmp endcmd ; no! so bye
;;
;fixit lda drvflg ; push needed vars
; pha
; lda delind
; pha
; lda found
; pha
; lda index
; pha
; lda filcnt
; pha
; lda lstbuf
; pha
; lda filtbl+1
; pha
; lda dirsec
; pha
;;
;exlp2 jsr trfnme ; transfer name
; lda #1 ; fake out lookup
; sta f1cnt
; sta f2cnt
; jsr lookup
; lda #1
; sta f1cnt
; lda #2 ; real
; sta f2cnt
; jsr cy ; copy it
; jmp exlp0 ; next one folks
;;
;; transfer name (dirbuf) to cmdbuf
;;
;trfnme ldy #3 ; both indexes
; sty filtbl ; begining of filename1
;trf0 lda (dirbuf),y ; move it
; sta cmdbuf,y
; iny
; cpy #19 ; all 16 chars passed?
; bne trf0
; rts
.list

+ 80
- 0
DOS_1571CR/copset.src View File

@@ -0,0 +1,80 @@
.page
.subttl 'copset.src'

; dskcpy check for type
; and parses special case

dskcpy
lda #$e0 ; kill bam buffer
sta bufuse
jsr clnbam ; clr tbam
jsr bam2x ; get bam lindx in .x
lda #$ff
sta buf0,x ; mark bam out-of-memory
lda #$0f
sta linuse ; free all lindxs
jsr prscln ; find ":"
bne dx0000
jmp duplct ; bad command error, cx=x not allowed
.nlist
;
;jsr prseq
;
;lda #'* ;cpy all
;ldx #39 ;put at buffer end
;stx filtbl+1
;sta cmdbuf,x ;place *
;inx
;stx cmdsiz
;ldx #1 ;set up cnt's
;stx f1cnt
;inx
;stx f2cnt
;jmp movlp2 ;enter routine
;
.list
dx0000 jsr tc30 ; normal parse
dx0005 jsr alldrs ; put drv's in filtbl
lda image ; get parse image
and #%01010101 ; val for patt copy
bne dx0020 ; must be concat or normal
ldx filtbl ; chk for *
lda cmdbuf,x
cmp #'*
bne dx0020
.nlist
;ldx #1 ;set cnt's
; no pattern matching allowed
;stx f1cnt
;inx
;stx f2cnt
;jmp cpydtd ;go copy
.list
dx0010 lda #badsyn ; syntax error
jmp cmderr
dx0020 lda image ; chk for normal
and #%11011001
bne dx0010
jmp copy
.nlist
;.end
;prseq
; lda #'= ; special case
; jsr parse
; bne x0020
;x0015 lda #badsyn
; jmp cmderr
;x0020 lda cmdbuf,y
; jsr tst0v1
; bmi x0015
; sta fildrv+1 ; src drv
; dey
; dey
; lda cmdbuf,y
; jsr tst0v1
; bmi x0015
; cmp fildrv+1 ; cannot be equal
; beq x0015
; sta fildrv ; dest drv
; rts
.list

+ 308
- 0
DOS_1571CR/dskintsf.src View File

@@ -0,0 +1,308 @@
.page
.subttl 'dskintsf.src'

; error display routine
; blinks the (error #)+1 in all three leds

pezro ldx #0 ; error #1 for zero page
.byte skip2 ; skip next two bytes
perr ldx temp ; get error #
txs ; use stack as storage reg.
pe20 tsx ; restore error #
pe30 lda #led0+led1
ora ledprt
jmp pea7a

; turn on led !!!!patch so ddrb led is output!!!!

rea7d tya ; clear inner ctr !!!!patch return!!!!
pd10 clc
pd20 adc #1 ; count inner ctr
bne pd20
dey ; done ?
bne pd10 ; no

lda ledprt
and #$ff-led0-led1
sta ledprt ; turn off all leds
pe40 ; wait
tya ; clear inner ctr
pd11 clc
pd21 adc #1 ; count inner ctr
bne pd21
dey ; done ?
bne pd11 ; no

dex ; blinked # ?
bpl pe30 ; no - blink again
cpx #$fc ; waited between counts ?
bne pe40 ; no
beq pe20 ; always - all again

dskint sei
cld
ldx #$66 ; *,atnout,clk,*,*,side,fsdir,trk0
jmp patch5 ; *** rom ds 8/18/83 ***
dkit10 inx ; fill

;*********************************
;
; power up diagnostic
;
;*********************************

ldy #0
ldx #0
pu10 txa ; fill z-page accend pattern
sta $0,x
inx
bne pu10
pu20 txa ; check pattern by inc...
cmp $0,x ; ...back to orig #
bne pezro ; bad bits
pu30
inc $0,x ; bump contents
iny
bne pu30 ; not done

cmp $0,x ; check for good count
bne pezro ; something's wrong

sty $0,x ; leave z-page zeroed
lda $0,x ; check it
bne pezro ; wrong

inx ; next!
bne pu20 ; not all done


; test 32k byte rom

; enter x=start page
; exit if ok

rm10 inc temp ; next error #
ldx #127 ; 128 pages
stx ip+1 ; save page, start x=0
inx ; **** rom ds 04/22/86 ***
lda #0
sta ip ; zero lo indirect
ldy #2 ; skip signature bytes
clc
rt10 inc ip+1 ; do it backwards
rt20 adc (ip),y ; total checksum in a
iny
bne rt20

dex
bne rt10

adc #255 ; add in last carry
sta ip+1
bne perr2 ; no - show error number

; **** rom ds 04/22/86 ***

nop ; fill
nop ; fill
nop ; fill

;----------------------------------

; test all common ram

cr20 lda #$01 ; start of 1st block
cr30 sta ip+1 ; save page #
inc temp ; bump error #

; enter x=# of pages in block
; ip ptr to first page in block
; exit if ok

ramtst ldx #7 ; save page count
ra10 tya ; fill with adr sensitive pattern
clc
adc ip+1
sta (ip),y
iny
bne ra10
inc ip+1
dex
bne ra10
ldx #7 ; restore page count
ra30 dec ip+1 ; check pattern backwards
ra40 dey
tya ; gen pattern again
clc
adc ip+1
cmp (ip),y ; ok ?
bne perr2 ; no - show error #
eor #$ff ; yes - test inverse pattern
sta (ip),y
eor (ip),y ; ok ?
sta (ip),y ; leave memory zero
bne perr2 ; no - show error #
tya
bne ra40
dex
bne ra30

beq diagok

perr2 jmp perr

diagok
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

jmp ptch31 ; *** rom ds 05/01/85 ***
; ldx #topwrt
; txs

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

rtch31 lda ledprt ; clear leds
and #$ff-led0-led1
sta ledprt

lda #3 ; neg edge of atn & edge on wp
sta pcr1
lda #%10000010 ; set,_t1,_t2,_cb1,_cb2,_sr,ca1,_ca2(wps)
sta ifr1
sta ier1
lda pb ; compute primary addr
and #%01100000 ; pb5 and pb6 are unused lines
asl a ; shift to lower
rol a
rol a
rol a
ora #$48 ; talk address
sta tlkadr
eor #$60 ; listen address
sta lsnadr

; initialize buffer pntr table

inttab ldx #0
ldy #0
intt1 lda #0
sta buftab,x
inx
lda bufind,y
sta buftab,x
inx
iny
cpy #bfcnt
bne intt1

lda #<cmdbuf ; set pntr to cmdbuf
sta buftab,x
inx
lda #>cmdbuf
sta buftab,x
inx
lda #<errbuf ; set pntr to errbuf
sta buftab,x
inx
lda #>errbuf
sta buftab,x

lda #$ff
ldx #maxsa
dskin1 sta lintab,x
dex
bpl dskin1

ldx #mxchns-1
dskin2
sta buf0,x ; set buffers as unused
sta buf1,x
sta ss,x
dex
bpl dskin2

lda #bfcnt ; set buffer pointers
sta buf0+cmdchn
lda #bfcnt+1
sta buf0+errchn
lda #$ff
sta buf0+blindx
sta buf1+blindx

lda #errchn
sta lintab+errsa
lda #cmdchn+$80
sta lintab+cmdsa
lda #lxint ; lindx 0 to 5 free
sta linuse

lda #rdylst
sta chnrdy+cmdchn
lda #rdytlk
sta chnrdy+errchn
lda #$e0
sta bufuse
lda #$ff
sta bufuse+1

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

jsr ptch72 ; *** rom ds 05/20/86 ***
nop
; lda #1
; sta wpsw

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

sta wpsw+1
jsr usrint ; init user jmp
jsr lruint

;**********************************
;
; controller initialization
;
;**********************************

jsr ptch10 ; *** rom ds 05/01/85 controller init ***
; jsr cntint

; set indirect vectors

lda #<diagok
sta vnmi
lda #>diagok
sta vnmi+1

lda #6 ; set up sector offset *** rom ds 01/22/85 ***
sta secinc
lda #5
sta revcnt ; set up recovery count

;*
;*******************************
;*
;* seterr
;* set up power on error msg
;*
;*******************************
;*
;*
seterr lda #$73
jsr errts0


;must be contiguous to .file idle

;********************************
; init the serial bus
;
;********************************

;-------rom -05 8/18/83-----------------
lda #$00 ; data hi, clock hi,atna hi
sta pb
lda #%00011010 ; atna,clkout,datout
sta ddrb1
;---------------------------------------
jsr ptch29 ; *rom ds 02/01/85*
; jsr boot

+ 36
- 0
DOS_1571CR/duplct.src View File

@@ -0,0 +1,36 @@
.page
.subttl 'duplct.src'

; duplicate disk

duplct
lda #badcmd
jmp cmderr

; transfer format code to buffer 0
; & start controller formatting

format
lda #$4c
sta bufs+$300

lda #<formt
sta bufs+$301
lda #>formt
sta bufs+$302

lda #3
jsr seth
lda drvnum
ora #exec
sta jobs+3
fmt105 lda jobs+3
bmi fmt105

cmp #2
bcc fmt110

lda #3
ldx #0
jmp error
fmt110 rts

+ 70
- 0
DOS_1571CR/duplct1.src View File

@@ -0,0 +1,70 @@
.page
.subttl 'duplct1.src'

; controller format disk

jformat lda #71
sta maxtrk ; double sided
lda #3
jsr seth
ldx #3 ; job #3
lda #0
sta fmtsid ; side zero first
lda #$f0 ; format cmd
sta tsttrk ; init speed var
sta jobs,x ; give job to controller
jsr stbctl ; wake him up
cmp #2 ; error?
bcs 1$ ; br, error

;read track one sector zero

ldy #3 ; retries
4$ lda #1 ; track 1
sta hdrs+6 ; *
lda #0 ; sector 0
sta hdrs+7 ; *
lda #$80 ; read
sta jobs,x ; give job to controller
jsr stbctl ; wake him up
cmp #2 ; error?
bcc 5$ ; br, ok...
dey
bpl 4$ ; try 3 times
bcs 1$ ; bra

5$ lda #1
sta fmtsid ; side one second
lda #$f0 ; format cmd
sta tsttrk ; init speed var
sta jobs,x ; give job to controller
jsr stbctl ; wake him up
cmp #2 ; error?
bcs 1$ ; br, error

;read track thirty-six sector zero

ldy #3 ; retries
6$ lda #36 ; track 36
sta hdrs+6 ; *
lda #0 ; sector 0
sta hdrs+7 ; *
lda #$80 ; read
sta jobs,x ; give job to controller
jsr stbctl ; wake him up
cmp #2 ; error?
bcs 3$ ; br, bad

rts ; ok
3$ dey
bpl 6$ ; keep trying

1$ ldx #0 ; set for offset for buffer to det. trk & sect.
bit jobrtn ; return on error ?
stx jobrtn ; clr
bpl 7$

rts ; back to caller
7$ jmp error

+ 439
- 0
DOS_1571CR/erproccr.src View File

@@ -0,0 +1,439 @@
.page
.subttl 'erproc.src'
; error processing

; controller errors
; 0 (1) no error
; 20 (2) can't find block header
; 21 (3) no synch character
; 22 (4) data block not present
; 23 (5) checksum error in data
; 24 (16) byte decoding error
; 25 (7) write-verify error
; 26 (8) write w/ write protect on
; 27 (9) checksum error in header
; 28 (10) data extends into next block
; 29 (11) disk i.d. mismatch

; command errors
; 30 general syntax
; 31 invalid command
; 32 long line
; 33 invalid filname
; 34 no file given
; 39 command file not found

; 50 record not present
; 51 overflow in record
; 52 file too large

; 60 file open for write
; 61 file not open
; 62 file not found
; 63 file exists
; 64 file type mismatch
; 65 no block
; 66 illegal track or sector
; 67 illegal system t or s

; 70 no channels available
; 71 directory error
; 72 disk full
; 73 cbm dos v3.1
; 74 drive not ready

; 1 files scratched response

badsyn =$30
badcmd =$31
longln =$32
badfn =$33
nofile =$34
nocfil =$39
norec =$50
recovf =$51
bigfil =$52
filopn =$60
filnop =$61
flntfd =$62
flexst =$63
mistyp =$64
noblk =$65
badts =$66
systs =$67
nochnl =$70
direrr =$71
dskful =$72
cbmv2 =$73
nodriv =$74
.page
; error message table
; leading errror numbers,
; text with 1st & last chars
; or'ed with $80,
; tokens for key words are
; less than $10 (and'ed w/ $80)

errtab ; " OK"
.byte 0,$a0,'O',$cb
;"read error"
.byte $20,$21,$22,$23,$24,$27
.byte $d2,'EAD',$89
;" file too large"
.byte $52,$83,' TOO LARG',$c5
;" record not present"
.byte $50,$8b,6,' PRESEN',$d4
;"overflow in record"
.byte $51,$cf,'VERFLOW '
.byte 'IN',$8b
;" write error"
.byte $25,$28,$8a,$89
;" write protect on"
.byte $26,$8a,' PROTECT O',$ce
;" disk id mismatch"
.byte $29,$88,' ID',$85
;"syntax error"
.byte $30,$31,$32,$33,$34
.byte $d3,'YNTAX',$89
;" write file open"
.byte $60,$8a,3,$84
;" file exists"
.byte $63,$83,' EXIST',$d3
;" file type mismatch"
.byte $64,$83,' TYPE',$85
;"no block"
.byte $65,$ce,'O BLOC',$cb
;"illegal track or sector"
.byte $66,$67,$c9,'LLEGAL TRACK'
.byte ' OR SECTO',$d2
;" file not open"
.byte $61,$83,6,$84
;" file not found"
.byte $39,$62,$83,6,$87
;" files scratched"
.byte 1,$83,'S SCRATCHE',$c4
;"no channel"
.byte $70,$ce,'O CHANNE',$cc
;"dir error"
.byte $71,$c4,'IR',$89
;" disk full"
.byte $72,$88,' FUL',$cc
;"cbm dos v3.1 1571"
.byte $73,$c3,'BM DOS V3.1 157',$b1
;"drive not ready"
.byte $74,$c4,'RIVE',6,' READ',$d9

; error token key words
; words used more than once
;"error"
.byte 9,$c5,'RRO',$d2
;"write"
.byte $a,$d7,'RIT',$c5
;"file"
.byte 3,$c6,'IL',$c5
;"open"
.byte 4,$cf,'PE',$ce
;"mismatch"
.byte 5,$cd,'ISMATC',$c8
;"not"
.byte 6,$ce,'O',$d4
;"found"
.byte 7,$c6,'OUN',$c4
;"disk"
.byte 8,$c4,'IS',$cb
;"record"
.byte $b,$d2,'ECOR',$c4
etend =*
.page
; controller error entry
; .a= error #
; .x= job #
error
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><>

jmp ptch46 ; *** rom ds 03/31/85 ***
; pha
; stx jobnum

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><>

rtch46 txa
asl a
tax
lda hdrs,x ; 4/12********* track,sector
sta track
lda hdrs+1,x ; 4/12*********
sta sector

pla
and #$f ; convert controller...
beq err1 ; ...errors to dos errors
cmp #$f ; check nodrive error
bne err2

lda #nodriv
bne err3 ; bra
err1
lda #6 ; code=16-->14
err2 ora #$20
tax
dex
dex
txa
err3
pha
lda cmdnum
cmp #val
bne err4
lda #$ff
sta cmdnum
pla
jsr errmsg
jsr initdr ; init for validate
jmp cmder3
err4
pla
cmder2
jsr errmsg
cmder3
jsr clrcb ; clear cmdbuf
lda #0
sta wbam ; clear after error
jsr erron ; set error led
jsr freich ; free internal channel
lda #0 ; clear pointers
sta buftab+cbptr
ldx #topwrt
txs ; purge stack
lda orgsa
and #$f
sta sa
cmp #$f
beq err10
sei
lda lsnact
bne lsnerr
lda tlkact
bne tlkerr

ldx sa
lda lintab,x
cmp #$ff
beq err10
and #$f
sta lindx
jmp tlerr


; talker error recovery
; if command channel, release dav
; if data channel, force not ready
; and release channel
tlkerr
jsr fndrch
; jsr iterr ; *** rom - 05 fix 8/18/83 ***
.byte $ea,$ea,$ea ; fill in 'jsr'
bne tlerr ; finish

; listener error recovery
; if command channel, release rfd
; if data channel, force not ready
; and release channel
lsnerr
jsr fndwch
; jsr ilerr ; *** rom - 05 fix 8/18/83 ***
.byte $ea,$ea,$ea ; fill in 'jsr'
tlerr
jsr typfil
cmp #reltyp
bcs err10
jsr frechn
err10

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><>

jmp xidle ; *** rom ds 01/22/84 ***
; jmp idle

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><>

.page
; convert hex to bcd
hexdec tax

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
jmp ptch67 ; *** rom sd 05/21/86 ***
; lda #0
; sed

;<><><><><><><><><><><><><><><><><><><><><><><><><><><><>

hex0 cpx #0
beq hex5
clc
adc #1
dex
jmp hex0
hex5 cld

; convert bcd to ascii dec
; return bcd in .x
; store ascii in (temp),y
bcddec tax
lsr a
lsr a
lsr a
lsr a
jsr bcd2
txa
bcd2
and #$f
ora #$30
sta (cb+2),y
iny
rts

; transfer error message to
; error buffer

okerr
jsr erroff
lda #0
errts0
ldy #0
sty track
sty sector

errmsg
ldy #0
ldx #<errbuf
stx cb+2
ldx #>errbuf
stx cb+3
jsr bcddec ; convert error #
lda #',
sta (cb+2),y
iny
lda errbuf
sta chndat+errchn
txa ; error # in .x
jsr ermove ; move message

ermsg2 lda #',
sta (cb+2),y
iny
lda track
jsr hexdec ; convert track #
lda #',
sta (cb+2),y
iny
lda sector ; convert sector #
jsr hexdec
dey
tya
clc
adc #<errbuf ; set last char
sta lstchr+errchn
inc cb+2
lda #rdytlk
sta chnrdy+errchn
rts

;**********************************;
;* ermove - move error message *;
;* from errtab to errbuf. *;
;* fully recursive for token *;
;* word prosessing. *;
;* input: .a= bcd error number *;
;**********************************;

ermove
tax ; save .a
lda r0 ; save r0,r0+1
pha
lda r0+1
pha
lda #<errtab ; set pointer to table
sta r0
lda #>errtab
sta r0+1
txa ; restore .a
ldx #0 ; .x=0 for indirect
e10
cmp (r0,x) ; ?error # = table entry?
beq e50 ; yes, send message

pha ; save error #
jsr eadv2 ; check & advance ptr
bcc e30 ; more #'s to check
e20
jsr eadv2 ; advance past this message
bcc e20
e30
lda r0+1 ; check ptr
cmp #>etend
bcc e40 ; <, continue
bne e45 ; >, quit