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.

newss.src 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. .page 'newss'
  2. ;*********************************
  3. ;* newss: generate new ss & fix *
  4. ;* old ss's to reflect it.*
  5. ;* vars: *
  6. ;* regs: *
  7. ;* *
  8. ;*********************************
  9. ;
  10. newss
  11. jsr nxtts ; get t&s based on hdr
  12. jsr dblbuf ; use inactive buffer
  13. jsr scrub
  14. jsr getact
  15. pha
  16. jsr clrbuf
  17. ldx lindx
  18. lda ss,x ; set regs for transfer
  19. tay
  20. pla
  21. tax
  22. lda #ssioff ; # of chars
  23. jsr b0tob0 ; transfer at buf(0)
  24. ;
  25. lda #0
  26. jsr ssdir
  27. ldy #2
  28. lda (dirbuf),y ; get ss #
  29. pha
  30. lda #0
  31. jsr setpnt
  32. pla
  33. clc
  34. adc #1
  35. sta (dirbuf),y ; put ss # in new ss
  36. asl a
  37. adc #4
  38. sta r3 ; save position
  39. tay
  40. sec
  41. sbc #2
  42. sta r4
  43. lda track
  44. sta r1 ; save for ss update
  45. sta (dirbuf),y ; put track in ss
  46. iny
  47. lda sector
  48. sta r2 ; save for ss update
  49. sta (dirbuf),y ; put sector in ss
  50. ldy #0
  51. tya
  52. sta (dirbuf),y ; null link
  53. iny
  54. lda #ssioff+1 ; ptr to last byte
  55. sta (dirbuf),y
  56. ;
  57. lda #ssioff
  58. jsr setpnt
  59. jsr wrtab
  60. jsr watjob
  61. ;
  62. ns20
  63. ldx lindx
  64. lda ss,x ; get ss buffer #
  65. pha
  66. jsr gaflgs
  67. ldx lindx
  68. sta ss,x ; swap act-buf & ss
  69. pla
  70. ldx lbused
  71. sta buf0,x
  72. ;
  73. lda #0
  74. jsr setpnt ; set link to new ss
  75. ldy #0
  76. lda track
  77. sta (dirbuf),y
  78. iny
  79. lda sector
  80. sta (dirbuf),y
  81. jmp ns50
  82. ns40
  83. jsr getact
  84. ldx lindx
  85. jsr ibrd ; read next ss
  86. lda #0
  87. jsr setpnt ; ptr=0
  88. ns50
  89. dec r4
  90. dec r4
  91. ldy r3 ; get new ss link ptr
  92. lda r1
  93. sta (dirbuf),y ; put track in
  94. iny
  95. lda r2
  96. sta (dirbuf),y ; put sector in
  97. ;
  98. jsr wrtout ; write it back...
  99. jsr watjob ; ...& wait
  100. ldy r4
  101. cpy #3
  102. bcs ns40 ; more ss to update!
  103. ;
  104. jmp dblbuf ; reset active buffer
  105. ; .end