home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 65 / 065.d81 / ss.pal (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  2KB  |  153 lines

  1. 100 rem open2,8,1,"ss baby.o"
  2. 110 sys700
  3. 120 ;
  4. 130 .opt oo
  5. 140 ;
  6. 150 memctrl = $01
  7. 160 maskout = %11111101
  8. 170 maskin = %00000010
  9. 180 frmevl = $ad9e
  10. 190 getcomma = $aefd
  11. 200 convert = $b1aa
  12. 210 illquan = $b248
  13. 220 pntr1 = $fb
  14. 230 pntr2 = pntr1 + 2
  15. 240 ;
  16. 250 dummyloc = $ff00
  17. 260 kill = $60
  18. 270 theenmi = $fffa
  19. 280 ;
  20. 290 clc ; preserve a screen
  21. 300 nop ;
  22. 310 .byte $24
  23. 320 ;
  24. 330 sec ; restore a screen
  25. 340 ;
  26. 350 php ; save flags
  27. 360 sei ; disable irq's
  28. 370 ;
  29. 380 ldx #0 ; init vector to disable
  30. 390 stx theenmi ;  nmi's
  31. 400 dex ;
  32. 410 stx theenmi+1 ;
  33. 420 ;
  34. 430 lda #kill ; put an 'rti' at
  35. 440 sta dummyloc ;  dummy location
  36. 450 ;
  37. 460 lda pntr1 ; preserve the contents
  38. 470 pha ;  of two 16-bit pointers
  39. 480 lda pntr1+1 ;
  40. 490 pha ;
  41. 500 lda pntr2 ;
  42. 510 pha ;
  43. 520 lda pntr2+1 ;
  44. 530 pha ;
  45. 540 ;
  46. 550 php ; save get/restore flag
  47. 560 ;
  48. 570 jsr getcomma ; skip past comma
  49. 580 jsr frmevl ; evaluate expression
  50. 590 jsr convert ;
  51. 600 ;
  52. 610 ; on return -- a=msb, y=lsb
  53. 620 ;                of integer number
  54. 630 ;
  55. 640 tax ; exit if acc != 0
  56. 650 bne error ;
  57. 660 ;
  58. 670 sta pntr1 ; clear lsb of each pntr
  59. 680 sta pntr2 ;
  60. 690 ;
  61. 700 tya ;
  62. 710 and #7 ; mask the lsb
  63. 720 beq error ; exit if acc = 0
  64. 730 ;
  65. 740 asl ; multiply by eight
  66. 750 asl ;
  67. 760 asl ;
  68. 770 ;
  69. 780 cmp #%00101000 ; determine which
  70. 790 bcc less ;  rom to look under
  71. 800 adc #$b7 ; if > #$20, then kernal
  72. 810 .byte $2c
  73. 820 less adc #$98 ; else basic rom
  74. 830 sta pntr2+1 ;
  75. 840 ;
  76. 850 ldy 648 ; get msb of screen
  77. 860 beq error ;
  78. 870 sty pntr1+1 ;
  79. 880 ;
  80. 890 lda memctrl ; switch out both roms
  81. 900 and #maskout ;
  82. 910 sta memctrl ;
  83. 920 ;
  84. 930 plp ; fetch get/restore flag
  85. 940 ;
  86. 950 ldx #4 ;
  87. 960 ldy #0 ;
  88. 970 ;
  89. 980 bcs recall ;
  90. 990 ;
  91. 1000 l1 lda (pntr1),y ;
  92. 1010 sta (pntr2),y ;
  93. 1020 iny ;
  94. 1030 bne l1 ;
  95. 1040 inc pntr1+1 ;
  96. 1050 inc pntr2+1 ;
  97. 1060 dex ;
  98. 1070 bne l1 ;
  99. 1080 lda #$d8 ;
  100. 1090 sta pntr1+1 ;
  101. 1100 ldx #4 ;
  102. 1110 l2 lda (pntr1),y ;
  103. 1120 sta (pntr2),y ;
  104. 1130 iny ;
  105. 1140 bne l2 ;
  106. 1150 inc pntr1+1 ;
  107. 1160 inc pntr2+1 ;
  108. 1170 dex ;
  109. 1180 bne l2 ;
  110. 1190 beq exit ;
  111. 1200 ;
  112. 1210 ;
  113. 1220 error pla ;
  114. 1230 clv ;
  115. 1240 bvc exit ;
  116. 1250 ;
  117. 1260 ;
  118. 1270 recall = *
  119. 1280 lda (pntr2),y ;
  120. 1290 sta (pntr1),y ;
  121. 1300 iny ;
  122. 1310 bne recall ;
  123. 1320 inc pntr1+1 ;
  124. 1330 inc pntr2+1 ;
  125. 1340 dex ;
  126. 1350 bne recall ;
  127. 1360 ldx #4 ;
  128. 1370 lda #$d8 ;
  129. 1380 sta pntr1+1 ;
  130. 1390 l3 lda (pntr2),y ;
  131. 1400 sta (pntr1),y ;
  132. 1410 iny ;
  133. 1420 bne l3 ;
  134. 1430 inc pntr1+1 ;
  135. 1440 inc pntr2+1 ;
  136. 1450 dex ;
  137. 1460 bne l3 ;
  138. 1470 ;
  139. 1480 exit lda memctrl ;
  140. 1490 ora #maskin ;
  141. 1500 sta memctrl ;
  142. 1510 ;
  143. 1520 pla ;
  144. 1530 sta pntr2+2 ;
  145. 1540 pla ;
  146. 1550 sta pntr2 ;
  147. 1560 pla ;
  148. 1570 sta pntr1+1 ;
  149. 1580 pla ;
  150. 1590 sta pntr1 ;
  151. 1600 plp ;
  152. 1610 rts ;
  153.