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.

new.src 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. .page 'new.src'
  2. ;new: initialize a disk, disk is
  3. ; soft-sectored, bit avail. map,
  4. ; directory, & 1st block are all inited
  5. new jsr onedrv
  6. lda fildrv ; set up drive #
  7. bpl n101
  8. lda #badfn ; bad drive # given
  9. jmp cmderr
  10. n101 and #1
  11. sta drvnum
  12. jsr ptch11 ; *** rom fix ds 01/25/85 ***
  13. ; jsr setlds
  14. lda drvnum
  15. asl a
  16. tax
  17. ldy filtbl+1 ; get disk id
  18. cpy cmdsiz ; ?is this new or clear?
  19. beq n108 ; end of cmd string
  20. lda cmdbuf,y ; format disk****
  21. sta dskid,x ; store in proper drive
  22. lda cmdbuf+1,y ; (y=0)
  23. sta dskid+1,x
  24. jsr clrchn ; clear all channels when formatting
  25. lda #1 ; ...in track, track=1
  26. sta track
  27. ;--------- patch7 for format bug 10/17/83---
  28. ;jsr format ;transfer format to ram
  29. jsr patch7 ; /set format flag
  30. ;-------------------------------------------
  31. jsr clrbam ; zero bam
  32. jmp n110
  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. lda jobnum
  42. tay
  43. asl a
  44. tax
  45. lda dsknam ; set ptr to disk name
  46. sta buftab,x
  47. ldx filtbl
  48. lda #27
  49. jsr trname ; transfer cmd buf to bam
  50. ldy #$12
  51. ldx drvnum
  52. lda vernum ; set dos's current format type
  53. sta dskver,x
  54. txa
  55. asl a
  56. tax
  57. lda dskid,x ; write directory's i.d.
  58. sta (dirbuf),y
  59. iny
  60. lda dskid+1,x
  61. sta (dirbuf),y
  62. iny
  63. iny
  64. lda #dosver+$30 ; write directory dos version
  65. sta (dirbuf),y
  66. iny
  67. lda vernum ; write directory format type
  68. sta (dirbuf),y
  69. ;
  70. ldy #2
  71. sta (bmpnt),y ; write diskette's format type
  72. lda dirtrk
  73. sta track
  74. jsr usedts ; set bam block used
  75. lda #1
  76. sta sector
  77. jsr usedts ; set 1st dir block used
  78. jsr scrbam ; scrub the bam
  79. jsr clrbam ; set to all 0's
  80. ldy #1
  81. lda #$ff ; set end link
  82. sta (bmpnt),y
  83. jsr drtwrt ; clear directory
  84. dec sector
  85. jsr drtrd ; read bam back
  86. jmp endcmd
  87. ;.end