home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 95 / 095.d81 / c-meister.sda / CATMEISTER.S < prev    next >
Text File  |  2022-08-26  |  14KB  |  1,437 lines

  1. open =$ffc0
  2. readst =$ffb7
  3. setlfs =$ffba
  4. setnam =$ffbd
  5. setmsg =$ff90
  6. load =$ffd5
  7. getin =$ffe4
  8. input'buffer =512
  9. clrchn =$ffcc
  10. close =$ffc3   ;a
  11. chrin =$ffcf
  12. chkout =$ffc9  ;x
  13. chkin =$ffc6   ;x
  14. plot =$fff0
  15. chrout =$ffd2
  16. color'pointer =243
  17. screen'line'pointer =209
  18. print'number =$bdcd ;x,a
  19. clear'line =59903
  20. background =53281
  21. border =53280
  22. strout = $ab1e; .A low .Y high
  23. unlisten =$ffae
  24. clall =$ffe7
  25. color1 =53282
  26. color2 =53283
  27. color3 =53284
  28. white =5
  29. crsr'down =17
  30. rvs'on =18
  31. home =19
  32. del =20
  33. red =28
  34. crsr'right =29
  35. green =30
  36. blue =31
  37. black =144
  38. lowercase =14
  39. uppercase =142
  40. crsr'up =145
  41. rvs'off =146
  42. clr =147
  43. insert =148
  44. brown =149
  45. light'red =150
  46. dark'grey =151
  47. medium'grey =152
  48. light'green =153
  49. light'blue =154
  50. light'grey =155
  51. purple =156
  52. crsr'left =157
  53. yellow =158
  54. cyan =159
  55. top'left =176
  56. top'right =174
  57. bottom'left =173
  58. bottom'right =189
  59. bottom'pointer =247
  60. top'pointer =249
  61. buffer =$200
  62.  
  63. ;****dir menu*****
  64. ;sys wildcard$,device,address,x,y,depth,color,highlight
  65.  
  66. .org $9500
  67. .obj "c-meister 9500"
  68. ;mem
  69.  
  70. jmp dir'menu
  71. jmp redisplay'entry
  72. jmp just'load'it
  73. jmp index'name
  74. jmp blocks'free
  75. jmp box'entry
  76. jmp screen'stash
  77. jmp screen'restore
  78. jmp print'at
  79. jmp center
  80. jmp bload
  81. jmp d'keyboard
  82. jmp scroll
  83. jmp clear'row
  84. jmp disk'command
  85.  
  86. redisplay'entry jsr zero'restore
  87. jmp redisplay
  88.  
  89. abort lda #4
  90. sta 251
  91. - jsr get'number
  92. dec 251
  93. bpl -
  94. abort2 jsr clear'buffer
  95. lda #0
  96. sta wlength
  97. jmp make'wstring
  98.  
  99. just'load'it lda #255
  100. sta wlength
  101. jmp +
  102. dir'menu lda #0
  103. sta wlength
  104. + jsr get'string
  105. jsr setnam
  106. jsr get'number
  107. sty device
  108. lda #2
  109. jsr close
  110. lda #2
  111. ldx device
  112. ldy #0
  113. jsr setlfs
  114. jsr open
  115.  
  116. lda #0
  117. sta that's'it
  118. lda #255
  119. sta files
  120. sta files+1
  121. jsr clrchn
  122. ldx #2
  123. jsr chkin
  124.  
  125. jsr getin
  126. jsr getin
  127.  
  128. jsr get'number
  129. sty 251
  130. sta 252
  131. sty address
  132. sta address+1
  133.  
  134. loop inc files
  135. bne +
  136. inc files+1
  137. + jsr fill'buffer
  138. jsr readst
  139. and #64
  140. bne +
  141. lda that's'it
  142. bne +
  143. beq loop
  144.  
  145. + lda #2
  146. jsr close
  147. lda #0
  148. tax
  149. tay
  150. jsr setnam
  151. lda #15
  152. ldx device
  153. ldy #15
  154. jsr setlfs
  155. jsr open
  156. jsr read'open'error
  157. lda #15
  158. jsr close
  159. jsr clrchn
  160. lda error'string
  161. cmp "0"
  162. beq +
  163. jmp abort
  164.  
  165. + lda files+1
  166. bne +
  167. lda files
  168. cmp #2
  169. bcs +
  170. jmp abort
  171.  
  172. + lda wlength
  173. beq redisplay
  174. jmp clear'buffer
  175.  
  176. redisplay jsr get'number
  177. cpy #20
  178. bcc +
  179. ldy #20
  180. + sty menu'x
  181. sty parms
  182. tya
  183. clc
  184. adc #19
  185. sta parms+1
  186. jsr get'number
  187. cpy #20
  188. bcc +
  189. ldy #19
  190.  
  191. + sty menu'y
  192. sty parms+2
  193. jsr get'number
  194. cpy #2
  195. bcs +
  196. ldy #2
  197. / sty menu'depth
  198. iny
  199. iny
  200. iny
  201. tya
  202. clc
  203. adc parms+2
  204. cmp #25
  205. bcc +
  206. ldy menu'depth
  207. dey
  208. bpl -
  209.  
  210. + sta parms+3
  211. lda #160
  212. sta parms+4
  213. jsr get'number
  214. sty menu'color
  215. sty parms+5
  216. jsr get'number
  217. sty menu'highlight
  218.  
  219. jsr fill'box
  220.  
  221. ldy menu'x
  222. iny
  223. sty parms
  224. tya
  225. dey
  226. clc
  227. adc #17
  228. sta parms+1
  229. ldy menu'y
  230. iny
  231. sty parms+2
  232. dey
  233. tya
  234. clc
  235. adc menu'depth
  236. sta parms+3
  237. lda #32
  238. sta parms+4
  239. lda menu'color
  240. sta parms+5
  241. ldy #3
  242.  
  243. - lda parms,y
  244. sta startingx,y ;set scroll parameters
  245. dey
  246. bpl -
  247.  
  248. jsr fill'box
  249.  
  250. ldx parms+3
  251. inx
  252. inx
  253. ldy parms
  254. clc
  255. jsr plot
  256. lda #1
  257. sta 199
  258. lda menu'color
  259. sta 646
  260. lda <prompt
  261. ldy >prompt
  262. jsr strout
  263.  
  264. inc menu'x
  265. inc menu'y
  266. menu'reenter ldx menu'y
  267. ldy menu'x
  268. clc
  269. iny
  270. jsr plot
  271. lda #0
  272. sta 199
  273. lda menu'color
  274. sta 646
  275.  
  276. fill'menu lda #0
  277. sta item
  278. sta menu'item
  279. lda address
  280. sta 253
  281. lda address+1
  282. sta 254
  283. lda #32
  284. sta char
  285.  
  286. sei
  287. ldx #$74
  288. stx 1
  289. ldy #0
  290. - lda (253),y
  291. jsr adjust'pointer
  292. cmp #0
  293. bne -
  294.  
  295. lda 253
  296. sta top
  297. sta top'pointer
  298. lda 254
  299. sta top'pointer+1
  300. sta top+1
  301.  
  302. - sei
  303. ldy #0
  304. lda #$74
  305. sta 1
  306. lda (253),y
  307. jsr adjust'pointer
  308. cmp #0
  309. bne +
  310. jmp next'name
  311. + ldx #$77
  312. stx 1
  313. stx 212
  314. jsr chrout
  315. bne -
  316.  
  317. next'name lda #$77
  318. sta 1
  319.  
  320. lda 254
  321. cmp 252
  322. bne +
  323. lda 253
  324. cmp 251
  325. beq bottom
  326.  
  327. + ldx item
  328. inx
  329. cpx menu'depth
  330. beq bottom
  331. stx item
  332.  
  333. inc 214
  334. ldx menu'x
  335. inx
  336. stx 211
  337. jsr 58732
  338. jmp -
  339.  
  340. bottom lda #0
  341. sta item
  342. sta 198
  343. lda #$77
  344. sta 1
  345. cli
  346.  
  347. lda item
  348. jsr item'on
  349.  
  350. get'key jsr getin
  351. beq get'key
  352.  
  353. cmp #133
  354. bne +
  355. jsr pup
  356. + cmp #136
  357. bne +
  358. jsr pdown
  359.  
  360. + cmp #3
  361. bne +
  362. jsr item'off
  363. - bit 197
  364. bvc -
  365.  
  366. jsr delay
  367. jsr zero'stash
  368. jmp abort2
  369.  
  370. + cmp #19;    home
  371. bne +
  372. jmp move'home
  373. + cmp #crsr'down
  374. beq down'pressed
  375. cmp #crsr'up
  376. beq up'pressed
  377. cmp #13
  378. beq return'pressed
  379. bne get'key
  380.  
  381. down'pressed lda files+1
  382. bne +
  383. ldy item
  384. iny
  385. iny
  386. cpy files
  387. beq get'key
  388.  
  389. + ldy item
  390. iny 
  391.  
  392. cpy menu'depth
  393. bcs down'we'go
  394. jsr item'off
  395. ldy item
  396. iny
  397. sty item
  398. jsr item'on
  399. jmp get'key
  400.  
  401. lda file+1
  402. cmp files+1
  403. bcc +
  404. lda file
  405. cmp files
  406. bcs get'key
  407.  
  408. up'pressed ldy item
  409. bne +
  410. jmp up'we'go
  411. + jsr item'off
  412. ldy item
  413. dey
  414. sty item
  415.  
  416. cpy menu'depth
  417. bcs +
  418. jsr item'on
  419. + jmp get'key
  420.  
  421. return'pressed jsr zero'stash
  422. jsr get'file
  423. jmp clear'buffer
  424.  
  425. down'we'go lda 254
  426. cmp 252
  427. bcc +
  428. lda 253
  429. cmp 251
  430. bcs bottom'out
  431. + lda #0
  432. sta direction
  433. jsr zero'stash
  434. jsr item'off
  435. jsr scroll'up
  436. jsr clear'ml'enter
  437. jsr zero'restore
  438.  
  439. print'bottom lda #0
  440. sta 212
  441. lda #crsr'right
  442. jsr chrout
  443. sei
  444. lda #$74
  445. sta 1
  446. ldy #0
  447.  
  448. - lda (top'pointer),y
  449. jsr adjust'top
  450. cmp #0
  451. bne -
  452.  
  453. - sei
  454. ldy #0
  455. lda #$74
  456. sta 1
  457. lda (253),y
  458. jsr adjust'pointer
  459. cmp #0
  460. bne +
  461. jmp bottom'out
  462. + ldx #$77
  463. stx 1
  464. stx 212
  465. jsr chrout
  466. bne -
  467.  
  468. bottom'out lda #$77
  469. sta 1
  470. cli
  471. jsr item'on
  472. jmp get'key
  473.  
  474. up'we'go lda top'pointer+1
  475. cmp top+1
  476. bne +
  477. lda top'pointer
  478. cmp top
  479. beq bottom'out
  480. + lda #1
  481. sta direction
  482. jsr zero'stash
  483. jsr item'off
  484. jsr scroll'down
  485. jsr clear'ml'enter
  486. jsr zero'restore
  487.  
  488. print'top lda #0
  489. sta 212
  490. lda #crsr'right
  491. jsr chrout
  492. sei
  493. lda #$74
  494. sta 1
  495. ldy #0
  496.  
  497. jsr dec'pointer
  498. jsr dec'pointer
  499. - lda (253),y
  500. jsr dec'pointer
  501. cmp #0
  502. bne -
  503. jsr adjust'pointer
  504. jsr adjust'pointer
  505.  
  506. jsr dec'top
  507. jsr dec'top
  508. ldy #0
  509. - lda (top'pointer),y
  510. jsr dec'top
  511. cmp #0
  512. bne -
  513. jsr adjust'top
  514. jsr adjust'top
  515.  
  516. - sei
  517. ldy #0
  518. lda #$74
  519. sta 1
  520. lda (top'pointer),y
  521. jsr adjust'top
  522. cmp #0
  523. bne +
  524. jmp top'out
  525. + ldx #$77
  526. stx 1
  527. stx 212
  528. jsr chrout
  529. bne -
  530.  
  531. top'out jsr dec'top
  532. jsr dec'top
  533. ldy #0
  534. - lda (top'pointer),y
  535. jsr dec'top
  536. cmp #0
  537. bne -
  538. jsr adjust'top
  539. jsr adjust'top
  540.  
  541. jmp bottom'out
  542.  
  543. move'home jsr item'off
  544. lda item
  545. beq +
  546. lda #0
  547. sta item
  548. jsr item'on
  549. jmp get'key
  550. + lda #0
  551. sta 212
  552. jsr fill'box
  553. jmp menu'reenter
  554.  
  555.  
  556. fill'buffer ldy #0
  557. - jsr getin
  558. sta buffer,y
  559. iny
  560. cpy #32
  561. bne -
  562.  
  563. copy'name sei
  564. lda #$74
  565. sta 1
  566. ldy #0
  567.  
  568. find'quote ldx #2
  569. - lda buffer,x
  570. cmp #34
  571. beq +
  572. inx
  573. cpx #30
  574. bcc -
  575.  
  576. lda #1
  577. sta that's'it
  578. jmp normal
  579.  
  580. + inx
  581.  
  582. - lda buffer,x
  583. cmp #34
  584. beq +
  585. sta (251),y
  586. jsr bump
  587. inx
  588. bne -
  589.  
  590. + lda #0
  591. sta (251),y
  592. jsr bump
  593.  
  594. normal lda #$77
  595. sta 1
  596. cli
  597. rts
  598.  
  599. bump inc 251
  600. bne +
  601. inc 252
  602. + rts
  603.  
  604.  
  605. box'entry lda #0
  606. sta temp
  607. - jsr get'number
  608. tya
  609. ldy temp
  610. sta parms,y
  611. inc temp
  612. cpy #5
  613. bne -
  614.  
  615. fill'box jsr linx
  616. box'start ldx parms+2
  617. ldy #0
  618. clc
  619. jsr $fff0
  620. jsr old'rom'patch
  621. dec parms
  622.  
  623. - ldy parms+1
  624. - lda parms+4
  625. cmp #255
  626. beq +
  627. sta (209),y
  628. + lda parms+5
  629. sta (243),y
  630. dey
  631. cpy parms
  632. bne -
  633. lda 214
  634. cmp parms+3
  635. beq +
  636.  
  637. inc 214
  638. jsr 58732
  639. jsr old'rom'patch
  640. jmp --
  641. + inc parms
  642. lda #home
  643. jmp $ffd2
  644.  
  645. linx ldy #24
  646. - lda 217,y
  647. ora #128
  648. sta 217,y
  649. dey
  650. bpl -
  651. rts
  652.  
  653. get'number jsr $aefd
  654. jsr $ad8a
  655. jmp $b7f7
  656.  
  657.  
  658. old'rom'patch lda 210
  659. sec
  660. sbc 648
  661. clc
  662. adc #$d8
  663. sta 244
  664. lda 209
  665. sta 243
  666. rts
  667.  
  668. d'keyboard lda 53280
  669. sta 646
  670. ldy #0
  671. - lda dynamic'keyboard,y
  672. jsr $ffd2
  673. cmp #34
  674. beq +
  675. iny
  676. bne -
  677.  
  678. + sty 251
  679. jsr get'string
  680. sta temp
  681. ldy #0
  682. - lda ($22),y
  683. jsr chrout
  684. iny
  685. cpy temp
  686. bne -
  687.  
  688. lda #34
  689. jsr chrout
  690. lda ","
  691. jsr chrout
  692. jsr get'number
  693. tya
  694. tax
  695. lda #0
  696. jsr print'number
  697.  
  698. ldy 251
  699. iny
  700. - lda dynamic'keyboard,y
  701. beq +
  702. jsr chrout
  703. iny
  704. bne -
  705.  
  706. + lda #13
  707. sta 631
  708. sta 632
  709. lda #2
  710. sta 198
  711. rts
  712.  
  713. ;***** get string from BASIC ****
  714.  
  715. get'string jsr $aefd
  716. jsr $ad9e
  717. jsr $b6a3
  718.  
  719. ldx $22
  720. ldy $23
  721. rts
  722.  
  723. bload jsr get'string
  724. jsr setnam
  725. jsr get'number
  726. tya
  727. tax
  728. lda #1
  729. ldy #0
  730. jsr setlfs
  731. jsr get'number
  732. ldx $14
  733. ldy $15
  734. lda #0
  735. jmp load
  736.  
  737. adjust'pointer inc 253
  738. bne +
  739. inc 254
  740. + ldx 253
  741. stx bottom'pointer
  742. ldx 254
  743. stx bottom'pointer+1
  744. rts
  745.  
  746. adjust'top ldy #0
  747. inc top'pointer
  748. bne +
  749. inc top'pointer+1
  750. + rts
  751.  
  752. dec'pointer ldy #0
  753. dec 253
  754. ldx 253
  755. cpx #255
  756. bne +
  757. dec 254
  758. + stx bottom'pointer
  759. ldx 254
  760. stx bottom'pointer+1
  761. rts
  762.  
  763. dec'top ldy #0
  764. dec top'pointer
  765. ldx top'pointer
  766. cpx #255
  767. bne +
  768. dec top'pointer+1
  769. + rts
  770.  
  771. ;scroll sysaddr,x,to x,y, to y, direction
  772. ;dir 0=up 1= down 
  773. ;clear line sysaddr+3,screen code,color
  774.  
  775.  
  776. scroll jsr linx
  777. jsr get'number
  778. sty startingx
  779. cpy #40
  780. bcs quit
  781. jsr get'number
  782. sty endingx
  783. cpy #40
  784. bcs quit
  785. jsr get'number
  786. sty startingy
  787. cpy #25
  788. bcs quit
  789. jsr get'number
  790. sty endingy
  791. cpy #25
  792. bcs quit
  793. jsr get'number
  794. cpy #2
  795. bcs quit
  796. sty direction
  797.  
  798. jsr linx
  799. lda direction
  800. beq scroll'up
  801. jmp scroll'down
  802. quit rts
  803.  
  804. scroll'up ldy startingx
  805. ldx startingy
  806. stx line
  807. clc
  808. jsr plot
  809. jsr old'rom'patch
  810.  
  811. scroll'up'math clc
  812. lda 209
  813. adc <40
  814. sta 251
  815. lda 210
  816. adc >40
  817. sta 252
  818.  
  819. clc
  820. lda