home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_14_1986_Transactor_Publishing.d64 / scroll.pal (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  7KB  |  453 lines

  1. 1 rem -------------------------------
  2. 2 rem    list scroll and line rule
  3. 3 rem           scroll.s
  4. 4 rem -------------------------------
  5. 10 open 2,8,1,"0:scroll.obj"
  6. 12 rem open 4,4
  7. 14 sys 700
  8. 16 .opt o2
  9. 18 ;---
  10. 20 msgflg = 157 ;run mode
  11. 22 lstx = 197 ;last keypress
  12. 24 blnsw = 204 ;blink sw
  13. 26 gdbln = 206
  14. 28 blnon = 207
  15. 30 tblx = 214 ;line#
  16. 32 ldtb1 = 217 ;screen line links
  17. 34 txcadr = 646 ;col for text
  18. 36 gdcol = 647
  19. 38 lstshf = 654 ;last shift
  20. 40 ;---
  21. 42 *= $9d00 ;install address
  22. 44 jmp listup ;scroll up
  23. 46 jmp listdn ;scroll down
  24. 48 jmp lrule  ;line ruler
  25. 50 jmp lrkill ;kill line ruler
  26. 52 ;
  27. 54 ;vector tab for background rtns
  28. 56 ;set up by profile program
  29. 58 brstart *= *+3 ;start int rtn
  30. 60 brend *= *+3 ;end int rtn
  31. 62 ppstart *= *+3 ;start parallel rtn
  32. 64 ppexcl *= *+3 ;run exclusive
  33. 66 ppshare *= *+3 ;run shared
  34. 68 ppend *= *+3 ;end parallel rtn
  35. 70 rescur *= *+3 ;reset cursor
  36. 72 bgwork *= *+15 ;remaining jmps
  37. 74 ;
  38. 76 ;------------------------
  39. 78 ;the list scroll routines
  40. 80 ;
  41. 82 ;run time variables
  42. 84 skey = bgwork
  43. 86 sshf = skey+1
  44. 88 savel = sshf+1
  45. 90 savex = savel+1
  46. 92 savec = savex+1
  47. 94 savev = savec+2
  48. 96 first1 = savev+2
  49. 98 first2 = first1+1
  50. 100 ;
  51. 102 ;---entry from interrupt
  52. 104 listup = * ;scroll up
  53. 106 jsr liston
  54. 108 lup jsr listin
  55. 110 jsr lstup
  56. 112 jsr listout
  57. 114 beq lup
  58. 116 bne lexit
  59. 118 ;
  60. 120 ;---entry from interrupt
  61. 122 listdn = * ;scroll down
  62. 124 jsr liston
  63. 126 ldn jsr listin
  64. 128 lda #24
  65. 130 sta $d6
  66. 132 jsr $e56c
  67. 134 jsr lstdn
  68. 136 jsr listout
  69. 138 beq ldn
  70. 140 lexit jmp ppend
  71. 142 ;
  72. 144 ;---initiate parallel program
  73. 146 liston = * ;common point for up/dn
  74. 148 sty skey ;save entry key
  75. 150 stx sshf ;...and shift value
  76. 152 lda #$ff
  77. 154 sta first1
  78. 156 sta first2
  79. 158 pla ;ret addr=start of parallel prg
  80. 160 clc
  81. 162 adc #1
  82. 164 tax ;low byte
  83. 166 pla
  84. 168 adc #0
  85. 170 tay ;high byte
  86. 172 jmp ppstart ;start parallel program
  87. 174 ;
  88. 176 ;---list up
  89. 178 lstup = *
  90. 180 ldx #$ff
  91. 182 lu04 inx
  92. 184 cpx #25 ;all lines
  93. 186 beq lu12
  94. 188 lda $d9,x
  95. 190 bpl lu04 ;linked
  96. 192 jsr gnum ;get num
  97. 194 bcc lu04 ;none
  98. 196 bcs lu16
  99. 198 ;
  100. 200 lu12 lda #$ff ;high line num
  101. 202 sta $14
  102. 204 sta $15
  103. 206 lu16 jsr $a613 ;find line
  104. 208 ldy $5f ;lo byt
  105. 210 cpx $2c ;hi byt
  106. 212 bne lu20
  107. 214 cpy $2b ;with start
  108. 216 bne lu20
  109. 218 rts ;no prev lines
  110. 220 ;
  111. 222 lu20 dex ;lower
  112. 224 cpx $2c ;..than start
  113. 226 bcs lu24
  114. 228 ldx $2c ;correct
  115. 230 ldy $2b
  116. 232 dey
  117. 234 lu24 stx $40
  118. 236 sty $3f
  119. 238 ldy #0 ;search for
  120. 240 lu28 lda ($3f),y
  121. 242 beq lu36 ;end of line
  122. 244 lu32 iny
  123. 246 bne lu28
  124. 248 rts ;no more
  125. 250 ;
  126. 252 lu36 iny ;chk
  127. 254 lda ($3f),y ;link lo
  128. 256 cmp $5f
  129. 258 bne lu32 ;no match
  130. 260 iny
  131. 262 lda ($3f),y ;chk
  132. 264 cmp $60 ;link hi
  133. 266 bne lu32
  134. 268 dey
  135. 270 tya ;make match
  136. 272 clc
  137. 274 adc $3f
  138. 276 sta $5f
  139. 278 lda $40
  140. 280 adc #0
  141. 282 sta $60
  142. 284 ldx #24 ;chk last line
  143. 286 lda $d9,x
  144. 288 bmi lu40 ;not linked
  145. 290 ldx #23 ;2nd last
  146. 292 jsr $e9ff ;erase
  147. 294 lu40 ldx #0 ;to scrl dwn
  148. 296 jsr $e968
  149. 298 lda $d9
  150. 300 ora #$80 ;fix up link
  151. 302 sta $d9
  152. 304 lda #39 ;and length
  153. 306 sta $d5
  154. 308 ldx #1 ;set insrt
  155. 310 stx $292
  156. 312 dex
  157. 314 stx $d6 ;home
  158. 316 jsr $e9f0 ;position
  159. 318 jmp list
  160. 320 ;
  161. 322 ;---list down
  162. 324 lstdn = *
  163. 326 ldx #25
  164. 328 ld04 dex
  165. 330 bmi ld08 ;all lines
  166. 332 lda $d9,x
  167. 334 bpl ld04 ;linked
  168. 336 jsr gnum ;get line num
  169. 338 bcc ld04 ;none
  170. 340 bcs ld16
  171. 342 ;
  172. 344 ld08 lda #$ff ;set
  173. 346 sta $14 ;..for
  174. 348 sta $15 ;..1st line
  175. 350 ld12 pha ;save a byte
  176. 352 bne ld30
  177. 354 ld16 cpx #24 ;last
  178. 356 bne ld20
  179. 358 ld18 lda #$0d ;ret char
  180. 360 bne ld12
  181. 362 ld20 cpx #23 ;2nd last
  182. 364 bne ld24
  183. 366 inx
  184. 368 lda $d9,x
  185. 370 bpl ld18
  186. 372 ld24 lda #$ff
  187. 374 bne ld12
  188. 376 ld30 inc $14 ;lnum
  189. 378 bne ld32
  190. 380 inc $15
  191. 382 ld32 jsr $a613 ;find line
  192. 384 lda $da ;2nd line
  193. 386 bmi ld36 ;not linked
  194. 388 ora #$80 ;unlink it
  195. 390 sta $da
  196. 392 ldx #1
  197. 394 jsr $e9ff ;erase line
  198. 396 ld36 ldx #24 ;last line
  199. 398 stx $d6 ;curs row
  200. 400 jsr $e9f0 ;set curs
  201. 402 pla
  202. 404 bmi list
  203. 406 jsr $ffd2 ;print ret
  204. 408 ;
  205. 410 ;---
  206. 412 list = *
  207. 414 ldy #1
  208. 416 lda ($5f),y
  209. 418 beq ls24
  210. 420 sta savel
  211. 422 lda #0
  212. 424 sta ($5f),y ;to fool list
  213. 426 sty $f ;list qote flg
  214. 428 lda $5f
  215. 430 sta $3f
  216. 432 lda $60
  217. 434 sta $40
  218. 436 lda #$ff ;to max
  219. 438 sta $14
  220. 440 sta $15
  221. 442 jmp $a6d7 ;into list
  222. 444 ;
  223. 446 ;---
  224. 448 lserv =* ;err vec entry
  225. 450 cpx #$0b ;err from
  226. 452 beq ls32 ;..eval fxd pt
  227. 454 lda savel ;restore
  228. 456 ldy #1
  229. 458 sta ($3f),y
  230. 460 ls24 lda #$0d ;ret
  231. 462 jsr $ffd2
  232. 464 rts ;end
  233. 466 ;
  234. 468 ls32 pla:pla
  235. 470 pla:pla ;clr rtss
  236. 472 jmp ls24
  237. 474 ;
  238. 476 ;---
  239. 478 gnum = * ;get line num
  240. 480 jsr $e9f0 ;set line start addr
  241. 482 ldy #$ff
  242. 484 gn10 iny
  243. 486 lda ($d1),y
  244. 488 cpy #39
  245. 490 beq gn20+1 ;end of line
  246. 492 cmp #$20
  247. 494 beq gn10
  248. 496 cmp #$30
  249. 498 bcc gn20+1
  250. 500 cmp #$3a
  251. 502 bcs gn20+1
  252. 504 tya
  253. 506 clc
  254. 508 adc $d1
  255. 510 sta $7a
  256. 512 lda $d2
  257. 514 adc #0
  258. 516 sta $7b
  259. 518 jsr $79 ;chr(NULL)t
  260. 520 stx savex
  261. 522 jsr $a96b ;eval num to binary
  262. 524 ldx savex
  263. 526 sec
  264. 528 gn20 bit $18
  265. 530 rts
  266. 532 ;
  267. 534 ;---
  268. 536 listin = *
  269. 538 sei
  270. 540 ;
  271. 542 serv = * ;set err vect
  272. 544 lda $300
  273. 546 sta savev
  274. 548 lda $301
  275. 550 sta savev+1
  276. 552 lda #<lserv
  277. 554 sta $300
  278. 556 lda #>lserv
  279. 558 sta $301
  280. 560 ;
  281. 562 scur = * ;save cursor
  282. 564 jsr rescur ;reset cursor
  283. 566 lda #255 ;set blink off
  284. 568 sta blnsw
  285. 570 lda $d6
  286. 572 sta savec
  287. 574 lda $d3
  288. 576 sta savec+1
  289. 578 lda #0
  290. 580 sta $d3 ;column
  291. 582 cli
  292. 584 jsr ppexcl ;run exclusively
  293. 586 rts
  294. 588 ;
  295. 590 ;---
  296. 592 listout = *
  297. 594 sei
  298. 596 lda #0
  299. 598 sta $292 ;clr scroll
  300. 600 ;
  301. 602 rerv = * ;rst err vect
  302. 604 lda savev
  303. 606 sta $300
  304. 608 lda savev+1
  305. 610 sta $301
  306. 612 ;
  307. 614 rcur = * ;rst cursor
  308. 616 lda #0 ;set blink on
  309. 618 sta blnsw
  310. 620 ldx savec
  311. 622 stx $d6
  312. 624 lda savec+1
  313. 626 sta $d3
  314. 628 sec
  315. 630 sbc #40
  316. 632 bcc rcu10 ;not on 2nd
  317. 634 sta $d3
  318. 636 rcu10 jsr $e56c ;fix curs
  319. 638 ;
  320. 640 getkey = *
  321. 642 cli
  322. 644 ldy skey
  323. 646 ldx sshf
  324. 648 cpy lstx
  325. 650 bne gk40
  326. 652 cpx lstshf
  327. 654 gk40 rts
  328. 656 ;
  329. 658 ;---not used: same as rescur
  330. 660 rcurs = * ;reset cursor
  331. 662 lda blnon ;check blink
  332. 664 beq rc10
  333. 666 lda gdbln ;orig char
  334. 668 ldx gdcol ;orig colr
  335. 670 ldy #0
  336. 672 sty blnon ;clear blink
  337. 674 jsr $ea13 ;reset blink
  338. 676 rc10 rts
  339. 678 ;
  340. 680 ;*************************
  341. 682 ;
  342. 684 ;basic line ruler routine
  343. 686 ;
  344. 688 sprt = 832 ;sprite data area
  345. 690 spr = 53248 ;sprite register
  346. 692 scr = 2040 ;sprite variables
  347. 694 lrspyl = bgwork+13
  348. 696 lrspyc = bgwork+14
  349. 698 ;
  350. 700 lrule = * ;entry from interrupt
  351. 702 ldx #<ruler ;start addr of bg rtn
  352. 704 ldy #>ruler
  353. 706 jsr brstart ;start background rtn
  354. 708 bne lr30 ;resource is used!
  355. 710 ;
  356. 712 lda #0;make sprite
  357. 714 sta lrspyl
  358. 716 sta lrspyc
  359. 718 ldx #$3f
  360. 720 lr10 sta sprt,x
  361. 722 dex
  362. 724 bpl lr10
  363. 726 ldx #2
  364. 728 lda #$ff
  365. 730 lr12 sta sprt,x
  366. 732 dex
  367. 734 bpl lr12
  368. 736 ldx #2
  369. 738 lr14 sta sprt+27,x
  370. 740 dex
  371. 742 bpl lr14
  372. 744 ;
  373. 746 ldx #6
  374. 748 lda #13
  375. 750 lr20 sta scr,x ;ptrs
  376. 752 dex
  377. 754 bpl lr20
  378. 756 lda txcadr
  379. 758 jsr lr50 ;color
  380. 760 lda #$60
  381. 762 sta spr+16 ;msb x
  382. 764 sec
  383. 766 lda #216
  384. 768 ldx #8
  385. 770 lr24 sta spr,x ;x pos
  386. 772 sbc #48
  387. 774 dex
  388. 776 dex
  389. 778 bpl lr24
  390. 780 lda #8
  391. 782 sta spr+10 ;s5 x
  392. 784 lda #56
  393. 786 sta spr+12 ;s6 x
  394. 788 lda #$7f
  395. 790 sta spr+29 ;exp x
  396. 792 sta spr+21 ;enable
  397. 794 ldx #25
  398. 796 stx lrspyl
  399. 798 lr30 rts
  400. 800 ;
  401. 802 ;---kill line rule
  402. 804 lrkill = *
  403. 806 lda #0
  404. 808 sta spr+21 ;dsabl
  405. 810 jmp brend ;finish
  406. 812 ;
  407. 814 ;---
  408. 816 ruler = *
  409. 818 bit msgflg ;run
  410. 820 bpl lrkill
  411. 822 ;
  412. 824 lr40 = * ;position
  413. 826 jsr lrcolr
  414. 828 ldx tblx
  415. 830 cpx lrspyl
  416. 832 beq lr30
  417. 834 stx lrspyl
  418. 836 lda ldtb1,x
  419. 838 bmi lr42
  420. 840 dex
  421. 842 lr42 txa
  422. 844 asl a
  423. 846 asl a
  424. 848 asl a
  425. 850 clc
  426. 852 adc #49
  427. 854 ldx #12
  428. 856 lr44 sta spr+1,x ;y pos
  429. 858 dex
  430. 860 dex
  431. 862 bpl lr44
  432. 864 lda #0
  433. 866 ldx #40
  434. 868 cpx $d5 ;max
  435. 870 bcs lr46
  436. 872 lda #$7f
  437. 874 lr46 sta spr+23 ;y exp
  438. 876 jmp lr30
  439. 878 ;
  440. 880 ;---
  441. 882 lrcolr = *
  442. 884 lda txcadr
  443. 886 cmp lrspyc
  444. 888 beq lr58
  445. 890 lr50 sta lrspyc
  446. 892 ldx #6
  447. 894 lr52 sta spr+39,x ;color
  448. 896 dex
  449. 898 bpl lr52
  450. 900 lr58 rts
  451. 902 ;
  452. 904 .end
  453.