Browse Source

reindented DOS_4040 to approximate the LST output of the assembler

master
Michael Steil 2 years ago
parent
commit
7599baed0d
56 changed files with 6661 additions and 6661 deletions
  1. 105
    105
      DOS_4040/addfil
  2. 144
    144
      DOS_4040/addrel
  3. 35
    35
      DOS_4040/autoit
  4. 60
    60
      DOS_4040/bas4.a
  5. 382
    382
      DOS_4040/block
  6. 50
    50
      DOS_4040/chksum
  7. 223
    223
      DOS_4040/close
  8. 84
    84
      DOS_4040/copyall
  9. 53
    53
      DOS_4040/copysetup
  10. 3
    3
      DOS_4040/dos
  11. 245
    245
      DOS_4040/dskint
  12. 123
    123
      DOS_4040/duplct
  13. 2
    2
      DOS_4040/echksm
  14. 58
    58
      DOS_4040/equate
  15. 243
    243
      DOS_4040/erproc
  16. 124
    124
      DOS_4040/fndrel
  17. 32
    32
      DOS_4040/frets
  18. 21
    21
      DOS_4040/getact
  19. 44
    44
      DOS_4040/i_odef
  20. 54
    54
      DOS_4040/idle
  21. 189
    189
      DOS_4040/ieee
  22. 194
    194
      DOS_4040/init
  23. 80
    80
      DOS_4040/jobs
  24. 306
    306
      DOS_4040/lookup
  25. 123
    123
      DOS_4040/lstdir
  26. 54
    54
      DOS_4040/master
  27. 54
    54
      DOS_4040/mcopy.nl
  28. 52
    52
      DOS_4040/memrw
  29. 94
    94
      DOS_4040/new
  30. 87
    87
      DOS_4040/newss
  31. 35
    35
      DOS_4040/nulbuf
  32. 358
    358
      DOS_4040/opchnl
  33. 370
    370
      DOS_4040/open
  34. 209
    209
      DOS_4040/parsex
  35. 139
    139
      DOS_4040/ramvar
  36. 110
    110
      DOS_4040/record
  37. 82
    82
      DOS_4040/rel1
  38. 74
    74
      DOS_4040/rel2
  39. 38
    38
      DOS_4040/rel3
  40. 45
    45
      DOS_4040/rel4
  41. 172
    172
      DOS_4040/rename
  42. 48
    48
      DOS_4040/romtbl
  43. 67
    67
      DOS_4040/scrtch
  44. 99
    99
      DOS_4040/setdrv
  45. 32
    32
      DOS_4040/ssend
  46. 23
    23
      DOS_4040/sstest
  47. 106
    106
      DOS_4040/ssutil
  48. 226
    226
      DOS_4040/trnsfr
  49. 356
    356
      DOS_4040/tst2
  50. 162
    162
      DOS_4040/tst3
  51. 173
    173
      DOS_4040/tst4
  52. 46
    46
      DOS_4040/tstflg
  53. 166
    166
      DOS_4040/tstfnd
  54. 88
    88
      DOS_4040/tsutil
  55. 18
    18
      DOS_4040/vector
  56. 101
    101
      DOS_4040/verdir

+ 105
- 105
DOS_4040/addfil View File

@@ -1,108 +1,108 @@
.PAGE 'ADDFIL'
.PAGE 'ADDFIL'
; ADD FILE TO DIRECTORY
.SKIP
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 FILDAT
AND #1
STA DRVNUM
LDX JOBNUM
EOR LSTJOB,X
LSR A
BCC AF08 ;SAME DRIVE AS REQUIRED
.SKIP
LDX #1
STX DELIND ;LOOK FOR DELETED ENTRY
JSR SRCHST
BEQ AF15 ;ALL FULL, NEW SECTOR
BNE AF20 ;FOUND ONE
.SKIP
AF08 LDA DELSEC
BEQ AF10 ;DELETED ENTRY NOT LOCATED
CMP SECTOR
BEQ AF20 ;SECTOR IS RESIDENT
STA SECTOR
JSR DRTRD ;READ SECTOR IN
JMP AF20
.SKIP
AF10 LDA #1 ;FIND DELETED ENTRY
STA DELIND
JSR SEARCH
BNE AF20
AF15 JSR NXDRBK ;ALL FULL, NEW SECTOR
LDA SECTOR
STA DELSEC
LDA #2
STA DELIND
AF20 LDA DELIND
JSR SETPNT
PLA
STA TYPE ;SET TYPE
CMP #RELTYP
BNE AF25
ORA #$80
.SKIP
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 FILDAT
AND #1
STA DRVNUM
LDX JOBNUM
EOR LSTJOB,X
LSR A
BCC AF08 ;SAME DRIVE AS REQUIRED
.SKIP
LDX #1
STX DELIND ;LOOK FOR DELETED ENTRY
JSR SRCHST
BEQ AF15 ;ALL FULL, NEW SECTOR
BNE AF20 ;FOUND ONE
.SKIP
AF08 LDA DELSEC
BEQ AF10 ;DELETED ENTRY NOT LOCATED
CMP SECTOR
BEQ AF20 ;SECTOR IS RESIDENT
STA SECTOR
JSR DRTRD ;READ SECTOR IN
JMP AF20
.SKIP
AF10 LDA #1 ;FIND DELETED ENTRY
STA DELIND
JSR SEARCH
BNE AF20
AF15 JSR NXDRBK ;ALL FULL, NEW SECTOR
LDA SECTOR
STA DELSEC
LDA #2
STA DELIND
AF20 LDA DELIND
JSR SETPNT
PLA
STA TYPE ;SET TYPE
CMP #RELTYP
BNE AF25
ORA #$80
AF25
JSR PUTBYT
PLA
STA FILTRK ;...TABLE & ENTRY
JSR PUTBYT
PLA
STA FILSEC ;SET SECTOR LINK IN...
JSR PUTBYT ;...TABLE & ENTRY
JSR GETACT
TAY
LDA FILTBL
TAX
LDA #16
JSR TRNAME ;TRANSFER NAME
LDY #16
LDA #0 ;CLEAR # OF BLOCKS &...
AF30 STA (DIRBUF),Y ;...& REPLACE LINKS
INY
CPY #27
BCC AF30
LDA TYPE ;A RELATIVE FILE ?
CMP #RELTYP
BNE AF50 ;NO
LDY #16 ;YES
LDA TRKSS ;GET SS TRACK
STA (DIRBUF),Y ;PUT IN DIRECTORY
INY
LDA SECSS ;GET SS SECTOR
STA (DIRBUF),Y ;PUT IN
INY
LDA REC ;GET RECORD SIZE
STA (DIRBUF),Y
AF50 JSR DRTWRT ;WRITE IT OUT
PLA
STA LINDX
TAX
PLA
STA SA
LDA DELSEC
AND #$1F
STA FILENT
LDA DELIND
AND #$E0
ORA FILENT
STA FILENT
STA DIRENT,X
LDA TYPE
ASL A
AND #$1E
ORA DRVNUM
STA FILDAT
RTS
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
AND #$1F
STA FILENT
LDA DELIND
AND #$E0
ORA FILENT
STA FILENT
STA DIRENT,X
LDA TYPE
ASL A
AND #$1E
ORA DRVNUM
STA FILDAT
RTS
;
.END
.END

+ 144
- 144
DOS_4040/addrel View File

@@ -1,4 +1,4 @@
.PAGE 'ADDREL'
.PAGE 'ADDREL'
;*********************************
;* ADDREL: ADD BLOCKS TO RELATIVE*
;* FILE. *
@@ -8,170 +8,170 @@
;*********************************
;
ADDREL
JSR SETDRN
JSR SSEND ;SET UP END OF FILE
JSR POSBUF
LDA SSIND
STA R1 ;SAVE SS INDEX
LDA SSNUM
STA R0 ;SAVE SS NUMBER
LDA #0
STA R2 ;CLEAR FLAG FOR ONE BLOCK
JSR SETDRN
JSR SSEND ;SET UP END OF FILE
JSR POSBUF
LDA SSIND
STA R1 ;SAVE SS INDEX
LDA SSNUM
STA R0 ;SAVE SS NUMBER
LDA #0
STA R2 ;CLEAR FLAG FOR ONE BLOCK
;
LDA #0 ;CLEAR FOR CALCULATION...
STA RECPTR ;...TO 1ST BYTE IN RECORD
JSR FNDREL ;CALC SS PTRS
JSR NUMFRE ;CALC AVAILABLE...
LDA #0 ;CLEAR FOR CALCULATION...
STA RECPTR ;...TO 1ST BYTE IN RECORD
JSR FNDREL ;CALC SS PTRS
JSR NUMFRE ;CALC AVAILABLE...
;
LDY LINDX ;RECORD SPAN?
LDX RS,Y
DEX
TXA
CLC
ADC RELPTR
BCC AR10 ;NO SPAN
LDY LINDX ;RECORD SPAN?
LDX RS,Y
DEX
TXA
CLC
ADC RELPTR
BCC AR10 ;NO SPAN
;
INC SSIND ;INC SS PTRS & CHECK
INC SSIND ;INC SS PTRS & CHECK
BNE AR10
INC SSNUM
LDA #SSIOFF
STA SSIND
INC SSIND ;INC SS PTRS & CHECK
INC SSIND ;INC SS PTRS & CHECK
BNE AR10
INC SSNUM
LDA #SSIOFF
STA SSIND
AR10
LDA R1
CLC
ADC #2
JSR SETSSP
LDA R1
CLC
ADC #2
JSR SETSSP
;
LDA SSNUM
CMP #NSSL
BCC AR25 ;VALID RANGE
LDA SSNUM
CMP #NSSL
BCC AR25 ;VALID RANGE
;
AR20
LDA #BIGFIL
JSR CMDERR ;TOO MANY SS'S
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
LDA SSIND ;CALC # BLOCKS NEEDED...
SEC ;...& CHECK AGAINST AVAIL.
SBC R1
BCS AR30
SBC #SSIOFF-1
CLC
AR30
STA T3 ;# SS INDICES
LDA SSNUM
SBC R0
STA T4 ;# SS NEEDED
STA T3 ;# SS INDICES
LDA SSNUM
SBC R0
STA T4 ;# SS NEEDED
;
LDX #0 ;CLEAR ACCUM.
STX T1
STX T2
TAX ;.X=# SS
JSR SSCALC ;CALC # OF BLOCKS NEEDED
LDX #0 ;CLEAR ACCUM.
STX T1
STX T2
TAX ;.X=# SS
JSR SSCALC ;CALC # OF BLOCKS NEEDED
;
LDA T2
BNE AR35
LDX T1
DEX
BNE AR35
LDA T2
BNE AR35
LDX T1
DEX
BNE AR35
;
INC R2
INC R2
AR35
CMP NBTEMP+1
BCC AR40 ;OK!!
BNE AR20
LDA NBTEMP
CMP T1
BCC AR20 ;NOT ENUF BLOCKS
CMP NBTEMP+1
BCC AR40 ;OK!!
BNE AR20
LDA NBTEMP
CMP T1
BCC AR20 ;NOT ENUF BLOCKS
AR40
LDA #1
JSR DRDBYT ;LOOK AT SECTOR LINK
CLC
ADC #1 ;+1 IS NR
LDX LINDX
STA NR,X
JSR NXTTS ;GET NEXT BLOCK...
JSR SETLNK ;...& SET LINK.
LDA R2
BNE AR50 ;ADD ONE BLOCK
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
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
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
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 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
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!!
PLA
JSR PUTSS ;RECORD T&S...
PLA
JSR PUTSS ;...IN SS.
PLA ;GET T&S FROM LINK
STA SECTOR
PLA
STA TRACK
BEQ AR65 ;T=0: THAT'S ALL!!
;
LDA R0
CMP SSNUM
BNE AR45 ;NOT EVEN DONE YET
LDA R0
CMP SSNUM
BNE AR45 ;NOT EVEN DONE YET
;
JSR GSSPNT
CMP SSIND
BCC AR45 ;ALMOST DONE
BEQ AR50 ;ONE MORE BLOCK LEFT
JSR GSSPNT
CMP SSIND
BCC AR45 ;ALMOST DONE
BEQ AR50 ;ONE MORE BLOCK LEFT
AR65
JSR GSSPNT
PHA
LDA #0
JSR SSDIR
LDA #0
TAY
STA (DIRBUF),Y
INY
PLA
SEC
SBC #1
STA (DIRBUF),Y
JSR WRTSS ;WRITE SS
JSR WATJOB
JSR MAPOUT
JSR FNDREL
JSR DBLBUF ;GET BACK TO LEADING BUFFER
JSR SSPOS
BVS AR70
JMP POSITN
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
.END
JSR DBLBUF
LDA #LRF
JSR SETFLG
LDA #NOREC
JSR CMDERR
.END
JSR DBLBUF

+ 35
- 35
DOS_4040/autoit View File

@@ -1,4 +1,4 @@
.PAGE 'AUTOIT'
.PAGE 'AUTOIT'
;RSR TEST SUBROUTINES
;
; THIS AUTO INIT SUBROUTINE WILL
@@ -11,40 +11,40 @@
; 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
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
LDA JOBNUM ;RETRIEVE JOB
JSR SETH ;SO CAN SET RESTORE ALL
RTS ;SAME ID
CATID1 JMP INITDR ;DIFF SO INIT
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
LDA JOBNUM ;RETRIEVE JOB
JSR SETH ;SO CAN SET RESTORE ALL
RTS ;SAME ID
CATID1 JMP INITDR ;DIFF SO INIT
;
.END

+ 60
- 60
DOS_4040/bas4.a View File

@@ -1,62 +1,62 @@
;>S0:BAS4.A
;CPUT"0:BAS4.A"
BAS2 = 1
BAS4 = 0
.OPT LST,NOSYMBOL
.LIB HEADER.A
.LIB MISC.A
.LIB ASC.A
.LIB EQU.A
.LIB IO.A
.LIB TOKENS.A
*=$B000
.LIB JMPTAB.A
.LIB KWORDS.A
.LIB BASMSG.A
.LIB SUBS.A
.LIB BASMON.A
.LIB NEW.A
.LIB LIST.A
.LIB FOR.A
.LIB EXEC.A
.LIB STATS.A
.LIB LET.A
.LIB PRINT.A
.LIB IGR.A
.LIB NEXT.A
.LIB EVAL.A
.LIB OAC.A
.LIB EVLVAR.A
.LIB FRE-POS.A
.LIB FN.A
.LIB STR.A
.LIB FP.A
.LIB INITBA.A
.LIB MON2.A
.LIB MON1.A
.LIB DISK.A
.LIB INITOS.A
.LIB SCREEN.A
.LIB IRQ.A
.LIB DISP.A
.LIB TAB.A
*=$F000
.LIB SYSMSG.A
.LIB IEEE.A
.LIB CIO.A
.LIB CLOSE.A
.LIB LOAD.A
.LIB OPEN.A
.LIB TAPE1.A
.LIB SYS.A
.LIB SAVE.A
.LIB CLOCK.A
.LIB IOCHN.A
.LIB TAPE2.A
.LIB TRW.A
.LIB RESET.A
*=$FF93
.LIB JMPVEC.A
*=$FFFA
.LIB HWVEC.A
.END
BAS2 = 1
BAS4 = 0
.OPT LST,NOSYMBOL
.LIB HEADER.A
.LIB MISC.A
.LIB ASC.A
.LIB EQU.A
.LIB IO.A
.LIB TOKENS.A
*=$B000
.LIB JMPTAB.A
.LIB KWORDS.A
.LIB BASMSG.A
.LIB SUBS.A
.LIB BASMON.A
.LIB NEW.A
.LIB LIST.A
.LIB FOR.A
.LIB EXEC.A
.LIB STATS.A
.LIB LET.A
.LIB PRINT.A
.LIB IGR.A
.LIB NEXT.A
.LIB EVAL.A
.LIB OAC.A
.LIB EVLVAR.A
.LIB FRE-POS.A
.LIB FN.A
.LIB STR.A
.LIB FP.A
.LIB INITBA.A
.LIB MON2.A
.LIB MON1.A
.LIB DISK.A
.LIB INITOS.A
.LIB SCREEN.A
.LIB IRQ.A
.LIB DISP.A
.LIB TAB.A
*=$F000
.LIB SYSMSG.A
.LIB IEEE.A
.LIB CIO.A
.LIB CLOSE.A
.LIB LOAD.A
.LIB OPEN.A
.LIB TAPE1.A
.LIB SYS.A
.LIB SAVE.A
.LIB CLOCK.A
.LIB IOCHN.A
.LIB TAPE2.A
.LIB TRW.A
.LIB RESET.A
*=$FF93
.LIB JMPVEC.A
*=$FFFA
.LIB HWVEC.A
.END

+ 382
- 382
DOS_4040/block View File

@@ -1,414 +1,414 @@
.PAGE 'BLOCK COMMAND'
.PAGE 'BLOCK COMMAND'
; ROM 1.1 ADDITIONS
; USER COMMANDS
.SKIP
USER LDY CMDBUF+1
CPY #'0
BNE US10 ;0 RESETS PNTR
.SKIP
USRINT LDA #<UBLOCK ;SET DEFAULT BLOCK ADD
STA USRJMP
LDA #>UBLOCK
STA USRJMP+1
RTS
.SKIP
US10 JSR USREXC ;EXECUTE CODE BY TABLE
JMP ENDCMD
.SKIP
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'
.SKIP
USER LDY CMDBUF+1
CPY #'0
BNE US10 ;0 RESETS PNTR
.SKIP
USRINT LDA #<UBLOCK ;SET DEFAULT BLOCK ADD
STA USRJMP
LDA #>UBLOCK
STA USRJMP+1
RTS
.SKIP
US10 JSR USREXC ;EXECUTE CODE BY TABLE
JMP ENDCMD
.SKIP
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 "#"
.SKIP
OPNBLK LDX CMDSIZ
DEX
BNE OB10
.SKI
LDA #1 ;GET ANY BUFFER
JSR GETRCH
JMP OB30
.SKIP
OB05 LDA #NOCHNL
JMP CMDERR
.SKIP
OB10 LDY #1 ;BUFFER # IS REQUESTED
JSR BP05
LDX FILSEC
CPX #BAMJOB ;MUST BE LESS THAN 13.
BCS OB05
.SKI
LDA #0
STA TEMP
STA TEMP+1
SEC
.SKI
.SKIP
OPNBLK LDX CMDSIZ
DEX
BNE OB10
.SKI
LDA #1 ;GET ANY BUFFER
JSR GETRCH
JMP OB30
.SKIP
OB05 LDA #NOCHNL
JMP CMDERR
.SKIP
OB10 LDY #1 ;BUFFER # IS REQUESTED
JSR BP05
LDX FILSEC
CPX #BAMJOB ;MUST BE LESS THAN 13.
BCS OB05
.SKI
LDA #0
STA TEMP
STA TEMP+1
SEC
.SKI
OB15
ROL TEMP
ROL TEMP+1
DEX
BPL OB15
.SKI
LDA TEMP
AND BUFUSE
BNE OB05 ;BUFFER IS USED
LDA TEMP+1
AND BUFUSE+1
BNE OB05 ;BUF IS USED
.SKI
LDA TEMP
ORA BUFUSE ;SET BUFFER AS USED
STA BUFUSE
LDA TEMP+1
ORA BUFUSE+1
STA BUFUSE+1
.SKI
LDA #0 ;SET UP CHANNEL
JSR GETRCH
LDX LINDX
LDA FILSEC
STA BUF0,X
.SKI
OB30 LDX SA
LDA LINTAB,X ;SET LINDX TABLE
ORA #$40
STA LINTAB,X
.SKI
LDY LINDX
LDA #$FF
STA LSTCHR,Y
.SKIP
LDA #RNDRDY
STA CHNRDY,Y ;SET CHANNEL READY
.SKIP
LDA BUF0,Y
STA CHNDAT,Y ;BUFFER # AS 1ST CHAR
ASL A
TAX
LDA #1
STA BUFTAB,X
LDA #DIRTYP+DIRTYP
STA FILTYP,Y ;SET DIRECT FILE TYPE
JMP ENDCMD
.PAGE
ROL TEMP
ROL TEMP+1
DEX
BPL OB15
.SKI
LDA TEMP
AND BUFUSE
BNE OB05 ;BUFFER IS USED
LDA TEMP+1
AND BUFUSE+1
BNE OB05 ;BUF IS USED
.SKI
LDA TEMP
ORA BUFUSE ;SET BUFFER AS USED
STA BUFUSE
LDA TEMP+1
ORA BUFUSE+1
STA BUFUSE+1
.SKI
LDA #0 ;SET UP CHANNEL
JSR GETRCH
LDX LINDX
LDA FILSEC
STA BUF0,X
.SKI
OB30 LDX SA
LDA LINTAB,X ;SET LINDX TABLE
ORA #$40
STA LINTAB,X
.SKI
LDY LINDX
LDA #$FF
STA LSTCHR,Y
.SKIP
LDA #RNDRDY
STA CHNRDY,Y ;SET CHANNEL READY
.SKIP
LDA BUF0,Y
STA CHNDAT,Y ;BUFFER # AS 1ST CHAR
ASL A
TAX
LDA #1
STA BUFTAB,X
LDA #DIRTYP+DIRTYP
STA FILTYP,Y ;SET DIRECT FILE TYPE
JMP ENDCMD
.PAGE
; BLOCK COMMANDS
BLOCK LDY #0
LDX #0
LDA #'- ;"-" SEPARATES CMD FROM SUBCMD
JSR PARSE ;LOCATE SUB-CMD
BNE BLK40
.SKI
BLK10 LDA #BADCMD
JMP CMDERR
.SKI
BLK30 LDA #BADSYN
JMP CMDERR
.SKI
BLK40 TXA
BNE BLK30
.SKI
LDX #NBCMDS-1 ;FIND COMMAND
LDA CMDBUF,Y
BLK50 CMP BCTAB,X
BEQ BLK60
DEX
BPL BLK50
BMI BLK10
.SKI
BLOCK LDY #0
LDX #0
LDA #'- ;"-" SEPARATES CMD FROM SUBCMD
JSR PARSE ;LOCATE SUB-CMD
BNE BLK40
.SKI
BLK10 LDA #BADCMD
JMP CMDERR
.SKI
BLK30 LDA #BADSYN
JMP CMDERR
.SKI
BLK40 TXA
BNE BLK30
.SKI
LDX #NBCMDS-1 ;FIND COMMAND
LDA CMDBUF,Y
BLK50 CMP BCTAB,X
BEQ BLK60
DEX
BPL BLK50
BMI BLK10
.SKI
BLK60
TXA
ORA #$80
STA CMDNUM
JSR BLKPAR ;PARSE PARMS
.SKI
LDA CMDNUM
ASL A
TAX
LDA BCJMP+1,X
STA TEMP+1
LDA BCJMP,X
STA TEMP
.SKI
JMP (TEMP) ;GOTO COMMAND
.SKI
BCTAB .BYT 'AFRWEP'
NBCMDS =*-BCTAB
.SKIP
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
.SKIP
BLKPAR LDY #0 ;PARSE BLOCK PARMS
LDX #0
LDA #':
JSR PARSE
BNE BP05 ;FOUND ":"
.SKIP
LDY #3 ;ELSE CHAR #3 IS BEGINNING
BP05 LDA CMDBUF,Y
CMP #'
BEQ BP10
.SKI
CMP #29 ;SKIP CHARACTER
BEQ BP10
.SKI
CMP #',
BNE BP20
.SKIP
BP10 INY
CPY CMDSIZ
BCC BP05
.SKIP
RTS ;THAT'S ALL
.SKIP
BP20 JSR ASCHEX
INC F1CNT
LDY F2PTR
CPX #MXFILS-1
BCC BP10
.SKIP
BCS BLK30 ;BAD SYNTAX
.SKIP
TXA
ORA #$80
STA CMDNUM
JSR BLKPAR ;PARSE PARMS
.SKI
LDA CMDNUM
ASL A
TAX
LDA BCJMP+1,X
STA TEMP+1
LDA BCJMP,X
STA TEMP
.SKI
JMP (TEMP) ;GOTO COMMAND
.SKI
BCTAB .BYT 'AFRWEP'
NBCMDS =*-BCTAB
.SKIP
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
.SKIP
BLKPAR LDY #0 ;PARSE BLOCK PARMS
LDX #0
LDA #':
JSR PARSE
BNE BP05 ;FOUND ":"
.SKIP
LDY #3 ;ELSE CHAR #3 IS BEGINNING
BP05 LDA CMDBUF,Y
CMP #'
BEQ BP10
.SKI
CMP #29 ;SKIP CHARACTER
BEQ BP10
.SKI
CMP #',
BNE BP20
.SKIP
BP10 INY
CPY CMDSIZ
BCC BP05
.SKIP
RTS ;THAT'S ALL
.SKIP
BP20 JSR ASCHEX
INC F1CNT
LDY F2PTR
CPX #MXFILS-1
BCC BP10
.SKIP
BCS BLK30 ;BAD SYNTAX
.SKIP
; CONVERT ASCII TO HEX (BINARY)
; & STORE CONVERSION IN TABLES
; .Y= PTR INTO CMDBUF
ASCHEX LDA #0
STA TEMP
STA TEMP+1
STA TEMP+3
.SKIP
LDX #$FF
AH10 LDA CMDBUF,Y ;TEST FOR DEC #
CMP #$40
BCS AH20 ;NON-NUMERIC TERMINATES
CMP #$30
BCC AH20 ;NON-NUMERIC
.SKIP
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
.SKIP
AH20 STY F2PTR ;CONVERT DIGITS TO...
CLC ;...BINARY BY DEC TABLE
LDA #0
.SKIP
AH30 INX
CPX #3
BCS AH40
.SKIP
LDY TEMP,X
AH35 DEY
BMI AH30
.SKIP
ADC DECTAB,X
BCC AH35
.SKIP
CLC
INC TEMP+3
BNE AH35
.SKIP
AH40 PHA
LDX F1CNT
LDA TEMP+3
STA FILTRK,X ;STORE RESULT IN TABLE
PLA
STA FILSEC,X
RTS
.SKIP
DECTAB .BYT 1,10,100 ;DECIMAL TABLE
.SKIP
ASCHEX LDA #0
STA TEMP
STA TEMP+1
STA TEMP+3
.SKIP
LDX #$FF
AH10 LDA CMDBUF,Y ;TEST FOR DEC #
CMP #$40
BCS AH20 ;NON-NUMERIC TERMINATES
CMP #$30
BCC AH20 ;NON-NUMERIC
.SKIP
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
.SKIP
AH20 STY F2PTR ;CONVERT DIGITS TO...
CLC ;...BINARY BY DEC TABLE
LDA #0
.SKIP
AH30 INX
CPX #3
BCS AH40
.SKIP
LDY TEMP,X
AH35 DEY
BMI AH30
.SKIP
ADC DECTAB,X
BCC AH35
.SKIP
CLC
INC TEMP+3
BNE AH35
.SKIP
AH40 PHA
LDX F1CNT
LDA TEMP+3
STA FILTRK,X ;STORE RESULT IN TABLE
PLA
STA FILSEC,X
RTS
.SKIP
DECTAB .BYT 1,10,100 ;DECIMAL TABLE
.SKIP
;BLOCK-FREE
BLKFRE JSR BLKTST
JSR FRETS
JMP ENDCMD
.SKIP
BLKFRE JSR BLKTST
JSR FRETS
JMP ENDCMD
.SKIP
;BLOCK-ALLOCATE
BLKALC JSR BLKTST
LDX DRVNUM
LDA IPBM,X
STA BMPNT+1
.SKIP
BA10 JSR AVAIL
BA20 JSR AV2
BCS BA40 ;SEARCH FOR NEXT AVAIL SECTOR
.SKIP
LDX SECTOR
INX
STX SECTOR
STX ERWORD ;SET NOT AVAIL FLAG
CPX R0
BCC BA20
.SKIP
LDA #0
STA SECTOR
LDX TRACK
INX
STX TRACK
CPX #36
BCS BA30
.SKIP
JSR BT05
JMP BA10
.SKIP
BA30 STA TRACK
BA35 LDA #NOBLK
JMP CMDER2
.SKIP
BA40 LDX ERWORD ;FINISHED SEARCH
BNE BA35 ;BLOCK WAS'NT AVAILABLE
.SKIP
JSR USEDTS ;BLOCK AVAIL, SET AS USED
JMP ENDCMD
.SKIP
BLKALC JSR BLKTST
LDX DRVNUM
LDA IPBM,X
STA BMPNT+1
.SKIP
BA10 JSR AVAIL
BA20 JSR AV2
BCS BA40 ;SEARCH FOR NEXT AVAIL SECTOR
.SKIP
LDX SECTOR
INX
STX SECTOR
STX ERWORD ;SET NOT AVAIL FLAG
CPX R0
BCC BA20
.SKIP
LDA #0
STA SECTOR
LDX TRACK
INX
STX TRACK
CPX #36
BCS BA30
.SKIP
JSR BT05
JMP BA10
.SKIP
BA30 STA TRACK
BA35 LDA #NOBLK
JMP CMDER2
.SKIP
BA40 LDX ERWORD ;FINISHED SEARCH
BNE BA35 ;BLOCK WAS'NT AVAILABLE
.SKIP
JSR USEDTS ;BLOCK AVAIL, SET AS USED
JMP ENDCMD
.SKIP
; BLOCK READ SUBS
BLKRD2 JSR BKOTST ;TEST PARMS
JMP DRTRD
.SKIP
GETSIM JSR GETPRE ;GET BYTE W/O INC
LDA (BUFTAB,X)
RTS
.SKIP
BLKRD2 JSR BKOTST ;TEST PARMS
JMP DRTRD
.SKIP
GETSIM JSR GETPRE ;GET BYTE W/O INC
LDA (BUFTAB,X)
RTS
.SKIP
; BLOCK READ
BLKRD3 JSR BLKRD2
LDA #0
JSR SETPNT
JSR GETSIM ;Y=LINDX
.SKIP
STA LSTCHR,Y
LDA #RNDRDY
STA CHNRDY,Y
RTS
BLKRD3 JSR BLKRD2
LDA #0
JSR SETPNT
JSR GETSIM ;Y=LINDX
.SKIP
STA LSTCHR,Y
LDA #RNDRDY
STA CHNRDY,Y
RTS
BLKRD
JSR BLKRD3
JSR RNGET1
JMP ENDCMD
.SKIP
JSR BLKRD3
JSR RNGET1
JMP ENDCMD
.SKIP
;USER DIRECT READ, LSTCHR=$FF
UBLKRD
JSR BLKPAR
JSR BLKRD3
LDA LSTCHR,Y
STA CHNDAT,Y
LDA #$FF
STA LSTCHR,Y
JMP ENDCMD ;(RTS)
.SKIP 2
JSR BLKPAR
JSR BLKRD3
LDA LSTCHR,Y
STA CHNDAT,Y
LDA #$FF
STA LSTCHR,Y
JMP ENDCMD ;(RTS)
.SKIP 2
;BLOCK-WRITE
BLKWT JSR BKOTST
.SKIP
JSR GETPNT
TAY
DEY
CMP #2
BCS BW10
LDY #1
.SKIP
BW10 LDA #0 ;SET RECORD SIZE
JSR SETPNT
TYA
JSR PUTBYT
TXA
PHA
.SKIP
BW20 JSR DRTWRT ;WRITE BLOCK
PLA
TAX
JSR RNGET2
JMP ENDCMD
.SKIP
BLKWT JSR BKOTST
.SKIP
JSR GETPNT
TAY
DEY
CMP #2
BCS BW10
LDY #1
.SKIP
BW10 LDA #0 ;SET RECORD SIZE
JSR SETPNT
TYA
JSR PUTBYT
TXA
PHA
.SKIP
BW20 JSR DRTWRT ;WRITE BLOCK
PLA
TAX
JSR RNGET2
JMP ENDCMD
.SKIP
;USER DIRCT WRITE, NO LSTCHR
UBLKWT JSR BLKPAR
JSR BKOTST
JSR DRTWRT
JMP ENDCMD
.SKIP
UBLKWT JSR BLKPAR
JSR BKOTST
JSR DRTWRT
JMP ENDCMD
.SKIP
;IN .FILE VECTOR:
;*=$FFFA-6 ;USER DIRECT ACCESS
;UBLOCK .WORD UBLKRD
; .WORD UBLKWT
.SKIP 2
.SKIP 2
;BLOCK-EXECUTE
BLKEXC JSR BLKRD2 ;READ BLOCK & EXECUTE
LDA #0
.SKIP
BE05 STA TEMP
LDX JOBNUM
LDA BUFIND,X
STA TEMP+1
JSR BE10 ;INDIRECT JSR
JMP ENDCMD
.SKIP
BE10 JMP (TEMP)
.SKIP 2
BLKEXC JSR BLKRD2 ;READ BLOCK & EXECUTE
LDA #0
.SKIP
BE05 STA TEMP
LDX JOBNUM
LDA BUFIND,X
STA TEMP+1
JSR BE10 ;INDIRECT JSR
JMP ENDCMD
.SKIP
BE10 JMP (TEMP)
.SKIP 2
;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
.SKIP
BLKPTR JSR BUFTST
LDA JOBNUM
ASL A
TAX
LDA FILSEC+1
STA BUFTAB,X
JSR GETPRE
JSR RNGET2 ;SET UP GET
JMP ENDCMD
.SKIP
;TEST FOR ALLOCATED BUFFER..
; ..RELATED TO SA
BUFTST LDX F1PTR
INC F1PTR
LDA FILSEC,X
TAY
DEY
DEY
CPY #BAMJOB
BCC BT20
.SKIP
BT15 LDA #NOCHNL
JMP CMDERR
.SKIP
BT20 STA SA
JSR FNDRCH
BCS BT15
JSR GETACT
STA JOBNUM
RTS
.SKIP
BUFTST LDX F1PTR
INC F1PTR
LDA FILSEC,X
TAY
DEY
DEY
CPY #BAMJOB
BCC BT20
.SKIP
BT15 LDA #NOCHNL
JMP CMDERR
.SKIP
BT20 STA SA
JSR FNDRCH
BCS BT15
JSR GETACT
STA JOBNUM
RTS
.SKIP
;TEST BLOCK OPERATION PARMS
BKOTST JSR BUFTST
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
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
STA R0
JMP SETLDS ;(RTS)
.SKIP
.END
JSR TSCHK
STA R0
JMP SETLDS ;(RTS)
.SKIP
.END

+ 50
- 50
DOS_4040/chksum View File

@@ -1,55 +1,55 @@
.PAGE 'CHCKSUM'
*= $CF00
LDX #$FF
TXS
CLD
SEI
LDA #0
STA DCHKSM
CMP DCHKSM
.PAGE 'CHCKSUM'
*= $CF00
LDX #$FF
TXS
CLD
SEI
LDA #0
STA DCHKSM
CMP DCHKSM
CHKPRO
BNE CHKPRO
LDA #$D0
JSR CHKSUM
STA DCHKSM
LDA #0
STA ECHKSM
CMP ECHKSM
BNE CHKPRO
LDA #$E0
JSR CHKSUM
STA ECHKSM
LDA #0
STA FCHKSM
CMP FCHKSM
BNE CHKPRO
LDA #$F0
JSR CHKSUM
STA FCHKSM
JMP *
BNE CHKPRO
LDA #$D0
JSR CHKSUM
STA DCHKSM
LDA #0
STA ECHKSM
CMP ECHKSM
BNE CHKPRO
LDA #$E0
JSR CHKSUM
STA ECHKSM
LDA #0
STA FCHKSM
CMP FCHKSM
BNE CHKPRO
LDA #$F0
JSR CHKSUM
STA FCHKSM
JMP *
;
CHKSUM ;.A=ADDRESS
CLC
PHA
STA TEMP+1
LDA #0
STA TEMP
LDX #16
LDY #0
CHKSUM ;.A=ADDRESS
CLC
PHA
STA TEMP+1
LDA #0
STA TEMP
LDX #16
LDY #0
CHK1
ADC (TEMP)Y
INY
BNE CHK1
ADC (TEMP)Y
INY
BNE CHK1
;
INC TEMP+1
DEX
BNE CHK1
INC TEMP+1
DEX
BNE CHK1
;
ADC #0
STA TEMP+1
PLA
SEC
SBC TEMP+1
SBC #0 ;.A=CHECKSUM BYTE
RTS
.END
ADC #0
STA TEMP+1
PLA
SEC
SBC TEMP+1
SBC #0 ;.A=CHECKSUM BYTE
RTS
.END

+ 223
- 223
DOS_4040/close View File

@@ -1,268 +1,268 @@
.PAGE 'CLOSE'
.PAGE 'CLOSE'
; CLOSE THE FILE ASSOCIATED WITH SA
;
CLOSE LDA SA
BNE CLS10 ; DIRECTORY CLOSE
LDA #0
STA DIRLST ;CLEAR DIR LIST
JSR FRECHN
CLOSE LDA SA
BNE CLS10 ; DIRECTORY CLOSE
LDA #0
STA DIRLST ;CLEAR DIR LIST
JSR FRECHN
CLS05
JMP FREICH
JMP FREICH
CLS10
CMP #$F
BEQ CLSALL ; CLOSE CMD CHANL
JSR CLSCHN ;CLOSE CHANNEL
LDA SA
CMP #2
BCC CLS05
CMP #$F
BEQ CLSALL ; CLOSE CMD CHANL
JSR CLSCHN ;CLOSE CHANNEL
LDA SA
CMP #2
BCC CLS05
;
JMP ENDCMD
JMP ENDCMD
;
CLSALL
LDA #14
STA SA
LDA #14
STA SA
CLS20
JSR CLSCHN
DEC SA
BPL CLS20
JMP ENDCMD
JSR CLSCHN
DEC SA
BPL CLS20
JMP ENDCMD
;
CLSCHN
LDX SA
LDA LINTAB,X
CMP #$FF
BNE CLSC28
RTS
LDX SA
LDA LINTAB,X
CMP #$FF
BNE CLSC28
RTS
CLSC28
AND #$F
STA LINDX
AND #$F
STA LINDX
;
JSR TYPFIL
CMP #DIRTYP
BEQ CLSC30 ;DIRECT CHANNEL
CMP #RELTYP
BEQ CLSREL
JSR TYPFIL
CMP #DIRTYP
BEQ CLSC30 ;DIRECT CHANNEL
CMP #RELTYP
BEQ CLSREL
;
JSR FNDWCH ;LOOK FOR WRITE CHANNEL
BCS CLSC31
JSR FNDWCH ;LOOK FOR WRITE CHANNEL
BCS CLSC31
;
JSR CLSWRT ;CLOSE SEQ WRITE
JSR CLSDIR ;CLOSE DIRECTORY
JSR CLSWRT ;CLOSE SEQ WRITE
JSR CLSDIR ;CLOSE DIRECTORY
CLSC30
JSR MAPOUT ;WRITE BAM
JSR MAPOUT ;WRITE BAM
CLSC31
JMP FRECHN
JMP FRECHN
;
CLSREL
JSR SCRUB
JSR DBLBUF
JSR SSEND
LDX SSNUM
STX T4
INC T4
LDA #0
STA T1
STA T2
LDA SSIND
SEC
SBC #SSIOFF-2
STA T3
JSR SSCALC
LDX LINDX
LDA T1
STA NBKL,X
LDA T2
STA NBKH,X
JSR CLSDIR
JMP FRECHN
JSR SCRUB
JSR DBLBUF
JSR SSEND
LDX SSNUM
STX T4
INC T4
LDA #0
STA T1
STA T2
LDA SSIND
SEC
SBC #SSIOFF-2
STA T3
JSR SSCALC
LDX LINDX
LDA T1
STA NBKL,X
LDA T2
STA NBKH,X
JSR CLSDIR
JMP FRECHN
;
; CLOSE A WRITE CHANL
;
CLSWRT ;CLOSE SEQ WRITE FILE
LDX LINDX
LDA NBKL,X
ORA NBKH,X
BNE CLSW10 ;AT LEAST 1 BLOCK WRITTEN
CLSWRT ;CLOSE SEQ WRITE FILE
LDX LINDX
LDA NBKL,X
ORA NBKH,X
BNE CLSW10 ;AT LEAST 1 BLOCK WRITTEN
;
JSR GETPNT
CMP #2
BNE CLSW10 ;AT LEAST 1 BYTE WRITTEN
JSR GETPNT
CMP #2
BNE CLSW10 ;AT LEAST 1 BYTE WRITTEN
;
LDA #CR
JSR PUTBYT
LDA #CR
JSR PUTBYT
CLSW10
JSR GETPNT
CMP #2
BNE CLSW20 ;NOT MT BUFFER
JSR GETPNT
CMP #2
BNE CLSW20 ;NOT MT BUFFER
;
JSR DBLBUF ;SWITCH BUFS
JSR DBLBUF ;SWITCH BUFS
;
LDX LINDX
LDA NBKL,X
BNE CLSW15
DEC NBKH,X
LDX LINDX
LDA NBKL,X
BNE CLSW15
DEC NBKH,X
CLSW15
DEC NBKL,X
DEC NBKL,X
;
LDA #0
LDA #0
CLSW20
SEC
SBC #1 ;BACK UP 1
PHA ;SAVE IT
LDA #0
JSR SETPNT
JSR PUTBYT ;TLINK=0
PLA ;LSTCHR COUNT
JSR PUTBYT
SEC
SBC #1 ;BACK UP 1
PHA ;SAVE IT
LDA #0
JSR SETPNT
JSR PUTBYT ;TLINK=0
PLA ;LSTCHR COUNT
JSR PUTBYT
;
JSR WRTBUF ;WRITE OUT LAST BUFFER
JSR WATJOB ;FINISH JOB UP
JMP DBLBUF ;MAKE SURE BOTH BUFS OK
;RTS
JSR WRTBUF ;WRITE OUT LAST BUFFER
JSR WATJOB ;FINISH JOB UP
JMP DBLBUF ;MAKE SURE BOTH BUFS OK
;RTS
;
; WRITE OUT THE BIT MAP TO
; THE DRIVE IN LSTJOB(ACTIVE)
;
MAPOUT JSR GETACT
TAX
LDA LSTJOB,X
MO10 AND #1
PHA ;CHECK BAM BEFORE WRITING
TAX
LDA #0
STA SECTOR
LDA IPBM,X
STA TEMP+5
LDA #0
STA TEMP+4
.SKIP
LDA #1
STA TRACK
.SKIP
MAPOUT JSR GETACT
TAX
LDA LSTJOB,X
MO10 AND #1
PHA ;CHECK BAM BEFORE WRITING
TAX
LDA #0
STA SECTOR
LDA IPBM,X
STA TEMP+5
LDA #0
STA TEMP+4
.SKIP
LDA #1
STA TRACK
.SKIP
; VERIFY THE BAM BLOCK COUNT
; MATCHES THE BITS
;
MAPCHK LDA TRACK
ASL A
ASL A
TAY
LDA (TEMP+4),Y
STA TEMP+3
INY
LDA (TEMP+4),Y
STA TEMP
INY
LDA (TEMP+4),Y
STA TEMP+1
INY
LDA (TEMP+4),Y
STA TEMP+2
.SKIP
JSR AVCK
INC TRACK
LDA TRACK
CMP #MAXTRK
BNE MAPCHK
.SKIP
LDA #18
STA TRACK
PLA
TAY
CLC
ADC #BAMJOB
TAX
TYA
ORA #WRITE
JMP DOIT
MAPCHK LDA TRACK
ASL A
ASL A
TAY
LDA (TEMP+4),Y
STA TEMP+3
INY
LDA (TEMP+4),Y
STA TEMP
INY
LDA (TEMP+4),Y
STA TEMP+1
INY
LDA (TEMP+4),Y
STA TEMP+2
.SKIP
JSR AVCK
INC TRACK
LDA TRACK
CMP #MAXTRK
BNE MAPCHK
.SKIP
LDA #18
STA TRACK
PLA
TAY
CLC
ADC #BAMJOB
TAX
TYA
ORA #WRITE
JMP DOIT
;
; DIRECTORY CLOSE ON OPEN WRITE FILE
;
CLSDIR LDX LINDX ;SAVE LINDX
STX WLINDX ;&SA
LDA SA
PHA
LDA DIRENT,X ;GET DIRECTORY SECTOR
PHA
AND #$1F
STA SECTOR
PLA
AND #$E0 ;GET SECTOR OFFSET
ORA #2
STA INDEX
LDA FILTYP,X ;DRV # IN FILTYP
AND #1
STA DRVNUM
LDA #18
STA TRACK
JSR GETACT ;ALLOCATE A BUFFER
PHA
STA JOBNUM
JSR DRTRD ;READ DIRECTORY SECTOR
LDY #0
LDA BUFIND,X ;.X IS JOB#
STA R0+1
LDA INDEX
STA R0
LDA (R0),Y
AND #$20
BEQ CLSD5
JSR TYPFIL
BEQ CLSD6
CLSDIR LDX LINDX ;SAVE LINDX
STX WLINDX ;&SA
LDA SA
PHA
LDA DIRENT,X ;GET DIRECTORY SECTOR
PHA
AND #$1F
STA SECTOR
PLA
AND #$E0 ;GET SECTOR OFFSET
ORA #2
STA INDEX
LDA FILTYP,X ;DRV # IN FILTYP
AND #1
STA DRVNUM
LDA #18
STA TRACK
JSR GETACT ;ALLOCATE A BUFFER
PHA
STA JOBNUM
JSR DRTRD ;READ DIRECTORY SECTOR
LDY #0
LDA BUFIND,X ;.X IS JOB#
STA R0+1
LDA INDEX
STA R0
LDA (R0),Y
AND #$20
BEQ CLSD5
JSR TYPFIL
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
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