Browse Source

added DOS_8280

For future reference, this is the (messy) script to convert
Resident Assembler style source into LST-style (with tabs):

for i in *; do LANG=C tr '\r' '\n' < "$i" > x; mv x "$i"; done

for i in *; do echo $i; cat "$i" |
    sed -e "s/^[    ]//" | # remove leading spaces and tabs
    sed -E -e "s/^(ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA|\.[A-Z]*)[[:>:]]/\t\1/" | # insert tab before mnemo
    sed -E -e "s/^\*/\t*/" | # insert tab before '*='
    sed -E -e "s/^([A-Z][A-Z0-9]*) +/\1\t/" | # insert tab after label

    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;]) ;/\1             ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;]) ;/\1            ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;]) ;/\1           ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;]) ;/\1          ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;][^;]) ;/\1         ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;][^;][^;]) ;/\1        ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;][^;][^;][^;]) ;/\1       ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;][^;][^;][^;][^;]) ;/\1      ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;]) ;/\1     ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;]) ;/\1    ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;]) ;/\1   ;/" |
    sed -E -e "s/^([A-Z0-9]*\t[^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;][^;]) ;/\1  ;/" |

    sed -E -e "s/^\t.PAG/.PAG/" |
    sed -E -e "s/^\t.SKI/.SKI/" |
    sed -E -e "s/^\t.END/.END/" |
    sed -E -e "s/^\t.LIB/.LIB/" |
    sed -E -e "s/^\t.FIL/.FIL/" |
    sed -E -e "s/^\t.OPT/.OPT/" > /tmp/x ; mv /tmp/x "$i"; done
pull/5/head
Michael Steil 4 years ago
parent
commit
7938d6d511
  1. 124
      DOS_8280/addfil
  2. 179
      DOS_8280/addrel
  3. 65
      DOS_8280/allromcheck
  4. 48
      DOS_8280/autoit
  5. 160
      DOS_8280/begin
  6. 426
      DOS_8280/block
  7. 15
      DOS_8280/changes
  8. 48
      DOS_8280/chksum
  9. 209
      DOS_8280/close
  10. 122
      DOS_8280/comprs
  11. 108
      DOS_8280/copyall
  12. 67
      DOS_8280/copysetup
  13. 44
      DOS_8280/dos
  14. 44
      DOS_8280/dos3.1
  15. 201
      DOS_8280/dskint
  16. 204
      DOS_8280/duplct
  17. 2
      DOS_8280/echksm
  18. 55
      DOS_8280/equate
  19. 4
      DOS_8280/erom
  20. 451
      DOS_8280/erproc
  21. 5
      DOS_8280/fmt40
  22. 172
      DOS_8280/fndrel
  23. 301
      DOS_8280/frets
  24. 44
      DOS_8280/getact
  25. 50
      DOS_8280/i_odef
  26. 80
      DOS_8280/idle
  27. 226
      DOS_8280/ieee
  28. 204
      DOS_8280/init
  29. 151
      DOS_8280/jobs
  30. 62
      DOS_8280/lib
  31. 402
      DOS_8280/lookup
  32. 120
      DOS_8280/lstdir
  33. 2
      DOS_8280/m.nl
  34. 2
      DOS_8280/m.ns
  35. 243
      DOS_8280/map
  36. 62
      DOS_8280/master
  37. 62
      DOS_8280/master3.1
  38. 69
      DOS_8280/memrw
  39. 59
      DOS_8280/mver
  40. 280
      DOS_8280/new
  41. 142
      DOS_8280/newss
  42. 62
      DOS_8280/nol
  43. 66
      DOS_8280/nolist
  44. 63
      DOS_8280/nolisting
  45. 63
      DOS_8280/nulbuf
  46. 206
      DOS_8280/opchnl
  47. 405
      DOS_8280/open
  48. 206
      DOS_8280/opx
  49. 279
      DOS_8280/parsex
  50. 23
      DOS_8280/patc
  51. 213
      DOS_8280/ramvar
  52. 144
      DOS_8280/record
  53. 130
      DOS_8280/rel1
  54. 154
      DOS_8280/rel2
  55. 59
      DOS_8280/rel3
  56. 85
      DOS_8280/rel4
  57. 217
      DOS_8280/rename
  58. 5
      DOS_8280/rom
  59. 135
      DOS_8280/romtbl
  60. 69
      DOS_8280/scrtch
  61. 110
      DOS_8280/setdrv
  62. 23
      DOS_8280/sidsec
  63. 47
      DOS_8280/ssend
  64. 25
      DOS_8280/sss
  65. 49
      DOS_8280/sstest
  66. 196
      DOS_8280/ssutil
  67. 120
      DOS_8280/system
  68. 129
      DOS_8280/temp
  69. 281
      DOS_8280/trnsfr
  70. 434
      DOS_8280/tst2
  71. 233
      DOS_8280/tst3
  72. 250
      DOS_8280/tst4
  73. 89
      DOS_8280/tstflg
  74. 185
      DOS_8280/tstfnd
  75. 181
      DOS_8280/tsutil
  76. 149
      DOS_8280/utlodr
  77. 20
      DOS_8280/vector
  78. 90
      DOS_8280/verdir
  79. 4
      README.md
  80. 1
      build.sh

124
DOS_8280/addfil

@ -0,0 +1,124 @@
.PAGE 'ADDFIL'
;
; 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 DELENT
BEQ AF10 ; DELETED ENTRY NOT LOCATED
LDA DELSEC
CMP SECTOR
BNE AF09 ; SECTOR IS NOT RESIDENT
LDA DELTRK
CMP TRACK
BEQ AF20 ; TRACK AND SECTOR ARE RESIDENT
AF09
LDA DELSEC
STA SECTOR
LDA DELTRK
STA TRACK
JSR DRTRD ; READ IN THE TRACK AND SECTOR
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 #$FF
STA DELENT
LDA TRACK
STA DELTRK
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 DELTRK
STA ENTTRK
STA DTRK,X
LDA DELIND
STA ENTIND
STA DIND,X
LDA TYPE
STA PATTYP
LDA DRVNUM
STA FILDRV
RTS
.END

179
DOS_8280/addrel

@ -0,0 +1,179 @@
.PAGE 'ADDREL'
ADDREL
JSR ADRELS
JSR FNDREL ; CALC SS PTRS
ADDR1
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
BNE AR10
INC SSNUM
LDA #SSIOFF
STA SSIND
AR10
LDA R1
CLC
ADC #2
JSR SETSSP
LDA SSNUM
CMP #NSSL
BCC AR25 ; VALID RANGE
LDA #0
STA SSNUM ; .A = 0
INC GRPNUM
BNE AR25 ; JUMP
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
LDA SSNUM
SBC R0
BCS ADDBI1
INC R3
ADC #6
ADDBI1
STA T4
LDA GRPNUM
SEC
SBC R3
STA R3
JSR SSSCAL
LDA RESULT+1
BNE AR35
LDX RESULT
BNE ADDBI2
RTS
ADDBI2
DEX
BNE AR35
AR34
INC R2
AR35
CMP NBTEMP+1
BCC AR40 ; OK!!
BNE AR20
LDA NBTEMP
CMP T1
BCC AR20 ; NOT ENOUGH 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 R5
CMP GRPNUM
BCC AR45
AR61
LDA R0
CMP SSNUM
BNE AR45 ; NOT DONE YET
JSR GSSPNT
CMP SSIND
BCC AR45 ; ALMOST DONE
BCS 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
ADRELS
JSR SETDRN
JSR SSEND ; SET UP END OF FILE
JSR POSBUF
LDA GRPNUM
STA R5
STA R3
ADREL1
LDA SSIND
STA R1 ; SAVE SS INDEX
LDA SSNUM
STA R0 ; SAVE SS NUMBER
LDA #0
STA R2 ; CLEAR FLAG FOR ONE BLOCK
STA RECPTR ; TO 1ST BYTE IN RECORD
RTS
.END

65
DOS_8280/allromcheck

@ -0,0 +1,65 @@
IP=0 ;ZPAGE POINTER
*=$F800
START SEI
LDY #0
LDA #$20
LOOP
STA $8000,Y ;CLEAR SCREEN
STA $8100,Y
STA $8200,Y
STA $8300,Y
INY
BNE LOOP
CALC
LDA #$B0 ;SET FOR $A SLOT
STA IP+1
LDA #0
STA IP ;ZERO LO INDIRECT
TAY
LDX #16 ;16 PAGES IN 4K ROM
CLC
RT10 DEC IP+1 ;DO IT BACKWARDS
RT20 ADC (IP),Y ;TOTAL CHECKSUM IN A
INY
BNE RT20
DEX
BNE RT10
ADC #0 ;ADD IN LAST CARRY
PHA
AND #$F
TAX
LDA HEX,X
STA $8029 ;POKE LOW NYBBLE
PLA
LSR A
LSR A
LSR A
LSR A
TAX
LDA HEX,X
STA $8028 ;POKE HIGH NYBBLE
JSR WAIT
LDA $8028
EOR #$40
STA $8028
LDA $8029
EOR #$40
STA $8029
JSR WAIT
JMP CALC
;
WAIT
LDY #0
W2
LDX #0
W3
DEX
BNE W3
DEY
BNE W2
RTS
HEX .BYTE '0123456789'
.BYTE 1,2,3,4,5,6 ;SCREEN ALPHA
*=$FFFC
.WORD START
.END

48
DOS_8280/autoit

@ -0,0 +1,48 @@
.PAGE 'AUTOIT'
;RSR TEST SUBROUTINES
;
; THIS AUTO INIT SUBROUTINE WILL
; CHECK IF DRVNUM DRIVE IS INITED
;
; IF CATALOG CALLS THIS ROUTINE
; BEFORE ANY HEADER INFO IS TRANSFERED
; THIS ROUTINE WORKS.
;
; THIS ROUTINE WILL END IN ERROR
; IF ANY ERROR BUT DISK ID OCCURS
;
AUTOIT LDX #$FF ;FLAG FOR ERROR RTN
STX JOBRTN
JSR INITSU ;.A=DRVNUM< >=ERROR
CMP #03 ;CHK MISSING DISK
BEQ CATID3
CATID5 CMP #2 ;CHK FOR OKAY
BCC CATID4
CATID2 JMP ERROR ;MUST BE AN ERROR
CATID3 LDY DRVCNT ;CHK FOR SINGLE
BEQ CATID2
LDA #0 ;ONLY ONE GOOD DRIVE?
STA DRVCNT
LDA DRVNUM ;FLIP TO CHK OTHER DRV
EOR #1
STA DRVNUM
JMP AUTOIT
;
CATID4 TXA ;X PRESERVED
ASL A ;MULT *8
ASL A
ASL A
TAY
LDA DRVNUM
ASL A
TAX
LDA HDRS,Y ;CHK DISK ID
CMP DSKID,X ;AGAINST OLD ID
BNE CATID1
LDA HDRS+1,Y
CMP DSKID+1,X
BNE CATID1
RTS ;SAME ID
CATID1 JMP INITDR ;DIFF SO INIT
;
.END

160
DOS_8280/begin

@ -0,0 +1,160 @@
.PAGE 'BEGIN DOS'
BEGIN
LDX #$FF
TXS ; INITIALIZE STACK
LDA PBD2
AND #255-ERRLED-LED0-LED1
STA PBD2 ; TURN LEDS OFF
LDA PBD2 ; COMPUTE PRIMARY ADDR
AND #7
ORA #$48 ; TALK ADDRESS
STA TLKADR
EOR #$60 ; LISTEN ADDRESS
STA LSNADR
;
; INITIALIZE BUFFER POINTER TABLE
;
INTTAB
LDX #0
LDY #0
INTT1
LDA #0
STA BUFTAB,X
INX
LDA BUFIND,Y
STA BUFTAB,X
INX
INY
CPY #BFCNT+2
BNE INTT1
LDA #<CMDBUF ; SET POINTER TO COMMAND BUFFER
STA BUFTAB,X
INX
LDA #>CMDBUF
STA BUFTAB,X
INX
LDA #<ERRBUF ; SET POINTER TO ERROR BUFFER
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+2 ; SET BUFFER POINTERS
STA BUF0+CMDCHN
LDA #BFCNT+3
STA BUF0+ERRCHN
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 #0
STA BUFUSE
LDA #$F0
STA BUFUSE+1
JSR USRINT ; INITIALIZE USER JUMP TABLE
LDA #0
STA RESULT+1
STA RESULT+2
LDA SECTRS
STA RESULT
LDA #8
JSR DIV006+2
LDA ACCUM+1
BEQ DSKIN3
INC RESULT
DSKIN3
INC RESULT
LDA RESULT
STA BAMSIZ ; BAMSIZ = (SECTRS/8)+1
LDX HEADS
LDA #0
CLC
DSKIN4
ADC BAMSIZ
DEX
BNE DSKIN4
STA BTSIZE ; BTSIZE = HEADS*BAMSIZ
LDX HEADS
LDA #0
CLC
DSKIN5
ADC SECTRS
DEX
BNE DSKIN5
STA MAXCYL ; MAXCYL = HEADS*SECTRS
LDA #0
STA RESULT+1
STA RESULT+2
LDA #250
STA RESULT
LDA BTSIZE
JSR DIV006+2
LDA ACCUM+1
CLC
ADC #6
STA MAPOFF ; MAPOFF = REMAINDER(250/BTSIZE)+6
LDA RESULT
STA TRKBAM ; TRKBAM = INT(250/BTSIZE)
LDX CYLLOW
INX
STX MAXTRK
LDA #'A
STA VERNUM
LDA #1
STA WPSW
STA WPSW+1 ; POWER UP INIT FLAG
;
; SET INDIRECT VECTORS
;
LDA #<DIAGOK
STA VNMI
LDA #>DIAGOK
STA VNMI+1
LDA #10 ; SET UP SECTOR ALLOCATE
STA SECINC
STA RETRY
STA REVCNT ; SET UP RECOVERY COUNT
;
; SET VECTORS TO IDLE LOOP AND IEEE
;
LDA #<VIDLE
STA VECIDL
LDA #>VIDLE
STA VECIDL+1
LDA #<VIEEE
STA VECIEE
LDA #>VIEEE
STA VECIEE+1
;
; SET UP POWER UP MESSAGE
;
MESAGE
LDA #CBMVER ; DOS VERSION NUMBER
JSR ERRTS0 ; TRANSFER MESSAGE
;
; ALLOW 'ATN' TO INTERRUPT
;
STA ATNPE
JMP BOOT ; CHECK POWER UP BOOT
;
; MUST BE CONTIGUOUS TO IDLE ROUTINE
;
.END

426
DOS_8280/block

@ -0,0 +1,426 @@
.PAGE 'BLOCK COMMAND'
;
; USER COMMANDS
;
USER
LDY CMDBUF+1
CPY #'0
BNE US10 ; 0 RESETS PNTR
USRINT
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 (IP)
.PAGE 'BLOCK COMMANDS'
;
; OPEN DIRECT ACCESS BUFFER
; FROM OPEN "#"
;
OPNBLK
LDA LSTDRV
STA DRVNUM
LDA SA
PHA
JSR AUTOI
PLA
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 #BAMJOB ; MUST BE LESS THAN 13
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 ; BUFFER 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 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
;
; 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
;
BLKALC
JSR BLKTST
JSR GETHED ; EXTRACT THE HEAD NUMBER
LDA SECTOR
PHA
JSR GETSEC
BEQ BA15 ; NONE GREATER ON THIS TRACK
PLA
CMP SECTOR
BNE BA30 ; REQUESTED SECTOR NOT AVAIL
JSR USEDT0 ; HEAD ALREADY OUT
JMP ENDCMD
BA15
PLA ; POP STACK
BA20
LDA #0
STA SECTOR ; START AT SECTOR 0
INC HEAD ; HEAD+1
LDA HEAD
CMP HEADS
BCC BA25
LDA #0
STA HEAD ; SET HEAD = 0
INC TRACK
LDA TRACK
CMP MAXTRK
BCS BA40 ; GONE ALL THE WAY
BA25
JSR GETSEC
BEQ BA20
BA30
JSR ADDHED ; ADD THE HEAD TO THE SECTOR
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
LDY LINDX
JSR RNGET2
JMP ENDCMD
;
; USER DIRCT WRITE, NO LSTCHR
;
UBLKWT
JSR BLKPAR
JSR BKOTST
JSR DRTWRT
JMP ENDCMD
;
; BLOCK-EXECUTE
;
BLKEXC
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 #BAMJOB
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)
.END

15
DOS_8280/changes

@ -0,0 +1,15 @@
.PAGE 'CHANGES'
;
; EXPANDED RELATIVE RECORD CHANGES ARE:
;
; COPY PAGE #
; FNDREL PAGE #
; CLOSE PAGE #
; OPCHNL PAGE #
; SSUTIL PAGE #
; SSTEST PAGE #
; SSEND PAGE #
; ADDREL PAGE #
; NEWSS PAGE #
; SYSTEM PAGE #
.END

48
DOS_8280/chksum

@ -0,0 +1,48 @@
.PAGE 'CHKSUM
*= $BF00
LDX #$FF
TXS
CLD
SEI
LDA #0
STA $1421
CMP $1421
CHKPRO
BNE CHKPRO
LDA #$10
JSR CHKSUM
STA $1421
BRK
LDA #0
STA $3000
CMP $3000
BNE CHKPRO
LDA #$30
JSR CHKSUM
STA $3000
BRK
;
CHKSUM ;.A=ADDRESS
CLC
STA TEMP+1
LDA #0
STA TEMP
LDX #32
LDY #0
CHK1
ADC (TEMP)Y
INY
BNE CHK1
;
INC TEMP+1
DEX
BNE CHK1
;
ADC #0
STA TEMP+1
LDA #$C0
SEC
SBC TEMP+1
SBC #0 ;.A=CHECKSUM BYTE
RTS
.END

209
DOS_8280/close

@ -0,0 +1,209 @@
.PAGE 'CLOSE'
;
; CLOSE THE FILE ASSOCIATED WITH SA
;
CLOSE
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
JMP ENDCMD
;
; CLOSE ALL SECONDARY CHANNELS
;
CLSALL
LDA #14
STA SA
CLS20
JSR CLSCHN
DEC SA
BPL CLS20
JMP ENDCMD
;
; CLOSE SECONDARY ADDRESS (SA)
;
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 OUT
CLSC31
JMP FRECHN
CLSREL
JSR SCRUB
JSR DBLBUF
JSR SSEND
LDX SSNUM
STX T4
LDA SSIND
SEC
SBC #SSIOFF-2
STA T3
LDA GRPNUM
STA R3
JSR SSSCAL
LDX #0
LDA #2
JSR ADDLIT
LDX LINDX
LDA RESULT
STA NBKL,X
LDA RESULT+1
STA NBKH,X
LDA #DYFILE
JSR TSTFLG ; TEST IF FILE WRITTEN TO
BEQ CLSR1
JSR CLSDIR
CLSR1
JMP FRECHN
;
; CLOSE A WRITE CHANL
;
CLSWRT
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
JSR GETLNK
JSR FRETS ; FREE EXTRA SECTOR
LDA #0
CLSW20
SEC
SBC #1 ; BACK UP 1
PHA ; SAVE IT
LDA #0
JSR SETPNT
JSR PUTBYT ; TRACK LINK = 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 ; AND SA
LDA SA
PHA
LDA DSEC,X ; GET DIRECTORY SECTOR
STA SECTOR
LDA DTRK,X
STA TRACK
LDA DIND,X ; GET SECTOR OFFSET
STA INDEX
LDA FILTYP,X ; DRIVE # IN FILTYP
AND #1
STA DRVNUM
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
.END

122
DOS_8280/comprs

@ -0,0 +1,122 @@
.PAGE 'COMPRESS DIRECTORY'
COMPRS
LDA BUFIND
STA DIRBUF+1 ; USE BUFFER 0
LDY #1
LDA #0
JSR SETBUF ; SET BUFFER 1 TO ZERO'S
LDA #1
STA IP
LDY DRVNUM
LDA DSTRK,Y ; START OF DIRECTORY (TRACK)
STA TRACK
LDA DSSEC,Y ; START OF DIRECTORY (SECTOR)
STA SECTOR
LDA #1 ; BUFFER 1 FOR NEW DIRECTORY
JSR SETH ; SET HEADER FOR NEW DIRECTORY
JMP COMPR1
COMPR0
LDA TRACK
BEQ COMPR5 ; DONE
COMPR1
LDA #0
STA JOBNUM ; DIRECTORY IN BUFFER 0
JSR SETH
JSR DOREAD ; READ THE DIRECTORY
LDA #0
STA DIRBUF
TAY
LDA (DIRBUF),Y ; NEXT SECTOR LINK (TRACK)
STA TRACK
BEQ COMPR2 ; NO LINK
INY
LDA (DIRBUF),Y ; NEXT SECTOR LINK (SECTOR)
STA SECTOR
JSR FRETS ; FREE THESE LINKS
COMPR2
LDA #2
STA DIRBUF
COMPR3
LDY #0
LDA (DIRBUF),Y ; GET FILE STATUS
BPL COMPR4 ; DELETE OR NOT CLOSED
JSR ADDENT ; ADD THIS ENTRY
COMPR4
LDA #32
CLC
ADC DIRBUF
STA DIRBUF ; POINT TO NEXT ENTRY
BCC COMPR3
BCS COMPR0 ; READ THE NEXT SECTOR
COMPR5
LDA #0
STA IP
TAY
STA (IP),Y ; TRACK LINK = 0, LAST SECTOR
INY
LDA #$FF
STA (IP),Y ; SECTOR LINK
LDA #1
STA JOBNUM
JMP DOWRIT ; WRITE LAST SECTOR (RTS)
.PAGE 'ADD ENTRY'
ADDENT
LDY #0
LDX #30 ; MOVE 30 CHARACTERS
ADDEN1
INC IP
LDA IP
CMP #1
BEQ ADDEN2 ; WRITE THIS SECTOR
TYA
PHA
LDA (DIRBUF),Y
LDY #0
STA (IP),Y ; STORE IN NEW DIRECTORY
PLA
TAY
INY
DEX
BNE ADDEN1
INC IP
INC IP
LDA IP
CMP #1
BNE ADDE1
DEC IP
ADDE1
RTS
ADDEN2
LDA TRACK
PHA
LDA SECTOR
PHA
LDY DRVNUM
LDA DSTRK,Y
STA TRACK
LDA #0
STA SECTOR
JSR NXT0 ; GET NEXT TRACK AND SECTOR
LDY #0
LDA SECTOR
STA (IP),Y ; SET NEXT SECTOR LINK
DEC IP
LDA TRACK
STA (IP),Y ; SET NEXT TRACK LINK
LDA #1
STA JOBNUM
JSR DOWRIT
LDA #1
JSR SETH ; SET HEADER FOR NEXT WRITE
PLA
STA SECTOR
PLA
STA TRACK
LDY #1
LDA #0
JSR SETBUF
LDA #1
STA IP
LDX #30
BNE ADDEN1 ; JUMP
.END

108
DOS_8280/copyall

@ -0,0 +1,108 @@
.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
;
; SET UP SUBROUTINE
;
PUPS1
LDA #0
STA REC
STA DRVCNT
STA FILTRK
STA FILTRK+1
LDA FILDRV+1 ; GET DRIVE NUMBER
AND #1
STA DRVNUM
ORA #1
STA DELSEC ; NONZERO
STA DELENT
LDA FILTBL+1 ; FN1 = FN2
STA FILTBL
RTS
.END

67
DOS_8280/copysetup

@ -0,0 +1,67 @@
.PAGE 'DISK COPY'
;
; DSKCPY CHECK FOR TYPE
; AND PARSES SPECIAL CASE
;
DSKCPY
JSR PRSCLN ;FIND ":"
BNE DX0000
;
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
;
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
LDX #1 ;SET CNT'S
STX F1CNT
LDA FILDRV
CMP FILDRV+1
BEQ DX0010 ; NO 'C:*=:*'
INX
STX F2CNT
JMP CPYDTD ;GO COPY
DX0010 LDA #BADSYN ;SYNTAX ERROR
JMP CMDERR
DX0020 LDA IMAGE ;CHK FOR NORMAL
AND #%11011001
BNE DX0010
JMP COPY
;
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
.END

44
DOS_8280/dos

@ -0,0 +1,44 @@
.PAGE 'SUPER DOS 3.0'
.SKIP 6
;******************************************
;* *
;* SSSS UU UU PPPP EEEE RRRR *
;* SSSSSS UU UU PPPPPP EEEEEE RRRRRR *
;* SS UU UU PP PP EE RR RR *
;* SS UU UU PP PP EE RR RR *
;* SSSSS UU UU PPPPPP EEEE RRRRRR *
;* SSSSS UU UU PPPPP EEEE RRRRR *
;* SS UU UU PP EE RR RR *
;* SS UU UU PP EE RR RR *
;* SSSSSS UUUUUU PP EEEEEE RR RR *
;* SSSS UUUU PP EEEE RR RR *
;* *
;* DDDDD OOOO SSSS *
;* DDDDDD OOOOOO SSSSSS *
;* DD DD OO OO SS *
;* DD DD OO OO SS *
;* DD DD OO OO SSSSS *
;* DD DD OO OO SSSSS *
;* DD DD OO OO SS *
;* DD DD OO OO SS *
;* DDDDDD OOOOOO SSSSSS *
;* DDDDD OOOO SSSS *
;* *
;******************************************
.SKIP 6
;******************************************
;* *
;* 9065D HARD DISK *
;* DISK OPERATING SYSTEM *
;* VERSION 3.0 *
;* RELEASED APRIL XX, 1981 *
;* MOS 2364 ROMS #XXXXXX *
;* -01 *
;* #XXXXXX *
;* -01 *
;* *
;* COPYRIGHT 1981 *
;* COMMODORE BUSINESS MACHINES *
;* *
;******************************************
.END

44
DOS_8280/dos3.1

@ -0,0 +1,44 @@
.PAGE 'SUPER DOS 3.1'
.SKIP 6
;******************************************
;* *
;* SSSS UU UU PPPP EEEE RRRR *
;* SSSSSS UU UU PPPPPP EEEEEE RRRRRR *
;* SS UU UU PP PP EE RR RR *
;* SS UU UU PP PP EE RR RR *
;* SSSSS UU UU PPPPPP EEEE RRRRRR *
;* SSSSS UU UU PPPPP EEEE RRRRR *
;* SS UU UU PP EE RR RR *
;* SS UU UU PP EE RR RR *
;* SSSSSS UUUUUU PP EEEEEE RR RR *
;* SSSS UUUU PP EEEE RR RR *
;* *
;* DDDDD OOOO SSSS *
;* DDDDDD OOOOOO SSSSSS *
;* DD DD OO OO SS *
;* DD DD OO OO SS *
;* DD DD OO OO SSSSS *
;* DD DD OO OO SSSSS *
;* DD DD OO OO SS *
;* DD DD OO OO SS *
;* DDDDDD OOOOOO SSSSSS *
;* DDDDD OOOO SSSS *
;* *
;******************************************
.SKIP 6
;******************************************
;* *
;* 8280 8" IBM DISK *
;* DISK OPERATING SYSTEM *
;* VERSION 3.1 *
;* RELEASED APRIL XX, 1981 *
;* MOS 2364 ROMS #XXXXXX *
;* -01 *
;* #XXXXXX *
;* -01 *
;* *
;* COPYRIGHT 1981 *
;* COMMODORE BUSINESS MACHINES *
;* *
;******************************************
.END

201
DOS_8280/dskint

@ -0,0 +1,201 @@
.PAGE 'DSKINT'
;
; ERROR DISPLAY ROUTINE
; BLINKS THE (ERROR #)+1 IN ALL THREE LEDS
;
PEZRO
LDX #0 ; ERROR#1 FOR ZERO PAGE
.BYTE $2C ; SKIP NEXT TWO BYTES
PERR
LDX TEMP ; GET THE ERROR#
TXS ; USE STACK AS STORAGE REG.
PE20
TSX ; RESTORE ERROR#
PE30
LDA #ERRLED+LED0+LED1
STA PBD2 ; TURN ON ALL THREE LEDS
TYA
PD10
CLC
PD20
ADC #1
BNE PD20
DEY ; DONE?
BNE PD10 ; NO
STY PBD2 ; TURN OFF ALL LEDS
PE40
TYA
PD11
CLC
PD21
ADC #1
BNE PD21
DEY ; DONE?
BNE PD11 ; NO
DEX
BPL PE30 ; BLINK AGAIN
CPX #$FC ; WAITED BETWEEN COUNTS?
BNE PE40 ; NO
BEQ PE20 ; ALWAYS - ALL AGAIN
DSKINT
SEI
CLD
LDX #$FF
STX IEEEDO
STX PBDD1
INX ; .X = 0
STX PBD2 ; CLEAR LED'S
LDA #DAVO+EOIO+RFDO
STA PAD2
LDA #$1F
STA PADD2
LDA #ERRLED+LED0+LED1
STA PBDD2
STA PBDD2
;
;*********************************
;
; 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
CLC
ADC #1 ; BUMP COUNT
CMP $0,X ; CHECK IT
BNE PEZRO ; WRONG
CMP $1,X ; CHECK IF DONE
BNE PU30 ; NOT DONE
TXA
ADC #0 ; .A = .A+1, (.C = 1)
CMP $0,X ; DOUBLE CHECK FOR DONE
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
;
; SET CONTROLLER TO RESET IF SOFT RESET
;
LDA #$78 ; SEI
STA $1100
LDA #$6C
STA $1101
LDA #$FC
STA $1102
LDA #$FF
STA $1103 ; JMP ($FFFC)
LDA #$D0
STA JOBS
;
; TEST TWO 64K-BIT ROMS
;
; ENTER X = START PAGE
; EXIT IF OK
;
RM10
INC TEMP ; NEXT ERROR#
STX IP+1 ; SAVE PAGE, START X = 0
LDA #0
STA IP ; ZERO LO INDIRECT
TAY
LDX #32 ; 32 PAGES IN 8K ROM
CLC
RT10
DEC IP+1 ; DO IT BACKWARDS
RT20
ADC (IP),Y ; TOTAL CHECKSUM IN A
INY
BNE RT20
DEX
BNE RT10
ADC #0 ; ADD IN LAST CARRY
TAX ; SAVE LOWER PAGE IN X
CMP IP+1 ; CORRECT?
BNE PERR2
CPX #$C0 ; DONE BOTH ROMS?
BNE RM10
;
; TEST ALL COMMON RAM
;
CR20
LDA #$10 ; START OF 1ST BLOCK
CR30
STA IP+1 ; SAVE PAGE#
INC TEMP ; BUMP ERROR#
RAMTST
LDX #4 ; 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 #4 ; 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
LDA IP+1 ; GET FIRST PAGE OF BLOCK
CLC
ADC #$10 ; NEXT BLOCK
CMP #$50 ; DONE?
BNE CR30 ; NO
;
;**********************************
;
; CONTROLLER TEST & INITIALIZATION
;
;**********************************
;
LDA #3 ; SET ERROR# TO 3+1
STA TEMP
LDA #1
CMP $1000 ; CHECK WAIT FLAG
BNE PERR2 ; NOT GOOD
LDY #0
STY $1000 ; LET CONTROLLER GO
LDA #ERRLED+LED0+LED1
STA PBD2 ; FLIP LEDS ON DURING TEST
CTEST2
LDA $1000
BEQ CTEST2 ; WAIT FOR CONTROLLER
CMP #1 ; CONTROLLER OK?
BEQ DIAGOK ; YES
STA TEMP ; CONTROLLER ERROR CODE
PERR2
JMP PERR
DIAGOK
JMP BEGIN ; START OF DOS
.END

204
DOS_8280/duplct

@ -0,0 +1,204 @@
.PAGE 'DUPLICATE'
;
; DUPLICATE DISK
;
DUPLCT
LDA #BADCMD
JMP CMDERR ; BAD COMMAND FOR SINGLE DISK
;
; FORMAT THE DRIVE
;
JFORMT
LDY #0
STY JOBNUM ; USE JOB NUMBER 0
JSR JOB2X ; .X = JOBNUM*8
TYA
STA HDRS+2,X
LDA #1 ; SECTOR 1
STA HDRS+3,X
LDA #FMTCMD ; FORMAT COMMAND
JSR DOJOB ; FORMAT THE DRIVE
FORMA0
LDA #0 ; USE JOB NUMBER 0
FORMA1
STA JOBNUM
JSR JOB2X ; .X = JOBNUM*8
LDA #0
STA R0 ; R0 = 0, NEW TRACK
STA HEAD ; HEAD = 0
STA HDRS+2,X ; TRACK = 0
LDA #1
STA HDRS+3,X ; SECTOR = 1, HEAD = 0
STA SECTOR ; FIRST SECTOR
JSR SETBTS ; SET UP BAD T, S AND H
FORMA2
LDA #$FF
STA JOBRTN ; RETURN ALL ERRORS
LDA #WVERFY
JSR DOJOB ; VERIFY ALL SECTORS
CMP #2 ; ANY ERRORS?
BCC FORMA3 ; NO
JSR ADDBTS ; YES, ADD TO BAD T, S AND H
FORMA3
JSR JOB2X ; .X = JOBNUM*8
INC HDRS+3,X ; NEXT SECTOR, HEAD
LDA HDRS+3,X
AND #%00011111
CMP SECTRS
BCC FORMA2 ; NEXT SECTOR
INC HEAD
LDA HEAD
CMP HEADS
BCS FORMA4 ; DONE WITH THIS TRACK
LDA SECTOR
PHA
LDA #1
STA SECTOR
JSR ADDHED
STA HDRS+3,X ; HEAD AND SECTOR
PLA
STA SECTOR
BNE FORMA2 ; JUMP
FORMA4
JSR JOB2X ; .X = JOBNUM*8
LDA #1
STA HDRS+3,X ; BACK TO SECTOR = 1, HEAD 0
LDA #0
STA R0 ; R0 = 0, NEW TRACK
STA HEAD ; HEAD = 0
INC HDRS+2,X ; TRACK = TRACK+1
LDA HDRS+2,X
CMP MAXTRK ; MORE TRACKS?
BCC FORMA2 ; YES, DO THE NEXT CYLINDER
JMP WRTBTS ; WRITE LAST LIST (RTS)
;
; SET UP BAD T, S AND H
;
; RETURNS WITH:
;
; BUFFER(JOBNUM) = $FF
; INDEX POINTER (IP) = 2
;
SETBTS
LDY JOBNUM
LDA #$FF
JSR SETBUF ; SET BUFFER TO $FF'S
INC IP
INC IP ; IP = 2
RTS
;
; SET BUFFER TO CONTENTS OF .A
;
; ON ENTRY:
;
; .Y = BUFFER NUMBER
; .A = BUFFER CONTENTS
;
SETBUF
LDX BUFIND,Y
STX IP+1
LDY #0
STY IP
SETBU1
STA (IP),Y
INY
BNE SETBU1
RTS
;
; ADD T, S AND H TO LIST
;
ADDBTS
LDY #0
LDA R0 ; NEW TRACK?
BNE ADDBT2 ; NO, JUST ADD SECTOR, HEAD
INC R0 ; R0 <> 0
INC IP ; LEAVE AN $FF
BNE ADDBT1
JSR WRTBTS ; WRITE THIS LIST
ADDBT1
JSR JOB2X ; .X = JOBNUM*8
LDA HDRS+2,X ; TRACK
STA (IP),Y ; MARK THE TRACK
INC IP
BNE ADDBT2
JSR WRTBTS ; WRITE THIS LIST
ADDBT2
JSR JOB2X ; .X = JOBNUM*8
LDA HDRS+3,X ; SECTOR, HEAD
STA (IP),Y ; MARK THE SECTOR, HEAD
INC IP
BNE ADDBT3
JSR WRTBTS ; WRITE THIS LIST
ADDBT3
RTS
;
; WRITE THE BAD T, S AND H LIST
;
WRTBTS
JSR JOB2X ; .X = JOBNUM*8
LDA HDRS+2,X
PHA ; SAVE THE CURRENT TRACK
LDA HDRS+3,X
PHA ; SAVE THE CURRENT SECTOR, HEAD
LDA SECTOR
CLC
ADC #1 ; NEXT SECTOR, HEAD
CMP SECTRS
BCS WRTBT2 ; NO MORE SECTORS
STA HDRS+3,X ; POSSIBLE NEXT SECTOR, HEAD
LDA #0
STA HDRS+2,X ; CYLINDER 0 ONLY
WRTBT1
LDA #$FF
STA JOBRTN ; RETURN ALL ERRORS
JSR DOWRIT ; TRY TO WRITE IT
CMP #2 ; ANY ERRORS?
BCC WRTBT3 ; NO
JSR JOB2X ; YES, .X = JOBNUM*8
INC HDRS+3,X ; NEXT SECTOR, HEAD
LDA HDRS+3,X
CMP SECTRS
BCC WRTBT1 ; TRY THE NEXT SECTOR, HEAD
WRTBT2
LDA #12
JMP ERROR ; FORMAT ERROR
WRTBT3
LDA SECTOR ; GET THE PREVIOUS SECTOR
CMP #1
BNE WRTBT4 ; HAS A PREVIOUS SECTOR
JSR JOB2X ; .X = JOBNUM*8
LDA HDRS+3,X
LDY DRVNUM
STA BTSSEC,Y ; START OF BAD T, S AND H (SECTOR)
LDA #0
STA BTSTRK,Y ; START OF BAD T, S AND H (TRACK)
BEQ WRTBT5 ; JUMP
WRTBT4
JSR JOB2X ; .X = JOBNUM*8
LDA HDRS+3,X ; CURRENT SECTOR
PHA ; SAVE IT
LDA SECTOR ; PREVIOUS SECTOR
STA HDRS+3,X ; NOW THE CURRENT SECTOR
JSR DOREAD ; READ THE PREVIOUS SECTOR
LDY #0
TYA
STA IP
STA (IP),Y ; SET THE TRACK LINK
INY
PLA ; CURRENT SECTOR
STA (IP),Y ; SET THE SECTOR LINK
PHA ; SAVE THE SECTOR AGAIN
JSR DOWRIT ; WRITE THE PREVIOUS BTS
JSR JOB2X ; .X = JOBNUM*8
PLA ; CURRENT SECTOR
STA HDRS+3,X ; RESTORE THE CURRENT SECTOR
WRTBT5
JSR JOB2X ; .X = JOBNUM*8
LDA HDRS+3,X
STA SECTOR ; NOW THE CURRENT SECTOR
PLA
STA HDRS+3,X ; SECTOR ON ENTRY
PLA
STA HDRS+2,X ; TRACK ON ENTRY
JMP SETBTS ; SET UP FOR NEW BUFFER (RTS)
.END

2
DOS_8280/echksm

@ -0,0 +1,2 @@
ECHKSM .BYTE 0
.END

55
DOS_8280/equate

@ -0,0 +1,55 @@
.PAGE 'EQUATE'
;
; EQUATES
;
ROM = $C000 ; START OF DOS
LRF = $80
DYFILE = $40
OVRFLO = $20
NSSL = 6
SSIOFF = 4+NSSL+NSSL
NSSP = 120
LOTRK = 4
HITRK = 5
MXCHNS = 8
MAXSA = 18
CR = $0D ; CARRIAGE RETURN
BFCNT = 12
BAMJOB = BFCNT
CBPTR = BAMJOB+BAMJOB+4
ERRCHN = MXCHNS-1
ERRSA = 16
CMDCHN = MXCHNS-2
LXINT = $3F
CMDSA = 15
APMODE = 2
MDMODE = 3
RDMODE = 0
WTMODE = 1
RELTYP = 4 ; RELATIVE TYPE FILE
DIRTYP = 7 ; DIRECT TYPE FILE
SEQTYP = 1 ; SEQUENTIAL TYPE FILE
PRGTYP = 2 ; PROGRAM TYPE FILE
USRTYP = 3 ; USER TYPE FILE
TYPMSK = 7
IRSA = 17 ; INTERNAL READ CHANNEL
IWSA = 18 ; INTERNAL WRITE CHANNEL
DOSVER = 3 ; DOS VERSION
;
;CONTROLLER JOB TYPES
;
READ = $80 ; READ
WRITE = $90 ; WRITE
WVERFY = $A0 ; WRITE VERIFY
SEEK = $B0 ; SEEK
SECSEK = $B8 ; SECTOR SEEK
BUMP = $C0 ; RESTORE
FMTCMD = $C4 ; FORMAT
JUMPC = $D0 ; JUMP
EXEC = $E0 ; EXECUTE
MXFILS = 5 ; MAX # FILENAMES IN STRING
CMDIND = 30 ; CMD BUFFER INDEX (*2)
DIRLEN = 24 ; DIRECTORY LENGTH USED
NBSIZ = 27 ; NAMBUF TEXT SIZE
CMDLEN = 58 ; COMMAND LENGTH
.END

4
DOS_8280/erom

@ -0,0 +1,4 @@
*=$E000
ECHKSM
.BYTE 0 ;CHECKSUM FOR $E-$F ROM
.END

451
DOS_8280/erproc

@ -0,0 +1,451 @@
.PAGE 'ERPROC'
;
; 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
; 27 (9) CHECKSUM ERROR IN HEADER
; 75 (12) FORMAT ERROR
; 76 (127) CONTROLLER ERROR
;
; 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.0
; 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
CBMVER = $73
NODRIV = $74
FMTERR = $75
CNTERR = $76
.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
;"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.0"
.BYTE $73,$C3,'BM DOS V3.',$B0
;"DRIVE NOT READY"
.BYTE $74,$C4,'RIVE',$6,' READ',$D9
;"FORMAT ERROR"
.BYTE $75,$C6,'ORMAT',$89
;"CONTROLLER ERROR"
.BYTE $76,$C3,'ONTROLLER',$89
ERRTOK =*-ERRTAB
;
; 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
;
; RECURSIVE ERROR MESSAGE ROUTINE
;
ERMOVE
TAX ; SAVE .A
LDA R0
PHA ; SAVE R0
LDA R0+1
PHA ; SAVE R0+1
LDA #<ERRTAB ; SET POINTER TO TABLE
STA R0
LDA #>ERRTAB
STA R0+1
TXA ; RESTORE .A
LDX #0 ; FOR INDIRECT
E10
CMP (R0,X) ; ERROR# = TABLE ENT?
BEQ E50 ; YES, SEND MSG
PHA ; SAVE ERROR
JSR EADV2 ; CHECK AND ADVANCE
BCC E30 ; MORE #'S TO CHECK
E20
JSR EADV2 ; ADVANCE PAST THIS MSG
BCC E20
E30
LDA R0+1 ; CHECK PTR
CMP #>ETEND
BCC E40 ; CONTINUE
BNE E45 ; QUIT
LDA #<ETEND
CMP R0
BCC E45 ; PAST END OF TABLE
E40
PLA ; RESTORE ERROR #
JMP E10 ; CHECK NXT ENT
E45
PLA ; RESTORE ERROR #
JMP E90 ; QUIT
E50
JSR EADV1
BCC E50 ; GO PAST OTHER #'S
E55
JSR E60
JSR EADV1
BCC E55
JSR E60 ; CHECK FOR TOKEN OR LAST CHAR
JMP E90
E60
CMP #$20 ; MAX TOKEN+1
BCS E70 ; NOT A TOKEN
TAX
LDA #$20 ; IMPLIED SPACE
STA (CB+2),Y ; ADD TO ERRBUF
INY
TXA
JSR ERMOVE ; ADD TOKEN MSG
RTS
E70
STA (CB+2),Y ; ADD TO ERRBUF
INY
RTS
E90
PLA
STA R0+1
PLA
STA R0
RTS
EADV1
INC R0
BNE EA10
INC R0+1
EA10
LDA (R0,X)
ASL A
LDA (R0,X)
AND #$7F
RTS
EADV2
JSR EA10
INC R0
BNE EA20
INC R0+1
EA20
RTS
;
; CONTROLLER ERROR ENTRY
; .A = ERROR #
; .X = JOB #
;
JERROR
PHA
CMP #12 ; FORMAT ERROR
BNE ERROR1
LDA #FMTERR
BNE JCDER2 ; JUMP
ERROR1
CMP #127 ; CONTROLLER ERROR
BNE ERROR2
LDA #CNTERR
BNE JCDER2 ; JUMP
ERROR2
STX JOBNUM
TXA
ASL A
ASL A
ASL A
TAX
LDA HDRS+2,X ; RECALL TRACK,SECTOR
STA TRACK
LDA HDRS+3,X
STA SECTOR
PLA
AND #$F ; CONVERT CONTROLLER...
BNE ERR1 ; ...ERRORS TO DOS ERRORS
LDA #6 ; CODE = 16-->14
ERR1
ORA #$20
TAX
DEX
DEX
TXA
PHA
LDA CMDNUM
CMP #VAL
BNE ERR2
LDA #$FF
STA CMDNUM
PLA
JSR ERRMSG
JSR INITDR ; INIT FOR VALIDATE
JMP CMDER3
ERR2
PLA
JCDER2
JSR ERRMSG
CMDER3
JSR CLRCB ; CLEAR CMDBUF
LDA #0
STA ERWORD ; CLEAR AFTER ERROR
LDA PBD2 ; SET ERROR LED
ORA #ERRLED
STA PBD2
JSR FREICH ; FREE INTERNAL CHANNEL
LDA #0 ; CLEAR POINTERS
STA BUFTAB+CBPTR
LDX #$FF
TXS ; PURGE STACK
LDA ORGSA
AND #$0F
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 #$0F
STA LINDX
JMP TLERR
;
; TALKER ERROR RECOVERY
; IF COMMAND CHANNEL, RELEASE DAV
; IF DATA CHANNEL, FORCE NOT READY
; AND RELEASE CHANNEL
;
TLKERR
JSR FNDRCH
LDA PAD2
ORA #DAVO
STA PAD2
BNE TLERR ; FINISH
;
; LISTENER ERROR RECOVERY
; IF COMMAND CHANNEL, RELEASE RFD
; IF DATA CHANNEL, FORCE NOT READY
; AND RELEASE CHANNEL
;
LSNERR
JSR FNDWCH
LDA #RFDO
ORA PAD2
AND #$FE
STA PAD2
TLERR
JSR TYPFIL
CMP #RELTYP
BCS ERR10
JSR FRECHN
ERR10
JMP IDLE
;
; CONVERT HEX TO BCD
;
HEXDEC
TAX
LDA #0
PHP
PHA
SED
HEX0
CPX #0
BEQ HEX5
CLC
ADC #1
BCC HEX1
PLA
ADC #0
PHA
LDA #0
HEX1
DEX
JMP HEX0
HEX5
TAX
PLA
PLP
ORA #0
BEQ HEX2
JSR BCD2
HEX2
TXA
;
; 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
JERRMS
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
LDX #0
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
LDA #',
STA (CB+2),Y
INY
LDA DRVNUM
AND #1
ORA #$30
STA (CB+2),Y ; STORE DRIVE #
TYA
CLC
ADC #<ERRBUF
STA LSTCHR+ERRCHN ; SET LAST CHAR
INC CB+2
LDA #RDYTLK
STA CHNRDY+ERRCHN
RTS
.END

5
DOS_8280/fmt40

@ -0,0 +1,5 @@
.PAGE '4040 FORMAT CODE'
*=$FB00
FMTCO4 ; 4040 FORMAT CODE
*=*+$400
.END

172
DOS_8280/fndrel

@ -0,0 +1,172 @@
.PAGE 'FNDREL'
;
;********************************
;*
;* FIND RELATIVE FILE
;*
;* VERSION 3.0
;*
;*
;* INPUTS
;* RECL - 1 BYTE = LO RECORD #
;* RECH - 1 BYTE = HI RECORD #
;* RS - 1 BYTE = RECORD SIZE
;* RECPTR - 1 BYTE = FIRST BYTE WANTED
;* FROM RECORD
;*
;* OUTPUTS
;* SSNUM - 1 BYTE = SIDE SECTOR #
;* SSIND - 1 BYTE = INDEX INTO SS
;* RELPTR - 1 BYTE = PTR TO FIRST
;* BYTE WANTED
;*
;********************************
;
FNDREL
JSR MULPLY ; RESULT = RN*RS+RP
JSR DIV254 ; DIVIDE BY 254
LDA ACCUM+1 ; SAVE REMAINDER
STA RELPTR
JSR DIV120 ; DIVIDE BY 120
INC RELPTR
INC RELPTR
LDA ACCUM+1
ASL A
CLC
ADC #16
STA SSIND
JSR DIV006
LDA ACCUM+1
STA SSNUM
LDA RESULT
STA GRPNUM
RTS
.PAGE
;
; MULTIPLY
;
; RESULT = RECNUM*RS+RECPTR
;
; DESTROYS .A, .X
;
MULPLY
JSR ZERRES ; RESULT=0
STA ACCUM+3 ; A = 0
LDX LINDX ; GET INDEX
LDA RECL,X
STA ACCUM+1
LDA RECH,X
STA ACCUM+2
BNE MUL25 ; ADJUST FOR REC #1 &...
LDA ACCUM+1 ; ...#0 = 1ST REC
BEQ MUL50
MUL25
LDA ACCUM+1
SEC
SBC #1
STA ACCUM+1
BCS MUL50
DEC ACCUM+2
MUL50
LDA RS,X ; COPY RECORD SIZE
STA TEMP
MUL100
LSR TEMP ; DO AN ADD?
BCC MUL200 ; NO
JSR ADDRES ; RESULT = RESULT+ACCUM+1,2,3
MUL200
JSR ACCX2 ; 2*(ACCUM+1,2,3)
LDA TEMP ; DONE ?
BNE MUL100 ; NO
LDA RECPTR ; ADD IN LAST BIT
CLC
ADC RESULT
STA RESULT
BCC MUL400 ; SKIP NO CARRY
INC RESULT+1
BNE MUL400
INC RESULT+2
MUL400
RTS
.PAGE
;
; DIVIDE
;
; RESULT = QUOTIENT, ACCUM+1 = REMAINDER
;
; DESTROYS .A, .X, .Y
;
DIV254
LDA #254 ; DIVIDE BY 254
.BYTE $2C ; SKIP NEXT TWO BYTES
DIV120
LDA #120 ; DIVIDE BY 120
.BYTE $2C ; SKIP NEXT TWO BYTES
DIV006
LDA #6 ; DIVIDE BY 6
STA TEMP ; 8 BIT DIVISOR
LDA #0
STA ACCUM+1 ; CLEAR PARTIAL DIVIDEND
STA ACCUM+2
LDX #24 ; 24 BIT DIVIDEND
DIVID1
ASL RESULT
ROL RESULT+1
ROL RESULT+2
ROL ACCUM+1
ROL ACCUM+2
LDA ACCUM+1
SEC
SBC TEMP
TAY ; SAVE RESULT
LDA ACCUM+2
SBC #0 ; RIPPLE THE CARRY
BCC DIVID2 ; BRANCH IF TEMP > DIVIDEND
INC RESULT
STA ACCUM+2
STY ACCUM+1
DIVID2
DEX
BNE DIVID1
RTS
.PAGE
;
; ZERO RESULT
;
ZERRES
LDA #0
STA RESULT
STA RESULT+1
STA RESULT+2
RTS
;
; MULTIPLY ACCUM BY 4
;
ACCX4
JSR ACCX2
;
; MULTIPLY ACCUM BY 2
;
ACCX2
CLC
ACC200
ROL ACCUM+1
ROL ACCUM+2
ROL ACCUM+3
RTS
;
; ADD ACCUM TO RESULT
;
; RESULT = RESULT+ACCUM+1,2,3
;
ADDRES
CLC
LDX #$FD
ADD100
LDA RESULT+3,X
ADC ACCUM+4,X
STA RESULT+3,X
INX
BNE ADD100
RTS
.END

301
DOS_8280/frets

@ -0,0 +1,301 @@
.PAGE 'FRETS'
;
; MARK A TRACK, SECTOR FREE IN BAM
;
JFRETS
JSR GETHED ; GET THE HEAD NUMBER
JSR SETBMP ; POINT BMPNT AT BAM
JSR FREUSE ; CALC INDEX INTO BAM
FRETS2
SEC ; FLAG FOR NO ACTION
BNE FRERTS ; FREE ALREADY
LDA (BMPNT),Y ; NOT FREE, FREE IT
ORA BMASK,X
STA (BMPNT),Y
JSR DTYBAM ; SET DIRTY FLAG
LDY TEMP
CLC
LDA (BMPNT),Y ; ADD ONE
ADC #1
STA (BMPNT),Y
INC NDBL,X
BNE FRERTS
INC NDBH,X
FRERTS
JMP ADDHED ; ADD THE HEAD NUMBER (RTS)
DTYBAM
LDX DRVNUM
LDA #1
STA MDIRTY,X ; SET DIRTY FLAG
RTS
;
; MARK TRACK, SECTOR USED
;
JUSED
JSR GETHED ; GET THE HEAD NUMBER
USEDT0
JSR FREUSE ; CALC IN DEX INTO BAM
BEQ USERTS ; USED, NO ACTION
LDA (BMPNT),Y ; GET BITS
EOR BMASK,X ; MARK SEC USED
STA (BMPNT),Y
JSR DTYBAM
LDY TEMP
LDA (BMPNT),Y ; GET COUNT
SEC
SBC #1 ; DEC ONE
STA (BMPNT),Y ; SAVE IT
LDA NDBL,X
BNE USEDT1
DEC NDBH,X
USEDT1
DEC NDBL,X
USEDT2
LDA NDBH,X
BNE USERTS
LDA NDBL,X
CMP #3
BCS USERTS ; > 2 BLOCKS FREE
LDA #DSKFUL
JSR ERRMSG
USERTS
JMP ADDHED ; ADD THE HEAD NUMBER (RTS)
;
; CALCULATES INDEX INTO BAM
; FOR FRETS AND USEDTS
;
FREUSE
JSR SETMAP
TYA
FREUS2
STA TEMP ; SAVE INDEX
FREUS3
LDA SECTOR ; .A = SECTOR/8
LSR A
LSR A
LSR A
SEC ; SKIP # OF BLOCKS
ADC TEMP ; CALC INDEX
TAY
LDA SECTOR ; BIT IN THAT BYTE
AND #7
TAX
LDA (BMPNT),Y ; GET THE BYTE
AND BMASK,X ; TEST IT
RTS ; .Z = 1 = USED, .Z = 0 = FREE
;
BMASK
.BYTE 1,2,4,8,16,32,64,128
.PAGE
SETMAP
JSR SETBJ
JSR SETBMP ; SET BAM POINTER
LDA TRACK
CMP MAXTRK
BCC SM11 ; TRACK < MAXTRK
SM10
LDA #BADTS ; BAD TRACK OR SECTOR
JSR CMDER2
SM11
JSR JOB2X
LDY DRVNUM
LDA HDRS+2,X
CMP HSTRK,Y
BNE SM20
LDA HDRS+3,X
CMP HSSEC,Y
BNE SM20
JSR RDBAM ; READ THE FIRST BAM
SM20
LDY #LOTRK ; LOW TRACK OFFSET
LDA TRACK
CMP (BMPNT),Y
BCS SM40 ; TRACK >= LOW TRACK
JSR PRVBAM ; READ THE PREVIOUS BAM
JMP SM20
SM40
LDA TRACK
LDY #HITRK ; HIGH TRACK OFFSET
CMP (BMPNT),Y
BCC SM50 ; TRACK < HIGH TRACK
JSR NXTBAM ; READ THE NEXT BAM
JMP SM20
SM50
JMP BAMIDX ; GET THE BAM INDEX (RTS)
;
; .X = JOBNUM*8
;
JOB2X
LDA JOBNUM
ASL A
ASL A
ASL A
TAX
RTS
;
; JOBNUM = DRVNUM+BAMJOB
;
SETBJ
LDA DRVNUM
CLC
ADC #BAMJOB
STA JOBNUM
RTS
;
; READ 1ST BAM IN
;
RDBAM
JSR SCRBAM
JSR JOB2X
LDY DRVNUM
LDA BAMTRK,Y
STA HDRS+2,X
LDA BAMSEC,Y
STA HDRS+3,X
JMP DOREAD
;
; READ THE NEXT BAM IN
;
NXTBAM
JSR SCRBAM
JSR JOB2X
LDY #0
LDA (BMPNT),Y
STA HDRS+2,X
INY
LDA (BMPNT),Y
STA HDRS+3,X
JMP DOREAD
;
; READ THE PREVIOUS BAM IN
;
PRVBAM
JSR SCRBAM ; WRITE THE CURRENT BAM IF NEEDED
JSR JOB2X
PRVBA1
LDY #2
LDA (BMPNT),Y ; GET THE TRACK
STA HDRS+2,X
INY
LDA (BMPNT),Y ; GET THE SECTOR AND HEAD
STA HDRS+3,X
JMP DOREAD ; READ IT IN
;
; .Y = BTSIZE*(TRACK-LOTRK)+MAPOFF+HEAD*BAMSIZ
;
BAMIDX
LDA TRACK
MBAM2
SEC
LDY #LOTRK
SBC (BMPNT),Y
STA ACCUM+1
LDA BTSIZE
STA TEMP
LDA #0
JMP MB30 ; NOW MULTIPLY
MB10
CLC
ADC ACCUM+1
BCC MB20
LDA #SYSTS
JSR CMDER2
MB20
ASL ACCUM+1
MB30
LSR TEMP
BCS MB10
BNE MB20
ADC MAPOFF ; .C = 0
MB35
LDY HEAD
BEQ MB50
CLC
MB40
ADC BAMSIZ
DEY
BNE MB40
MB50
TAY
RTS
;
; CLEAR THE BAM AREA
;
CLRBAM
LDY #0
TYA
CLB1
STA (BMPNT),Y
INY
BNE CLB1
RTS
;
; READ THE DIRECTORY HEADER
;
RDDIR
JSR SETBJ
JSR SCRBAM ; SCRUB BAM
LDX DRVNUM
LDA HSTRK,X ; START OF HEADER
STA TRACK
LDA HSSEC,X
STA SECTOR
LDA JOBNUM
JSR SETH
JMP DOREAD
;
; TURN ON ACTIVITY LED SPECIFIED
; BY DRVNUM
;
JSETLD
LDA #$E7
AND PBD2
PHA
LDA DRVNUM
BEQ LEDS0
PLA
ORA #LED1
BNE LEDS1
LEDS0
PLA
ORA #LED0
LEDS1
STA PBD2
RTS
ERROFF
LDA PBD2
AND #$FF-ERRLED
STA PBD2
RTS
;
; ADD THE HEAD NUMBER TO THE SECTOR NUMBER
;
ADDHED
LDA HEAD
ASL A
ASL A
ASL A
ASL A
ASL A
ORA SECTOR
STA SECTOR
RTS
;
; EXTRACT THE HEAD NUMBER FORM THE SECTOR
;
GETHED
LDA SECTOR
AND #%11100000 ; MASK OUT THE SECTOR
LSR A
LSR A
LSR A
LSR A
LSR A
STA HEAD ; CURRENT HEAD
PHA ; SAVE THE HEAD NUMBER
LDA SECTOR
AND #%00011111 ; MASK OUT THE HEAD
STA SECTOR ; CURRENT SECTOR
PLA ; RETURN WITH .A = HEAD
RTS
.END

44
DOS_8280/getact

@ -0,0 +1,44 @@
.PAGE 'GETACT'
;*********************************
;* GETACT: GET ACTIVE BUFFER # *
;* VARS: BUF0,BUF1,LINDX *
;* REGS: OUT: .A= ACT BUFFER # *
;* .X= LINDX *
;* FLAGS: .N=1: NO ACT-BUF *
;*********************************
;
GETACT
LDX LINDX
LDA BUF0,X
BPL GA1
LDA BUF1,X
GA1
AND #$BF ; STRIP DIRTY BIT
RTS
;
;*********************************
;* GAFLG: GET ACTIVE BUFFER #; *
;* SET LBUSED & FLAGS. *
;* REGS: OUT: .A= ACT BUFFER # *
;* .X= LINDX *
;* FLAGS: .N=1: NO ACT-BUF *
;* .V=1: DIRTY BUF *
;*********************************
;
GAFLGS
LDX LINDX
GA2
STX LBUSED ; SAVE BUF #
LDA BUF0,X
BPL GA3
TXA
CLC
ADC #MXCHNS
STA LBUSED
LDA BUF1,X
GA3
STA T1
AND #$1F
BIT T1
RTS
.END

50
DOS_8280/i_odef

@ -0,0 +1,50 @@
.PAGE 'I/ODEF'
;
; I/O DEFINITIONS
;
UNLSN = $3F ; IEEE UNLISTEN COMMAND
NOTRDY = $00 ; NOT READY
TALKER = $80 ; IEEE TALKER FLAG
LISNER = $01 ; IEEE LISTENER FLAG
EOIOUT = $80 ; TALK WITH EOI
EOISND = $08 ; NOT(EOI) TO SEND
RDYTLK = $88 ; TALK NO EOI
RDYLST = $01 ; READY TO LISTEN
RNDRDY = RDYTLK+RDYLST ; RANDOM CHNRDY
RNDEOI = EOIOUT+RDYLST ; RANDOM W/ EOI
;
; I/O REGISTERS
;
; MOS 6532-1
;
*=$0200
IEEEDI *=*+1 ; IEEE DATA IN
PADD1 *=*+1 ; IEEE DATA DIR
IEEEDO *=*+1 ; IEEE DATA OUT
PBDD1 *=*+1 ; IEEE DATA OUT DIR
;
; MOS 6532-2
;
*=$0280
PAD2 *=*+1
ATNA = 1
DACO = 2 ; (INVERTED)
RFDO = 4
EOIO = 8
DAVO = 16
EOII = 32
DAVI = 64
ATNI = 128 ; (INVERTED)
PADD2 *=*+1
PBD2 *=*+1
LED1 = $08 ; ACTIVE LED 1
LED0 = $10 ; ACTIVE LED 0
ERRLED = 32 ; ERROR LED
NDACI = 64
NRFDI = 128
PBDD2 *=*+1
ATNND *=*+1 ; ATN IS IRQ CAUSING
ATNPD *=*+1
ATNNE *=*+1
ATNPE *=*+1
.END

80
DOS_8280/idle

@ -0,0 +1,80 @@
.PAGE 'IDLE'
;
; IDLE LOOP, WAITING FOR SOMETHING TO DO
;
VIDLE
LDA CMDWAT ; TEST FOR PENDING COMMAND
BEQ IDL1 ; NO COMMAND WAITING
SEI
LDA #0
STA CMDWAT
STA NMIFLG ; CLEAR DEBOUNCE
JSR PARSXQ ; PARSE AND EXECUTE COMMAND
IDL1
CLI
LDA #14
STA TEMP+3
LDA #0 ; IF FILE OPEN, TURN ON ACT LED
STA TEMP
STA TEMP+1
IDL2
LDX TEMP+3 ; LOOK THRU LINTAB
LDA LINTAB,X ; FOR ACTIVE FILE
CMP #$FF
BEQ IDL3
AND #$3F
STA LINDX
JSR GETACT
TAX
LDA LSTJOB,X ; DETERMINE WHICH DRIVE IT'S ON
AND #1
TAX
INC TEMP,X
IDL3
DEC TEMP+3 ; SET FLAG INDICATING DRV
BPL IDL2 ; HAS FILE OPEN
LDY #BFCNT-1 ; LOOK THRU JOB QUE FOR
IDL4
LDA JOBS,Y ; FOR JOBS STILL RUNNING
BPL IDL5
AND #1
TAX
INC TEMP,X ; SET FLAG INDICATING DRIVE
IDL5
DEY ; IS ACTIVE
BPL IDL4
SEI
LDA DRVNUM
PHA ; SAVE DRIVE
LDA PBD2
AND #255-LED1-LED0
PHA
LDA #0
STA DRVNUM
LDA TEMP
BEQ IDL7
LDA WPSW
BEQ IDL6
JSR CLDCHN
IDL6
PLA ; TURN ON LED IF DRIVE FLAG
ORA #LED0 ; IF NOT 0
PHA
IDL7
INC DRVNUM
LDA TEMP+1
BEQ IDL9
LDA WPSW+1
BEQ IDL8
JSR CLDCHN
IDL8
PLA
ORA #LED1
PHA
IDL9
PLA
STA PBD2
PLA
STA DRVNUM ; RESTORE DRIVE
JMP IDL1 ; BACK TO TOP OF LOOP
.END

226
DOS_8280/ieee

@ -0,0 +1,226 @@
.PAG 'IEEE'
;
; ATN IRQ PROCESS
; IRQ ON ATN, LISTEN TO PET
; CLEAR STACK
;
VIEEE
LDX #$FF
STX CMDNUM
TXS
LDA ATNPE ; CLEAR IRQ FLAG
LDA #DAVO+EOIO
ORA PAD2 ; FREE CONTROL LINES
STA PAD2
LDA #255
STA IEEEDO ; FREE DATA LINES
ATN10
LDA #DACO+RFDO+ATNA
ORA PAD2
STA PAD2
ATN20
BIT PAD2
BVC ATN30 ; DAV LO
BMI ATN20 ; ATN LO ATNI HI
BPL ATN50 ; ATN HI
ATN30
LDA #255-RFDO ; NRFD LO
AND PAD2
STA PAD2
AND #EOII
STA EOIFLG ; SAVE EOI
LDA IEEEDI
EOR #$FF
STA DATA ; SAVE COMMAND
LDA #255-DACO ; NDAC HI
AND PAD2
STA PAD2
DCDE
LDY #0
LDA DATA
AND #%01100000
CMP #$40 ; TALK?
BEQ DCDE60
CMP #$20 ; LISTEN?
BEQ DCDE20
CMP #$60 ; SECONDARY?
BEQ DCDE70
BNE DCDE80 ; OTHER
DCDE20
LDA DATA
CMP LSNADR
BEQ DCDE40 ; MY LISTEN ADDRESS
CMP #UNLSN
BNE DCDE30
STY LSNACT
DCDE30
STY ADRSED ; NOT PRIMARY ADDRSED
JMP DCDE80
DCDE40
STA LSNACT
STY TLKACT
DCDE50
LDA #32
STA SA ; DEFAULT SA
STA ORGSA
STA ADRSED ; PRIMARY ADDRESSED
BNE DCDE80
DCDE60
STY TLKACT
LDA DATA
CMP TLKADR
BNE DCDE30
STA TLKACT
STY LSNACT
BEQ DCDE50
DCDE70
LDA ADRSED
BEQ DCDE80 ; NOT ADDRESSED
LDA DATA
STA ORGSA
PHA
AND #$F
STA SA
PLA
AND #$F0 ; CLOSE?
CMP #$E0
BNE DCDE80
JSR CLOSE
DCDE80
ATN40
BIT PAD2
BVC ATN40
JMP ATN10
ATN50
LDA LSNACT
BEQ ATN60
LDA #255-RFDO-ATNA
AND PAD2
STA PAD2
CLI
JSR LISTEN
JMP IDLE
ATN60
LDA #255-ATNA-DACO
AND PAD2
STA PAD2
LDA TLKACT
BEQ ATN70
CLI
JSR TALK
ATN70
JMP IDLE
LISTEN
LDA #RFDO ; RFD: HI
ORA PAD2
STA PAD2
LSN10
BIT PAD2 ; DAV: LO
BVS LSN10
JSR FNDWCH ;
BCS LSN15
LDA CHNRDY,X
ROR A ; OK, OPEN FOR LISTEN
BCS LSN30
LSN15
LDA ORGSA
AND #$F0 ; SA = OPEN?
CMP #$F0
BEQ LSN30
LSN20
LDA SA
CMP #1
BEQ LSN25
LSN21
BIT PAD2
BVC LSN21
LDA #255-DACO
AND PAD2
STA PAD2
RTS
LSN25
LDA #255-RFDO ; ACCEPT ALL DATA
AND PAD2
STA PAD2 ; RFD LOW
LDA #255-DACO
AND PAD2 ; DAC HI
STA PAD2
LSN26
BIT PAD2 ; DAV HI
BVC LSN26
LDA #DACO
ORA PAD2 ; DAC LOW
STA PAD2
LDA #RFDO ; RFD HI
ORA PAD2
STA PAD2
LSN28
BIT PAD2 ; WAIT DAV LOW
BVC LSN28
JMP LSN25 ; DO UNTIL ATN PULLED
LSN30
LDA #255-RFDO
AND PAD2
STA PAD2
AND #EOII
STA EOIFLG
LDA IEEEDI
EOR #$FF
STA DATA
SEI
LDA #255-DACO
AND PAD2
STA PAD2
LSN40
BIT PAD2
BVC LSN40
LDA #DACO
ORA PAD2
STA PAD2
JSR PUT
LSTRTN
CLI
JMP LISTEN
TALK
JSR FNDRCH
BCS NOTLK ; TEST IF CHANNEL READY
TALK1
LDX LINDX
LDA CHNRDY,X
BMI TLK10
NOTLK
RTS
TLK10
BIT PBD2 ; RFD: HI
BPL TLK10
LDA CHNDAT,X
EOR #$FF
STA IEEEDO
LDA CHNRDY,X
ORA #255-EOIO-DAVO
AND PAD2
STA PAD2
TLK20
BIT PBD2
BPL TLK30
BVC TLK20
LDA #DAVO+EOIO
ORA PAD2
STA PAD2
JMP IDLE
TLK30
JSR GET
TLK35
BIT PBD2
BVC TLK35
TLKRTN
LDA #$FF
STA IEEEDO
LDA #DAVO+EOIO
ORA PAD2
STA PAD2
TLK40
BIT PBD2
BVS TLK40
BVC TALK1
.END

204
DOS_8280/init

@ -0,0 +1,204 @@
.PAG 'INIT'
;RAM & ROM TEST, I/O-DATA INIT
.SKI 3
* = $E040+$141
F7 =$38 ;FAIL STATES
F6 =F7-8
F5 =F6-8
F4 =F5-8
F3 =F4-8
F2 =F3-8
F1 =F2-8
DROMTS LDX #0 ;TEST FOR DROM
LDA #$55 ; TEST FOR $55
DRT05 CMP $D000
BNE DRT10
DEX
BNE DRT05
DRT10 RTS
.SKIP
; RESET ENTRY ON POWER ON
INIT CLD
SEI
LDX #$FF
TXS
STX IEEEDO ;FREE DATA LINES
STX PBDD1
LDA #DAVO+EOIO+RFDO
STA PAD2 ;FREE CONTROL LINES
LDA #%00011111
STA PADD2 ;THEN SET DDR
LDA #ERRLED+ACTLDB+ACTLDA
STA PBD2
;LDA #%00111000
STA PBDD2
.SKIP
;ZERO PAGE TEST
ZPTST LDX #0
TXA
ZPT10 LDY #$55 ;ALTERNATING BITS
STY 0,X
DEX
BNE ZPT10
TAX
ZPT20 LDA #$AA
ASL 0,X
EOR 0,X
STA 0,X
BNE ZPBAD
.SKIP
DEX
BNE ZPT20
.SKIP
JSR DROMTS
BNE EROMCK ;NOT HERE, GOTO E-ROM TEST
JMP $D005 ;DIAGNOSTICS HOOK
.SKIP
ROMTST ;ROM CHECK SUBROUTINE
;SET IP AS INDIR. PNTR
LDX #16 ;CHECKSUM RETURNED IN .A
LDY #0
TYA
CLC
.SKI
ROMT10 ADC (IP)Y
INY
BNE ROMT10
.SKIP
DEX
BEQ ROMT20
.SKIP
INC IP+1
BNE ROMT10
.SKIP
ROMT20 RTS
ZPBAD LDA #$FF
STA 0,X
BNE ZPBAD
.SKIP
;E-ROM CHECK
EROMCK LDA #F6
STA PBD2
LDA #$E0 ;E-ROM
STA IP+1
LDA #0
STA IP
JSR ROMTST
.SKI
CMP #0
BEQ FROMCK ;OK, GOTO F-ROM TEST
.SKIP
BADE
STA $E000
JMP BADE
.SKIP
;F-ROM CHECK
FROMCK LDA #F5
STA PBD2
LDA #$F0
STA IP+1
JSR ROMTST
CMP #0
BEQ DIAGOK ;OK, GOTO 4K TEST
.SKIP
BADF
STA $F000
JMP BADF
.SKIP
DIAGOK LDA #0
STA PBD2
LDA PBD2 ;COMPUTE PRIMARY ADDR
AND #7
ORA #$48 ;TALK ADDRESS
STA TLKADR
EOR #$60 ;LISTEN ADDRESS
STA LSNADR
;INIT COMMAND CHANNEL
LDA #TALKER+LISNER
STA CHNRDY+CMDCHN
LDA #'0
STA CHNDAT+CMDCHN
DSKINT JSR INTTAB
LDA #$FF
LDX #33
DSKIN1 STA LINTAB,X
DEX
BPL DSKIN1
LDA #CMDRD
STA LINTAB+30
LDA #CMDWRT
STA LINTAB+31
LDA #$3F ;LINDX 0 TO 5 FREE
STA LINUSE
.SKIP
LDA #$0F
STA BUFNUM+12
LDA #$10
STA BUFNUM+14
LDA #$FF
STA BUFNUM+13
STA BUFNUM+15
LDA #$88
STA CHNRDY+CMDRD
LDA #$01
STA CHNRDY+CMDWRT
LDA #0
STA BUFUSE
LDA #$E0
STA BUFUSE+1
JSR USRINT ;INIT USER JMP
LDA #10 ;SET UP SECTOR OFFSET
STA SECINC
.SKIP
;ALLOW ATN TO INTERRUPT
STA ATNPE
.SKIP3
; IDLE LOOP, WAITING FOR SOMETHING TO DO
IDLE LDA CMDWAT ; TEST FOR PENDING COMMAND
BEQ IDLE2 ; NO COMMAND WAITING
LDA #0
STA CMDWAT
SEI
JSR PARSXQ ; PARSE AND XEQ COMMAND
IDLE2 CLI ;TEST FOR DRIVE RUNNING OR OPENFILE
LDA #29
STA TEMP+3
LDA #0 ;IF FILE OPEN, TURN ON ACT LED
STA TEMP
STA TEMP+1
FILO1 LDX TEMP+3 ;LOOK THRU LINTAB
LDA LINTAB,X ;FOR ACTIVE FILE
CMP #$FF
BEQ FILO2
STA LINDX
JSR GETACT
TAX
LDA LSTJOB,X ;DETERMINE WHICH DRV IT IS ON
AND #1
TAX
INC TEMP,X
FILO2 DEC TEMP+3 ;SET FLAG INDICATING DRV
BPL FILO1 ;HAS FILE OPEN
TSTFIL LDY #14 ;LOOK THRU JOB QUE FOR
FIL5 LDA JOBS,Y ; FOR JOBS STILL RUNNING
BPL FIL6
AND #1
TAX
INC TEMP,X ;SET FLAG INDICATING DRIVE
FIL6 DEY ;IS ACTIVE
BPL FIL5
LDA PBD2
AND #255-ACTLDA-ACTLDB
STA PBD2
LDA TEMP
BEQ FILO3
LDA PBD2 ;TURN ON LED IF DRIVE FLAG
ORA #ACTLDB ; IF NOT 0
STA PBD2
FILO3 LDA TEMP+1
BEQ FILO4
LDA PBD2
ORA #ACTLDA
STA PBD2
FILO4 JMP IDLE2 ;BACK TO TOP OF LOP
.END

151
DOS_8280/jobs

@ -0,0 +1,151 @@
.PAGE 'JOBS'
;
; USE LASTJOB FOR DRIVE #
; CMD IS USED FOR JOB COMMAND
;
SETLJB
LDA LSTJOB,X
AND #1
ORA CMD
;
; SET JOB UP AND CHECK T&S
; .A = COMMAND FOR JOBS
; .X = JOB NUMBER
;
SETJOB
STA CMD
STX JOBNUM
TXA
ASL A
ASL A
ASL A
TAX
LDA HDRS+2,X ; TRACK
CMP MAXTRK
BCS TSERR ; TRACK TOO LARGE
LDA HDRS+3,X ; SECTOR
AND #%00011111 ; MASK OUT THE HEAD
BEQ TSERR
CMP SECTRS
BCS TSERR ; SECTOR TOO LARGE
LDA HDRS+3,X ; HEAD
AND #%11100000 ; MASK OUT THE SECTOR
LSR A
LSR A
LSR A
LSR A
LSR A
CMP HEADS
BCS TSERR ; HEAD TOO LARGE
LDX JOBNUM
LDA CMD
STA JOBS,X
STA LSTJOB,X
RTS
;
; ILLEGAL TRACK AND SECTOR
;
TSERR
LDA JOBNUM
JSR GETHD1 ; GET THE TRACK, SECTOR AND HEAD
TSER1
LDA #BADTS ; BAD TRACK OR SECTOR
JMP CMDER2
TSCHK
LDA TRACK
CMP MAXTRK
BCS TSER1 ; TRACK TOO LARGE
LDA SECTOR
AND #%00011111 ; MASK OUT THE HEAD
BEQ TSER1
CMP SECTRS
BCS TSER1 ; SECTOR TOO LARGE
LDA SECTOR
AND #%11100000 ; MASK OUT THE SECTOR
LSR A
LSR A
LSR A
LSR A
LSR A
CMP HEADS
BCS TSER1 ; HEAD TOO LARGE
RTS
;
; DO JOB IN .A, SET UP ERROR COUNT
; AND LSTJOB. RETURN WHEN JOB DONE OK
; JMP TO ERROR IF ERROR RETURNS
;
DOREAD
LDA #READ
BNE JDOJOB ; JUMP
DOWRIT
LDA #WRITE
JDOJOB
ORA DRVNUM
LDX JOBNUM
DOIT
STA CMD
DOIT2
LDA CMD
JSR SETJOB
.PAGE
;
; WAIT UNTIL JOB(.X) IS DONE
; RETURN WHEN DONE
;
WATJOB
JSR TSTJOB
BCS WATJOB
PHA ; CLR JOBRTN FLAG
LDA #0
STA JOBRTN
PLA
RTS
;
; TEST IF JOB(.X) IS DONE YET
; IF NOT DONE RETURN
; IF OK THEN RETURN ELSE REDO IT
;
JTSTJB
LDA JOBS,X
BMI TSTJB4
CMP #2
BCC TSTJB3 ; FINISHED OK
BCS TSTJB2 ; DO RETRIES
TSTJB1
LDY REVCNT
STY RETRY ; RESTORE RETRY COUNT
BIT JOBRTN
BMI TSTJB3 ; JUST RETURN
JMP ERROR ; SEND THE ERROR CODE
TSTJB2
JSR PATC ; PATCH FOR RESTORE
BEQ TSTJB1 ; NO MORE RETRIES
LDA LSTJOB,X
STA JOBS,X ; TRY THE JOB AGAIN
BNE TSTJB4 ; JUMP
TSTJB3
LDY REVCNT
STY RETRY ; RESTORE RETRY COUNT
CLC ; .C = 0 FINISHED OK OR QUIT
RTS
TSTJB4
SEC ; .C = 1 NOT YET
RTS
;
; SET HEADER OF ACTIVE BUFFER OF THE
; CURRENT LINDX TO TRACK,SECTOR,ID
;
SETHDR
JSR GETACT
JSETH
ASL A
ASL A
ASL A
TAY
LDA TRACK
STA HDRS+2,Y ; SET TRACK
LDA SECTOR
STA HDRS+3,Y ; SET SECTOR AND HEAD
RTS
.END

62
DOS_8280/lib

@ -0,0 +1,62 @@
.OPT NOSYM
.OPT NOLIST
.LIB DOS
.LIB CHANGES
.LIB SIDSEC
.LIB SSS
.LIB EQUATE
.LIB I_ODEF
.LIB RAMVAR
.LIB ROM
.LIB BEGIN
.LIB IDLE
.LIB IEEE
.LIB PARSEX
.LIB SETDRV
.LIB LOOKUP
.LIB TRNSFR
.LIB SCRTCH
.LIB DUPLCT
.LIB COPYSETUP
.LIB COPYALL
.LIB RENAME
.LIB MEMRW
.LIB BLOCK
.LIB FNDREL
.LIB TST2
.LIB TST3
.LIB TST4
.LIB JOBS
.LIB ADDFIL
.LIB PATC
.LIB EROM
.LIB OPEN
.LIB CLOSE
.LIB OPCHNL
.LIB TSTFLG
.LIB TSUTIL
.LIB SSUTIL
.LIB SSTEST
.LIB GETACT
.LIB REL1
.LIB REL2
.LIB REL3
.LIB REL4
.LIB SSEND
.LIB RECORD
.LIB NULBUF
.LIB ADDREL
.LIB NEWSS
.LIB ERPROC
.LIB UTLODR
.LIB DSKINT
.LIB LSTDIR
.LIB VERDIR
.LIB NEW
.LIB MAP
.LIB FRETS
.LIB TSTFND
.LIB SYSTEM
.LIB ROMTBL
.LIB VECTOR
.END

402
DOS_8280/lookup

@ -0,0 +1,402 @@
.PAGE 'LOOKUP-OPTSCH'
;
; OPTSCH: OPTIMAL SEARCH FOR LOOKUP
; AND FNDFIL
;
OPTSCH
LDA #0 ; DETERMINE OPTIMAL SEARCH
STA TEMP ; INIT DRIVE MASK
STA DRVFLG
PHA
LDX F2CNT
OS10
PLA
ORA TEMP
PHA
LDA #1
STA TEMP
DEX
BMI OS30
LDA FILDRV,X
BPL OS15
ASL TEMP
ASL TEMP
OS15
LSR A
BCC OS10
ASL TEMP
BNE OS10 ; JUMP
OS30
PLA
TAX
LDA SCHTBL-1,X
PHA
AND #3
STA DRVCNT
PLA
ASL A
BPL OS40
LDA FILDRV
OS35
AND #1
STA DRVNUM
LDA DRVCNT
BEQ OS60 ; ONLY 1 DRIVE ADDRESSED
JSR AUTOI ; CHECK FOR AUTO INIT
BEQ OS50 ; DRIVE IS ACTIVE
JSR TOGDRV
LDA #0 ; SET 1 DRIVE ADDRESSED
STA DRVCNT
JSR AUTOI ; CHECK FOR AUTO INIT
BEQ OS70 ; DRIVE IS ACTIVE
OS45
LDA #NODRIV
JSR CMDERR ; NO DRIVE ERROR
OS50
JSR TOGDRV
JSR AUTOI
PHP
JSR TOGDRV
PLP
BEQ OS70
LDA #0
STA DRVCNT ; SET 1 DRIVE ADDRESSED
BEQ OS70 ; JUMP
OS60
JSR AUTOI
BNE OS45 ; DRIVE NOT ACTIVE
OS70
JMP SETLDS
OS40
ROL A
JMP OS35
;
SCHTBL
.BYTE 0,$80,$41
.BYTE 1,1,1,1
.BYTE $81,$81,$81,$81
.BYTE $42,$42,$42,$42
.PAGE 'LOOKUP/FNDFIL'
;
; LOOK UP ALL FILES IN STREAM
; AND FILL TABLES W/INFO
;
LOOKUP
JSR OPTSCH
LK05
LDA #0
STA DELIND
JSR SRCHST ; START SEARCH
BNE LK25
LK10
DEC DRVCNT
BPL LK15
RTS ; NO MORE DRIVE SEARCHES
LK15
LDA #1 ; TOGGLE DRIVE #
STA DRVFLG
JSR TOGDRV
JSR SETLDS ; TURN ON LED
JMP LK05
LK20
JSR SEARCH ; FIND VALID FILE NAME
BEQ LK30 ; END OF SEARCH
LK25
JSR COMPAR ; COMPARE DIR W/TABLE
LDA FOUND ; FOUND FLAG
BEQ LK26 ; ALL NAME'S NOT FOUND, YET
RTS
LK26
LDA ENTFND
BMI LK20
BPL LK25
LK30
LDA FOUND
BEQ LK10
RTS
;
; FIND NEXT FILE NAME MATCHING
; ANY FILE IN STREAM & RETURN
; WITH ENTRY FOUND STUFFED INTO
; TABLES
;
FFRE
JSR SRRE ; FIND FILE RE-ENTRY
BEQ FF10
BNE FF25
FF15
LDA #1
STA DRVFLG
JSR TOGDRV
JSR SETLDS
FFST
LDA #0 ; FIND FILE START ENTRY
STA DELIND
JSR SRCHST
BNE FF25
STA FOUND
FF10
LDA FOUND
BNE FF40
DEC DRVCNT
BPL FF15
RTS
FNDFIL
JSR SEARCH ; FIND FILE CONTINUOUS...
BEQ FF10 ; ... RE-ENTRY
FF25
JSR COMPAR ; COMPARE FILE NAMES
LDX ENTFND
BPL FF30
LDA FOUND
BEQ FNDFIL
BNE FF40
FF30
LDA TYPFLG
BEQ FF40 ; NO TYPE RESTRICTION
LDA PATTYP,X
AND #TYPMSK
CMP TYPFLG
BNE FNDFIL
FF40
RTS
.PAGE 'LOOKUP-COMPAR'
;
; COMPARE ALL FILENAMES IN STREAM TABLE
; WITH EACH VALID ENTRY IN THE
; DIRECTORY. MATCHES ARE TABULATED
;
COMPAR
LDX #$FF
STX ENTFND
INX
STX PATFLG
JSR CMPCHK
BEQ CP10
CP02
RTS ; ALL ARE FOUND
CP05
JSR CC10
BNE CP02
CP10
LDA DRVNUM
EOR FILDRV,X
LSR A
BCC CP20 ; RIGHT DRIVE
AND #$40
BEQ CP05 ; NO DEFAULT
LDA #2
CMP DRVCNT
BEQ CP05 ; DON'T USE DEFAULT
CP20
LDA FILTBL,X ; GOOD DRIVE MATCH
TAX
JSR FNDLMT
LDY #3
JMP CP33
CP30
LDA CMDBUF,X
CMP (DIRBUF),Y
BEQ CP32 ; CHARS ARE EQUAL
CMP #'?
BNE CP05 ; NO SINGLE PATTERN
LDA (DIRBUF),Y
CMP #$A0
BEQ CP05 ; END OF FILENAME
CP32
INX
INY
CP33
CPX LIMIT
BCS CP34 ; END OF PATTERN
LDA CMDBUF,X
CMP #'*
BEQ CP40 ; STAR MATCHES ALL
BNE CP30 ; KEEP CHECKING
CP34
CPY #19
BCS CP40 ; END OF FILENAME
LDA (DIRBUF),Y
CMP #$A0
BNE CP05
CP40
LDX F2PTR ; FILENAMES MATCH
STX ENTFND
LDA PATTYP,X ; STORE INFO IN TABLES
AND #$80
STA PATFLG
LDA INDEX
STA ENTIND,X
LDA SECTOR
STA ENTSEC,X
LDA TRACK
STA ENTTRK,X
LDY #0
LDA (DIRBUF),Y
INY
PHA
AND #$40
STA TEMP
PLA
AND #$FF-$20
BMI CP42
ORA #$20
CP42
AND #$27
ORA TEMP
STA TEMP
LDA #$80
AND PATTYP,X
ORA TEMP
STA PATTYP,X
LDA FILDRV,X
AND #$80
ORA DRVNUM
STA FILDRV,X
LDA (DIRBUF),Y
STA FILTRK,X
INY
LDA (DIRBUF),Y
STA FILSEC,X
LDA REC
BNE CMPCHK
LDY #21
LDA (DIRBUF),Y
STA REC
;
; CHECK TABLE FOR UNFOUND FILES
;
CMPCHK
LDA #$FF
STA FOUND
LDA F2CNT
STA F2PTR
CC10
DEC F2PTR
BPL CC15
RTS ; TABLE EXHAUSTED
CC15
LDX F2PTR
LDA PATTYP,X
BMI CC20
LDA FILTRK,X
BNE CC10
CC20
LDA #0
STA FOUND
RTS
.PAGE 'LOOKUP-SEARCH'
;
; SEARCH DIRECTORY
;
; RETURNS WITH VALID ENTRY W/DELIND = 0
; OR RETURNS W/1ST DELETED ENTRY
; W/DELIND = 1
;
; SRCHST WILL INITIATE A SEARCH
; SEARCH WILL CONTINUE A SEARCH
;
SRCHST
JSR AUTOI
LDY #0 ; INIT DELETED SECTOR
STY DELSEC
STY DELENT ; INIT DELETED ENTRY
DEY
STY ENTFND
LDX DRVNUM
LDA DSTRK,X ; START SEARCH AT BEGINNING
STA TRACK
LDA DSSEC,X
STA SECTOR
LDA #$FF
STA LSTBUF
JSR OPNIRD ; OPEN INTERNAL READ CHNL
SR10
LDA LSTBUF ; LAST BUFFER IF 0
BNE SR15
RTS ; (.Z = 1)
SR15
LDA #7
STA FILCNT
LDA #0 ; READ TRACK #
JSR DRDBYT
STA LSTBUF ; UPDATE END FLAG
SR20
JSR GETPNT
DEC FILCNT
LDY #0
LDA (DIRBUF),Y ; READ FILE TYPE
BNE SR30
LDA DELENT ; DELETED ENTRY FOUND?
BNE SEARCH ; DELETED ENTRY ALREADY FOUND
JSR CURBLK ; GET CURRENT SECTOR
LDA SECTOR
STA DELSEC
LDA #$FF
STA DELENT
LDA TRACK
STA DELTRK
LDA DIRBUF ; GET CURRENT INDEX
LDX DELIND ; BIT1: WANT DELETED ENTRY
STA DELIND
BEQ SEARCH ; NEED VALID ENTRY
RTS ; (.Z = 0)
SR30
LDX #1
CPX DELIND ; LOOKING FOR DELETED?
BNE SR50 ; NO!
BEQ SEARCH
SRRE
LDA DIRTRK
STA TRACK
LDA DIRSEC
STA SECTOR
JSR OPNIRD
LDA INDEX
JSR SETPNT
SEARCH
LDA #$FF
STA ENTFND
LDA FILCNT ; ADJUST FILE COUNT
BMI SR40
LDA #32 ; INCR BY 32
JSR INCPTR
JMP SR20
SR40
JSR NXTBUF ; NEW BUFFER
JMP SR10
SR50
LDA DIRBUF ; FOUND VALID ENTRY
STA INDEX ; SAVE INDEX
JSR CURBLK ; GET SECTOR
LDA SECTOR
STA DIRSEC
LDA TRACK
STA DIRTRK
RTS ; (.Z = 0)
JAUTOI ; AUTO-INIT SECTION
LDA AUTOFG
BNE AUTO2 ; CHECK DISABLE FLAG
LDX DRVNUM
LSR WPSW,X ; TEST & CLEAR FLAG
BCC AUTO2
LDA #$FF
STA JOBRTN ; SET ERROR RETURN CODE
JSR ITRIAL ; INIT SEEK-TEST
LDY #$FF
CMP #2
BEQ AUTO1 ; NO SYNC = NO DISKETTE
CMP #3
BEQ AUTO1 ; NO HEADER = NO DIRECTORY
LDY #00
AUTO1
LDX DRVNUM
TYA
STA NODRV,X ; SET CONDITION OF NO DRIVE
BNE AUTO2
JSR INITDR
AUTO2
LDX DRVNUM
LDA NODRV,X
RTS ; RETURN NO DRIVE STATUS
.END

120
DOS_8280/lstdir

@ -0,0 +1,120 @@
.PAGE 'LIST DIRECTORY'
; START THE DIRECTORY LOADING FUNCTION
; GET THE BUFFER AND GET IT STARTED
;
STDIR LDA #0
STA SA
LDA #1 ;ALLOCATE CHANL AND 1 BUFEFER
JSR GETRCH
.SKIP
LDA #0
JSR SETPNT
.SKIP
LDX LINDX
LDA #0
STA LSTCHR,X
JSR GETACT
TAX
LDA DRVNUM
STA LSTJOB,X
LDA #1 ; PUT SAL IN BUFFER
JSR PUTBYT
LDA #4 ;PUT SAH IN BUFFER
JSR PUTBYT
LDA #1 ;INSERT FHONEY LINKS (0101)
JSR PUTBYT
JSR PUTBYT
LDA NBTEMP
JSR PUTBYT ;PUT IN DRVNUM
LDA #0
JSR PUTBYT
JSR MOVBUF ;GET DISK NAME
JSR GETACT
ASL A
TAX
DEC BUFTAB,X
DEC BUFTAB,X
LDA #0 ;END OF THIS LINE
JSR PUTBYT
DIR1 LDA #1 ;INSERT FHONEY LINKS ($0101)
JSR PUTBYT
JSR PUTBYT
JSR GETNAM ;GET #BUFRS AND FILE NAME
BCC DIR3 ;TEST IF LAST ENTRY
LDA NBTEMP
JSR PUTBYT
LDA NBTEMP+1
JSR PUTBYT
JSR MOVBUF
LDA #0 ;END OF ENTRY
JSR PUTBYT
BNE DIR1
DIR10 JSR GETACT
ASL A
TAX
LDA #0
STA BUFTAB,X
LDA #RDYTLK
LDY LINDX
STA DIRLST
STA CHNRDY,Y ; DIRECTORY LIST BUFFER FULL
LDA DATA
RTS
;
;
DIR3 LDA NBTEMP ; THIS IS END OF LOAD
JSR PUTBYT
LDA NBTEMP+1
JSR PUTBYT
JSR MOVBUF
JSR GETACT
ASL A
TAX
DEC BUFTAB,X
DEC BUFTAB,X
LDA #0 ; END OF LISTING (000)
JSR PUTBYT
JSR PUTBYT
JSR PUTBYT
JSR GETACT
ASL A
TAY
LDA BUFTAB,Y
LDX LINDX
STA LSTCHR,X
DEC LSTCHR,X
JMP DIR10
;
;
;
;
; TRANSFER FILE NAME TO LISTING BUFFER
;
MOVBUF LDY #0
MOVB1 LDA NAMBUF,Y
JSR PUTBYT
INY
CPY #27
BNE MOVB1
RTS
;
;
; GET CHAR FOR DIRECTORY LOADING
;
GETDIR JSR GETBYT
BEQ GETD3
RTS
GETD3 STA DATA
LDY LINDX
LDA LSTCHR,Y
BEQ GD1
LDA #EOIOUT
STA CHNRDY,Y
LDA DATA
RTS
GD1 PHA
JSR DIR1
PLA
RTS
;
.END

2
DOS_8280/m.nl

@ -0,0 +1,2 @@
.OPT NOLIST
.FILE MASTER

2
DOS_8280/m.ns

@ -0,0 +1,2 @@
.OPT NOLIST,NOSYM
.FILE MASTER

243
DOS_8280/map

@ -0,0 +1,243 @@
.PAGE 'NEWMAP'
;
; BUILD A NEW MAP ON DISKETTE
;
NEWMAP
JSR SETBMP
JSR CLRBAM
JSR SETBJ
;
; SET NEW BAM, CALLED BY VERDIR
;
NEWMPV
JSR SETH
LDX DRVNUM
LDA #1
STA TMPBAM
STA BAMTRK,X
STA BAMSEC,X
JSR JOB2X ; .X = JOBNUM*8
LDA #$FF
STA HDRS+2,X
STA HDRS+3,X ; SET FIRST BACKWARD LINK
LDY #LOTRK ; LOW TRACK OFFSET
LDA #0
STA TRACK ; START AT TRACK 0
STA (BMPNT),Y ; LOW TRACK IN BAM
STA HEAD ; START AT HEAD 0
NM40
JSR BAMIDX ; GET THE BAM INDEX
BCS NM45
TAY
CLC
ADC BAMSIZ
BEQ NM50
BCC NM50
NM45
JSR BAMOUT ; WRITE THE BAM OUT
JSR CLRBAM ; CLEAR THE BAM AREA
LDY #LOTRK
LDA TRACK
STA (BMPNT),Y ; SET LOW TRACK OF NEXT BAM
JSR BAMIDX
NM50
STY R1
LDA #1
STA SECTOR ; START AT SECTOR 1
NM60
LDA R1 ; R1 = BAM INDEX
JSR FREUS2 ; GET THE SECTOR INDEX
JSR FRETS2 ; MARK THE BAM
JSR GETHED ; EXTRACT THE HEAD NUMBER
INC SECTOR
LDX SECTOR ; SECTOR = SECTOR+1
CPX SECTRS
BCC NM60 ; MORE SECTORS FOR THIS HEAD
INC HEAD
LDX HEAD ; HEAD = HEAD+1
CPX HEADS
BCC NM40 ; MORE HEADS FOR THIS TRACK
INC TRACK
LDX TRACK ; TRACK = TRACK+1
CPX MAXTRK
BCS NM70 ; NO MORE TRACKS TO DO
LDX #0
STX HEAD ; NEW TRACK, HEAD = 0
BEQ NM40 ; DO THE NEXT TRACK
NM70
JSR BAMOUT
LDX DRVNUM
LDA #0
STA MDIRTY,X
JMP RDBAM ; READ FIRST BAM (RTS)
;
; BAMOUT - SET LINKS AND WRITE IT
;
BAMOUT
LDA #0
STA WRTFLG ; BAM WRITE ERROR FLAG
LDX TRKBAM
DEX
STX R0 ; MAX BAM TRACKS-1
JSR JOB2X ; .X = JOBNUM*8
LDY #2
LDA HDRS+2,X
STA (BMPNT),Y ; SET BACKWARD LINK (TRACK)
INY
LDA HDRS+3,X
STA (BMPNT),Y ; SET BACKWARD LINK (SECTOR)
LDA #1
STA HDRS+3,X ; START WRITE AT SECTOR, HEAD 0
LDY TRACK
CPY MAXTRK
BCC BAMOU0 ; NOT THE LAST BAM
LDA #$FF
BAMOU0
LDY #1
STA (BMPNT),Y ; SET NEXT SECTOR LINK
LDA TMPBAM
STA HDRS+2,X ; START WRITE AT TRACK(TMPBAM)
LDY TRACK
CPY MAXTRK
BCC BAMOU1 ; NOT THE LAST BAM
LDA #$FF
BNE BAMOU2 ; JUMP
BAMOU1
CLC
ADC TRKBAM
CMP MAXTRK
BCC BAMO1
SBC #1 ; TRKBAM = TRKBAM-1 (.C = 1)
BAMO1
STA TMPBAM ; NEXT POSSIBLE BAM TRACK
BAMOU2
LDY #0
STA (BMPNT),Y ; SET NEXT TRACK LINK
LDY #HITRK
LDA TRACK
STA (BMPNT),Y ; SET HIGH TRACK OF THIS BAM
BAMOU3
LDA #$FF
STA JOBRTN ; RETURN THE ERROR CODE
JSR DOWRIT ; TRY THE WRITE
CMP #2 ; ANY ERRORS?
BCC BAMOU4 ; NO, IT WORKED
LDA #$FF
STA WRTFLG ; DIDN'T WORK, FLAG IT
JSR JOB2X ; .X = JOBNUM*8
INC HDRS+3,X ; NEXT SECTOR, HEAD
LDA HDRS+3,X
CMP SECTRS
BCC BAMOU3 ; STILL MORE SECTORS, HEADS
INC HDRS+2,X ; NEXT TRACK
LDA #0
STA HDRS+3,X ; START AT SECTOR, HEAD 0
DEC R0
BNE BAMOU3 ; TRY THE NEXT TRACK
LDA #12
JMP ERROR ; FORMAT ERROR
BAMOU4
LDA WRTFLG
BNE BAMOU5 ; CHANGE THE LINK OF PREVIOUS BAM
RTS
BAMOU5
JSR JOB2X ; .X = JOBNUM*8
LDY #LOTRK
LDA (BMPNT),Y
BNE BAMOU6 ; HAS A BACKWARD LINK
LDY DRVNUM
LDA HDRS+2,X
STA BAMTRK,Y
LDA HDRS+3,X
STA BAMSEC,Y
RTS
BAMOU6
LDA HDRS+2,X
PHA ; SAVE THE TRACK
LDA HDRS+3,X
PHA ; SAVE THE SECTOR
JSR PRVBA1 ; READ IN THE PREVIOUS BAM
LDY #1
PLA ; GET THE SECTOR
STA (BMPNT),Y ; CHANGE THE SECTOR LINK
DEY
PLA ; GET THE TRACK
STA (BMPNT),Y ; CHANGE THE TRACK LINK
PHA ; SAVE THE TRACK AGAIN
JSR DOWRIT ; WRITE IT OUT
JSR JOB2X ; .X = JOBNUM*8
PLA ; GET THE TRACK
STA HDRS+2,X
LDY #1
LDA (BMPNT),Y
STA HDRS+3,X
RTS
.PAGE 'MAPOUT'
;
; WRITE OUT THE BIT MAP TO
; THE DRIVE IN LSTJOB(ACTIVE)
;
MAPOUT
JSR GETACT
TAX
LDA LSTJOB,X ; GET DRIVE FROM LAST JOB
MO10
AND #1
STA DRVNUM
JSR SETBJ ; SET THE BAM JOB
;
; VERIFY THE BAM BLOCK COUNT
; MATCHES THE BITS
;
JSCRBM
JSR SETBMP
JSR SETBJ
LDY DRVNUM
LDA MDIRTY,Y
BNE SB10 ; BAM HAS BEEN CHANGED
RTS
SB10
LDA HEAD
PHA
LDA #0
STA MDIRTY,Y
STA HEAD
LDY #LOTRK
LDA (BMPNT),Y
MC10
PHA ; SAVE THE TRACK NUMBER
JSR MBAM2 ; GET THE BAM INDEX
JSR AVCK ; CHECK THE BITS
INC HEAD
LDA HEAD ; HEAD = HEAD+1
CMP HEADS
BCS MC12 ; ALL OF THE HEADS
PLA ; GET THE CURRENT TRACK
JMP MC10 ; NEXT HEAD, SAME TRACK
MC12
PLA ; GET THE TRACK NUMBER
CLC
ADC #1 ; TRACK = TRACK+1
LDY #HITRK
CMP (BMPNT),Y
BCS MC13 ; NO MORE TO THIS BAM
LDX #0
STX HEAD ; START OVER WITH HEAD 0
BEQ MC10 ; JUMP
MC13
JSR DOWRIT ; WRITE THE BAM
PLA
STA HEAD
RTS
.PAGE 'NUMFRE'
;
; CALC THE NUMBER OF FREE BLOCKS ON DRVNUM
;
NUMFRE
LDX DRVNUM
LDA NDBL,X
STA NBTEMP
LDA NDBH,X
STA NBTEMP+1
RTS
.END

62
DOS_8280/master

@ -0,0 +1,62 @@
.OPT NOSYM
.LIB DOS
.LIB CHANGES
.LIB SIDSEC
.LIB SSS
.LIB EQUATE
.LIB I_ODEF
.LIB RAMVAR
.LIB ROM
.LIB BEGIN
.LIB IDLE
.LIB IEEE
.LIB PARSEX
.LIB SETDRV
.LIB LOOKUP
.LIB TRNSFR
.LIB SCRTCH
.LIB DUPLCT
.LIB COPYSETUP
.LIB COPYALL
.LIB RENAME
.LIB MEMRW
.LIB BLOCK
.LIB FNDREL
.LIB TST2
.LIB TST3
.LIB TST4
.LIB JOBS
.LIB ADDFIL
.LIB PATC
.LIB EROM
.LIB OPEN
.LIB CLOSE
.LIB OPCHNL
.LIB TSTFLG
.LIB TSUTIL
.LIB SSUTIL
.LIB SSTEST
.LIB GETACT
.LIB REL1
.LIB REL2
.LIB REL3
.LIB REL4
.LIB SSEND
.LIB RECORD
.LIB NULBUF
.LIB ADDREL
.LIB NEWSS
.LIB ERPROC
.LIB UTLODR
.LIB DSKINT
.LIB LSTDIR
.LIB VERDIR
.LIB COMPRS
.LIB NEW
.LIB MAP
.LIB FRETS
.LIB TSTFND
.LIB SYSTEM
.LIB ROMTBL
.LIB VECTOR
.END

62
DOS_8280/master3.1

@ -0,0 +1,62 @@
.OPT NOSYM
.LIB DOS3.1
.LIB CHANGES
.LIB SIDSEC
.LIB SSS
.LIB EQUATE
.LIB I_ODEF
.LIB RAMVAR
.LIB ROM
.LIB BEGIN
.LIB IDLE
.LIB IEEE
.LIB PARSEX
.LIB SETDRV
.LIB LOOKUP
.LIB TRNSFR
.LIB SCRTCH
.LIB DUPLCT
.LIB COPYSETUP
.LIB COPYALL
.LIB RENAME
.LIB MEMRW
.LIB BLOCK
.LIB FNDREL
.LIB TST2
.LIB TST3
.LIB TST4
.LIB JOBS
.LIB ADDFIL
.LIB PATC
.LIB EROM
.LIB OPEN
.LIB CLOSE
.LIB OPCHNL
.LIB TSTFLG
.LIB TSUTIL
.LIB SSUTIL
.LIB SSTEST
.LIB GETACT
.LIB REL1
.LIB REL2
.LIB REL3
.LIB REL4
.LIB SSEND
.LIB RECORD
.LIB NULBUF
.LIB ADDREL
.LIB NEWSS
.LIB ERPROC
.LIB UTLODR
.LIB DSKINT
.LIB LSTDIR
.LIB VERDIR
.LIB COMPRS
.LIB NEW
.LIB MAP
.LIB FRETS
.LIB TSTFND
.LIB SYSTEM
.LIB ROMTBL
.LIB VECTOR
.END

69
DOS_8280/memrw

@ -0,0 +1,69 @@
.PAGE 'MEMORY READ WRITE'
;
; MEMORY ACCESS COMMANDS
; "-" MUST BE 2ND CHAR
;
MEM
LDA CMDBUF+1
CMP #'-
BNE MEMERR
LDA CMDBUF+3 ; SET ADDRESS IN TEMP
STA TEMP
LDA CMDBUF+4
STA TEMP+1
LDY #0
LDA CMDBUF+2
CMP #'R
BEQ MEMRD ; READ
CMP #'W
BEQ MEMWRT ; WRITE
CMP #'E
BNE MEMERR ; ERROR
;
; MEMORY EXECUTE
;
MEMEX
JMP (TEMP)
;
; MEMORY READ
;
MEMRD
LDA (TEMP),Y
STA DATA
LDA CMDSIZ
CMP #6
BCC M30
LDX CMDBUF+5
DEX
BEQ M30
TXA
CLC
ADC TEMP
INC TEMP
STA LSTCHR+ERRCHN
LDA TEMP
STA CB+2
LDA TEMP+1
STA CB+3
JMP GE20
M30
JSR FNDRCH
JMP GE15
.PAGE
;
; MEMORY COMMAND ERROR
;
MEMERR
LDA #BADCMD ; BAD COMMAND
JMP CMDERR
;
; MEMORY WRITE
;
MEMWRT
LDA CMDBUF+6,Y
STA (TEMP),Y ; TRANSFER FROM CMDBUF
INY
CPY CMDBUF+5 ; # OF BYTES TO WRITE
BCC MEMWRT
RTS
.END

59
DOS_8280/mver

@ -0,0 +1,59 @@
.OPT NOL
.LIB DOS
.LIB EQUATE
.LIB I_ODEF
.LIB RAMVAR
.LIB ROM
.LIB PARSEX
.LIB SETDRV
.LIB AUTOIT
.LIB LOOKUP
.LIB TRNSFR
.LIB SCRTCH
.LIB DUPLCT
.LIB COPYSETUP
.LIB COPYALL
.LIB RENAME
.LIB MEMRW
.LIB BLOCK
.LIB FNDREL
.LIB TST2
.LIB TST3
.LIB TST4
.LIB JOBS
.LIB ADDFIL
.LIB ECHKSM
.LIB OPEN
.LIB CLOSE
.LIB OPCHNL
.LIB TSTFLG
.LIB TSUTIL
.LIB SSUTIL
.LIB SSTEST
.LIB GETACT
.LIB REL1
.LIB REL2
.LIB REL3
.LIB REL4
.LIB SSEND
.LIB RECORD
.LIB NULBUF
.LIB ADDREL
.LIB NEWSS
.LIB ERPROC
.LIB UTLODR
.LIB DSKINT
.LIB IDLE
.LIB IEEE
.LIB LSTDIR
.OPT LIST
.LIB VERDIR
.LIB NEW
.LIB MAP
.LIB FRETS
.LIB TSTFND
.LIB ROMTBL
.LIB VECTOR
.LIB CHKSUM
.PAGE ''
.END

280
DOS_8280/new

@ -0,0 +1,280 @@
.PAGE 'NEW'
;
; NEW: INITIALIZE A DISK, DISK IS
; SOFT-SECTORED, BIT AVAIL. MAP,
; DIRECTORY, & 1ST BLOCK ARE ALL INITED
;
NEW
JSR ONEDRV
LDA FILDRV ; SET UP DRIVE #
BPL N101
LDA #BADFN
JMP CMDERR
N101
AND #1
STA DRVNUM
JSR SETLDS
JSR SETBMP
LDA DRVNUM
ASL A
TAX
LDY FILTBL+1 ; GET DISK ID
CPY CMDSIZ ; IS THIS NEW OR CLEAR?
BEQ N108 ; END OF CMD STRING
LDA CMDBUF,Y
STA DSKID,X ; STORE IN PROPER DRIVE
LDA CMDBUF+1,Y ; Y = 0
STA DSKID+1,X
JSR CLRCHN
JSR FORMAT ; FORMAT THE DRIVE
JMP N110
N108
JSR INITDR
N110
JSR NEWMAP ; CREATE A NEW BAM
LDY #0 ; USE BUFFER NUMBER 0
LDA BUFIND,Y ; GET BUFFER INDEX
STA IP+1
LDA #0
STA IP ; SET IP TO BUFFER
JSR MRKBAM ; MARK THE BAMS USED
JSR MRKBTS ; MARK THE BTS AND CONTENTS USED
LDA #0
STA TRACK
LDA #1
STA SECTOR
JSR USEDTS ; MARK TRACK, SECTOR AND HEAD
JSR MAKDIR ; CREATE A DIRECTORY
JSR SET000 ; SET UP TRACK, SECTOR AND HEAD
JSR SCRBAM
JSR NF05 ; COUNT BLOCKS FREE
JMP ENDCMD ; DONE!!!
;
; TRANSFER THE DIRECTORY HEADER
;
TRNHDR
LDA JOBNUM
TAY
ASL A
TAX
LDA #6
STA BUFTAB,X
LDX FILTBL
LDA #27
JSR TRNAME ; TRANSFER CMD BUF TO BUF0
LDY #$12
LDA DRVNUM ; SET UP CURRENT I.D.
ASL A
TAX
LDA DSKID,X
STA (DIRBUF),Y
INY
LDA DSKID+1,X
STA (DIRBUF),Y
INY
INY
LDA #DOSVER+$30
STA (DIRBUF),Y
INY
LDA VERNUM ; SHOW VER #
STA (DIRBUF),Y
RTS
;
; MARK THE BTS SECTORS USED ALONG WITH
; THE BTS CONTENTS
;
MRKBTS
LDX DRVNUM
LDA BTSTRK,X ; START OF BTS (TRACK)
STA TRACK
LDA BTSSEC,X ; START OF BTS (SECTOR)
STA SECTOR
JSR NXTBTS ; MARK THIS SECTOR, READ NEXT ONE
MRKBT1
LDA (IP),Y
CMP #$FF ; NEW TRACK OR END MARKER
BEQ MRKBT3
STA SECTOR
TYA
PHA
JSR USEDTS ; MARK THE SECTOR USED
PLA
TAY
MRKBT2
INY
BNE MRKBT1
JSR BTSLNK ; READ NEXT LINK
JMP MRKBT1
MRKBT3
INY
BNE MRKBT4
JSR BTSLNK ; READ NEXT LINK
MRKBT4
LDA (IP),Y
CMP #$FF ; ALREADY HAVE ONE $FF
BEQ MRKBT5 ; NOW HAVE TWO, DONE
STA TRACK
JMP MRKBT2
MRKBT5
RTS
;
; MARK AND READ THE NEXT BTS
;
NXTBTS
JSR USEDTS ; MARK THIS LINK USED
LDA #0
STA JOBNUM ; USE JOB NUMBER 0
JSR SETH
JSR DOREAD ; READ THE NEXT BTS
LDY #2
RTS
;
; GET, MARK AND READ THE NEXT BTS
;
BTSLNK
LDA TRACK
PHA ; CURRENT TRACK
LDA SECTOR
PHA ; CURRENT SECTOR
LDA (IP),Y ; .Y = 0
CMP #$FF ; AT THE END?
BEQ BTSLN1 ; YES
STA TRACK
INY
LDA (IP),Y
STA SECTOR
JSR NXTBTS ; MARK AND READ NEXT BTS
PLA
STA SECTOR ; RESTORE CURRENT SECTOR
PLA
STA TRACK ; RESTORE CURRENT TRACK
RTS
BTSLN1
PLA ; ON ENTRY SECTOR
PLA ; ON ENTRY TRACK
PLA ; RETURN FOR MRKBTS
PLA ; RETURN FOR MRKBTS
RTS ; RETURN TO ORIGINAL CALLER
;
; MARK THE BAMS USED
;
MRKBAM
LDX DRVNUM
LDA BAMTRK,X ; START OF BAM (TRACK)
STA TRACK
LDA BAMSEC,X ; START OF BAM (SECTOR)
MRKBA1
STA SECTOR
JSR USEDTS ; MARK TRACK AND SECTOR
LDA #0
STA JOBNUM
JSR SETH
JSR DOREAD ; READ THE BAM
LDY #0
LDA (IP),Y ; TRACK LINK
CMP #$FF ; DONE?
BEQ MRKBA2 ; YES
STA TRACK
INY
LDA (IP),Y ; SECTOR LINK
JMP MRKBA1
MRKBA2
RTS
;
; CREATE THE DIRECTORY
;
MAKDIR
LDA CYLLOW
LSR A ; .A = CYLLOW/2
STA TRACK
LDA #0
STA SECTOR
JSR NXT0 ; GET A DIRECTORY TRACK AND SECTOR
LDX DRVNUM
LDA TRACK
STA DSTRK,X ; START OF DIRECTORY (TRACK)
LDA SECTOR
STA DSSEC,X ; START OF DIRECTORY (SECTOR)
LDA #0
TAY
JSR SETBUF ; CLEAR THE DIRECTORY BUFFER
STA (IP),Y ; .A = 0, .Y = 0
INY
LDA #$FF
STA (IP),Y
LDA #0
STA JOBNUM
JSR SETH
JSR DOWRIT ; WRITE THE DIRECTORY
LDX DRVNUM
LDY #0
LDA DSTRK,X
STA (IP),Y
INY
LDA DSSEC,X
STA (IP),Y
JSR TRNHDR ; TRANSFER THE DIRECTORY HEADER
JSR NXT0 ; GET HEADER TRACK AND SECTOR
LDX DRVNUM
LDA TRACK
STA HSTRK,X ; START OF HEADER (TRACK)
LDA SECTOR
STA HSSEC,X ; START OF HEADER (SECTOR)
LDA #0
STA JOBNUM
JSR SETH
JMP DOWRIT ; WRITE THE HEADER (RTS)
;
; SET TRACK, SECTOR AND HEAD 0
;
SET000
LDA #0
TAY
JSR SETBUF ; CLEAR THE BUFFER
LDX DRVNUM
LDA BTSTRK,X ; START OF BTS (TRACK)
STA (IP),Y ; .Y = 0
INY
LDA BTSSEC,X ; START OF BTS (SECTOR)
STA (IP),Y
INY ; .Y = 2
LDA #0
STA (IP),Y ; MARK IDENTIFIER
INY
LDA #$FF
STA (IP),Y
INY ; .Y = 4
LDA DSTRK,X ; START OF DIRECTORY (TRACK)
STA (IP),Y
INY
LDA DSSEC,X ; START OF DIRECTORY (SECTOR)
STA (IP),Y
INY ; .Y = 6
LDA HSTRK,X ; START OF HEADER (TRACK)
STA (IP),Y
INY
LDA HSSEC,X ; START OF HEADER (SECTOR)
STA (IP),Y
INY ; .Y = 8
LDA BAMTRK,X ; START OF BAM (TRACK)
STA (IP),Y
INY
LDA BAMSEC,X ; START OF BAM (SECTOR)
STA (IP),Y
TXA
ASL A
TAX
INY ; .Y = 10
LDA DSKID,X
STA (IP),Y
INY
LDA DSKID+1,X
STA (IP),Y
LDA #1
STA SECTOR
LDA #0
STA TRACK
STA JOBNUM
JSR SETH
JMP DOWRIT ; WRITE 000 (RTS)
.END

142
DOS_8280/newss

@ -0,0 +1,142 @@
.PAGE 'NEWSS'
;
;*********************************
;* NEWSS: GENERATE NEW SS & FIX *
;* OLD SS'S TO REFLECT IT.*
;* *
;*********************************
;
NEWSS
JSR NXTTS ; GET T&S BASED ON HDR
JSR DBLBUF ; USE INACTIVE BUFFER
JSR SCRUB
JSR GETACT
PHA
JSR CLRBUF
LDX LINDX
LDA SS,X ; SET REGS FOR TRANSFER
TAY
PLA
TAX
LDA R0
CMP #NSSL-1
BCS NEWSS4
BCC NEWSS1
NEWSS4
LDA #255
STA R0
LDA #0
JSR SETPNT
LDY #2
STA (DIRBUF),Y ; SIDE SECTOR 0
LDX LINDX
LDA RS,X
INY
STA (DIRBUF),Y ; RECORD SIZE
INY
BEQ NEWSS1
BNE NEWSS2
NEWSS1
LDA #SSIOFF ; # OF CHARS
JSR B0TOB0 ; TRANSFER AT BUF(0)
LDA #0
JSR SSDIR
LDY #2
LDA (DIRBUF),Y ; GET SS #
PHA
LDA #0
JSR SETPNT
PLA
CLC
ADC #1
STA (DIRBUF),Y ; PUT SS # IN NEW SS
ASL A
ADC #4
STA R3 ; SAVE POSITION
TAY
SEC
SBC #2
STA R4
NEWSS2
LDA TRACK
STA R1 ; SAVE FOR SS UPDATE
STA (DIRBUF),Y ; PUT TRACK IN SS
INY
LDA SECTOR
STA R2 ; SAVE FOR SS UPDATE
STA (DIRBUF),Y ; PUT SECTOR IN SS
LDY #0
TYA
STA (DIRBUF),Y ; NULL LINK
INY
LDA #SSIOFF+1 ; PTR TO LAST BYTE
STA (DIRBUF),Y
LDA #SSIOFF
JSR SETPNT
JSR WRTAB
JSR WATJOB
NS20
LDX LINDX
LDA SS,X ; GET SS BUFFER #
PHA
JSR GAFLGS
LDX LINDX
STA SS,X ; SWAP ACT-BUF & SS
PLA
LDX LBUSED
STA BUF0,X
LDA #0
JSR SETPNT ; SET LINK TO NEW SS
LDY #0
LDA TRACK
STA (DIRBUF),Y
INY
LDA SECTOR
STA (DIRBUF),Y
LDA R0
CMP #255
BNE NS50
LDA SECTOR
PHA
LDA TRACK
PHA
JSR WRTOUT ; WRITE OLD SS
JSR WATJOB
JSR DBLBUF
JSR RDSSSA ; READ SUPER SIDE SECTOR
INC R5 ; NEXT GROUP #
LDA R5
ASL A ; * 2
CLC
ADC #3 ; INDEX INTO SSS
JSR SETSSP ; POINT TO IT
PLA
JSR PUTSS ; SET THE TRACK
PLA
JSR PUTSS ; SET THE SECTOR
JSR WRTSSS ; WRITE THE SSS
LDA R5
PHA
JMP RDSS1D ; READ THE NEW SS BACK IN
NS40
JSR GETACT
LDX LINDX
JSR IBRD ; READ NEXT SS
LDA #0
JSR SETPNT ; PTR = 0
NS50
DEC R4
DEC R4
LDY R3 ; GET NEW SS LINK PTR
LDA R1
STA (DIRBUF),Y ; PUT TRACK IN
INY
LDA R2
STA (DIRBUF),Y ; PUT SECTOR IN
JSR WRTOUT ; WRITE IT BACK...
JSR WATJOB ; ...& WAIT
LDY R4
CPY #3
BCS NS40 ; MORE SS TO UPDATE!
JMP DBLBUF ; RESET ACTIVE BUFFER
.END

62
DOS_8280/nol

@ -0,0 +1,62 @@
.OPT NOSYM
.OPT NOLIST
.LIB DOS
.LIB CHANGES
.LIB SIDSEC
.LIB SSS
.LIB EQUATE
.LIB I_ODEF
.LIB RAMVAR
.LIB ROM
.LIB BEGIN
.LIB IDLE
.LIB IEEE
.LIB PARSEX
.LIB SETDRV
.LIB LOOKUP
.LIB TRNSFR
.LIB SCRTCH
.LIB DUPLCT
.LIB COPYSETUP
.LIB COPYALL
.LIB RENAME
.LIB MEMRW
.LIB BLOCK
.LIB FNDREL
.LIB TST2
.LIB TST3
.LIB TST4
.LIB JOBS
.LIB ADDFIL
.LIB PATC
.LIB EROM
.LIB OPEN
.LIB CLOSE
.LIB OPCHNL
.LIB TSTFLG
.LIB TSUTIL
.LIB SSUTIL
.LIB SSTEST
.LIB GETACT
.LIB REL1
.LIB REL2
.LIB REL3
.LIB REL4
.LIB SSEND
.LIB RECORD
.LIB NULBUF
.LIB ADDREL
.LIB NEWSS
.LIB ERPROC
.LIB UTLODR
.LIB DSKINT
.LIB LSTDIR
.LIB VERDIR
.LIB NEW
.LIB MAP
.LIB FRETS
.LIB TSTFND
.LIB SYSTEM
.LIB ROMTBL
.LIB VECTOR
.END

66
DOS_8280/nolist

@ -0,0 +1,66 @@
.OPT NOSYM
.OPT NOLIST
.LIB DOS
.LIB CHANGES
.LIB SIDSEC
.LIB SSS
.LIB EQUATE
.LIB I_ODEF
.LIB RAMVAR
.LIB ROM
.LIB BEGIN
.LIB IDLE
.LIB IEEE
.LIB PARSEX
.LIB SETDRV
.LIB LOOKUP
.LIB TRNSFR
.LIB SCRTCH
.LIB DUPLCT
.LIB COPYSETUP
.LIB COPYALL
.LIB RENAME
.LIB MEMRW
.LIB BLOCK
.LIB FNDREL
.LIB TST2
.LIB TST3
.LIB TST4
.OPT LIST
.LIB JOBS
.OPT NOLIST
.LIB ADDFIL
.OPT LIST
.LIB PATC
.OPT NOLIST
.LIB EROM
.LIB OPEN
.LIB CLOSE
.LIB OPCHNL
.LIB TSTFLG
.LIB TSUTIL
.LIB SSUTIL
.LIB SSTEST
.LIB GETACT
.LIB REL1
.LIB REL2
.LIB REL3
.LIB REL4
.LIB SSEND
.LIB RECORD
.LIB NULBUF
.LIB ADDREL
.LIB NEWSS
.LIB ERPROC
.LIB UTLODR
.LIB DSKINT
.LIB LSTDIR
.LIB VERDIR
.LIB NEW
.LIB MAP
.LIB FRETS
.LIB TSTFND
.LIB SYSTEM
.LIB ROMTBL
.LIB VECTOR
.END

63
DOS_8280/nolisting

@ -0,0 +1,63 @@
.OPT NOSYM
.OPT NOLIST
.LIB DOS
.LIB CHANGES
.LIB SIDSEC
.LIB SSS
.LIB EQUATE
.LIB I_ODEF
.LIB RAMVAR
.LIB ROM
.LIB BEGIN
.LIB IDLE
.LIB IEEE
.LIB PARSEX
.LIB SETDRV
.LIB LOOKUP
.LIB TRNSFR
.LIB SCRTCH
.LIB DUPLCT
.LIB COPYSETUP
.LIB COPYALL
.LIB RENAME
.LIB MEMRW
.LIB BLOCK
.LIB FNDREL
.LIB TST2
.LIB TST3
.LIB TST4
.LIB JOBS
.LIB ADDFIL
.LIB PATC
.LIB EROM
.LIB OPEN
.LIB CLOSE
.LIB OPCHNL
.LIB TSTFLG
.LIB TSUTIL
.LIB SSUTIL
.LIB SSTEST
.LIB GETACT
.LIB REL1
.LIB REL2
.LIB REL3
.LIB REL4
.LIB SSEND
.LIB RECORD
.LIB NULBUF
.LIB ADDREL
.LIB NEWSS
.LIB ERPROC
.LIB UTLODR
.LIB DSKINT
.LIB LSTDIR
.LIB VERDIR
.LIB COMPRS
.LIB NEW
.LIB MAP
.LIB FRETS
.LIB TSTFND
.LIB SYSTEM
.LIB ROMTBL
.LIB VECTOR
.END

63
DOS_8280/nulbuf

@ -0,0 +1,63 @@
.PAGE 'NULBUF'
;*********************************
;* NULBUF: SET NULL RECORDS IN *
;* ACT-BUF FOR EXTENTION *
;* VARS: NR,RS,LX,ACT-BUF *
;* IN: NR= LAST RECORD *
;* POSITION IN PREVIOUS *
;* BUFFER. *
;* OUT: NR= LAST RECORD *
;* POSITION IN BUFFER *
;* FOR NEXT NULBUF OR *
;* TO SET LSTCHR. *
;*********************************
;
NULBUF
JSR SET00 ;SET INDIRECT PTR
LDY #2
LDA #0
NB10
STA (DIRBUF),Y ;CLEAR BUFFER
INY
BNE NB10
;
JSR ADDNR ;ADVANCE NR
NB20
STA NR,X
TAY
LDA #$FF
STA (DIRBUF),Y ;INIT RECORD W/ CR
JSR ADDNR
BCC NB20 ;NOT DONE
;
BNE NB30
LDA #0
STA NR,X
NB30
RTS
;
; ADD RS & NR, LEAVE IN ACCUM
; C=1: CROSS BUFFER BOUNDARY
;
ADDNR
LDX LINDX
LDA NR,X
SEC
BEQ AN05
;
CLC
ADC RS,X
BCC AN10
BNE AN05
LDA #2
BIT ER00
RTS
;
AN05
ADC #1 ;ADJUST FOR LINK
SEC
AN10
RTS
;
;
.END

206
DOS_8280/opchnl

@ -0,0 +1,206 @@
.PAGE 'OPEN CHANNEL'
;
; OPEN A READ CHANL WITH 2 BUFFERS
; WILL INSERT SA IN LINTAB
; AND INITS ALL POINTERS.
; RELATIVE SS AND PTRS ARE SET.
;
OPNRCH
LDA #2 ; GET TWO DATA BUFFERS
JSR GETRCH
JSR INTPNT ; CLEAR POINTERS
LDA TYPE
PHA
ASL A
ORA DRVNUM
STA FILTYP,X ; SET FILE TYPE
JSR STRDBL ; READ ONE OR TWO BLOCKS
LDX LINDX
LDA TRACK
BNE OR10
LDA SECTOR
STA LSTCHR,X ; SET LAST CHAR PTR
OR10
PLA
CMP #RELTYP
BNE OR30 ; MUST BE SEQUENTIAL STUFF
LDY SA
LDA LINTAB,Y ; SET CHANNEL AS R/W
ORA #$40
STA LINTAB,Y
LDA REC
STA RS,X ; SET RECORD SIZE
JSR GETBUF ; GET SS BUFFER
BPL OR20
JMP GBERR ; NO BUFFER
OR20
LDX LINDX
STA SS,X
LDA TRKSS
STA SSSTRK,X
LDA SECSS
STA SSSSEC,X
LDA #255
STA SSSGRP,X ; NO GROUP RESIDENT
OROW
LDX LINDX
LDA #2
STA NR,X ; SET FOR NXTREC
LDA #0
JSR SETPNT ; SET FIRST DATA BYTE
JSR RD40 ; SET UP 1ST RECORD
JMP GETHDR ; RESTORE TRACK AND SECTOR
OR30
JSR RDBYT ; SEQUENTIAL SET UP
LDX LINDX
STA CHNDAT,X
LDA #RDYTLK
STA CHNRDY,X
RTS
;
; INITIALIZE VARIABLES FOR OPEN CHANL
; LSTJOB,SETS ACTIVE BUFFER#,LSTCHR,
; BUFFER POINTERS IN BUFTAB = 2
;
INTPNT
LDX LINDX
LDA DRVNUM
LDY BUF0,X
STA LSTJOB,Y
LDY BUF1,X
STA LSTJOB,Y
STA JOBS,Y
LDA BUF0,X
ASL A
TAY
LDA #2
STA BUFTAB,Y
LDA BUF1,X
ORA #$80
STA BUF1,X
ASL A
TAY
LDA #2
STA BUFTAB,Y
LDA #0
STA NBKL,X
STA NBKH,X
LDA #0
STA LSTCHR,X
RTS
;
; OPEN A WRITE CHANL WITH 2 BUFFERS
;
OPNWCH
JSR INTTS ; GET FIRST TRACK, SECTOR
LDA #2
JSR GETWCH ; GET 2 BUFFERS FOR WRITING
JSR SETHDR ; SET UP BUFFER HEADERS
JSR INTPNT
LDX LINDX
LDA TYPE
PHA
ASL A
ORA DRVNUM
STA FILTYP,X ; SET FILTYP = SEQ
PLA
CMP #RELTYP
BEQ OW10
LDA #RDYLST ; ACTIVE LISTENER
STA CHNRDY,X
RTS
OW10
LDY SA
LDA LINTAB,Y
AND #$3F
ORA #$40
STA LINTAB,Y ; SET CHANNEL AS R/W
LDA REC
STA RS,X ; SET RECORD SIZE
JSR GETBUF ; GET SS BUFFER
BPL OW20
JMP GBERR ; NO BUFFER
OW20
LDX LINDX
STA SS,X
JSR CLRBUF
JSR NXTTS
LDA TRACK
STA TRKSS ; SAVE SS TRACK AND SECTOR
LDA SECTOR
STA SECSS
LDX LINDX
LDA SS,X
JSR SETH ; SET SS HEADER
LDA #0
JSR SETSSP
LDA #0 ; SET NULL LINK
JSR PUTSS
LDA #SSIOFF+1 ; SET LAST CHAR
JSR PUTSS
LDA #0 ; SET THIS SS #
JSR PUTSS
LDA REC ; RECORD SIZE
JSR PUTSS
LDA TRACK
JSR PUTSS
LDA SECTOR
JSR PUTSS
LDA #SSIOFF
JSR SETSSP
JSR GETHDR ; GET FIRST TRACK AND SECTOR
LDA TRACK
JSR PUTSS
LDA SECTOR
JSR PUTSS
JSR WRTSS ; WRITE IT OUT
JSR WATJOB
LDX LINDX
LDA SS,X ; GET SS BUFFER #
JSR CLRBUF ; CLEAR THAT BUFFER
JSR SETSSP ; SET SIDE SECTOR POINTER
LDA TRKSS
JSR PUTSS ; SET TRACK LINK
LDA SECSS
JSR PUTSS ; SET SECTOR LINK
LDA #254
JSR PUTSS ; SET SUPER SS ID
LDA TRKSS
JSR PUTSS ; SET TRACK SS LINK
LDA SECSS
JSR PUTSS ; SET SECTOR SS LINK
JSR NXTTS ; GET NEXT TRACK AND SECTOR
LDX LINDX
LDA TRACK
STA SSSTRK,X ; SAVE SSS TRACK
STA TRKSS
LDA SECTOR
STA SSSSEC,X ; SAVE SSS SECTOR
STA SECSS
LDA #255
STA SSSGRP,X ; NO RESIDENT SS
JSR WRTSSS ; WRITE THE SUPER SIDE SECTOR
JSR GETHDR
OW21
LDA #2
JSR SETPNT
LDX LINDX ; SET NR FOR NULL BUFFER
SEC
LDA #0
SBC RS,X
STA NR,X
JSR NULBUF ; NULL RECORDS
JSR NULLNK
JSR WRTOUT
JSR WATJOB
JSR MAPOUT ; WRITE THE BAM
JMP OROW
;
; PUT BYTE INTO SIDE SECTOR
;
PUTSS
PHA
LDX LINDX
LDA SS,X
JMP PUTB1
.END

405
DOS_8280/open

@ -0,0 +1,405 @@
.PAGE 'OPEN'
;
; OPEN CHANNEL FROM IEEE
; PARSES THE INPUT STRING THAT IS
; SENT AS AN OPEN DATA CHANNEL,
; LOAD, OR SAVE. CHANNELS ARE ALLOCATED
; AND THE DIRECTORY IS SEARCHED FOR
; THE FILENAME CONTAINED IN THE STRING.
;
OPEN
LDA SA
STA TEMPSA
JSR CMDSET ; INITIATE CMD PTRS
STX CMDNUM
LDX CMDBUF
LDA TEMPSA
BNE OP021
CPX #'* ; LOAD LAST?
BNE OP021
LDA PRGTRK
BEQ OP0415 ; NO LAST PROG, INIT 0
OP02
STA TRACK ; LOAD LAST PROGRAM
LDA PRGDRV
STA DRVNUM
STA FILDRV
LDA #PRGTYP
STA PATTYP
LDA PRGSEC
STA SECTOR
JSR OPNRCH
LDA #PRGTYP+PRGTYP
ORA DRVNUM
ENDRD
LDX LINDX
STA FILTYP,Y
JMP ENDCMD
OP021
CPX #'$
BNE OP041
LDA TEMPSA ; LOAD DIRECTORY
BNE OP04
JMP LOADIR
OP04
JSR SIMPRS ; OPEN DIR AS SEQ FILE
LDX DRVNUM
LDA DSTRK,X ; START OF DIRECTORY
STA TRACK
LDA DSSEC,X
STA SECTOR
JSR OPNRCH
LDA DRVNUM
ORA #SEQTYP+SEQTYP
JMP ENDRD
OP041
CPX #'# ; "#" IS DIRECT ACCESS
BNE OP042
JMP OPNBLK
OP0415
LDA #PRGTYP ; PROGRAM TYPE
STA TYPFLG
LDA #0
STA DRVNUM
STA LSTDRV
JSR INITDR
OP042
JSR PRSCLN ; LOOK FOR ":"
BNE OP049
LDX #0
BEQ OP20 ; JUMP
OP049
TXA
BEQ OP10
OP05
LDA #BADSYN ; SOMETHING AMISS
JMP CMDERR
OP10
DEY ; BACK UP TO ":"
BEQ OP20 ; 1ST CHAR IS ":"
DEY
OP20
STY FILTBL ; SAVE FILENAME PTR
LDA #$8D ; LOOK FOR CR-SHIFTED
JSR PARSE
INX
STX F2CNT
JSR ONEDRV
JSR OPTSCH
JSR FFST ; LOOK FOR FILE ENTRY
LDX #0
STX REC
STX MODE ; READ MODE
STX TYPE ; DELETED
INX
CPX F1CNT
BCS OP40 ; NO PARAMETERS
JSR CKTM ; CHECK FOR TYPE & MODE
INX
CPX F1CNT
BCS OP40 ; ONLY ONE PARAMETER
CPY #RELTYP
BEQ OP60 ; SET RECORD SIZE
JSR CKTM ; SET TYPE/MODE
OP40
LDX TEMPSA
STX SA ; SET SA BACK
CPX #2
BCS OP45 ; NOT LOAD OR SAVE
STX MODE ; MODE=SA
LDA TYPE
BNE OP50 ; TYPE FROM PARM
LDA #PRGTYP
STA TYPE ; USE PRG
OP45
LDA TYPE
BNE OP50 ; TYPE FROM PARM
LDA PATTYP
AND #TYPMSK
STA TYPE ; TYPE FROM FILE
LDA FILTRK
BNE OP50 ; YES, IT EXISTS
LDA #SEQTYP
STA TYPE ; DEFAULT IS SEQ
OP50
LDA MODE
CMP #WTMODE
BEQ OP75 ; GO WRITE
JMP OP90
OP60
LDY FILTBL,X ; GET RECORD SIZE
LDA CMDBUF,Y
STA REC
LDA FILTRK
BNE OP40 ; IT'S HERE, READ
LDA #WTMODE ; USE WRITE TO OPEN
STA MODE
BNE OP40 ; JUMP
OP75
LDA PATTYP
AND #$80
TAX
BNE OP81
OP77
LDA #$20 ; OPEN WRITE
BIT PATTYP
BEQ OP80
JSR DELDIR ;CREATED
JMP OPWRIT
OP80
LDA FILTRK
BNE OP81
JMP OPWRIT ; NOT FOUND, OK!
OP81
LDA CMDBUF
CMP #'@ ; CHECK FOR REPLACE
BEQ OP82
TXA
BNE OP815
LDA #FLEXST
JMP CMDERR
OP815
LDA #BADFN
JMP CMDERR
OP82
LDA PATTYP ; REPLACE
AND #TYPMSK
CMP TYPE
BNE OP115
CMP #RELTYP
BEQ OP115
JSR OPNWCH
LDA LINDX
STA WLINDX
LDA #IRSA ; INTERNAL CHAN
STA SA
JSR FNDRCH
LDA INDEX
JSR SETPNT
LDY #0
LDA (DIRBUF),Y
ORA #$20 ; SET REPLACE BIT
STA (DIRBUF),Y
LDY #26
LDA TRACK
STA (DIRBUF),Y
INY
LDA SECTOR
STA (DIRBUF),Y
LDX WLINDX
LDA ENTSEC
STA DSEC,X
LDA ENTTRK
STA DTRK,X
LDA ENTIND
STA DIND,X
JSR CURBLK
JSR DRTWRT
JMP OPFIN
OP90
LDA FILTRK ; OPEN READ (& LOAD)
BNE OP100
OP95
LDA #FLNTFD ; TRACK NOT RECORDED
JMP CMDERR ; NOT FOUND
OP100
LDA MODE
CMP #MDMODE
BEQ OP110
LDA #$20
BIT PATTYP
BEQ OP110
LDA #FILOPN
JMP CMDERR
OP110
LDA PATTYP
AND #TYPMSK ; TYPE IS IN INDEX TABLE
CMP TYPE
BEQ OP120
OP115
LDA #MISTYP ; TYPE MISMATCH
JMP CMDERR
OP120
LDY #0
STY F2PTR
LDX MODE
CPX #APMODE
BNE OP125
CMP #RELTYP
BEQ OP115
LDA (DIRBUF),Y
AND #$4F
STA (DIRBUF),Y
LDA SA
PHA
LDA #IRSA
STA SA
JSR CURBLK
JSR DRTWRT
PLA
STA SA
OP125
JSR OPREAD
LDA MODE
CMP #APMODE
BNE OPFIN
JSR APPEND
JMP ENDCMD
OPREAD
LDY #19
LDA (DIRBUF),Y
STA TRKSS
INY
LDA (DIRBUF),Y
STA SECSS
INY
LDA (DIRBUF),Y
LDX REC
STA REC
TXA
BEQ OP130
CMP REC
BEQ OP130
LDA #NOREC
JSR CMDERR
OP130
LDX F2PTR
LDA FILTRK,X
STA TRACK
LDA FILSEC,X
STA SECTOR
JSR OPNRCH
LDY LINDX ; OPEN A READ CHNL
LDX F2PTR
LDA ENTSEC,X
STA DSEC,Y
LDA ENTTRK,X
STA DTRK,Y
LDA ENTIND,X
STA DIND,Y
RTS
OPWRIT
LDA FILDRV
AND #1
STA DRVNUM
JSR OPNWCH
JSR ADDFIL ; ADD TO DIRECTORY
OPFIN
LDA SA
CMP #2
BCS OPF1
JSR GETHDR
LDA TRACK
STA PRGTRK
LDA DRVNUM
STA PRGDRV
LDA SECTOR
STA PRGSEC
OPF1
JMP ENDCMD
CKTM
LDY FILTBL,X ; GET PTR
LDA CMDBUF,Y ; GET CHAR
LDY #NMODES
CKM1
DEY
BMI CKM2 ; NO VALID MODE
CMP MODLST,Y
BNE CKM1
STY MODE ; MODE FOUND
CKM2
LDY #NTYPES
CKT1
DEY
BMI CKT2 ; NO VALID TYPE
CMP TPLST,Y
BNE CKT1
STY TYPE ; TYPE FOUND
CKT2
RTS
APPEND
JSR GCBYTE
LDA #LRF
JSR TSTFLG
BEQ APPEND
JSR RDLNK
LDX SECTOR
INX
TXA
BNE AP30
JSR WRT0 ;GET ANOTHER BLOCK
LDA #2
AP30
JSR SETPNT
LDX LINDX
LDA #RDYLST
STA CHNRDY,X
LDA #$80 ;CHNL BIT
ORA LINDX
LDX SA
STA LINTAB,X
RTS
;
; LOAD DIRECTORY
;
LOADIR
LDA #LDCMD
STA CMDNUM
LDX CMDSIZ
DEX
BNE LD01
LDA #'* ; LOAD BOTH DIRECTORIES
STA CMDBUF
LDA #$80
STA PATTYP
ORA LSTDRV
STA FILDRV
INC F1CNT
INC F2CNT
BNE LD10 ; JUMP
LD01
DEX ; LOAD BY NAME
BNE LD03
LDA CMDBUF+1
JSR TST0V1
BMI LD03
LD02
AND #1 ; LOAD ONE DIR
STA FILDRV
INC F1CNT
INC F2CNT
INC FILTBL
LDA #$80
STA PATTYP
LDA #'*
STA CMDBUF+1
BNE LD10 ; JUMP
LD03
JSR PRSCLN
BNE LD05 ; FOUND ":"
JSR CMDRST
LDY #3
LD05
DEY
DEY
STY FILTBL
JSR TC35 ; PARSE & SET TABLES
JSR FS1SET
JSR ALLDRS
LD10
JSR OPTSCH ; NEW DIRECTORY
JSR NEWDIR
JSR FFST
LD20
JSR STDIR ; START DIRECTORY
JSR GETBYT ; SET 1ST BYTE
LDX LINDX
STA CHNDAT,X
LDA DRVNUM
STA LSTDRV
ORA #4
STA FILTYP,X
LDA #0
STA BUFTAB+CBPTR
RTS
.END

206
DOS_8280/opx

@ -0,0 +1,206 @@
.PAGE 'OPEN CHANNEL'
;
; OPEN A READ CHANL WITH 2 BUFFERS
; WILL INSERT SA IN LINTAB
; AND INITS ALL POINTERS.
; RELATIVE SS AND PTRS ARE SET.
;
OPNRCH
LDA #2 ; GET TWO DATA BUFFERS
JSR GETRCH
JSR INTPNT ; CLEAR POINTERS
LDA TYPE
PHA
ASL A
ORA DRVNUM
STA FILTYP,X ; SET FILE TYPE
JSR STRDBL ; READ ONE OR TWO BLOCKS
LDX LINDX
LDA TRACK
BNE OR10
LDA SECTOR
STA LSTCHR,X ; SET LAST CHAR PTR
OR10
PLA
CMP #RELTYP
BNE OR30 ; MUST BE SEQUENTIAL STUFF
LDY SA
LDA LINTAB,Y ; SET CHANNEL AS R/W
ORA #$40
STA LINTAB,Y
LDA REC
STA RS,X ; SET RECORD SIZE
JSR GETBUF ; GET SS BUFFER
BPL OR20
JMP GBERR ; NO BUFFER
OR20
LDX LINDX
STA SS,X
LDA TRKSS
STA SSSTRK,X
LDA SECSS
STA SSSSEC,X
LDA #255
STA SSSGRP,X ; NO GROUP RESIDENT
OROW
LDX LINDX
LDA #2
STA NR,X ; SET FOR NXTREC
LDA #0
JSR SETPNT ; SET FIRST DATA BYTE
JSR RD40 ; SET UP 1ST RECORD
JMP GETHDR ; RESTORE TRACK AND SECTOR
OR30
JSR RDBYT ; SEQUENTIAL SET UP
LDX LINDX
STA CHNDAT,X
LDA #RDYTLK
STA CHNRDY,X
RTS
;
; INITIALIZE VARIABLES FOR OPEN CHANL
; LSTJOB,SETS ACTIVE BUFFER#,LSTCHR,
; BUFFER POINTERS IN BUFTAB = 2
;
INTPNT
LDX LINDX
LDA DRVNUM
LDY BUF0,X
STA LSTJOB,Y
LDY BUF1,X
STA LSTJOB,Y
STA JOBS,Y
LDA BUF0,X
ASL A
TAY
LDA #2
STA BUFTAB,Y
LDA BUF1,X
ORA #$80
STA BUF1,X
ASL A
TAY
LDA #2
STA BUFTAB,Y
LDA #0
STA NBKL,X
STA NBKH,X
LDA #0
STA LSTCHR,X
RTS
;
; OPEN A WRITE CHANL WITH 2 BUFFERS
;
OPNWCH
JSR INTTS ; GET FIRST TRACK, SECTOR
LDA #2
JSR GETWCH ; GET 2 BUFFERS FOR WRITING
JSR SETHDR ; SET UP BUFFER HEADERS
JSR INTPNT
LDX LINDX
LDA TYPE
PHA
ASL A
ORA DRVNUM
STA FILTYP,X ; SET FILTYP = SEQ
PLA
CMP #RELTYP
BEQ OW10
LDA #RDYLST ; ACTIVE LISTENER
STA CHNRDY,X
RTS
OW10
LDY SA
LDA LINTAB,Y
AND #$3F
ORA #$40
STA LINTAB,Y ; SET CHANNEL AS R/W
LDA REC
STA RS,X ; SET RECORD SIZE
JSR GETBUF ; GET SS BUFFER
BPL OW20
JMP GBERR ; NO BUFFER
OW20
LDX LINDX
STA SS,X
JSR CLRBUF
JSR NXTTS
LDA TRACK
STA TRKSS ; SAVE SS TRACK AND SECTOR
LDA SECTOR
STA SECSS
LDX LINDX
LDA SS,X
JSR SETH ; SET SS HEADER
LDA #0
JSR SETSSP
LDA #0 ; SET NULL LINK
JSR PUTSS
LDA #SSIOFF+1 ; SET LAST CHAR
JSR PUTSS
LDA #0 ; SET THIS SS #
JSR PUTSS
LDA REC ; RECORD SIZE
JSR PUTSS
LDA TRACK
JSR PUTSS
LDA SECTOR
JSR PUTSS
LDA #SSIOFF
JSR SETSSP
JSR GETHDR ; GET FIRST TRACK AND SECTOR
LDA TRACK
JSR PUTSS
LDA SECTOR
JSR PUTSS
JSR WRTSS ; WRITE IT OUT
JSR WATJOB
LDX LINDX
LDA SS,X ; GET SS BUFFER #
JSR CLRBUF ; CLEAR THAT BUFFER
JSR SETSSP ; SET SIDE SECTOR POINTER
LDA TRKSS
JSR PUTSS ; SET TRACK LINK
LDA SECSS
JSR PUTSS ; SET SECTOR LINK
LDA #254
JSR PUTSS ; SET SUPER SS ID
LDA TRKSS
JSR PUTSS ; SET TRACK SS LINK
LDA SECSS
JSR PUTSS ; SET SECTOR SS LINK
JSR NXTTS ; GET NEXT TRACK AND SECTOR
LDX LINDX
LDA TRACK
STA SSSTRK,X ; SAVE SSS TRACK
STA TRKSS
LDA SECTOR
STA SSSSEC,X ; SAVE SSS SECTOR
STA SECSS
LDA #255
STA SSSGRP,X ; NO RESIDENT SS
JSR WRTSSS ; WRITE THE SUPER SIDE SECTOR
JSR GETHDR
OW21
LDA #2
JSR SETPNT
LDX LINDX ; SET NR FOR NULL BUFFER
SEC
LDA #0
SBC RS,X
STA NR,X
JSR NULBUF ; NULL RECORDS
JSR NULLNK
JSR WRTOUT
JSR WATJOB
JSR MAPOUT ; WRITE THE BAM
JMP OROW
;
; PUT BYTE INTO SIDE SECTOR
;
PUTSS
PHA
LDX LINDX
LDA SS,X
JMP PUTB1
.END

279
DOS_8280/parsex

@ -0,0 +1,279 @@
.PAGE 'PARSE & EXECUTE'
;
; PARSE & EXECUTE STRING IN CMDBUF
;
PARSXQ
JSR OKERR ; SET ERROR CHANNEL TO 00, OK
LDA ORGSA
BPL PS05
AND #$F
CMP #$F
BEQ PS05
JMP OPEN
PS05
JSR CMDSET ; SET VARIABLES,REGS
LDA (CB),Y
STA CHAR
LDX #NCMDS-1 ; SEARCH COMMAND TABLE
PS10
LDA CMDTBL,X
CMP CHAR
BEQ PS20
DEX
BPL PS10
LDA #BADCMD ; NO SUCH COMMAND
JMP CMDERR
PS20
STX CMDNUM ; .X = CMD #
CPX #PCMD ; COMMANDS NOT PARSED
BCC PS30
JSR TAGCMD ; SET TABLES, POINTERS & PATTERNS
PS30
LDX CMDNUM
LDA CJUMPL,X
STA TEMP
LDA CJUMPH,X
STA TEMP+1
JMP (TEMP) ; JUMP TO THE COMMAND
.PAGE
;
; COMMAND TERMINATION
;
ENDCMD
LDA ERWORD
BNE JCMDER ; LAST COMMAND HAD AN ERROR
LDY #0
TYA
STY TRACK
;
; SCRATCH TERMINATION
;
SCREND
STY SECTOR ; SCRATCH ENTRY
STY CB
JSR ERRMSG ; FILES SCRATCHED
JSR ERROFF ; TURN OFF ERROR LED
LDA DRVNUM
STA LSTDRV
TAX
LDA #0
STA NODRV,X
JSR CLRCB
JMP FREICH ; FREE INTERNAL CHANNEL
;
; CLEAR THE COMMAND BUFFER
;
CLRCB
LDY #CMDLEN-1
LDA #0
CLRB2
STA CMDBUF,Y
DEY
BPL CLRB2
RTS
;
; COMMAND LEVEL ERROR PROCESSING
;
JCMDER
LDY #0
STY TRACK
STY SECTOR
JMP CMDER2
SIMPRS
LDX #0 ; SIMPLE PARSER
STX FILTBL
LDA #':
JSR PARSE ; LOOK FOR ':'
BEQ SP10 ; FOUND IT
DEY
DEY
STY FILTBL
SP10
JMP SETANY ; SET DRIVE #
.PAGE 'PARSE-TAGCMD'
;
; PARSE FOR COLON
;
PRSCLN
LDY #0
LDX #0
LDA #':
JMP PARSE ; FIND POSITION OF ':'
;
; TAG COMMAND STRING
; SET UP CMD STRUCTURE
; IMAGE & FILE STREAM PTRS
;
TAGCMD
JSR PRSCLN ; LOOK FOR ':'
BNE TC30
TC25
LDA #NOFILE ; NONE, NO FILES
JMP CMDERR
TC30
DEY
DEY
STY FILTBL ; ':'-1 STARTS FS1
TXA
BNE TC25 ; ERROR, ',' BEFORE ':'
TC35
LDA #'= ; SEARCH FOR '='
JSR PARSE
TXA ; COUNT = 1-1?
BEQ TC40
LDA #%01000000 ; G1-BIT
TC40
ORA #%00100001 ; E1,^E2-BITS
STA IMAGE ; FS STRUCTURE
INX
STX F1CNT
STX F2CNT ; INIT FOR NO FS2
LDA PATFLG
BEQ TC50
LDA #%10000000 ; P1-BIT
ORA IMAGE
STA IMAGE
LDA #0
STA PATFLG ; CLEAR PATTERN FLAG
TC50
TYA ; PTR TO FS2
BEQ TC75 ; FS2 NOT HERE
STA FILTBL,X
LDA F1CNT ; FS2 IS HERE NOW,...
STA F2PTR ; ...NOW SET F2 PTR
LDA #$8D ; FIND CR-SHIFTED
JSR PARSE ; PARSE REST OF CMD STRING
INX ; ADVANCE FILTBL PTR TO END
STX F2CNT ; SAVE IT
DEX ; RESTORE FOR TEST
LDA PATFLG ; SAVE LAST PATTERN
BEQ TC60 ; ANY PATTERNS?
LDA #%1000 ; YES, P2-BIT
TC60
CPX F1CNT ; F2CNT = F1CNT+1?
BEQ TC70
ORA #%0100 ; G2-BIT
TC70
ORA #%0011 ; E2-BIT,^E2-BIT
EOR IMAGE ; EOR CLEARS ^E2-BIT
STA IMAGE
TC75
LDA IMAGE
LDX CMDNUM
AND STRUCT,X ; MATCH CMD TEMPLATE
BNE TC80
RTS
TC80
STA ERWORD ; COULD BE WARNING
LDA #BADSYN ; ERROR, BAD SYNTAX
JMP CMDERR
.PAGE 'PARSE'
;
; PARSE STRING
; LOOKS FOR SPECIAL CHARS,
; RETURNING WHEN VAR'BL CHAR
; IS FOUND
; .A: VAR'BL CHAR
; .X: IN,OUT: INDEX, FILTBL+1
; .Y: IN: INDEX, CMDBUF
; OUT: NEW PTR, = 0 IF NONE
; (Z = 1) IF Y = 0
;
PARSE
STA CHAR ; SAVE VAR'BL CHAR
PR10
CPY CMDSIZ ; STAY IN STRING
BCS PR30
LDA (CB),Y ; MATCH CHAR
INY
CMP CHAR
BEQ PR35 ; FOUND CHAR
CMP #'* ; MATCH PATTERN CHARS
BEQ PR20
CMP #'?
BNE PR25
PR20
INC PATFLG ; SET PATTERN FLAG
PR25
CMP #', ; MATCH FILE SEPARATOR
BNE PR10
TYA
STA FILTBL+1,X ; PUT PTRS IN TABLE
LDA PATFLG ; SAVE PATTERN FOR EA FILE
AND #$7F
BEQ PR28
LDA #$80 ; RETAIN PATTERN PRESENCE...
STA PATTYP,X
STA PATFLG ; ...BUT CLEAR COUNT
PR28
INX
CPX #MXFILS-1
BCC PR10 ; NO MORE THAN MXFILS
PR30
LDY #0 ; Y = 0 (Z = 1)
PR35
LDA CMDSIZ
STA FILTBL+1,X
LDA PATFLG
AND #$7F
BEQ PR40
LDA #$80
STA PATTYP,X
PR40
TYA ; .Z IS SET
RTS
;
;INITIALIZE COMMAND TABLES, PTRS, ETC.
;
CMDSET
LDY BUFTAB+CBPTR
BEQ CS08
DEY
BEQ CS07
LDA CMDBUF,Y
CMP #CR
BEQ CS08
DEY
LDA CMDBUF,Y
CMP #CR
BEQ CS08
INY
CS07
INY
CS08
STY CMDSIZ ; SET CMD STRING SIZE
CPY #CMDLEN+1
LDY #$FF
BCC CMDRST
STY CMDNUM
LDA #LONGLN ; LONG LINE ERROR
JMP CMDERR
;
; CLEAR VARIABLES,TABLES
;
CMDRST
LDY #0
TYA
STA BUFTAB+CBPTR
STA REC
STA TYPE
STA TYPFLG
STA F1PTR
STA F2PTR
STA F1CNT
STA F2CNT
STA PATFLG
STA ERWORD
LDX #MXFILS
CS10
STA FILTBL-1,X
STA ENTSEC-1,X
STA ENTIND-1,X
STA FILDRV-1,X
STA PATTYP-1,X
STA FILTRK-1,X
STA FILSEC-1,X
DEX
BNE CS10
RTS
.END

23
DOS_8280/patc

@ -0,0 +1,23 @@
.PAGE 'RETRY PATCH SPACE'
PATC
DEC RETRY
BEQ PATC3
LDA RETRY
CMP #5
BNE PATC3
LDA #BUMP
ORA DRVNUM
STA JOBS,X
PATC1
LDA JOBS,X
BMI PATC1
CMP #1
BEQ PATC2
PLA
PLA
JMP TSTJB1
PATC2
LDA #$FF
PATC3
RTS
.END

213
DOS_8280/ramvar

@ -0,0 +1,213 @@
.PAG 'RAMVAR'
;
; COMMON AREA DEFINES
;
*=$1003
JOBS *=*+15 ; JOB QUE
*=$1021
HDRS *=*+120 ; JOB HEADERS
*=$1099
CYLHIG *=*+1 ; CYLINDER HIGH
CYLLOW *=*+1 ; CYLINDER LOW
HDSCYL *=*+1 ; HEADS/CYLINDER
SECTRK *=*+1 ; SECTORS/TRACK
HEADS *=*+1 ; NUMBER OF HEADS
SECTRS *=*+1 ; NUMBER OF SECTORS
BYTSEC *=*+1 ; BYTES/SECTOR
XFRINT *=*+1 ; TRANSFER/INTERLEAVE CODE
ECCRTY *=*+1 ; ECC AND RETRY BYTE
INTRLV *=*+1 ; INTERLEAVE CODE
SAMJOB *=*+1 ; SAME JOB NUMBER
MAXCYL *=*+1 ; MAX SECTORS/CYLINDER
*=$10B0
WPSW *=*+2 ; AUTO INIT SWITCH
VERNUM *=*+1 ; VERSION NUMBER
INTFLG *=*+1 ; INITIAL T&S FLAG
TMPHED *=*+1 ; TEMPORARY HEAD STORAGE
BAMTRK *=*+2 ; START OF BAM (TRACK)
BAMSEC *=*+2 ; START OF BAM (SECTOR)
DSTRK *=*+2 ; START OF DIRECTORY (TRACK)
DSSEC *=*+2 ; START OF DIRECTORY (SECTOR)
HSTRK *=*+2 ; START OF HEADER (TRACK)
HSSEC *=*+2 ; START OF HEADER (SECTOR)
BTSTRK *=*+2 ; START OF BAD T, S AND H (TRACK)
BTSSEC *=*+2 ; START OF BAD T, S AND H (SECTOR)
DELENT *=*+1 ; LOOK FOR DELETED ENTRY
RETRY *=*+1 ; CONTROLLER ERROR RETRIES
TMPBAM *=*+1 ; TEMPORARY BAM TRACK
WRTFLG *=*+1 ; BAM WRITE ERROR FLAG
TRKBAM *=*+1 ; NUMBER OF TRACKS/BAM
;
; VARIABLES FOR BIG RELATIVE FILES
;
*=$10CF
GRPNUM *=*+1 ; GROUP NUMBER
SSSGRP *=*+MXCHNS ; RESIDENT GROUP
SSSSEC *=*+MXCHNS ; SUPER SIDE SECTOR ADDRESS
SSSTRK *=*+MXCHNS ; SUPER SIDE SECTOR TRACK ADDR
;
; PERMANENT ADDRESS VARIABLES
;
*=$10F0
VNMI *=*+2 ; INDIRECT FOR NMI
NMIFLG *=*+1
AUTOFG *=*+1
SECINC *=*+1 ; SECTOR ALLOCATION
REVCNT *=*+1 ; ERROR RECOVERY COUNT
VECIDL *=*+2 ; VECTOR TO IDLE LOOP
VECIEE *=*+2 ; VECTOR TO IEEE
BUFS = $1100 ; START OF DATA BUFFER
.PAGE
;
; ZERO PAGE VARIABLES
;
*=$0000
USRJMP *=*+2 ; USER JMP TABLE PTR
BMPNT *=*+2 ; BIT MAP POINTER
TEMP *=*+6 ; TEMP WORK SPACE
IP *=*+2 ; INDIRECT PTR VARIABLE
LSNADR *=*+1 ; LISTEN ADDRESS
TLKADR *=*+1 ; TALKER ADDRESS
LSNACT *=*+1 ; ACTIVE LISTENER FLAG
TLKACT *=*+1 ; ACTIVE TALKER FLAG
ADRSED *=*+1 ; ADDRESSED FLAG
PRGTRK *=*+1 ; LAST PROG ACCESSED
DRVNUM *=*+1 ; CURRENT DRIVE #
TRACK *=*+1 ; CURRENT TRACK
SECTOR *=*+1 ; CURRENT SECTOR
LINDX *=*+1 ; LOGICAL INDEX
SA *=*+1 ; SECONDARY ADDRESS
ORGSA *=*+1 ; ORIGINAL SECONDARY ADDRESS
DATA *=*+1 ; TEMP DATA BYTE
T0 = TEMP
T1 = TEMP+1
T2 = TEMP+2
T3 = TEMP+3
T4 = TEMP+4
R0 *=*+1
R1 *=*+1
R2 *=*+1
R3 *=*+1
R4 *=*+1
RESULT *=*+4
ACCUM *=*+5
DIRBUF *=*+2
;
; ZERO PAGE ARRAY
;
BUFTAB *=*+CBPTR+4 ; BUFFER BYTE POINTERS
CB=BUFTAB+CBPTR
BUF0 *=*+MXCHNS
BUF1 *=*+MXCHNS
NBKL
RECL *=*+MXCHNS
NBKH
RECH *=*+MXCHNS
NR *=*+MXCHNS
RS *=*+MXCHNS
SS *=*+MXCHNS
F1PTR *=*+1 ; FILE STREAM 1 POINTER
RECPTR *=*+1 ; RECORD POINTER
SSNUM *=*+1 ; SIDE SECTOR NUMBER
SSIND *=*+1 ; INDEX INTO SIDE SECTOR
RELPTR *=*+1 ; POINTER INTO RECORD
ENTSEC *=*+MXFILS ; SECTOR OF DIRECTORY ENTRY
ENTIND *=*+MXFILS ; INDEX OF DIRECTORY ENTRY
FILDRV *=*+MXFILS ; DEFAULT FLAG, DRIVE #
PATTYP *=*+MXFILS ; PATTERN,REPLACE,CLOSED-FLAGS,TYPE
FILTYP *=*+MXCHNS ; CHANNEL FILE TYPE
CHNRDY *=*+MXCHNS ; CHANNEL STATUS
EOIFLG *=*+1 ; TEMP EOI
JOBNUM *=*+1 ; CURRENT JOB #
LINTAB *=*+MAXSA+1 ; SA:LINDX TABLE
CHNDAT *=*+MXCHNS ; CHANNEL DATA BYTE
LSTCHR *=*+MXCHNS ; CHANNEL LAST CHAR PTR
TYPE *=*+1 ; ACTIVE FILE TYPE
.PAGE
;
; RAM VARIABLES IN $4300
;
*=$4300
CMDBUF *=*+CMDLEN+1
CMDNUM *=*+1 ; COMMAND #
STRSIZ *=*+1
TEMPSA *=*+1 ; TEMPORARY SA
CMD *=*+1 ; TEMP JOB COMMAND
LSTSEC *=*+1
BUFUSE *=*+2 ; BUFFER ALLOCATION
DSKID *=*+4 ; CURRENT DISK ID'S
MDIRTY *=*+2 ; BAM 0 & 1 DIRTY FLAGS
ENTFND *=*+1 ; DIR-ENTRY FOUND FLAG
DIRLST *=*+1 ; DIR LISTING FLAG
CMDWAT *=*+1 ; COMMAND WAITING FLAG
LINUSE *=*+1 ; LINDX USE WORD
LBUSED *=*+1 ; LAST BUFFER USED
REC *=*+1 ; RECORD LENGTH
TRKSS *=*+1 ; SIDE SECTOR TRACK
SECSS *=*+1 ; SIDE SECTOR SECTOR
.PAGE
;
; RAM ARRAY AREA
;
LSTJOB *=*+BFCNT+3 ; LAST JOB
DSEC *=*+MXCHNS ; SECTOR OF DIRECTORY ENTRY
DIND *=*+MXCHNS ; INDEX OF DIRECTORY ENTRY
ERWORD *=*+1 ; ERROR WORD FOR RECOVERY
PRGDRV *=*+1 ; LAST PROGRAM DRIVE
PRGSEC *=*+1 ; LAST PROGRAM SECTOR
WLINDX *=*+1 ; WRITE LINDX
RLINDX *=*+1 ; READ LINDX
NBTEMP *=*+2 ; # BLOCKS TEMP
CMDSIZ *=*+1 ; COMMAND STRING SIZE
CHAR *=*+1 ; CHAR UNDER PARSER
LIMIT *=*+1 ; PTR LIMIT IN COMPAR
F1CNT *=*+1 ; FILE STREAM 1 COUNT
F2CNT *=*+1 ; FILE STREAM 2 COUNT
F2PTR *=*+1 ; FILE STREAM 2 POINTER
;
; PARSER TABLES
;
FILTBL *=*+MXFILS+1 ; FILENAME POINTER
FILTRK *=*+MXFILS ; 1ST LINK/TRACK
FILSEC *=*+MXFILS ; /SECTOR
;
; CHANNEL TABLES
;
PATFLG *=*+1 ; PATTERN PRESENCE FLAG
IMAGE *=*+1 ; FILE STREAM IMAGE
DRVCNT *=*+1 ; NUMBER OF DRV SEARCHES
DRVFLG *=*+1 ; DRIVE SEARCH FLAG
LSTDRV *=*+1 ; LAST DRIVE W/O ERROR
FOUND *=*+1 ; FOUND FLAG IN DIR SEARCHES
DIRSEC *=*+1 ; DIRECTORY SECTOR
DELSEC *=*+1 ; SECTOR OF 1ST AVAIL ENTRY
DELIND *=*+1 ; INDEX "
LSTBUF *=*+1 ; = 0 IF LAST BLOCK
INDEX *=*+1 ; CURRENT INDEX IN BUFFER
FILCNT *=*+1 ; COUNTER, FILE ENTRIES
TYPFLG *=*+1 ; MATCH BY TYPE FLAG
MODE *=*+1 ; ACTIVE FILE MODE (R,W)
JOBRTN *=*+1 ; JOB RETURN FLAG
EPTR *=*+1 ; POINTER FOR RECOVERY
TOFF *=*+1 ; TOTAL TRACK OFFSET
NDBL *=*+2
NDBH *=*+2
NODRV *=*+2
R5 *=*+1 ; CURRENT GROUP FOR BIG REL
DTRK *=*+MXCHNS
ENTTRK *=*+MXFILS
DELTRK *=*+1
DIRTRK *=*+1 ; DIRECTORY TRACK
MAXTRK *=*+1 ; MAX TRACK+1
BAMSIZ *=*+1 ; BYTES/TRACK IN BAM
BTSIZE *=*+1 ; BYTES/CYLINDER IN BAM
HEAD *=*+1 ; CURRENT HEAD
MAPOFF *=*+1 ; BAM OFFSET
.PAGE
;
; OUTPUT BUFFERS
;
*=$4400-36-36
NAMBUF *=*+36 ; DIRECTORY BUFFER
ERRBUF =* ; ERROR MESSAGE BUFFER
.END

144
DOS_8280/record

@ -0,0 +1,144 @@
.PAGE 'RECORD'
;
;*********************************
;* RECORD: POSITION RELATIVE *
;* POINTERS TO GIVEN *
;* RECORD NUMBER OR TO *
;* LAST RECORD IF OUT OF *
;* RANGE. *
;*********************************
;
RECORD
JSR CMDSET ; INIT TABLES, PTRS
LDA CMDBUF+1
STA SA
JSR FNDRCH
BCC R20 ; GOT CHANNEL'S LINDEX
LDA #NOCHNL ; NO VALID CHANNEL
JSR CMDERR
R20
LDA #LRF+OVRFLO
JSR CLRFLG
JSR TYPFIL ; GET FILE TYPE
BEQ R30 ; IT IS A RELATIVE FILE
LDA #MISTYP ; WRONG TYPE
JSR CMDERR
R30
LDA FILTYP,X
AND #1
STA DRVNUM
LDA CMDBUF+2
STA RECL,X ; GET RECORD #
LDA CMDBUF+3
STA RECH,X
LDX LINDX ; CLEAR CHNRDY TO RNDRDY
LDA #RNDRDY
STA CHNRDY,X
LDA CMDBUF+4 ; GET OFFSET
BEQ R40
SEC
SBC #1
BEQ R40
CMP RS,X
BCC R40
LDA #RECOVF
STA ERWORD
LDA #0
R40
STA RECPTR ; SET OFFSET
JSR FNDREL ; CALC SS STUFF
JSR SSPOS ; SET SS PTRS
BVC R50
LDA #LRF ; BEYOND THE END
JSR SETFLG ; SET LAST REC FLAG
JMP RD05
R50
JSR POSITN ; POSITION TO RECORD
LDA #LRF
JSR TSTFLG
BEQ R60
JMP RD05
R60
JMP ENDCMD ; THAT'S ALL
;
;*********************************
;* POSITN: POSITION RELATIVE *
;* DATA BLOCK INTO ACTIVE*
;* BUFFER & NEXT BLOCK *
;* INTO INACTIVE BUFFER. *
;*********************************
;
POSITN
JSR POSBUF ; POSITION BUFFERS
LDA RELPTR
JSR SETPNT ; SET PTR FROM FNDREL
LDX LINDX
LDA RS,X
SEC ; CALC THE OFFSET
SBC RECPTR
BCS P2
JMP BREAK ; SHOULD NOT BE NEEDED
P2
CLC
ADC RELPTR
BCC P30
ADC #1
SEC
P30
JSR NXOUT ; SET NR
JMP RD15
LDA #RECOVF
JSR CMDERR
;
;*********************************
;* POSBUF: POSITION PROPER DATA *
;* BLOCKS INTO BUFFERS *
;*********************************
;
POSBUF
LDA DIRBUF
STA R3
LDA DIRBUF+1
STA R4
JSR BHERE ; IS BUFFER IN?
BEQ P20 ; YES!
JSR SCRUB ; CLEAN BUFFER
JSR GETLNK
LDA TRACK
BEQ P80
JSR DBLBUF ; TRY INACTIVE BUFFER
JSR BHERE ; IS IT THIS BUFFER?
BNE P80 ; NO!
JSR GETLNK
LDA TRACK
BEQ P20
JSR DBLBUF
JSR RDAB ; READ IN NEXT BUFFER
JSR DBLBUF
P20
RTS
P80
LDY #0 ; GET PROPER BLOCK
LDA (R3),Y
STA TRACK
INY
LDA (R3),Y
STA SECTOR
JSR DBLBUF
JMP STRDBL ; GET NEXT BLOCK, TOO.
;
; CHECK TO SEE IF BUFFER IS IN MEMORY
;
BHERE
JSR GETHDR ; GET THE HEADER
LDY #0
LDA (R3),Y
CMP TRACK
BEQ BH10 ; TEST SECTOR, TOO.
RTS
BH10
INY
LDA (R3),Y
CMP SECTOR ; SET .Z
RTS
.END

130
DOS_8280/rel1

@ -0,0 +1,130 @@
.PAGE 'REL1'
;***********************************
;*
;* ROUTINE: NXTREC
;*
;*
;*
;*
;*
;***********************************
NXTREC
LDA #OVRFLO
JSR CLRFLG
;
LDA #LRF
JSR TSTFLG
BNE NXTR40
;
LDX LINDX
INC RECL,X ; GOTO NEXT RECORD #
BNE NXTR15
INC RECH,X
;
NXTR15
LDX LINDX
LDA NR,X
BEQ NXTR45 ;THERE IS A NR
;
JSR GETPNT ; GET POINTER
LDX LINDX ;TEST IF SAME BUFFER
CMP NR,X
BCC NXTR20 ; YES, BT<NR
;
JSR NRBUF ; NO,NEXT BUFFER
;
NXTR20 LDX LINDX
LDA NR,X
JSR SETPNT ;ADVANCE TO NEXT REC
LDA (BUFTAB,X) ;READ 1ST DAT BYTE
;
STA DATA ;SAVE FOR READ CHANNEL
LDA #OVRFLO
JSR CLRFLG ; CLEAR
; THE OVERFLOW FLAG
JSR ADDNR ;ADVANCE NR
NXOUT
PHA
BCC NXTR30 ;NO BLOCK BOUNDARY
;
LDA #0
JSR DRDBYT ;CHECK TRACK LINK
BNE NXTR30 ;NOT LAST BLOCK
;
PLA
CMP #2
BEQ NXTR50
NXTR45
LDA #LRF
JSR SETFLG
NXTR40
JSR GETPRE
LDA BUFTAB,X
STA LSTCHR,Y
LDA #CR
STA DATA
RTS
;
NXTR50
JSR NXTR35
LDX LINDX
LDA #0
STA NR,X
RTS
NXTR30
PLA
NXTR35
LDX LINDX
;*
STA NR,X
JMP SETLST
;*
;*
;**********************************
;*
;*
;* NRBUF
;*
;*
;********************************
;*
;*
NRBUF ;READ TRK,SEC LINK
JSR SETDRN
JSR RDLNK
;
;
JSR GAFLGS ; TEST IF DIRTY
BVC NRBU50 ;CLEAN, DONT WRITE OUT
;
JSR WRTOUT ;DIRTY, WRITE OUT
JSR DBLBUF ;TOGGLE ACTIVE BUFFER
;
LDA #2
JSR SETPNT
JSR TSTWRT ;TEST IF LSTJOB IS WRT
BNE NRBU20 ;NOT A WRITE,BUFFER OK
;
JSR RDAB ;READ IN NEEDED BUFFER
JMP WATJOB ;WAIT AROUND TILL DONE
;
NRBU50 JSR DBLBUF ;TOGGLE ACT BUF
JSR TSTWRT ;WAS LSTJOB A WRT?
BNE NRBU70 ;NOT A WRITE
;
JSR RDAB ;READ IN NEEDED BUFFER
JSR WATJOB ;WAIT TILL DONE
;
NRBU70 ;READ TRK,SEC LINK
JSR RDLNK ; TO DO A READ AHEAD
;
LDA TRACK ;TEST IF LAST BUFFER
BEQ NRBU20 ;YES,NO DBL BUFF TODO
;
JSR DBLBUF ;START READ JOB ON THE
JSR RDAB ;INACTIVE BUFFER
JSR DBLBUF
;
NRBU20 RTS
;
.END

154
DOS_8280/rel2

@ -0,0 +1,154 @@
.PAGE 'REL2'
;**********************************
;*
;* RELPUT
;*
;*
;**********************************
;*
;*
RELPUT JSR SDIRTY ;WRITE DATA TO BUFFER
JSR GETACT
ASL A
TAX
LDA DATA
STA (BUFTAB,X)
;
LDY BUFTAB,X ;INC THE POINTER
INY
BNE RELP05
LDY LINDX
LDA NR,Y
BEQ RELP07
;
RELP06
LDY #2
RELP05
TYA
LDY LINDX
;
CMP NR,Y ;TEST IF NR=POINTER
BNE RELP10 ;NO,SET NEW POINTER
;
RELP07 LDA #OVRFLO ;YES,SET OVERFLOW
JMP SETFLG
;
RELP10 ;WRITE BACK NEW POINTER
INC BUFTAB,X
;
BNE RELP20 ;TEST IF =0
JSR NRBUF ;PREPARE NXT BUFFER
;
RELP20 RTS
;*
;*
;*
;*********************************
;*
;* WRTREL
;*
;*
;*********************************
;*
;*
WRTREL
LDA #LRF+OVRFLO ;CHECK ALL FLAGS
JSR TSTFLG
BNE WR50 ;SOME FLAG IS SET
WR10
LDA DATA ;READY TO PUT DATA
JSR RELPUT
WR20
LDA EOIFLG
BEQ WR40 ;EOI WAS SENT
RTS
WR30
LDA #OVRFLO
JSR TSTFLG
BEQ WR40 ;NO REC OVERFLOW
LDA #RECOVF
STA ERWORD ;SET ERROR FOR END OF PRINT
WR40
JSR CLREC ;CLEAR REST OF RECORD
JSR RD40
LDA ERWORD
BEQ WR45
JMP CMDERR
WR45
JMP OKERR
;
;
WR50
AND #LRF
BNE WR60 ;LAST REC, ADD
LDA EOIFLG
BEQ WR30
WR51
RTS
;
WR60
LDA DATA
PHA
JSR ADDREL ;ADD TO FILE
PLA
STA DATA
LDA #LRF
JSR CLRFLG
JMP WR10
;*
;*
;*
;********************************
;*
;* CLREC
;*
;*********************************
;
CLREC LDA #OVRFLO ;PUT 0'S INTO REST OF RECORD
JSR TSTFLG
BNE CLR10
;
LDA #0
STA DATA
JSR RELPUT
;
JMP CLREC
;
CLR10 RTS
;
;
;*
;*
;*******************************
;*
;* SDIRTY
;*
;*******************************
;*
;
SDIRTY
LDA #DYFILE
JSR SETFLG
JSR GAFLGS
ORA #$40
LDX LBUSED
STA BUF0,X
RTS
;
;*
;*
;*******************************
;*
;* CDIRTY
;*
;*******************************
;*
;
CDIRTY JSR GAFLGS
AND #$BF
LDX LBUSED
STA BUF0,X
RTS
;
;
.END

59
DOS_8280/rel3

@ -0,0 +1,59 @@
.PAGE 'REL3'
;********************************
;*
;*
;* RDREL
;*
;*
;********************************
;*
;*
;
RDREL
LDA #LRF
JSR TSTFLG
BNE RD05 ;NO RECORD ERROR
;
RD10
JSR GETPRE
LDA BUFTAB,X
CMP LSTCHR,Y
BEQ RD40
;
INC BUFTAB,X
BNE RD20
;
JSR NRBUF
RD15
JSR GETPRE
RD20
LDA (BUFTAB,X)
RD25
STA CHNDAT,Y
LDA #RNDRDY
STA CHNRDY,Y
LDA BUFTAB,X
CMP LSTCHR,Y
BEQ RD30
RTS
RD30
LDA #RNDEOI
STA CHNRDY,Y
RTS
RD40
JSR NXTREC
JSR GETPRE
LDA DATA
JMP RD25
;
RD05
LDX LINDX ;NO RECORD CHAR SET UP
LDA #CR
STA CHNDAT,X
LDA #RNDEOI
STA CHNRDY,X
;NO RECORD ERROR
LDA #NOREC
JSR CMDERR
;
.END

85
DOS_8280/rel4

@ -0,0 +1,85 @@
.PAGE 'REL4'
;*
;*
;**********************************
;*
;*
;* SETLST
;*
;*
;**********************************
;*
;*
SETLST LDX LINDX
LDA NR,X
STA R1
DEC R1
CMP #2
BNE SETL01
LDA #$FF
STA R1
SETL01
LDA RS,X
STA R2
;
JSR GETPNT
LDX LINDX
CMP R1
BCC SETL10
BEQ SETL10
;
JSR DBLBUF
JSR FNDLST
BCC SETL05
;
LDX LINDX
STA LSTCHR,X
JMP DBLBUF
;
SETL05 JSR DBLBUF
LDA #$FF
STA R1
;
SETL10 JSR FNDLST
BCS SETL40
;
JSR GETPNT
;
SETL40 LDX LINDX
STA LSTCHR,X
RTS
;*
;*
;*
;*********************************
;*
;*
;* FNDLST
;*
;*
;*********************************
;*
;*
FNDLST
JSR SET00
LDY R1 ;OFFSET TO START AT
;
FNDL10 LDA (DIRBUF),Y
BNE FNDL20
;
DEY
CPY #2
BCC FNDL30
;
DEC R2 ;LIMIT COUNTER
BNE FNDL10
;
FNDL30 DEC R2
CLC ; NOT FOUND HERE
RTS
;
FNDL20 TYA ;FOUND THE END CHAR
SEC
RTS
;
.END

217
DOS_8280/rename

@ -0,0 +1,217 @@
.PAGE 'COPY'
;
; COPY FILE(S) TO ONE FILE
;
COPY
JSR LOOKUP ; LOOK UP ALL FILES
LDA F2CNT
CMP #3
BCC COP10
LDA FILDRV
CMP FILDRV+1
BNE COP10
LDA ENTIND
CMP ENTIND+1
BNE COP10
LDA ENTSEC
CMP ENTSEC+1
BNE COP10
LDA ENTTRK
CMP ENTTRK+1
BNE COP10
JSR CHKIN ; CONCAT
LDA #1
STA F2PTR
JSR OPIRFL
JSR TYPFIL
BEQ COP01 ; RELATIVE FILE
CMP #PRGTYP
BNE COP05
COP01
LDA #MISTYP
JSR CMDERR
COP05
LDA #IWSA
STA SA
LDA LINTAB+IRSA
STA LINTAB+IWSA
LDA #$FF
STA LINTAB+IRSA
JSR APPEND
LDX #2
JSR CY10
JMP ENDCMD
COP10
JSR CY
JMP ENDCMD
CY
JSR CHKIO ; CHECK FILES FOR EXISTENCE
LDA FILDRV
AND #1
STA DRVNUM
JSR OPNIWR ; OPEN INTERNAL WRITE CHNL
JSR ADDFIL ; ADD TO DIRECTORY
LDX F1CNT
CY10
STX F2PTR ; SET UP READ FILE
JSR OPIRFL
LDA #IRSA
STA SA
JSR FNDRCH
JSR TYPFIL
BNE CY10A
JSR CYEXT
CY10A
LDA #EOISND
STA EOIFLG
JMP CY20
CY15
JSR PIBYTE
CY20
JSR GIBYTE
LDA #LRF
JSR TSTFLG
BEQ CY15
JSR TYPFIL
BEQ CY30
JSR PIBYTE
CY30
LDX F2PTR
INX
CPX F2CNT
BCC CY10 ; MORE FILES TO COPY
LDA #IWSA
STA SA
JMP CLSCHN ; CLOSE COPY CHANNEL, FILE
OPIRFL
LDX F2PTR
LDA FILDRV,X
AND #1
STA DRVNUM
LDA ENTTRK,X
STA TRACK
LDA ENTSEC,X
STA SECTOR
JSR OPNIRD
LDX F2PTR
LDA ENTIND,X
JSR SETPNT
LDX F2PTR
LDA PATTYP,X
AND #TYPMSK
STA TYPE
LDA #0
STA REC
JSR OPREAD
LDY #1
JSR TYPFIL
BEQ OPIR10 ; REALTIVE FILE
INY
OPIR10
TYA
JMP SETPNT
GIBYTE
LDA #IRSA
STA SA
GCBYTE
JSR GBYTE
STA DATA
LDX LINDX
LDA CHNRDY,X
AND #EOISND
STA EOIFLG
BNE GIB20
JSR TYPFIL
BEQ GIB20 ; RELATIVE FILE
LDA #LRF
JSR SETFLG
GIB20
RTS
CYEXT
JSR SETDRN
JSR SSEND
LDA GRPNUM ; SAVE GROUP #
PHA
LDA SSIND
PHA
LDA SSNUM
PHA
LDA #IWSA
STA SA
JSR FNDWCH
JSR ADRELS
STA RELPTR
PLA
STA SSNUM
PLA
STA SSIND
PLA
STA GRPNUM ; RESTORE GROUP #
JMP ADDR1
.PAGE 'RENAME'
;
; RENAME FILE NAME IN DIRECTORY
;
RENAME
JSR ALLDRS ; SET BOTH DRIVE #'S
LDA FILDRV+1
AND #1
STA FILDRV+1
CMP FILDRV
BEQ RN10 ; SAME DRIVE #'S
ORA #$80 ; CHECK BOTH DRIVES FOR NAME
RN10
STA FILDRV
JSR LOOKUP ; LOOK UP BOTH NAMES
JSR CHKIO ; CHECK FOR EXISTENCE
LDA FILDRV+1
AND #1
STA DRVNUM
LDA ENTSEC+1
STA SECTOR
LDA ENTTRK+1
STA TRACK
JSR RDAB ; READ DIRECTORY SECTOR
JSR WATJOB
LDA ENTIND+1
CLC ; SET SECTOR INDEX
ADC #3 ; ...+3
JSR SETPNT
JSR GETACT
TAY
LDX FILTBL
LDA #16
JSR TRNAME ; TRANSFER NAME
JSR WRTOUT ; WRITE SECTOR OUT
JSR WATJOB
JMP ENDCMD
;
; CHECK I/O FILE FOR EXIST
;
CHKIN
LDA PATTYP+1 ; 1ST FILE BEARS TYPE
AND #TYPMSK
STA TYPE
LDX F2CNT
CK10
DEX
CPX F1CNT
BCC CK20
LDA FILTRK,X
BNE CK10
LDA #FLNTFD ; INPUT FILE NOT FOUND
JMP CMDERR
CK20
RTS
CHKIO
JSR CHKIN
CK25
LDA FILTRK,X
BEQ CK30
LDA #FLEXST
JMP CMDERR
CK30
DEX
BPL CK25
RTS
.END

5
DOS_8280/rom

@ -0,0 +1,5 @@
.PAGE 'ROM'
*=ROM
CCHKSM
.BYTE 0
.END

135
DOS_8280/romtbl

@ -0,0 +1,135 @@
.PAGE 'ROMTBL'
;
; JUMP TABLE TO ROUTINES
;
*=$FF00
GETBUF
JMP JGETBF
FREBUF
JMP JFREBF
FRETS
JMP JFRETS
USEDTS
JMP JUSED
NXTTS
JMP JNXTTS
INTTS
JMP JINTTS
MAXSEC
JMP JMXSEC
ERROR
JMP JERROR
AUTOI
JMP JAUTOI
SETH
JMP JSETH
ERRMSG
JMP JERRMS
SETLDS
JMP JSETLD
ILLTS
JMP JILLTS
IDLE
JMP (VECIDL)
SCRBAM
JMP JSCRBM
CMDERR
JMP JCMDER
CMDER2
JMP JCDER2
TSTJOB
JMP JTSTJB
ATNIRQ
JMP (VECIEE)
DOJOB
JMP JDOJOB
NXT0
JMP JNXT0
FORMAT
JMP JFORMT
.PAGE
*=$FF50
;
; COMMAND SEARCH TABLE
;
CMDTBL
.BYT 'VIDMBUP&CRSN'
NCMDS =*-CMDTBL
;
; JUMP TABLE LOW
;
CJUMPL
.BYT <VERDIR
.BYT <INTDRV
.BYT <DUPLCT
.BYT <MEM
.BYT <BLOCK
.BYT <USER
.BYT <RECORD
.BYT <UTLODR
.BYT <DSKCPY
.BYT <RENAME
.BYT <SCRTCH
.BYT <NEW
*=CJUMPL+NCMDS
;
; JUMP TABLE HIGH
;
CJUMPH
.BYT >VERDIR
.BYT >INTDRV
.BYT >DUPLCT
.BYT >MEM
.BYT >BLOCK
.BYT >USER
.BYT >RECORD
.BYT >UTLODR
.BYT >DSKCPY
.BYT >RENAME
.BYT >SCRTCH
.BYT >NEW
*=CJUMPH+NCMDS
.SKIP
VAL=0 ; VALIDATE (VERIFY) CMD #
.SKIP
;
; STRUCTURE IMAGES FOR CMDS
;
PCMD = 9 ; # OF PARSED COMMANDS
.BYT %01010001 ; DISKCOPY
STRUCT =*-PCMD ; CMDS NOT PARSED
.BYT %11011101 ; RENAME
.BYT %00011100 ; SCRATCH
.BYT %10011110 ; NEW
LDCMD =*-STRUCT ; LOAD CMD IMAGE
.BYT %00011100 ; LOAD
; --- ---
; PGDRPGDR
; FS1 FS2
.SKIP
; BIT REPS: NOT PATTERN
; NOT GREATER THAN ONE FILE
; NOT DEFAULT DRIVE(S)
; REQUIRED FILENAME
.SKIP
MODLST .BYT 'RWAM' ; MODE TABLE
NMODES =*-MODLST
;
; FILE TYPE TABLE
;
TPLST .BYT 'DSPUL'
TYPLST .BYT 'DSPUR' ; DEL, SEQ, PRG, USR, REL
NTYPES =*-TYPLST
TP1LST .BYT 'EERSE'
TP2LST .BYT 'LQGRL'
;
; ERROR FLAG VARS FOR BIT
;
ER00 .BYT 0
ER0 .BYT $3F
ER1 .BYT $7F
ER2 .BYT $BF
ER3 .BYT $FF
;
IPBM .BYTE $41,$42
.END

69
DOS_8280/scrtch

@ -0,0 +1,69 @@
.PAGE 'SCRATCH'
; SCRATCH FILE(S)
SCRTCH JSR FS1SET ;SET UP FOR 1 STREAM
JSR ALLDRS
JSR OPTSCH
LDA #0
STA R0 ;USED AS FILE COUNT
JSR FFST
BMI SC30
SC15 JSR TSTCHN ;IS IT ACTIVE ?
BCC SC25 ;YES - DONT SCRATCH
LDY #0
LDA (DIRBUF),Y
AND #$40 ;LOCK BIT
BNE SC25 ;IT'S LOCKED
;
JSR DELDIR ;DELETE DIRECTORY
LDY #19 ;IS THIS A RELATIVE ?
LDA (DIRBUF),Y ;HAS A SS ?
BEQ SC17 ;NO
STA TRACK ;YES - SAVE TRACK
INY
LDA (DIRBUF),Y ;GET SECTOR
STA SECTOR
JSR DELFIL ;DELETE BY LINKS
SC17 LDX ENTFND
LDA #$20
AND PATTYP,X
BNE SC20 ;CREATED, NOT CLOSED
.SKIP
LDA FILTRK,X ;DELETE BY LINKS
STA TRACK
LDA FILSEC,X
STA SECTOR
JSR DELFIL
.SKIP
SC20 INC R0
SC25 JSR FFRE
BPL SC15
.SKIP
SC30 LDA R0 ;FINISHED, SET
STA TRACK ; FILE COUNT
LDA #1
LDY #0
JMP SCREND ;END OF SCRATCH
.SKIP
DELFIL JSR FRETS ;DELETE FILE BY LINKS
JSR OPNIRD ;UPDATE BAM
DEL2 LDA #0
JSR SETPNT
JSR RDBYT
STA TRACK
JSR RDBYT
STA SECTOR
LDA TRACK
BNE DEL1
JSR MAPOUT
JMP FRECHN
DEL1 JSR FRETS
JSR NXTBUF
JMP DEL2
.SKIP
DELDIR LDY #0 ;DELETE DIR ENTRY
TYA
STA (DIRBUF),Y
JSR WRTOUT
JMP WATJOB
.SKIP
.END

110
DOS_8280/setdrv

@ -0,0 +1,110 @@
.PAGE 'SET DRIVE'
;SET 1ST DRIVE AND TABLE POINTERS
ONEDRV LDA F2CNT
STA F1CNT
LDA #1
STA F2CNT
STA F2PTR
.SKIP
;SET UP ALL DRIVES FROM F2CNT
ALLDRS LDY LSTDRV ;SET UP DRIVE #'S...
LDX #0 ;...INTO FILE ENTRY TABLE...
AD10 STX F1PTR ;...ON SECTOR PTR BYTE
LDA FILTBL,X
JSR SETDRV
LDX F1PTR
STA FILTBL,X ;INCR PTR PAST ":"
TYA ;BITS REP DRIVES
STA FILDRV,X ;BIT7: DEFAULT
INX ;BIT0: DRIVE #
CPX F2CNT
BCC AD10
RTS
.SKIP
;SET DRIVE NUMBER
; DETERMINES DRIVE # FROM TEXT OR
; USES DEFAULT (-D)
; A: IN,OUT: INDEX, CMDBUF
; Y: IN: DEFAULT DRIVE
; OUT: DRIVE NUMBER, - IF DEFAULT
.SKIP
SETDRV TAX ;X= CMDBUF INDEX
LDA #':
CMP CMDBUF+1,X ;FOR XXX:FILE
BEQ SD40 ; ^
CMP CMDBUF,X ;FOR XXX:FILE
BNE SD50 ; ^
INX ;FOUND ":", SO...
SD20 TYA ;DRIVE= DEFAULT
SD22 AND #1 ;CONVERT TO NUMERIC
SD24 TAY ;RESTORE DRIVE
TXA ;A=INDEX & XXXXFILE
RTS ; ^
.SKIP 2
SD40 LDA CMDBUF,X
INX ; XXX:FILE
INX ; --^
CMP #'0 ;FOR XX0:FILE
BEQ SD22 ; ^
CMP #'1 ;FOR XX1:FILE
BEQ SD22 ; ^
BNE SD20 ;CMD:FILE OR XX,:FILE
SD50 =* ; ^ ^
TYA ;FOR XXX,FILE OR XX=FILE
ORA #$80 ; ^ ^
AND #$81 ;DRIVE= -DEFAULT
BNE SD24 ;FINISH TESTING
.SKIP
;SET DRIVE FROM ANY CONFIG.
SETANY LDA #0
STA IMAGE
LDY FILTBL
SA05 LDA (CB),Y
JSR TST0V1
BPL SA20
INY
CPY CMDSIZ
BCS SA10
LDY CMDSIZ
DEY
BNE SA05
SA10 DEC IMAGE
LDA LSTDRV
SA20 AND #1
STA DRVNUM
JMP SETLDS
;TOGGLE DRVNUM
TOGDRV LDA DRVNUM
EOR #1
AND #1
STA DRVNUM
RTS
.SKIP
;SET PTRS TO ONE FILE STREAM & CHK TYPE
FS1SET LDY #0
LDA F1CNT
CMP F2CNT
BEQ FS15
DEC F2CNT
LDY F2CNT
LDA FILTBL,Y
TAY
LDA (CB),Y
LDY #NTYPES-1
FS10 CMP TYPLST,Y
BEQ FS15
DEY
BNE FS10
FS15 TYA
STA TYPFLG
RTS
.SKIP
;TEST CHAR IN ACCUM FOR "0" OR "1"
TST0V1 CMP #'0
BEQ T0V1
CMP #'1
BEQ T0V1
ORA #$80
T0V1 AND #$81
RTS
.END

23
DOS_8280/sidsec

@ -0,0 +1,23 @@
.PAGE 'SIDE SECTOR'
;
; SIDE SECTOR FORMAT
;
; S
; I S S S S S S S S S S S S
; D R S S S S S S S S S S S S
; E E
; C # # # # # # # # # # # #
; S O 0 0 1 1 2 2 3 3 4 4 5 5
; E R
; S C D S S S S S S
; T E T T E T E T E T E T E T E
; R C O S R C R C R C R C R C R C
; A T R I A T A T A T A T A T A T
; C O Z C O C O C O C O C O C O
; K R # E K R K R K R K R K R K R
;
; 1 1 1 1 1 1
; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
;
; 16-255 120 TRACK AND SECTOR POINTERS TO DATA BLOCKS
.END

47
DOS_8280/ssend

@ -0,0 +1,47 @@
.PAGE 'SSEND'
;
;*********************************
;* SSEND: POSITION SS & BUFTAB *
;* TO END OF LAST RECORD. *
;*********************************
;
SSEND
JSR RDLG ; YES, READ LAST GROUP
SSEND1
JSR SSSET
STA SSNUM
LDA #4
STA DIRBUF
LDY #SSIOFF-6
BNE SE20 ; JUMP
SE10
DEY
DEY
BMI BREAK
SE20
LDA (DIRBUF),Y ; LOOK FOR LAST SS #
BEQ SE10 ; T = 0, NOT YET
TYA
LSR A
CMP SSNUM ; CHECK SS #
BEQ SE30 ; THIS IS LAST SS
STA SSNUM
LDX LINDX
LDA SS,X
JSR IBRD ; READ LAST SS
SE30
LDY #0 ; SET SSIND
STY DIRBUF
LDA (DIRBUF),Y ; DEBUG
BNE BREAK
INY
LDA (DIRBUF),Y
TAY ; BACK UP TO TRACK
DEY
STY SSIND
TYA
JMP SETSSP
BREAK
LDA #$67
JSR CMDER2
.END

25
DOS_8280/sss

@ -0,0 +1,25 @@
.PAGE 'SUPER SIDE SECTOR'
;
; SUPER SIDE SECTOR FORMAT
;
; S
; T E
; R C I
; A T D
; C O E
; K R N
; T
; O O I
; F F F
; I
; 1 1 C
; S S A
; T T T
; I
; S S O
; S S N
;
; 0 1 2
;
; 3-255 TRACK AND SECTOR POINTERS TO SIDE SECTORS
.END

49
DOS_8280/sstest

@ -0,0 +1,49 @@
.PAGE 'SSTEST'
;
;*********************************
;* SSTEST: TEST SSNUM & SSIND FOR*
;* RESIDENCE & RANGE. *
;* VARS: SSNUM,SSIND,DIRBUF *
;* *
;* FLAGS: .N RNG .V RES ER *
;* 0 OK 0 YES ER0 *
;* 0 MAYBE 1 NO ER1 *
;* 1 NO 0 YES ER2 *
;* 1 NO 1 NO ER3 *
;*********************************
;
SSTEST
LDA GRPNUM
JSR RDSS1
BEQ ST50
BIT ER3
RTS
ST50
JSR SSSET ; SET POINTER & SS #
CMP SSNUM
BNE ST20 ; NOT THIS SS
LDY SSIND
LDA (DIRBUF),Y
BEQ ST10
BIT ER0 ;OK, RESIDENT
RTS
ST10
BIT ER2 ; OUT OF RANGE, RES
RTS
ST20
LDA SSNUM
CMP #NSSL
BCS ST30
ASL A
TAY
LDA #4
STA DIRBUF
LDA (DIRBUF),Y
BNE ST40
ST30
BIT ER3 ; WAY OUT OF RANGE
RTS
ST40
BIT ER1 ; NOT RES, RANGE???
RTS
.END

196
DOS_8280/ssutil

@ -0,0 +1,196 @@
.PAGE 'SSUTIL'
;
;*********************************
;* B0TOB0: TRANSFER BYTES FROM *
;* ONE BUFFER TO OTHER. *
;* REG: IN: .A = # BYTES *
;* .Y = SOURCE BUF # *
;* .X = DESTIN BUF # *
;*********************************
;
B0TOB0
PHA
LDA #0
STA TEMP
STA TEMP+2
LDA BUFIND,Y
STA TEMP+1
LDA BUFIND,X
STA TEMP+3
PLA
TAY
DEY
B02
LDA (TEMP),Y
STA (TEMP+2),Y
DEY
BPL B02
RTS
;
;*********************************
;* CLRBUF: CLEAR BUFFER GIVEN *
;* REG: IN: .A = BUFFER # *
;* OUT: .Y, .A = 0 *
;*********************************
;
CLRBUF
TAY
LDA BUFIND,Y
STA TEMP+1
LDA #0
STA TEMP
TAY
CB10
STA (TEMP),Y
INY
BNE CB10
RTS
;
;*********************************
;* SSSET: SET SS PNTR TO 0 *
;* REG: OUT: .A = SS NUMBER *
;*********************************
;
SSSET
LDA #0
JSR SSDIR
LDY #2
LDA (DIRBUF),Y
RTS
;
;*********************************
;* SSDIR: SET DIRBUF WITH CURRENT*
;* SS POINTER. *
;* REGS: IN: .A = LOW BYTE *
;*********************************
;
SSDIR
STA DIRBUF
LDX LINDX
LDA SS,X
TAX
LDA BUFIND,X
STA DIRBUF+1
RTS
;
;*********************************
;* SETSSP: SET DIRBUF & BUFTAB *
;* WITH CURRENT SS PTR. *
;* REGS: IN: .A = LOW BYTE *
;*********************************
;
SETSSP
PHA
JSR SSDIR
PHA
TXA
ASL A
TAX
PLA
STA BUFTAB+1,X
PLA
STA BUFTAB,X
RTS
;
;*********************************
;* SSPOS: POSITION SS & BUFTAB *
;* TO SSNUM SSIND. *
;* FLAG: .V = 0, OK *
;* .V = 1, OUT OF RANGE *
;*********************************
;
SSPOS
JSR SSTEST
BMI SSP10 ; OUT OF RANGE
BVC SSP20 ; ER0:OK, IN RANGE
LDX LINDX ; ER1: POSSIBLY IN RANGE
LDA SS,X
JSR IBRD ; READ SS IN
JSR SSTEST ; TEST AGAIN
BPL SSP20
SSP10
JSR SSEND ; NOT IN RANGE,SET END
BIT ER1
RTS
SSP20
LDA SSIND ; OK, SET PTR W/INDEX
JSR SETSSP
BIT ER0
RTS
;
;*********************************
;* IBRD: INDIRECT BLOCK READ & *
;* IBWT: WRITE. *
;* REGS: IN: .A = BUF # FOR R/W*
;* .X = LINDX *
;* (DIRBUF),Y POINTS TO *
;* T&S TO BE R/W. *
;*********************************
;
IBRD
STA JOBNUM
LDA #READ
BNE IBOP
IBWT
STA JOBNUM
LDA #WRITE
IBOP
PHA
LDA FILTYP,X
AND #1
STA DRVNUM
PLA
ORA DRVNUM
STA CMD
LDA (DIRBUF),Y
STA TRACK
INY
LDA (DIRBUF),Y
STA SECTOR
LDA JOBNUM
JSR SETH
LDX JOBNUM
JMP DOIT2
GSSPNT
LDX LINDX
LDA SS,X
JMP GP1
;
; CALCULATE # OF SIDE SECTORS NEEDED
;
SSSCAL
JSR ZERRES
JSR ZERACC
LDY R3
SSSCA1
DEY
BMI SSSCA2
LDX #>726
LDA #<726
JSR ADDLIT
JMP SSSCA1
SSSCA2
LDY T4
SSSCA3
DEY
BMI SSSCA4
LDX #0
LDA #NSSP+1
JSR ADDLIT
JMP SSSCA3
SSSCA4
LDA T3
LSR A
LDX #0
JMP ADDLIT
ZERACC
LDX #0
STX ACCUM+1
STX ACCUM+2
STX ACCUM+3
RTS
ADDLIT
STX ACCUM+2
STA ACCUM+1
JMP ADDRES
.END

120
DOS_8280/system

@ -0,0 +1,120 @@
.PAGE 'SYSTEM ROUTINES'
;
; READ/WRITE THE SUPER SIDE SECTOR
;
RDSSS
LDX LINDX
LDA #254
CMP SSSGRP,X
BNE RDSSSA ; SS NOT RESIDENT, READ IT
RTS
RDSSSA
LDA #READ
.BYTE $2C ; SKIP NEXT TWO BYTES
WRTSSS
LDA #WRITE
PHA
JSR SETDRN
LDX LINDX
LDA SSSTRK,X
STA TRACK ; SET TRACK
LDA SSSSEC,X
STA SECTOR ; SET SECTOR
LDA #255
STA SSSGRP,X
LDA SS,X ; GET SS BUFFER #
STA JOBNUM
JSR SETH ; SET THE JOB HEADER
PLA ; GET JOB
JSR DOJOB ; DO THE JOB
LDX LINDX
LDA #254
STA SSSGRP,X ; MARK SSS RESIDENT
RTS
;
; READ LAST GROUP
;
RDLG
LDA #$5A
STA GRPNUM
JSR RDSS1
BNE RDLG1
RTS
RDLG1
DEC GRPNUM
LDA GRPNUM
JSR RDSS1C
BNE RDLG1
RTS
;
; READ SIDE SECTOR 1 OF GROUP N
;
RDSS1
LDX LINDX
CMP SSSGRP,X
BNE RDSS1A
RTS
RDSS1A
PHA ; SAVE DESIRED GROUP #
JSR RDSSS ; READ THE SSS
RDSS1D
JSR SETDRN ; SET THE DRIVE #
LDA #3
JSR SSDIR ; POINT TO THE FIRST GROUP
PLA ; RESTORE DESIRED GROUP #
RDSS1C
TAX ; SAVE DESIRED GROUP #
ASL A
TAY
LDA (DIRBUF),Y ; GET THE TRACK
BNE RDSS1B ; DOES EXSIT
ORA #255 ; DOES NOT EXIST (RETURN CODE)
RTS
RDSS1B
STA TRACK
INY
LDA (DIRBUF),Y ; GET THE SECTOR
STA SECTOR
TXA ; RESTORE DESIRED GROUP #
PHA
LDA #255
LDX LINDX
STA SSSGRP,X ; MARK GROUP NONRESIDENT
LDA SS,X ; GET SS BUFFER #
STA JOBNUM
JSR SETH ; SET THE JOB HEADER
LDA #READ
JSR DOJOB ; READ THE SS IN
LDX LINDX
PLA
STA SSSGRP,X ; MARK THE GROUP AS RESIDENT
LDA #0 ; RETURN CODE
RTS
;
; CHECK FOR LEGAL TRACK AND SECTOR
; .C = 0 IF LEGAL
; .C = 1 IF ILLEGAL
;
JILLTS
LDA TRACK
BEQ ILLTS1
CMP MAXTRK
BCC ILLTS1
RTS
ILLTS1
LDA SECTOR
AND #%00011111
CMP SECTRS
BCC ILLTS2
RTS
ILLTS2
LDA SECTOR
AND #%11100000
LSR A
LSR A
LSR A
LSR A
LSR A
CMP HEADS
RTS
.END

129
DOS_8280/temp

@ -0,0 +1,129 @@
;
;TEST IF JOB(.X) IS DONE YET
;IF NOT DONE RETURN
;IF OK THEN RETURN ELSE REDO IT
;
TSTJOB LDA JOBS,X
BMI NOTYET
CMP #2
BCC OK
CMP #8 ;CHECK FOR WP SWITCH ON
BEQ QUIT
DEC ERRCNT,X ;REDO UNTIL ERRCNT=0
BNE AGAIN
BIT JOBRTN ;RETURN WITH .A=ERROR?
BMI OK
;
RECOV
TYA ;SAVE .Y
PHA
LDA DRVNUM ;SAVE DRIVE #
PHA
LDA LSTJOB,X
AND #1
STA DRVNUM ;SET ACTIVE DRIVE #
BIT REVCNT
BVS REC5 ;NO TRACK OFFSET
;
LDA #0
STA EPTR ;CLR OFFSET TABLE PTR
STA TOFF ;CLR TOTAL OFFSET
REC1
LDY EPTR
LDA OFFSET,Y
PHA
CLC
ADC TOFF ;KEEP TRACK OF TOTAL OFFSET
STA TOFF
PLA
JSR SCOMP ;CHANGE TO S-MAGNITUDE
LDY DRVNUM
STA PHASE,Y ;SET OFFSET FOR CONTRL
REC2
LDA PHASE,Y
BNE REC2 ;WAIT
;
INC EPTR ;BUMP TABLE PTR
JSR DOREC ;DO THE RECOVERY
CMP #2 ;ERROR CODE < 2?
BCC REC3 ;JOB WORKED
;
LDY EPTR
LDA OFFSET,Y
BNE REC1 ;NULL INDICATES END
REC3
LDA TOFF
JSR SCOMP
EOR #$80 ;NEGATE IN S-MAG.
LDY DRVNUM
STA PHASE,Y ;RESTOR HEAD TO ORIG. TRACK
REC4
LDA PHASE,Y
BNE REC4 ;WAIT
;
LDA JOBS,X
CMP #2
BCC REC9 ;NO ERROR
REC5
BIT REVCNT ;CHECK BUMP-ON FLAG
BPL REC7 ;NO BUMP
QUIT
JSR ERROR
REC7 ;DO THE BUMP
LDA #BUMP
ORA DRVNUM
STA JOBS,X
REC8
LDA JOBS,X
BMI REC8 ;WAIT
;
JSR DOREC ;TRY ONE LAST SET
CMP #2
BCS QUIT ;IT CLEARLY AIN'T GONNA WORK
REC9
PLA
STA DRVNUM ;RESTORE DRIVE #
PLA
TAY ;RESTORE .Y
OK CLC ;C=0 DONE OK
RTS
;
AGAIN LDA LSTJOB,X
STA JOBS,X
NOTYET SEC ;C=1 NOT YET
RTS
;
;
; WAIT UNTIL JOB(.X) IS DONE
; RETURN WHEN DONE
;
WATJOB JSR TSTJOB
BCS WATJOB
PHA ;CLR JOBRTN FLAG
LDA #0
STA JOBRTN
PLA
RTS
;
; SET HEADER OF ACTIVE BUFFER OF THE
; CURRENT LINDX TO TRACK,SECTOR,ID
;
SETHDR JSR GETACT
SETH
ASL A
ASL A
ASL A
TAY
LDA TRACK
STA HDRS+2,Y ;SET TRACK
LDA SECTOR
STA HDRS+3,Y ;SET SECTOR
LDA DRVNUM ;GET PROPER ID(DRVNUM)
ASL A
TAX
LDA DSKID,X
STA HDRS,Y
LDA DSKID+1,X
STA HDRS+1,Y
RTS
;

281
DOS_8280/trnsfr

@ -0,0 +1,281 @@
.PAGE 'TRANSFER'
;
; TRANSFER FILENAME FROM CMD TO BUFFER
; A: STRING SIZE
; X: STARTING INDEX IN CMDBUF
; Y: BUFFER #
;
TRNAME
PHA
JSR FNDLMT
JSR TRCMBF
PLA
SEC
SBC STRSIZ
TAX
BEQ TN20
BCC TN20
LDA #$A0
TN10
STA (DIRBUF),Y
INY
DEX
BNE TN10
TN20
RTS
;
; TRANSFER CMD BUFFER TO OTHER BUFFER
; USES CURRENT BUFFER PTR
; LIMIT: ENDING INDEX+1 IN CMD BUF
; X: STARTING INDEX IN CMD BUF
; Y: BUFFER #
;
TRCMBF
TYA
ASL A
TAY
LDA BUFTAB,Y
STA DIRBUF
LDA BUFTAB+1,Y
STA DIRBUF+1
LDY #0
TR10
LDA CMDBUF,X
STA (DIRBUF),Y
INY
BEQ TR20
INX
CPX LIMIT
BCC TR10
TR20
RTS
;
; FIND THE LIMIT OF THE STRING IN CMDBUF
; POINTED TO BY X
;
FNDLMT
LDA #0
STA STRSIZ
TXA
PHA
FL05
LDA CMDBUF,X
CMP #',
BEQ FL10
CMP #'=
BEQ FL10
INC STRSIZ
INX
LDA #15
CMP STRSIZ
BCC FL10
CPX CMDSIZ
BCC FL05
FL10
STX LIMIT
PLA
TAX
RTS
.PAGE 'TRNSFR-GETNAM'
;
; GET FILE ENTRY FROM DIRECTORY
; CALLED BY STDIR, GETDIR
;
GETNAM
LDA SA ; SAVE VARIABLES
PHA
LDA LINDX
PHA
JSR GNSUB
PLA ; RESTORE VARIABLES
STA LINDX
PLA
STA SA
RTS
GNSUB
LDA #IRSA
STA SA
JSR FNDRCH
JSR GETPNT
LDA ENTFND
BPL GN05 ; MORE FILES
LDA DRVFLG
BNE GN050
JSR MSGFRE ; SEND BLOCKS FREE
CLC ; (.C = 0): END
JMP GN45 ; TERMINATE
GN05
LDA DRVFLG ; (DRVFLG = 0)
BEQ GN10 ; SEND FILE NAME
GN050
DEC DRVFLG ; (DRVFLG = -1):NEW DIR
BNE GN051
DEC DRVFLG ; (DRVFLG = -1)
JSR TOGDRV ; SEND BLOCKS FREE
JSR MSGFRE
SEC
JMP TOGDRV
GN051
LDA #0
STA NBTEMP+1
STA DRVFLG ; RESET FLAG
JSR NEWDIR
SEC
RTS
GN10
LDX #DIRLEN ; SET NUMBER BLOCKS
LDY #29 ; & ADJUST SPACING
LDA (DIRBUF),Y
STA NBTEMP+1
BEQ GN12
CMP #>1000
BCC GN11A
BNE GN11
DEY
LDA (DIRBUF),Y
INY
CMP #<1000
BCC GN11A
GN11
DEX
GN11A
DEX
DEX
GN12
DEY
LDA (DIRBUF),Y
STA NBTEMP
CPX #DIRLEN
BCC GN14
CMP #10
BCC GN14
DEX
CMP #100
BCC GN14
DEX
GN14
JSR BLKNB ; CLEAR NAME BUFFER
LDA (DIRBUF),Y ; SET TYPE CHARS
PHA
ASL A ; (USED IN BCS)
BPL GN15
LDA #'<
STA NAMBUF+1,X
GN15
PLA
AND #$F
TAY
LDA TP2LST,Y
STA NAMBUF,X
DEX
LDA TP1LST,Y
STA NAMBUF,X
DEX
LDA TYPLST,Y
STA NAMBUF,X
DEX
DEX
BCS GN20 ; (FROM ASL)
LDA #'* ; FILE NOT CLOSED
STA NAMBUF+1,X
GN20
LDA #$A0
STA NAMBUF,X
DEX
LDY #18
GN22
LDA (DIRBUF),Y
STA NAMBUF,X
DEX
DEY
CPY #3
BCS GN22
LDA #'" ; SEND NAME IN QUOTES
STA NAMBUF,X
GN30
INX
CPX #$20
BCS GN35
LDA NAMBUF,X
CMP #'"
BEQ GN35
CMP #$A0
BNE GN30
GN35
LDA #'"
STA NAMBUF,X
GN37
INX
CPX #$20
BCS GN40
LDA #$7F
AND NAMBUF,X
STA NAMBUF,X
BPL GN37
GN40
JSR FNDFIL
SEC
GN45
RTS
BLKNB
LDY #NBSIZ ; BLANK NAMBUF
LDA #$20
BLKNB1
STA NAMBUF-1,Y
DEY
BNE BLKNB1
RTS
;
; NEW DIRECTORY IN LISTING
;
NEWDIR
JSR AUTOI
JSR RDDIR
JSR BLKNB
LDA #$FF
STA TEMP
LDX DRVNUM
STX NBTEMP
LDA #0
STA NBTEMP+1
LDA IPBM,X
STA DIRBUF+1
LDA #6
STA DIRBUF
LDY #22
ND10
LDA (DIRBUF),Y
CMP #$A0
BNE ND20
LDA #'1 ;VERSION # 1
.BYTE $2C
ND15
LDA (DIRBUF),Y
CMP #$A0
BNE ND20
LDA #$20
ND20
STA NAMBUF+2,Y
DEY
BPL ND15
LDA #$12
STA NAMBUF
LDA #'"
STA NAMBUF+1
STA NAMBUF+18
LDA #$20
STA NAMBUF+19
RTS
MSGFRE
JSR BLKNB
LDY #MSGLEN-1
MSG1
LDA FREMSG,Y
STA NAMBUF,Y
DEY
BPL MSG1
JMP NUMFRE ; GET NUMBER OF BYTES
FREMSG
.BYTE 'BLOCKS FREE.'
MSGLEN =*-FREMSG
.END

434
DOS_8280/tst2

@ -0,0 +1,434 @@
.PAGE 'TST2'
;
; TOGGLE ACTIVE BUFFER # IN BUFNUM
;
DBLBUF
LDX LINDX
LDA BUF0,X ; TOGGLE ACTIVE FLAG
EOR #$80
STA BUF0,X
DBL1
LDA BUF1,X ; TOGGLE ACTIVE FLAG
EOR #$80
STA BUF1,X
DBL2
JSR GETACT ; GET ACTIVE BUF#
TAX
JMP WATJOB ; AND WAIT FOR BUFFER READY
PIBYTE
LDX #IWSA
STX SA
PBYTE
JSR FNDWCH
JSR SETLDS
LDA SA
CMP #15
BEQ L42
BNE L40
;
; MAIN ROUTINE TO WRITE TO CHANL
;
PUT
LDA ORGSA ; IS CHANL CMD OR DATA
AND #$8F
CMP #15 ; < 15
BCS L42
L40
JSR TYPFIL ; DATA BYTE TO STORE
BCS L41 ; BRANCH IF RND
LDA DATA ; SEQ FILE
JMP WRTBYT ; WRITE BYTE TO CHANL
L41
BNE L46
JMP WRTREL
L46
LDA DATA ; RND FILE WRITE
JSR PUTBYT ; WRITE TO CHANL
LDY LINDX ; PREPARE NXT BYTE
JMP RNGET2
L42
LDA #CMDCHN ; WRITE TO CMD CHANL
STA LINDX
JSR GETPNT ;TEST IF COMM AND BUFFER FULL
CMP #<CMDBUF+CMDLEN+1
BEQ L50 ; IT IS FULL
LDA DATA ; NOT FULL YET
JSR PUTBYT ; STORE THE BYTE
L50
LDA EOIFLG ; TST IF LST BYTE OF MSG
BEQ L45 ; IT IS
RTS ; NOT YET, RETURN
L45
INC CMDWAT ; SET CMD WAITING FLAG
RTS
;
; PUT .A INTO ACTIVE BUFFER OF LINDX
;
PUTBYT
PHA ; SAVE .A
JSR GETACT ; GET ACTIVE BUF#
BPL PUTB1 ; BRACH IF THERE IS ONE
PLA ; NO BUFFER ERROR
LDA #FILNOP
JMP CMDERR ; JMP TO ERROR ROUTINE
PUTB1
ASL A ; SAVE THE BYTE IN BUFFER
TAX
PLA
STA (BUFTAB,X)
INC BUFTAB,X ; INC THE BUFFER POINTER
RTS ; .Z = 1 IF LAST CHAR SLOT IN BUFFER
;
;INITIALIZE DRIVES (COMMAND)
;
INTDRV
JSR SIMPRS
JSR INITDR
LDA IMAGE ; USED AS FLAG FOR BOTH DRIVES
BPL ID20
JSR TOGDRV
JSR SETLDS
JSR INITDR
JSR TOGDRV
ID20
JMP ENDCMD
;
; INITIALIZE DRIVE (DRVNUM)
;
ITRIAL
LDA #BAMJOB+2
STA JOBNUM
LDX #0
STX TRACK ; TRACK = 0
INX
STX SECTOR ; SECTOR = 1, HEAD = 0
JSR SETH
LDA #SECSEK ; SECTOR SEEK
JMP DOJOB
INITDR
JSR CLDCHN
JSR ITRIAL ; SEE IF DRIVE ACTIVE
JSR SETBJ ; USE BAM JOB NUMBER
JSR DRTRD ; READ TRACK, SECTOR AND HEAD 0
JSR SETBMP ; SET THE BAM POINTER
LDY #2
LDA (BMPNT),Y
BNE INITD1 ; NOT INITIALIZED
INY
LDA (BMPNT),Y
CMP #$FF
BEQ INITD2 ; INITIALIZED
INITD1
LDA #$FF
LDX DRVNUM
STA NODRV,X
LDA #NODRIV
JMP CMDER2 ; DRIVE NOT READY
INITD2
LDX DRVNUM
INY ; .Y = 4
LDA (BMPNT),Y ; START OF DIRECTORY (TRACK)
STA DSTRK,X
INY
LDA (BMPNT),Y ; START OF DIRECTORY (SECTOR)
STA DSSEC,X
INY ; .Y = 6
LDA (BMPNT),Y ; START OF HEADER (TRACK)
STA HSTRK,X
INY
LDA (BMPNT),Y ; START OF HEADER (SECTOR)
STA HSSEC,X
INY ; .Y = 8
LDA (BMPNT),Y ; START OF BAM (TRACK)
STA BAMTRK,X
INY
LDA (BMPNT),Y ; START OF BAM (SECTOR)
STA BAMSEC,X
TXA
ASL A
TAX
INY ; .Y = 10
LDA (BMPNT),Y ; DISK ID
STA DSKID,X
INY
LDA (BMPNT),Y
STA DSKID+1,X
LDX DRVNUM
LDY #0
LDA (BMPNT),Y ; START OF BTS (TRACK)
STA BTSTRK,X
INY
LDA (BMPNT),Y ; START OF BTS (SECTOR)
STA BTSSEC,X
LDA #0
STA MDIRTY,X
LDA BAMTRK,X
STA TRACK
LDA BAMSEC,X
STA SECTOR
JSR SETBJ ; SET UP BAM JOB
JSR DRTRD ; READ THE FIRST BAM
LDX DRVNUM
LDA #0
STA WPSW,X ; CLEAR WP SWITCH
STA NODRV,X ; DRIVE IS ACTIVE
;
; CALCULATE FREE BLOCKS
;
NF05
LDX DRVNUM
LDA #0
STA NDBL,X
STA NDBH,X
TAX ; .X = 0
STX TRACK ; START AT TRACK 1
NF10
STX HEAD ; START AT HEAD 0
INC TRACK
LDX TRACK
CPX MAXTRK
BCC NF20
RTS
NF20
JSR SETMAP ; SET THE BAM
LDX DRVNUM
LDA (BMPNT),Y ; NUMBER OF FREE SECTORS
CLC
ADC NDBL,X
STA NDBL,X
BCC NF30
INC NDBH,X
NF30
INC HEAD
LDX HEAD ; HEAD = HEAD+1
CPX HEADS
BCC NF20 ; COUNT NEXT HEAD
LDX #0
BEQ NF10 ; JUMP, COUNT THE NEXT TRACK
;
; START DOUBLE BUFFERING
; USE TRACK,SECTOR AS STARTING BLOACK
;
STRDBL
JSR SETHDR
JSR RDBUF
JSR WATJOB
JSR GETBYT
STA TRACK
JSR GETBYT
STA SECTOR
LDA TRACK
BNE STR1
RTS
STR1
JSR DBLBUF
JSR SETHDR
JSR RDBUF
JMP DBLBUF
;
; START A READ JOB ON TRACK,SECTOR
;
RDBUF
LDA #READ
BNE STRTIT
;
; START A WRITE JOB ON TRACK,SECTOR
;
WRTBUF
LDA #WRITE
STRTIT
STA CMD
JSR GETACT
TAX
JSR SETLJB
TXA
PHA
ASL A
TAX
LDA #0
STA BUFTAB,X
JSR TYPFIL
CMP #4
BCS WRTC1 ; NOT SEQUENTIAL TYPE
INC NBKL,X
BNE WRTC1
INC NBKH,X
WRTC1
PLA
TAX
RTS
;
; FIND THE READ CHANNEL
;
FNDRCH
LDA SA
CMP #MAXSA+1
BCC FNDC20
AND #$F
FNDC20
CMP #CMDSA
BNE FNDC25
LDA #ERRSA
FNDC25
TAX
SEC
LDA LINTAB,X
BMI FNDC30
AND #$F
STA LINDX
TAX
CLC
FNDC30
RTS
;
; FIND THE WRITE CHANNEL
;
FNDWCH
LDA SA
CMP #MAXSA+1
BCC FNDW13
AND #$F
FNDW13
TAX
LDA LINTAB,X
TAY
ASL A
BCC FNDW15
BMI FNDW20
FNDW10
TYA
AND #$0F
STA LINDX
TAX
CLC
RTS
FNDW15
BMI FNDW10
FNDW20
SEC
RTS
TYPFIL
LDX LINDX
LDA FILTYP,X
LSR A
AND #7
CMP #RELTYP
RTS
GETPRE
JSR GETACT
ASL A
TAX
LDY LINDX
RTS
;
; READ BYTE FROM ACTIVE BUFFER
; AND SET FLAG IF LAST DATA BYTE
; IF LAST THEN .Z = 1
;
GETBYT
JSR GETPRE
LDA LSTCHR,Y
BEQ GETB1
LDA (BUFTAB,X)
PHA
LDA BUFTAB,X
CMP LSTCHR,Y
BNE GETB2
LDA #$FF
STA BUFTAB,X
GETB2
PLA
INC BUFTAB,X
RTS
GETB1
LDA (BUFTAB,X)
INC BUFTAB,X
RTS
;
;
; READ A CHAR FROM FILE AND READ NEXT
; BLOCK OF FILE IF NEEDED.
; SET CHNRDY = EOI IF END OF FILE
;
RDBYT
JSR GETBYT
BNE RD3
STA DATA
RD0
LDA LSTCHR,Y
BEQ RD1
LDA #EOIOUT
RD01
STA CHNRDY,Y
LDA DATA
RTS
RD1
JSR DBLBUF
LDA #0
JSR SETPNT
JSR GETBYT
CMP #0
BEQ RD4
STA TRACK
JSR GETBYT
STA SECTOR
JSR DBLBUF
JSR SETDRN
JSR SETHDR
JSR RDBUF
JSR DBLBUF
LDA DATA
RD3
RTS
RD4
JSR GETBYT
LDY LINDX
STA LSTCHR,Y
LDA DATA
RTS
;
; WRITE A CHAR TO CHANL AND WRITE
; BUFFER OUT TO DISK IF ITS FULL
;
WRTBYT
JSR PUTBYT
BEQ WRT0
RTS
WRT0
JSR SETDRN
JSR NXTTS
LDA #0
JSR SETPNT
LDA TRACK
JSR PUTBYT
LDA SECTOR
JSR PUTBYT
JSR WRTBUF
JSR DBLBUF
JSR SETHDR
LDA #2
JMP SETPNT
;
; INC POINTER OF ACTIVE BUFFER
; BY .A
;
INCPTR
STA TEMP
JSR GETPNT
CLC
ADC TEMP
STA BUFTAB,X
STA DIRBUF
RTS
;
; SET DRVNUM TO DRIVE INDICATED BY
; LSTJOB OF ACTIVE BUFFER
;
SETDRN
JSR GETACT
TAX
LDA LSTJOB,X
AND #1
STA DRVNUM
RTS
.END

233
DOS_8280/tst3

@ -0,0 +1,233 @@
.PAGE 'TST3'
;
; .A = # OF BUFFERS NEEDED
; SETS UP BUFFER # AND ALLOCATES LINDX
;
GETWCH
SEC ; SET .C=1 TO INDICATE WRITE
BCS GETR2
GETRCH
CLC ; SET .C=0 TO INDICATE READ
GETR2
PHP ; SAVE R/W FLAG (.C)
STA TEMP ; SAVE # OF BUFS NEEDED
JSR FRECHN ; FREE ANY CHANNELS
JSR FNDLNX ; GET NEXT LINDX OPEN
STA LINDX
LDX SA
PLP
BCC GETR55
GETR52
ORA #$80
GETR55
STA LINTAB,X ; SAVE LINDX IN LINTAB
GETBF
AND #$3F
TAY ; NOW GET THE BUFFERS
LDA #$FF
STA SS,Y
STA BUF0,Y
STA BUF1,Y
GETR3
DEC TEMP
BMI GETR4
JSR GETBUF
BPL GETR5
GBERR
JSR FRECO ; ERROR, RELEASE BUFS
LDA #NOCHNL
JMP CMDERR
GETR5
STA BUF0,Y
DEC TEMP
BMI GETR4
JSR GETBUF
BMI GBERR
STA BUF1,Y
GETR4
RTS
;
; FREE CHANNEL ASSOCIATED WITH SA
; FREE READ AND WRITE CHANNELS
; DONT FREE CHANNEL 15
;
FRECHN
LDA SA
CMP #$F
BNE FRECO
RTS
FRECO
FRERD
FREWRT
LDX SA
LDA LINTAB,X
CMP #$FF
BEQ FRE25
AND #$3F
STA LINDX
LDA #$FF
STA LINTAB,X
LDX LINDX
LDA #00
STA CHNRDY,X
JSR RELBUF
;
; RELEASE THE LINDX
;
RELINX
LDX LINDX
LDA #1
REL15
DEX
BMI REL10
ASL A
BNE REL15
REL10
ORA LINUSE ; 1=FREE, 0=USED
STA LINUSE
FRE25
RTS
;
; GIVEN SA, FREE ITS READ CHANNEL
; RELEASE BUFFERS (LINDX)
;
RELBUF
LDX LINDX
LDA BUF0,X
CMP #$FF
BEQ REL1
PHA
LDA #$FF
STA BUF0,X
PLA
JSR FREBUF
REL1
LDX LINDX
LDA BUF1,X
CMP #$FF
BEQ REL2
PHA
LDA #$FF
STA BUF1,X
PLA
JSR FREBUF
REL2
LDX LINDX
LDA SS,X
CMP #$FF
BEQ REL3
PHA
LDA #$FF
STA SS,X
PLA
JSR FREBUF
REL3
RTS
;
; GET A FREE BUFFER #
;
JGETBF
LDA #$FF
STA TEMP+1
LDX #15
GETBU1
ROL BUFUSE
ROL BUFUSE+1
BCS GETBU2
STX TEMP+1
SEC
BCS GETBU3
GETBU2
DEX
BPL GETBU1
ROL BUFUSE
ROL BUFUSE+1
GETBU4
LDX TEMP+1
BMI GETB5
GETBU5
LDA JOBS,X
BMI GETBU5 ; WAIT FOR JOB TO FINISH
LDA #0
STA JOBS,X
LDA DRVNUM
STA LSTJOB,X
GETB5
TXA
RTS
GETBU3
ROL BUFUSE
ROL BUFUSE+1
DEX
BPL GETBU3
BMI GETBU4
.PAGE
;
; FREE A BUFFER
;
JFREBF
AND #$F
TAY
INY
LDX #16
FREB1
ROR BUFUSE+1
ROR BUFUSE
DEY
BNE FREB2
CLC
FREB2
DEX
BPL FREB1
RTS
CLRCHN
LDA #14
STA SA
CLRC1
JSR FRECHN
DEC SA
BNE CLRC1
RTS
CLDCHN
LDA #14
STA SA
CLSD
LDX SA
LDA LINTAB,X
CMP #$FF
BEQ CLD2
AND #$3F
STA LINDX
JSR GETACT
TAX
LDA LSTJOB,X
AND #1
CMP DRVNUM
BNE CLD2
JSR FRECHN
CLD2
DEC SA
BPL CLSD
RTS
;
; FIND A FREE LINDX TO USE
; MARK AS USED IN LINUSE
;
FNDLNX
LDY #0
LDA #1
FND10
BIT LINUSE ; 1=FREE, 0=USED
BNE FND30
INY
ASL A
BNE FND10
LDA #NOCHNL ; NO FREE LINDX AVAILABLE
JMP CMDERR
FND30
EOR #$FF ; TOGGLE BIT MASK
AND LINUSE ; MARK BIT USED
STA LINUSE
TYA ; RETURN LINDX IN .A
RTS
.END

250
DOS_8280/tst4

@ -0,0 +1,250 @@
.PAGE 'TST4'
;
; GET NEXT CHAR FROM A CHANNEL
;
GBYTE
JSR FNDRCH
JSR SETLDS
JSR GET
LDX LINDX
LDA CHNDAT,X
RTS
GET
LDX LINDX
JSR TYPFIL ; GET FILE TYPE
BNE GET00 ; NOT A RELATIVE FILE
JMP RDREL
GET00
LDA SA
CMP #$F
BEQ GETERC
LDA CHNRDY,X ; WAS LAST CHAR JUST SENT
AND #EOISND ; JUST SENT EOI
BNE GET1 ; NOPE NOT THIS TIME
JSR TYPFIL
CMP #DIRTYP
BNE GET0 ; NOT DIRECT TYPE
LDA #RNDRDY ; DIRECT FILE REMAINS ACTIVE
STA CHNRDY,X ; TALKER LISTENER NOEOI
JMP RNDGET ; PREPARE THE NEXT CHAR
GET0
LDA #NOTRDY ; LST CHAR SENT, NOT READY
STA CHNRDY,X
RTS
GET1
LDA SA ; TEST IF A LOAD
BEQ GET6 ; IT'S A LOAD SA OF 0
GET2
JSR TYPFIL ; TEST FOR REL FILE
BCC SEQGET ; SEQ FILE CHAR GET
RNDGET
JSR GETPRE ; DIRECT FILE GET
LDA BUFTAB,X
CMP LSTCHR,Y ; UP TO LST CHAR YET
BNE RNGET1 ; NOT YET
LDA #0 ; READ THE WHOLE THING
STA BUFTAB,X ; WRAP PNTR TO 0
RNGET1
INC BUFTAB,X ; GET THE NEXT CHAR
RNGET2
LDA (BUFTAB,X)
RNGET4
STA CHNDAT,Y ; SAVE CHAR IN
LDA BUFTAB,X
CMP LSTCHR,Y
BNE RNGET3
LDA #RNDEOI
STA CHNRDY,Y ; THIS IS LAST CHAR
RNGET3
RTS ; SEND EOI WITH IT
SEQGET
JSR RDBYT ; READ THE NEXT BYTE
GET3
LDX LINDX
STA CHNDAT,X ; STORE IN CHNDAT
RTS
GET6
LDA DIRLST ; TEST IF DIR LSTING
BEQ SEQGET ; NO, ITS NOT
JSR GETDIR ; YES IT IS,GET DIR CHAR
JMP GET3
GETERC
JSR GETPNT
CMP #<ERRBUF-1
BNE GE10
LDA DIRBUF+1
CMP #>ERRBUF
BNE GE10
LDA #CR
STA DATA
JSR ERROFF
LDA #0
JSR ERRTS0
DEC CB+2
LDA #EOIOUT
BNE GE30 ; JUMP
GE10
JSR GETBYT
STA DATA
BNE GE20
GE15
LDA #<ERRBUF-1
JSR SETPNT
LDA #>ERRBUF
STA BUFTAB+1,X
GE20
LDA #RDYTLK
GE30
STA CHNRDY+ERRCHN
LDA DATA
STA CHNDAT+ERRCHN
RTS
;
; READ NEXT BUFFER OF A FILE
; FOLLOW LINKS IN FIRST TWO BYTES
; END OF FILE IF 1ST BYTE = 0
; 2ND CHAR LENGTH
;
NXTBUF
JSR GETACT
ASL A
TAX
LDA #0
STA BUFTAB,X
LDA (BUFTAB,X)
BEQ NXTB1
DEC BUFTAB,X
JMP RDBYT
NXTB1
RTS
;
; DIRECT BLOCK READ
;
DRTRD
LDA #READ
BNE DRT
;
; DIRECT BLOCK WRITE
;
DRTWRT
LDA #WRITE
DRT
ORA DRVNUM
STA CMD
LDA JOBNUM
JSR SETH
LDX JOBNUM
JMP DOIT2
;
; OPEN INTERNAL READ CHANL (SA = 16)
;
OPNIRD
LDA #1
OPNTYP
STA TYPE
LDA #IRSA
STA SA
JSR OPNRCH
LDA #2
JMP SETPNT
;
; OPEN INTERNAL WRITE CHANL (SA = 16)
;
OPNIWR
LDA #IWSA
STA SA
JMP OPNWCH
;
; ALLOCATE NEXT DIRECTORY BLOCK ON 18
; AND MARK AS USED IN BAM
;
NXDRBK
JSR CURBLK
LDA #3
STA TEMP
LDA SECINC
PHA
LDA #3 ; INCR SECTOR BY 3 IN DIRECTORY
STA SECINC
JSR GETHED ; EXTRACT THE HEAD NUMBER
STA TMPHED ; SAVE THE HEAD NUMBER
JSR NXTDS
PLA
STA SECINC
LDA #0
JSR SETPNT
LDA TRACK
JSR PUTBYT
LDA SECTOR
JSR PUTBYT
JSR WRTBUF
JSR WATJOB
LDA #0
JSR SETPNT
NXDB1
JSR PUTBYT
BNE NXDB1 ; CLEAR THE NEW SECTOR
JSR PUTBYT ; TRACK = 0
LDA #$FF
JMP PUTBYT ; SECTOR = 255
;
; .A = NEW PNTR VALUE
;
SETPNT
STA TEMP
JSR GETACT
ASL A
TAX
LDA BUFTAB+1,X
STA DIRBUF+1
LDA TEMP
STA BUFTAB,X
STA DIRBUF
RTS
;
;
; FREE THE INTERNAL CHANL (SA = 16)
;
FREICH
LDA #IRSA
STA SA
JSR FRECHN
LDA #IWSA
STA SA
JMP FRECHN
;
; READ THE ACTIVE BUFFER POINTER
;
GETPNT
JSR GETACT
SETDIR
GP1
ASL A
TAX
LDA BUFTAB+1,X
STA DIRBUF+1
LDA BUFTAB,X
STA DIRBUF
RTS
;
; DIRECT READ BYTE, .A = BYTE # TO READ
;
DRDBYT
STA TEMP+2
JSR GETACT
TAX
LDA BUFIND,X
STA TEMP+3
LDY #0
LDA (TEMP+2),Y
RTS
;
; INDEX TABLE CONTAINING HIGH
; BYTE ADDRESS OF BUFFERS
;
BUFIND
.BYTE $11,$12,$13
.BYTE $20,$21,$22,$23
.BYTE $30,$31,$32,$33
.BYTE $40,$41,$42,$43
.END

89
DOS_8280/tstflg

@ -0,0 +1,89 @@
.PAGE 'TSTFLG'
;
;**********************************
;*
;* SCFLG
;* SETFLG
;* CLRFLG
;* TSTFLG
;*
;*********************************
;
SCFLG
BCC CLRFLG
SETFLG
LDX LINDX
ORA FILTYP,X
BNE CLRF10
CLRFLG
LDX LINDX
EOR #$FF
AND FILTYP,X
CLRF10
STA FILTYP,X
RTS
TSTFLG
LDX LINDX
AND FILTYP,X
RTS
;
;******************************
;*
;*
;* TSTWRT
;*
;******************************
;
TSTWRT
JSR GETACT
TAX
LDA LSTJOB,X
AND #$F0
CMP #$90
RTS
.PAGE 'TEST CHANNEL'
;
; TEST FOR ACTIVE FILES FROM
; LINDX TABLE
;
; C=1 FILE NOT ACTIVE X=18,Y=?,A=?
; C=0 FILE ACTIVE X=ENTFND,Y=LINDX,A=?
;
TSTCHN
LDX #0 ; START SEARCH AT TOP
TSTC20
STX TEMP+2 ; SAVE TO LOOK ON
LDA LINTAB,X ; GET LINDX
CMP #$FF
BNE TSTC40 ; IF PLUS TEST IT
TSTC30
LDX TEMP+2 ; NOT ACTIVE
INX
CPX #MAXSA-2 ; SEARCHED ALL
BCC TSTC20 ; NO
TSTRTS
RTS ; YES
TSTC40
STX TEMP+2 ; SAVE X
AND #$3F
TAY ; USE LINDX AS INDEX
LDA FILTYP,Y ; RIGHT DRIVE#?
AND #1
STA TEMP+1
LDX ENTFND ; INDEX ENTRY FOUND
LDA FILDRV,X
AND #1
CMP TEMP+1 ; SAME DRIVE # ?
BNE TSTC30 ; NO
LDA DSEC,Y ; YES - SAME DIR ENTRY?
CMP ENTSEC,X
BNE TSTC30 ; NO
LDA DTRK,Y
CMP ENTTRK,X
BNE TSTC30
LDA DIND,Y
CMP ENTIND,X
BNE TSTC30 ; NO
CLC ; SET FLAG
RTS
.END

185
DOS_8280/tstfnd

@ -0,0 +1,185 @@
.PAGE 'TSTFND '
;
; NEXT TRACK & SECTOR
; RETURNS NEXT AVAILABLE TRACK & SECTOR
; GIVEN CURRENT TRACK AND SECTOR
;
; ALLOCATION IS FROM DSTRK TOWARDS
; 1 & MAXTRK, BY FULL TRACKS
;
JNXTTS
JSR GETHDR
JNXT0
JSR GETHED ; GET THE HEAD NUMBER
STA TMPHED ; SAVE IT
LDA #3
STA TEMP
NXTDS
LDA TEMP
PHA ; SAVE TEMP
JSR SETMAP
PLA
STA TEMP ; RESTORE TEMP
LDA (BMPNT),Y ; GET # OF FREE BLOCKDS
BNE FNDNXT ; HAVE AT LEAST 1 FREE
INC HEAD ; NEXT HEAD
LDA HEAD
CMP HEADS
BCC NXT1 ; HEAD < MAX HEAD
LDA #0
STA HEAD
NXT1
CMP TMPHED
BNE NXTDS ; CHECK THE NEXT HEAD
LDY DRVNUM
LDA TRACK
CMP DSTRK,Y
BCC NXT2
INC TRACK
LDA TRACK
CMP MAXTRK
BNE NXTDS
LDX DSTRK,Y
DEX
STX TRACK
LDA #0
STA SECTOR
DEC TEMP
BNE NXTDS
NXTERR
LDA #DSKFUL
JSR CMDERR
NXT2
DEC TRACK
BNE NXTDS
LDX DSTRK,Y
INX
STX TRACK
LDA #0
STA SECTOR
DEC TEMP
BNE NXTDS
BEQ NXTERR
;
; FIND THE NEXT OPTIMUM SECTOR
; NEXT SECTOR = CURRENT SECTOR+N
;
FNDNXT
LDA SECTOR
CLC
ADC SECINC
STA SECTOR
CMP SECTRS
BCC FNDN0
SEC
LDA SECTOR
SBC SECTRS
STA SECTOR
BEQ FNDN0
DEC SECTOR
FNDN0
JSR GETSEC
BEQ FNDN2
FNDN1
JMP USEDT0 ; HEAD ALREADY OUT
FNDN2
LDA #0
STA SECTOR
JSR GETSEC
BNE FNDN1
JMP DERR
;
; RETURNS OPTIMUM INITIAL TRACK, SECTOR
;
JINTTS
LDY DRVNUM
LDX DSTRK,Y
LDA INTFLG
EOR #$FF
STA INTFLG
BEQ INTTS1
INX
BNE INTTS2 ; JUMP
INTTS1
DEX
INTTS2
STX TRACK
LDX #1
STX SECTOR
JMP JNXT0
FND2
DERR
LDA #DIRERR
JSR CMDER2
;
; SET (INDIRECT) BAM PNTR BY DRVNUM
;
SETBMP
LDX DRVNUM
LDA IPBM,X
STA BMPNT+1
LDA #0
STA BMPNT
RTS
;
; SET BAM AND FIND AVAILABLE SECTOR
; STARTING AT SECTOR
;
GETSEC
JSR SETMAP
STY TEMP
JSR AVCK ; CHECK BITS & COUNT
GS10
LDA SECTOR
CMP SECTRS
BCS GS20
JSR FREUS3
BNE GS30
INC SECTOR
BNE GS10 ; JUMP
GS20
LDA #0
GS30
RTS ; (Z = 1), USED
;
; BIT MAP VALIDITY CHECK
;
AVCK
LDA TEMP
PHA ; SAVE TEMP
LDA #0
STA TEMP ; TEMP = 0
TYA
STA BMPNT ; SET LOW BYTE TO TRACK BAM
LDY BAMSIZ
DEY
AC10
LDX #7 ; COUNT THE BITS
AC20
LDA (BMPNT),Y
AND BMASK,X
BEQ AC30
INC TEMP
AC30
DEX
BPL AC20
DEY
BNE AC10
LDA (BMPNT),Y
CMP TEMP
BNE AC40 ; COUNTS DO NOT MATCH
LDA #0
STA BMPNT ; RESTORE PNTR
PLA
STA TEMP ; RESTORE TEMP
RTS
AC40
LDA #DIRERR
JSR CMDER2
;
; RETURNS # OF SECTORS ON TRACK
;
JMXSEC
LDA SECTRS
RTS
.END

181
DOS_8280/tsutil

@ -0,0 +1,181 @@
.PAGE 'TSUTIL'
;
;*********************************
;*
;* SCRUB
;*
;* WRITE OUT BUFFER IF DIRTY
;*
;*********************************
;
SCRUB
JSR GAFLGS
BVC SCR1 ; NOT DIRTY
JSR WRTOUT
JSR WATJOB
SCR1
RTS
;
;*********************************
;*
;* SETLNK
;*
;* PUT TRACK,SECTOR INTO BUFFER
;*
;*********************************
;
SETLNK
JSR SET00
LDA TRACK
STA (DIRBUF),Y
INY
LDA SECTOR
STA (DIRBUF),Y
JMP SDIRTY
;
;********************************
;*
;* GETLNK
;*
;* GET LINK FROM BUFFER INTO
;* TRACK AND SECTOR
;*
;********************************
;
GETLNK
JSR SET00
LDA (DIRBUF),Y
STA TRACK
INY
LDA (DIRBUF),Y
STA SECTOR
RTS
;
;********************************
;*
;* NULLNK
;*
;* SET TRACK LINK = 0 & SECTOR
;* LINK = LAST NON-ZERO CHAR.
;*
;*********************************
;
NULLNK
JSR SET00
LDA #0
STA (DIRBUF)Y
INY
LDX LINDX
LDA NR,X
TAX
DEX
TXA
STA (DIRBUF)Y
RTS
;
;*******************************
;*
;* SET00
;*
;* SETUP UP POINTER TO BUFFER
;*
;*******************************
;
SET00
JSR GETACT
ASL A
TAX
LDA BUFTAB+1,X
STA DIRBUF+1
LDA #0
STA DIRBUF
LDY #0
RTS
;
;*******************************
;*
;* GETHDR
;*
;* READ TRACK,SETOR FROM HEADER
;*
;*******************************
;
CURBLK
JSR FNDRCH
GETHDR
JSR GETACT
STA JOBNUM
GETHD1
ASL A
ASL A
ASL A
TAY
LDA HDRS+2,Y
STA TRACK
LDA HDRS+3,Y
STA SECTOR
RTS
;
;******************************
;*
;* WRTAB,RDAB WRTOUT,RDIN
;* WRTSS,RDSS
;*
;******************************
;
WRTAB
LDA #WRITE
STA CMD
BNE SJ10
RDAB
LDA #READ
STA CMD
BNE SJ10
WRTOUT
LDA #WRITE
STA CMD
BNE SJ20
RDIN
LDA #READ
STA CMD
BNE SJ20
WRTSS
LDA #WRITE
STA CMD
BNE RDS5
RDSS
LDA #READ
RDS5
STA CMD
LDX LINDX
LDA SS,X
TAX
BPL SJ30
SJ10
JSR SETHDR
JSR GETACT
TAX
LDA DRVNUM
STA LSTJOB,X
SJ20
JSR CDIRTY
JSR GETACT
TAX
SJ30
JMP SETLJB
;
;***************************
;*
;* RDLNK
;*
;***************************
;
RDLNK
LDA #0
JSR SETPNT
JSR GETBYT
STA TRACK
JSR GETBYT
STA SECTOR
RTS
.END

149
DOS_8280/utlodr

@ -0,0 +1,149 @@
.PAGE 'UTLODR'
;
; UTILITY LOADER
;
BOOT2
LDA #DAVO+EOIO+RFDO
STA PAD2
JMP IDLE ; GOTO THE IDLE LOOP
BOOT
LDA IEEEDI ; CHECK DATA BUS
BNE BOOT2 ; NOT ZERO
;
; CHECK DAV & NRFD TIED
;
LDA PAD2
ORA #DAVO ; DAV = 1
STA PAD2
LDA PBD2
AND #NRFDI
BEQ BOOT2 ; NRFD = 0
LDA PAD2
AND #$FF-DAVO
STA PAD2 ; DAV = 0
LDA PBD2
AND #NRFDI
BNE BOOT2 ; NRFD = 1
;
; BOOT CLIP MUST BE ON
;
BOOT3
LDA IEEEDI
BEQ BOOT3 ; WAIT TIL IT'S OFF
INC F2CNT ; SET # FILES
INC CMDSIZ ; SET # OF CHARS
LDA #'*
STA CMDBUF ; SET FILENAME FOR ANY MATCH
LDA #DAVO+EOIO+RFDO
STA PAD2
BNE BOOT4 ; BRANCH ALWAYS
;
; ENTRY POINT
;
UTLODR
LDA #$8D ; SHIFTED CR
JSR PARSE
BOOT4
LDA F2CNT
PHA ; SAVE FILE COUNT FOR UTILITY
LDA #1
STA F2CNT
LDA #$FF ; INIT FIRSTBYTE FLAG
STA R0 ; R0 IS FLAG
JSR LOOKUP ; LOCATE FILENAME ON DISK
LDA FILTRK ; CHECK IF FOUND, ERR IF NOT
BNE UTLD00
LDA #NOCFIL
JSR CMDERR
UTLD00
PLA
STA F2CNT ; RESTORE FILE COUNT
LDA FILTRK ; INIT TRACK, SECTOR FOR OPEN
STA TRACK
LDA FILSEC
STA SECTOR
LDA #USRTYP ; OPEN SYSTEM TYPE FILE(5)
JSR OPNTYP ; OPEN
;
; FILE RECORD FETCH LOOP
;
UTLD10
LDA #0 ; INIT CHECKSUM
STA R1 ; CALC CHKSUM RESIDES IN R1
JSR GTABYT ; FETCH LOAD ADDRESS LO
STA R2
JSR ADDSUM ; ADD INTO CHECKSUM
JSR GTABYT ; FETCH LOAD ADDRESS HI
STA R3
JSR ADDSUM
LDA R0 ; IS THIS THE FIRST BYTE ADDRESS?
BEQ UTLD20 ; BR IF NOT
LDA R2 ; SAVE AWAY THIS ADDR IN STACK
PHA ; LO FIRST
LDA R3
PHA ; HI NEXT
LDA #0 ; CLEAR FLAG
STA R0 ; FIRST BYTE FLAG
UTLD20
JSR GTABYT ; FETCH DATA BYTE COUNT
STA R4 ; SAVE IN R4
JSR ADDSUM ; ADD DATA BYTE COUNT
;
; BYTE STORE LOOP
;
UTLD30
JSR GTABYT ; FETCH DATA BYTE
LDY #0 ; INIT INDEX
STA (R2),Y ; STORE BYTE AT DESIRED ADDRESS
JSR ADDSUM ; ADD INTO CHECKSUM
LDA R2 ; POINTER = POINTER+1
CLC
ADC #1
STA R2
BCC UTLD35
INC R3 ; ADD IN CARRY
UTLD35
DEC R4 ; UPDATE BYTE COUNTER
BNE UTLD30 ; IF NONZERO, CONTINUE
;
; END OF BYTE STORE LOOP
;
JSR GIBYTE ; GET A BYTE WITHOUT CHECK FOR EOI
LDA DATA
CMP R1 ; LAST BYTE FETCHED WAS CHKSUM
BEQ UTLD50 ; IF SAME...EVERYTHING OK
JSR SETHDR ; SET UP TRACK AND SECTOR
LDA #NOREC ; SHOW RECORD OVERFLOW
JSR CMDER2 ; AND LEAVE TO ERROR EXIT
UTLD50
LDA EOIFLG ; CHECK FOR END OF FILE
BNE UTLD10 ; IF NONZERO, NOT DONE
;
; END OF RECORD LOAD LOOP
;
PLA ; XFER CNTRL TO 1ST BYTE ADDR.
STA R3
PLA
STA R2
JMP (R2)
.PAG
;
; LOCAL ROUTINES USED BY UTLODR
;
GTABYT
JSR GIBYTE ; FETCH A BYTE TO DATA LOC
LDA EOIFLG ; CHECK IF EOF EXISTS
BNE GTABYE ; OK IF NONZERO
JSR SETHDR ; SET UP TRACK AND SECTOR
LDA #RECOVF ; RECORD SIZE ERROR
JSR CMDER2 ; CALL ERROR ROUTINE
GTABYE
LDA DATA
RTS
ADDSUM
CLC
ADC R1 ; .A = .A+R1
ADC #0 ; .A = .A+CARRY
STA R1 ; SAVE NEW CHECKSUM
RTS
.END

20
DOS_8280/vector

@ -0,0 +1,20 @@
.PAG VECTOR
*=$FFE7
NMI
JMP (VNMI)
;
; TABLE FOR USER COMMAND
;
UBLOCK
.WORD UBLKRD
.WORD UBLKWT
.WORD $1300 ; LINKS TO BUFFER #2
.WORD $1303
.WORD $1306
.WORD $1309
.WORD $130C
.WORD $130F
.WORD NMI ; NMI
.WORD DSKINT ; RESET
.WORD ATNIRQ ; IRQ
.END

90
DOS_8280/verdir

@ -0,0 +1,90 @@
.PAGE 'VER-DIR'
;
; VALIDATE FILES WITH BAM
; CREATE NEW BAM ACCORDING TO
; CONTENTS OF FILES ENTERED IN DIR
;
VERDIR
VALDAT
JSR SIMPRS ; EXTRACT DRIVE #
JSR INITDR
JSR COMPRS ; COMPRESS THE DIRECTORY
LDX DRVNUM
LDA #0
STA NDBL,X
STA NDBH,X ; CLEAR FOR NEW MAP
JSR NEWMAP ; SET NEW BAM
LDA BUFIND
STA IP+1
LDA #0
STA IP
JSR MRKBAM ; MARK THE BAM USED
JSR MRKBTS ; MARK THE BTS USED
LDA #0
STA TRACK
LDA #1
STA SECTOR
JSR USEDTS ; MARK TRACK, SECTOR AND HEAD 0
LDA #0
STA DELIND
JSR SRCHST ; SEARCH FOR FIRST FILE
BNE VD25 ; FOUND ONE
VD10
LDX DRVNUM
LDA HSTRK,X
STA TRACK
LDA HSSEC,X
STA SECTOR
JSR VMKBAM ; MARK ALL DIRECTORY SECTORS USED
JSR SCRBAM
JSR INITDR
JMP ENDCMD
VD15
INY
LDA (DIRBUF),Y
PHA ; SAVE TRACK
INY
LDA (DIRBUF),Y
PHA ; SAVE SECTOR
LDY #19 ; GET SS TRACK
LDA (DIRBUF),Y ; IS THIS RELATIVE?
BEQ VD17 ; NO
STA TRACK ; YES, SAVE TRACK
INY
LDA (DIRBUF),Y ; GET SS SECTOR
STA SECTOR
JSR VMKBAM ; VALIDATE SS BY LINKS
VD17
PLA
STA SECTOR ; NOW DO DATA BLOCKS
PLA
STA TRACK
JSR VMKBAM ; SET BIT USED IN BAM
VD20
JSR SRRE ; SEARCH FOR MORE
BEQ VD10 ; NO MORE FILES
VD25
LDY #0
LDA (DIRBUF),Y
BMI VD15
JSR DELDIR ; NOT CLOSED DELETE DIR
JMP VD20
VMKBAM
JSR TSCHK
JSR USEDTS
JSR OPNIRD
MRK2
LDA #0
JSR SETPNT
JSR GETBYT
STA TRACK
JSR GETBYT
STA SECTOR
LDA TRACK
BNE MRK1
JMP FRECHN
MRK1
JSR USEDTS
JSR NXTBUF
JMP MRK2
.END

4
README.md

@ -136,6 +136,10 @@ The CBM 8250/8050/1001/4040 DOS V2.7 source (1981). Extracted from old-dos-sourc
* Comments in the source call this "SUPER DOS".
* This only contains the DOS and IEEE code. The controller is in CONTROLLER_8250/CONTROLLER_1001.
## DOS_8280
The CBM 8280 V3.1 source (1981). Extracted from [Ruud Baltissen's ICPUG disks](http://www.pagetable.com/docs/8280DOS.D80) and converted to LF line breaks and LST-style indenting.
## DOS_8060_REC
The reconstructed source for the CBM 8061/8062 (1980). The source is based on DOS_8070 and modified by Martin Hoffmann-Vetter to build into the DOS portion of the 901488-01/-02 ROMs.

1
build.sh

@ -124,6 +124,7 @@ build1 DOS_8250 master
build1 DOS_8060 dos
build1 DOS_8070 dos
build1 DOS_D9065 master
build1 DOS_8280 master3.1
build2 DOS_1551 d1551
build2 DOS_1541_05 1541

Loading…
Cancel
Save