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.

map.src 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. .page 'newmap'
  2. ;
  3. ; build a new map on diskette
  4. ;
  5. newmap
  6. newmpv
  7. jsr clnbam
  8. ldy #0
  9. lda #18 ; set link to 18.1
  10. sta (bmpnt),y
  11. iny
  12. tya
  13. sta (bmpnt),y
  14. iny
  15. iny
  16. iny ; .y=4
  17. nm10
  18. lda #0 ; clear track map
  19. sta t0
  20. sta t1
  21. sta t2
  22. ;
  23. tya
  24. lsr a
  25. lsr a ; .a=track #
  26. jsr maxsec
  27. sta (bmpnt),y
  28. iny
  29. tax
  30. nm20
  31. sec ; set map bits
  32. rol t0
  33. rol t1
  34. rol t2
  35. dex
  36. bne nm20
  37. nm30 ; .x=0
  38. lda t0,x
  39. sta (bmpnt),y
  40. iny
  41. inx
  42. cpx #3
  43. bcc nm30
  44. cpy #$90 ; end of bam
  45. bcc nm10
  46. jmp nfcalc ; calc # free sectors
  47. ;
  48. ;
  49. ;
  50. ;
  51. ; write out the bit map to
  52. ; the drive in lstjob(active)
  53. ;
  54. mapout jsr getact
  55. tax
  56. lda lstjob,x
  57. mo10 and #1
  58. sta drvnum ; check bam before writing
  59. ;
  60. ; write bam according to drvnum
  61. ;
  62. scrbam
  63. ldy drvnum
  64. lda mdirty,y
  65. bne sb10
  66. rts ; not dirty
  67. sb10
  68. lda #0 ; set to clean bam
  69. sta mdirty,y
  70. jsr setbpt ; set bit map ptr
  71. lda drvnum
  72. asl a
  73. pha
  74. ;put memory images to bam
  75. jsr putbam
  76. pla
  77. clc
  78. adc #1
  79. jsr putbam
  80. ; verify the bam block count
  81. ; matches the bits
  82. ;
  83. lda track
  84. pha ; save track var
  85. lda #1
  86. sta track
  87. sb20
  88. asl a
  89. asl a
  90. sta bmpnt
  91. jsr avck ; check available blocks
  92. inc track
  93. lda track
  94. cmp maxtrk
  95. bcc sb20
  96. pla ; restore track var
  97. sta track
  98. ;
  99. jmp dowrit ; write it out
  100. .page 'numfre'
  101. ;
  102. ; set bit map ptr, read in bam if nec.
  103. ;
  104. setbpt
  105. jsr bam2a
  106. tax
  107. jsr redbam ; read bam if not in
  108. ldx jobnum
  109. lda bufind,x ; set the ptr
  110. sta bmpnt+1
  111. lda #0
  112. sta bmpnt
  113. rts
  114. ;
  115. ; calc the number of free blocks on drvnum
  116. ;
  117. numfre
  118. ldx drvnum
  119. lda ndbl,x
  120. sta nbtemp
  121. lda ndbh,x
  122. sta nbtemp+1
  123. rts
  124. ; .end