You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
1.8KB

  1. .PAGE 'NEW'
  2. ;NEW: INITIALIZE A DISK, DISK IS
  3. ; SOFT-SECTORED, BIT AVAIL. MAP,
  4. ; DIRECTORY, & 1ST BLOCK ARE ALL INITED
  5. .SKIP
  6. NEW JSR ONEDRV
  7. LDA FILDRV ;SET UP DRIVE #
  8. BPL N101
  9. LDA #BADFN ;BAD DRIVE # GIVEN
  10. JMP CMDERR
  11. N101 AND #1
  12. STA DRVNUM
  13. JSR SETLDS
  14. .SKIP
  15. LDA DRVNUM
  16. ASL A
  17. TAX
  18. LDY FILTBL+1 ;GET DISK ID
  19. CPY CMDSIZ ;?IS THIS NEW OR CLEAR?
  20. BEQ N108 ;END OF CMD STRING
  21. LDA CMDBUF,Y ;FORMAT DISK****
  22. STA DSKID,X ;STORE IN PROPER DRIVE
  23. LDA CMDBUF+1,Y ;(Y=0)
  24. STA DSKID+1,X
  25. .SKIP
  26. JSR CLRCHN ;CLEAR ALL CHANNELS WHEN FORMATTING
  27. LDA #1 ;...IN TRACK, TRACK=1
  28. STA TRACK
  29. JSR FORMAT ;TRANSFER FORMAT TO RAM
  30. JSR CLRBAM ;ZERO BAM
  31. JMP N110
  32. .SKIP
  33. N108 JSR INITDR ;CLEAR DIRECTORY ONLY
  34. LDX DRVNUM
  35. LDA DSKVER,X ;USE CURRENT VERSION #
  36. CMP VERNUM
  37. BEQ N110
  38. JMP VNERR ;WRONG VERSION #
  39. N110
  40. JSR NEWMAP ;NEW BAM
  41. .SKIP
  42. LDA JOBNUM
  43. TAY
  44. ASL A
  45. TAX
  46. LDA DSKNAM ;SET PTR TO DISK NAME
  47. STA BUFTAB,X
  48. LDX FILTBL
  49. LDA #27
  50. JSR TRNAME ;TRANSFER CMD BUF TO BAM
  51. .SKIP
  52. LDY #$12
  53. LDX DRVNUM
  54. LDA VERNUM ;SET DOS'S CURRENT FORMAT TYPE
  55. STA DSKVER,X
  56. TXA
  57. ASL A
  58. TAX
  59. LDA DSKID,X ;WRITE DIRECTORY'S I.D.
  60. STA (DIRBUF),Y
  61. INY
  62. LDA DSKID+1,X
  63. STA (DIRBUF),Y
  64. .SKIP
  65. INY
  66. INY
  67. LDA #DOSVER+$30 ;WRITE DIRECTORY DOS VERSION
  68. STA (DIRBUF)Y
  69. INY
  70. LDA VERNUM ;WRITE DIRECTORY FORMAT TYPE
  71. STA (DIRBUF)Y
  72. ;
  73. LDY #2
  74. STA (BMPNT),Y ;WRITE DISKETTE'S FORMAT TYPE
  75. LDA DIRTRK
  76. STA TRACK
  77. JSR USEDTS ;SET BAM BLOCK USED
  78. LDA #1
  79. STA SECTOR
  80. JSR USEDTS ;SET 1ST DIR BLOCK USED
  81. JSR SCRBAM ;SCRUB THE BAM
  82. JSR CLRBAM ;SET TO ALL 0'S
  83. LDY #1
  84. LDA #$FF ;SET END LINK
  85. STA (BMPNT)Y
  86. JSR DRTWRT ;CLEAR DIRECTORY
  87. DEC SECTOR
  88. JSR DRTRD ;READ BAM BACK
  89. .SKIP
  90. JMP ENDCMD
  91. .SKIP
  92. .END