home *** CD-ROM | disk | FTP | other *** search
/ Loadstar Extras 3 / Ex3side1.d64 / toolbox.s < prev    next >
Encoding:
Text File  |  1990-01-01  |  21.0 KB  |  2,111 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. loc1 =$14
  63. loc2 =$22
  64. source =251
  65. end =253
  66. destination =$14
  67. temp =2
  68.  
  69. ;****dir menu*****
  70. ;sys wildcard$,device,address,x,y,depth,color,highlight
  71.  
  72. .org $9000
  73. .obj "@0:toolbox 9000"
  74. ;mem
  75. ;dis e
  76. jmp dir'menu
  77. jmp redisplay'entry      ;+3
  78. jmp just'load'it;        ;+6
  79. jmp index'name           ;+9
  80. jmp blocks'free          ;+12
  81. jmp box'entry ;          
  82. jmp screen'stash
  83. jmp screen'restore
  84. jmp print'at
  85. jmp center
  86. jmp bload
  87. jmp d'keyboard
  88. jmp scroll
  89. jmp clear'row
  90. jmp disk'command
  91. jmp brancher             ;+45
  92. jmp menu'entry           ;+48
  93. jmp reader               ;+51
  94. jmp copymem              ;+54
  95. jmp copymem+7 ;swappymem ;+57
  96. jmp copymem+14;ROM in copy;60
  97. jmp inpanyii              ;63
  98. jmp get'word              ;66
  99. jmp linx                  ;69
  100. jmp shade'area            ;72
  101.  
  102. redisplay'entry jsr zero'restore
  103. jmp redisplay
  104.  
  105. abort lda #4
  106. sta 251
  107. - jsr get'number
  108. dec 251
  109. bpl -
  110. abort2 jsr clear'buffer
  111. lda #0
  112. sta wlength
  113. jmp make'wstring
  114.  
  115. just'load'it lda #255
  116. sta sub'low
  117. bne +
  118. dir'menu lda #0
  119. sta sub'low
  120. + jsr get'string
  121. jsr setnam
  122. jsr get'number
  123. sty device
  124. lda #2
  125. jsr close
  126. lda #2
  127. ldx device
  128. ldy #0
  129. jsr setlfs
  130. jsr open
  131.  
  132. jsr get'number
  133. sty 251
  134. sta 252
  135. sty address
  136. sta address+1
  137.  
  138. lda #0
  139. sta that's'it
  140. lda #255
  141. sta files
  142. sta files+1
  143. jsr clrchn
  144. ldx #2
  145. jsr chkin
  146.  
  147. jsr getin
  148. jsr getin
  149.  
  150. loop inc files
  151. bne +
  152. inc files+1
  153. + jsr fill'buffer
  154. jsr readst
  155. and #64
  156. bne +
  157. lda that's'it
  158. bne +
  159. beq loop
  160.  
  161. + lda #2
  162. jsr close
  163. jsr zero'stash
  164. lda files
  165. sta 201
  166. lda files+1
  167. sta 202
  168. dec 201
  169. lda 201
  170. cmp #255
  171. bne +
  172. dec 202
  173.  
  174. + jsr make'variable
  175. jsr zero'restore
  176. lda #0
  177. tax
  178. tay
  179. jsr setnam
  180. jsr open'duh'error
  181. jsr read'open'error
  182. lda #15
  183. jsr close
  184. jsr clrchn
  185. lda error'string
  186. cmp "0"
  187. beq +
  188. bit sub'low
  189. bmi +
  190. jmp abort
  191.  
  192. + lda files+1
  193. bne +
  194. lda files
  195. cmp #2
  196. bcs +
  197. bit sub'low
  198. bmi +
  199. jmp abort
  200.  
  201. + bit sub'low
  202. beq redisplay
  203. jmp clear'buffer
  204.  
  205. redisplay jsr get'number
  206. cpy #20
  207. bcc +
  208. ldy #20
  209. + sty menu'x
  210. sty parms
  211. tya
  212. clc
  213. adc #19
  214. sta parms+1
  215. jsr get'number
  216. cpy #20
  217. bcc +
  218. ldy #19
  219.  
  220. + sty menu'y
  221. sty parms+2
  222. jsr get'number
  223. cpy #2
  224. bcs +
  225. ldy #2
  226. / sty menu'depth
  227. iny
  228. iny
  229. iny
  230. tya
  231. clc
  232. adc parms+2
  233. cmp #25
  234. bcc +
  235. ldy menu'depth
  236. dey
  237. bpl -
  238.  
  239. + sta parms+3
  240. lda #160
  241. sta parms+4
  242. jsr get'number
  243. sty menu'color
  244. sty parms+5
  245. jsr get'number
  246. sty menu'highlight
  247.  
  248. jsr fill'box
  249.  
  250. ldy menu'x
  251. iny
  252. sty parms
  253. tya
  254. dey
  255. clc
  256. adc #17
  257. sta parms+1
  258. ldy menu'y
  259. iny
  260. sty parms+2
  261. dey
  262. tya
  263. clc
  264. adc menu'depth
  265. sta parms+3
  266. lda #32
  267. sta parms+4
  268. lda menu'color
  269. sta parms+5
  270. ldy #3
  271.  
  272. - lda parms,y
  273. sta startingx,y ;set scroll parameters
  274. dey
  275. bpl -
  276.  
  277. jsr fill'box
  278.  
  279. ldx parms+3
  280. inx
  281. inx
  282. ldy parms
  283. clc
  284. jsr plot
  285. lda #1
  286. sta 199
  287. lda menu'color
  288. sta 646
  289. lda <prompt
  290. ldy >prompt
  291. jsr strout
  292.  
  293. inc menu'x
  294. inc menu'y
  295. menu'reenter ldx menu'y
  296. ldy menu'x
  297. clc
  298. iny
  299. jsr plot
  300. lda #0
  301. sta 199
  302. lda menu'color
  303. sta 646
  304.  
  305. fill'menu lda #0
  306. sta item
  307. sta menu'item
  308. lda address
  309. sta 253
  310. lda address+1
  311. sta 254
  312. lda #32
  313. sta char
  314.  
  315. sei
  316. ldx #$74
  317. stx 1
  318. ldy #0
  319. - lda (253),y
  320. jsr adjust'pointer
  321. cmp #0
  322. bne -
  323.  
  324. lda 253
  325. sta top
  326. sta top'pointer
  327. lda 254
  328. sta top'pointer+1
  329. sta top+1
  330.  
  331. - sei
  332. ldy #0
  333. lda #$74
  334. sta 1
  335. lda (253),y
  336. jsr adjust'pointer
  337. cmp #0
  338. bne +
  339. jmp next'name
  340. + ldx #$77
  341. stx 1
  342. stx 212
  343. jsr chrout
  344. bne -
  345.  
  346. next'name lda #$77
  347. sta 1
  348.  
  349. lda 254
  350. cmp 252
  351. bne +
  352. lda 253
  353. cmp 251
  354. beq bottom
  355.  
  356. + ldx item
  357. inx
  358. cpx menu'depth
  359. beq bottom
  360. stx item
  361.  
  362. inc 214
  363. ldx menu'x
  364. inx
  365. stx 211
  366. jsr 58732
  367. jmp -
  368.  
  369. bottom lda #0
  370. sta item
  371. sta 198
  372. lda #$77
  373. sta 1
  374. cli
  375.  
  376. lda item
  377. jsr item'on
  378.  
  379. get'key jsr getin
  380. beq get'key
  381.  
  382. cmp #133
  383. bne +
  384. jsr pup
  385. + cmp #136
  386. bne +
  387. jsr pdown
  388.  
  389. + cmp #3
  390. bne +
  391. jsr item'off
  392. - bit 197
  393. bvc -
  394.  
  395. jsr delay
  396. jsr zero'stash
  397. jmp abort2
  398.  
  399. + cmp #19;    home
  400. bne +
  401. jmp move'home
  402. + cmp #crsr'down
  403. beq down'pressed
  404. cmp #crsr'up
  405. beq up'pressed
  406. cmp #13
  407. beq return'pressed
  408. bne get'key
  409.  
  410. down'pressed lda files+1
  411. bne +
  412. ldy item
  413. iny
  414. iny
  415. cpy files
  416. beq get'key
  417.  
  418. + ldy item
  419. iny 
  420.  
  421. cpy menu'depth
  422. bcs down'we'go
  423. jsr item'off
  424. ldy item
  425. iny
  426. sty item
  427. jsr item'on
  428. jmp get'key
  429.  
  430. lda file+1
  431. cmp files+1
  432. bcc +
  433. lda file
  434. cmp files
  435. bcs get'key
  436.  
  437. up'pressed ldy item
  438. bne +
  439. jmp up'we'go
  440. + jsr item'off
  441. ldy item
  442. dey
  443. sty item
  444.  
  445. cpy menu'depth
  446. bcs +
  447. jsr item'on
  448. + jmp get'key
  449.  
  450. return'pressed jsr zero'stash
  451. jsr get'file
  452. jmp clear'buffer
  453.  
  454. down'we'go lda 254
  455. cmp 252
  456. bcc +
  457. lda 253
  458. cmp 251
  459. bcs bottom'out
  460. + lda #0
  461. sta direction
  462. jsr zero'stash
  463. jsr item'off
  464. jsr scroll'up
  465. jsr clear'ml'enter
  466. jsr zero'restore
  467.  
  468. print'bottom lda #0
  469. sta 212
  470. lda #crsr'right
  471. jsr chrout
  472. sei
  473. lda #$74
  474. sta 1
  475. ldy #0
  476.  
  477. - lda (top'pointer),y
  478. jsr adjust'top
  479. cmp #0
  480. bne -
  481.  
  482. - sei
  483. ldy #0
  484. lda #$74
  485. sta 1
  486. lda (253),y
  487. jsr adjust'pointer
  488. cmp #0
  489. bne +
  490. jmp bottom'out
  491. + ldx #$77
  492. stx 1
  493. stx 212
  494. jsr chrout
  495. bne -
  496.  
  497. bottom'out lda #$77
  498. sta 1
  499. cli
  500. jsr item'on
  501. jmp get'key
  502.  
  503. up'we'go lda top'pointer+1
  504. cmp top+1
  505. bne +
  506. lda top'pointer
  507. cmp top
  508. beq bottom'out
  509. + lda #1
  510. sta direction
  511. jsr zero'stash
  512. jsr item'off
  513. jsr scroll'down
  514. jsr clear'ml'enter
  515. jsr zero'restore
  516.  
  517. print'top lda #0
  518. sta 212
  519. lda #crsr'right
  520. jsr chrout
  521. sei
  522. lda #$74
  523. sta 1
  524. ldy #0
  525.  
  526. jsr dec'pointer
  527. jsr dec'pointer
  528. - lda (253),y
  529. jsr dec'pointer
  530. cmp #0
  531. bne -
  532. jsr adjust'pointer
  533. jsr adjust'pointer
  534.  
  535. jsr dec'top
  536. jsr dec'top
  537. ldy #0
  538. - lda (top'pointer),y
  539. jsr dec'top
  540. cmp #0
  541. bne -
  542. jsr adjust'top
  543. jsr adjust'top
  544.  
  545. - sei
  546. ldy #0
  547. lda #$74
  548. sta 1
  549. lda (top'pointer),y
  550. jsr adjust'top
  551. cmp #0
  552. bne +
  553. jmp top'out
  554. + ldx #$77
  555. stx 1
  556. stx 212
  557. jsr chrout
  558. bne -
  559.  
  560. top'out jsr dec'top
  561. jsr dec'top
  562. ldy #0
  563. - lda (top'pointer),y
  564. jsr dec'top
  565. cmp #0
  566. bne -
  567. jsr adjust'top
  568. jsr adjust'top
  569.  
  570. jmp bottom'out
  571.  
  572. move'home jsr item'off
  573. lda item
  574. beq +
  575. lda #0
  576. sta item
  577. jsr item'on
  578. jmp get'key
  579. + lda #0
  580. sta 212
  581. jsr fill'box
  582. jmp menu'reenter
  583.  
  584.  
  585. fill'buffer ldy #0
  586. - jsr getin
  587. sta buffer,y
  588. iny
  589. cpy #32
  590. bne -
  591.  
  592. copy'name sei
  593. lda #$74
  594. sta 1
  595. ldy #0
  596.  
  597. find'quote ldx #2
  598. - lda buffer,x
  599. cmp #34
  600. beq +
  601. inx
  602. cpx #30
  603. bcc -
  604.  
  605. lda #1
  606. sta that's'it
  607. jmp normal
  608.  
  609. + inx
  610.  
  611. - lda buffer,x
  612. cmp #34
  613. beq +
  614. sta (251),y
  615. jsr bump
  616. inx
  617. bne -
  618.  
  619. + lda #0
  620. sta (251),y
  621. jsr bump
  622.  
  623. normal lda #$77
  624. sta 1
  625. cli
  626. rts
  627.  
  628. bump inc 251
  629. bne +
  630. inc 252
  631. + rts
  632.  
  633.  
  634. box'entry lda #5
  635. sta parm'count
  636. lda #0
  637. sta shade
  638. box'ii lda #0
  639. sta temp
  640. - jsr get'number
  641. tya
  642. ldy temp
  643. sta parms,y
  644. inc temp
  645. cpy parm'count
  646. bne -
  647.  
  648. fill'box jsr linx
  649. box'start ldx parms+2
  650. ldy #0
  651. clc
  652. jsr $fff0
  653. jsr old'rom'patch
  654. dec parms
  655.  
  656. - ldy parms+1
  657. - bit parms+5
  658. bvc check'rev
  659. lda (209),y
  660. and #127
  661. sta (209),y
  662. lda #255
  663. sta parms+4
  664. jmp alter'screen
  665.  
  666. check'rev ldx parms+5
  667. bpl alter'screen
  668. lda (209),y
  669. ora #128
  670. sta (209),y
  671. lda #255
  672. sta parms+4
  673. alter'screen lda parms+4
  674. bit shade
  675. bmi get'shade
  676. cmp #255
  677. beq +
  678. sta (209),y
  679. + lda parms+5
  680. store'color sta (243),y
  681. dey
  682. cpy parms
  683. bne -
  684. lda 214
  685. cmp parms+3
  686. beq +
  687.  
  688. inc 214
  689. jsr 58732
  690. jsr old'rom'patch
  691. jmp --
  692. + inc parms
  693. lda #home
  694. jmp $ffd2
  695.  
  696. get'shade lda (243),y
  697. and #15
  698. tax
  699. lda shade'table,x
  700. jmp store'color
  701.  
  702. linx lda #0
  703. sta 212
  704. ldy #24
  705. - lda 217,y
  706. ora #128
  707. sta 217,y
  708. dey
  709. bpl -
  710. rts
  711.  
  712. get'number jsr $aefd
  713. jsr $ad8a
  714. jmp $b7f7
  715.  
  716. old'rom'patch lda 210
  717. sec
  718. sbc 648
  719. clc
  720. adc #$d8
  721. sta 244
  722. lda 209
  723. sta 243
  724. rts
  725.  
  726. d'keyboard lda #2
  727. jsr close
  728. jsr get'string
  729. jsr setnam
  730. jsr get'number
  731. tya
  732. tax
  733. ldy #2
  734. lda #2
  735. jsr setlfs
  736. lda #0
  737. jsr load
  738. lda 174
  739. sta 45
  740. lda 175
  741. sta 46
  742. jsr $a533
  743. jsr clear'buffer
  744. lda #138
  745. sta buffer
  746. lda "r"
  747. sta 631
  748. lda "U"
  749. sta 632
  750. lda ":"
  751. sta 633
  752. lda #13
  753. sta 634
  754. lda #4
  755. sta 198
  756. jmp $a474
  757.  
  758. ;***** get string from BASIC ****
  759.  
  760. get'string jsr $aefd
  761. jsr $ad9e
  762. jsr $b6a3
  763.  
  764. ldx $22
  765. ldy $23
  766. rts
  767.  
  768. bload jsr get'string
  769. jsr setnam
  770. jsr get'number
  771. sty device
  772. tya
  773. tax
  774. lda #1
  775. ldy #0
  776. jsr setlfs
  777. jsr get'number
  778. ldx $14
  779. ldy $15
  780. lda #0
  781. jsr load
  782. lda 174
  783. sta 201
  784. lda 175
  785. sta 202
  786. jsr make'variable
  787. jsr open'duh'error
  788. jmp read'open'error
  789.  
  790. adjust'pointer inc 253
  791. bne +
  792. inc 254
  793. + ldx 253
  794. stx bottom'pointer
  795. ldx 254
  796. stx bottom'pointer+1
  797. rts
  798.  
  799. adjust'top ldy #0
  800. inc top'pointer
  801. bne +
  802. inc top'pointer+1
  803. + rts
  804.  
  805. dec'pointer ldy #0
  806. dec 253
  807. ldx 253
  808. cpx #255
  809. bne +
  810. dec 254
  811. + stx bottom'pointer
  812. ldx 254
  813. stx bottom'pointer+1
  814. rts
  815.  
  816. dec'top ldy #0
  817. dec top'pointer
  818. ldx top'pointer
  819. cpx #255
  820. bne +
  821. dec top'pointer+1
  822. + rts
  823.  
  824. ;scroll sysaddr,x,to x,y, to y, direction
  825. ;dir 0=up 1= down 
  826. ;clear line sysaddr+3,screen code,color
  827.  
  828.  
  829. scroll jsr linx
  830. jsr get'number
  831. sty startingx
  832. cpy #40
  833. bcs quit
  834. jsr get'number
  835. sty endingx
  836. cpy #40
  837. bcs quit
  838. jsr get'number
  839. sty startingy
  840. cpy #25
  841. bcs quit
  842. jsr get'number
  843. sty endingy
  844. cpy #25
  845. bcs quit
  846. jsr get'number
  847. cpy #2
  848. bcs quit
  849. sty direction
  850.  
  851. jsr linx
  852. lda direction
  853. beq scroll'up
  854. jmp scroll'down
  855. quit rts
  856.  
  857. scroll'up ldy startingx
  858. ldx startingy
  859. stx line
  860. clc
  861. jsr plot
  862. jsr old'rom'patch
  863.  
  864. scroll'up'math clc
  865. lda 209
  866. adc <40
  867. sta 251
  868. lda 210
  869. adc >40
  870. sta 252
  871.  
  872. clc
  873. lda 243
  874. adc <40
  875. sta 253
  876. lda 244
  877. adc >40
  878. sta 254
  879.  
  880. ldy startingx
  881.  
  882. - lda (251),y
  883. sta (209),y
  884. lda (253),y
  885. sta (243),y
  886. iny
  887. cpy endingx
  888. beq -
  889. bcc -
  890.  
  891. inc line
  892. lda line
  893. cmp endingy
  894. bcs through'scrolling'up
  895.  
  896. clc
  897. lda 209
  898. adc <40
  899. sta 209
  900. lda 210
  901. adc >40
  902. sta 210
  903.  
  904. clc
  905. lda 243
  906. adc <40
  907. sta 243
  908. lda 244
  909. adc >40
  910. sta 244
  911. jmp scroll'up'math
  912.  
  913. through'scrolling'up ldx endingy
  914. ldy startingx
  915. clc
  916. jsr plot
  917. jmp old'rom'patch
  918.  
  919. scroll'down ldy startingx
  920. ldx endingy
  921. stx line
  922. clc
  923. jsr plot
  924. jsr old'rom'patch
  925.  
  926. scroll'down'math sec
  927. lda 209
  928. sbc <40
  929. sta 251
  930. lda 210
  931. sbc >40
  932. sta 252
  933.  
  934. sec
  935. lda 243
  936. sbc <40
  937. sta 253
  938. lda 244
  939. sbc >40
  940. sta 254
  941.  
  942. ldy startingx
  943.  
  944. - lda (251),y
  945. sta (209),y
  946. lda (253),y
  947. sta (243),y
  948. iny
  949. cpy endingx
  950. beq -
  951. bcc -
  952.  
  953. dec line
  954. lda line
  955. cmp startingy
  956. beq through'scrolling'down
  957.  
  958. sec
  959. lda 209
  960. sbc <40
  961. sta 209
  962. lda 210
  963. sbc >40
  964. sta 210
  965.  
  966. sec
  967. lda 243
  968. sbc <40
  969. sta 243
  970. lda 244
  971. sbc >40
  972. sta 244
  973. jmp scroll'down'math
  974.  
  975. through'scrolling'down ldx startingy
  976. ldy startingx
  977. clc
  978. jsr plot
  979. jmp old'rom'patch
  980.  
  981. clear'row jsr get'number
  982. sty char
  983. jsr get'number
  984. sty color
  985.  
  986. clear'ml'enter ldy startingx
  987. - lda char
  988. sta (209),y
  989. lda color
  990. sta (243),y
  991. iny
  992. cpy endingx
  993. beq -
  994. bcc -
  995.  
  996. rts
  997.  
  998. item'on lda item
  999. clc
  1000. adc menu'y
  1001. tax
  1002. clc
  1003. ldy #0
  1004. jsr plot
  1005. jsr old'rom'patch
  1006. ldx #0
  1007. ldy menu'x
  1008. - lda (209),y
  1009. ora #128
  1010. sta (209),y
  1011. lda menu'highlight
  1012. sta (243),y
  1013. iny
  1014. inx
  1015. cpx #18
  1016. bne -
  1017. rts
  1018.  
  1019. item'off lda item
  1020. clc
  1021. adc menu'y
  1022. tax
  1023. clc
  1024. ldy #0
  1025. jsr plot
  1026. jsr old'rom'patch
  1027. ldx #0
  1028. ldy menu'x
  1029. - lda (209),y
  1030. and #127
  1031. sta (209),y
  1032. lda menu'color
  1033. sta (243),y
  1034. iny
  1035. inx
  1036. cpx #18
  1037. bne -
  1038. rts
  1039.  
  1040. zero'stash sty tempy
  1041. ldy #7
  1042. - lda 247,y
  1043. sta zbuffer,y
  1044. dey
  1045. bpl -
  1046. ldy tempy
  1047. rts
  1048.  
  1049. zero'restore sty tempy
  1050. ldy #7
  1051. - lda zbuffer,y
  1052. sta 247,y
  1053. dey
  1054. bpl -
  1055. ldy tempy
  1056. rts
  1057.  
  1058. read'open'error jsr clear'buffer
  1059. jsr clrchn
  1060. ldx #15
  1061. jsr chkin
  1062. ldy #0
  1063.  
  1064. - jsr getin
  1065. sta error'string,y
  1066. iny
  1067. cmp #13
  1068. bne -
  1069. iny
  1070. sty elength
  1071. jsr clrchn
  1072.  
  1073. dec elength
  1074. dec elength
  1075. ldx <error'name
  1076. ldy >error'name
  1077. jsr locvar
  1078. lda <elength
  1079. ldy >elength
  1080. jmp set'string
  1081.  
  1082.  
  1083. locvar lda $7a
  1084. pha
  1085. lda $7b
  1086. pha
  1087. stx $7a
  1088. sty $7b
  1089. jsr $b08b
  1090. sta $49
  1091. sty $4a
  1092. pla
  1093. sta $7b
  1094. pla
  1095. sta $7a
  1096. rts
  1097.  
  1098. set'string sta $64
  1099. sty $65
  1100. jmp $aa52
  1101.  
  1102. make'wstring ldx <string'name
  1103. ldy >string'name
  1104. jsr locvar
  1105. lda <wlength
  1106. ldy >wlength
  1107. jsr set'string
  1108.  
  1109. clear'buffer ldy #79
  1110. lda #0
  1111. sta 212
  1112. - sta buffer,y
  1113. dey
  1114. bpl -
  1115. rts
  1116.  
  1117. get'file lda #0
  1118. sta 212
  1119. sei
  1120. lda #$74
  1121. sta 1
  1122. ldy #0
  1123. ldx #0
  1124. lda item
  1125. beq copy'to'w'string
  1126.  
  1127. - lda (top'pointer),y
  1128. jsr adjust'top
  1129. cmp #0
  1130. bne -
  1131. inx
  1132. cpx item
  1133. bne -
  1134.  
  1135. copy'to'w'string ldy #0
  1136. - lda (top'pointer),y
  1137. beq +
  1138. sta buffer,y
  1139. iny
  1140. cpy #80
  1141. bne -
  1142.  
  1143. + sty wlength
  1144.  
  1145. lda #$77
  1146. sta 1
  1147. cli
  1148. jmp make'wstring
  1149.  
  1150.  
  1151. index'name jsr get'number
  1152. cmp files+1
  1153. bcc +
  1154. cpy files
  1155. bcc +
  1156. jmp index'quit
  1157. + sta parms+1
  1158. sty parms
  1159.  
  1160. jsr zero'restore
  1161. lda address
  1162. sta top'pointer
  1163. lda address+1
  1164. sta top'pointer+1
  1165.  
  1166. sei
  1167. lda #$74
  1168. sta 1
  1169.  
  1170. lda #255
  1171. sta file
  1172. sta file+1
  1173.  
  1174. ldy #0
  1175.  
  1176. - lda (top'pointer),y
  1177. jsr adjust'top
  1178. cmp #0
  1179. beq +
  1180. bne -
  1181.  
  1182. + inc file
  1183. bne +
  1184. inc file+1
  1185.  
  1186. + lda file+1
  1187. cmp files+1
  1188. bcc +
  1189. lda file
  1190. cmp files
  1191. bcc +
  1192. beq +
  1193.  
  1194. jmp index'quit
  1195.  
  1196. + lda file+1
  1197. cmp parms+1
  1198. bcc -
  1199. lda file
  1200. cmp parms
  1201. bcc -
  1202.  
  1203. jsr copy'to'w'string
  1204. jmp clear'buffer
  1205.  
  1206. index'quit lda #$77
  1207. sta 1
  1208. cli
  1209. lda #0
  1210. sta wlength
  1211. jsr make'wstring
  1212. jmp clear'buffer
  1213.  
  1214. screen'stash jsr linx
  1215. jsr get'number
  1216. sty 252
  1217. cpy >1024
  1218. bcs +
  1219. rts
  1220.  
  1221. + tya
  1222. clc
  1223. adc #4
  1224. sta 254
  1225. lda #0
  1226. sta 253
  1227. sta 251
  1228.  
  1229. lda #home
  1230. jsr chrout
  1231. jsr old'rom'patch
  1232. sei
  1233. lda #0
  1234. sta 1
  1235.  
  1236. ldx #3
  1237. ldy #0
  1238. - lda (209),y
  1239. sta (251),y
  1240. dec 1
  1241. lda (243),y
  1242. inc 1
  1243. sta (253),y
  1244. iny
  1245. bne -
  1246. inc 210
  1247. inc 252
  1248. inc 244
  1249. inc 254
  1250. dex
  1251. bpl -
  1252. lda #$77
  1253. sta 1
  1254. cli
  1255. lda #home
  1256. jmp chrout
  1257.  
  1258. screen'restore jsr linx
  1259. jsr get'number
  1260. sty 252
  1261. tya
  1262. clc
  1263. adc #4
  1264. sta 254
  1265. lda #0
  1266. sta 253
  1267. sta 251
  1268.  
  1269. lda #home
  1270. jsr chrout
  1271. jsr old'rom'patch
  1272. sei
  1273. lda #0
  1274. sta 1
  1275.  
  1276. ldx #3
  1277. ldy #0
  1278.  
  1279. - lda (251),y
  1280. sta (209),y
  1281. lda (253),y
  1282. dec 1
  1283. sta (243),y
  1284. inc 1
  1285. iny
  1286. bne -
  1287. inc 210
  1288. inc 252
  1289. inc 244
  1290. inc 254
  1291. dex
  1292. bpl -
  1293. lda #$77
  1294. sta 1
  1295. cli
  1296. lda #home
  1297. jmp chrout
  1298.  
  1299. print'at jsr linx
  1300. jsr get'number
  1301. sty 211
  1302. jsr get'number
  1303. sty 214
  1304. jsr 58732
  1305. jsr get'string
  1306. sta temp
  1307.  
  1308. print'string lda temp
  1309. bne +
  1310. rts
  1311. + ldy #0
  1312. - lda ($22),y
  1313. jsr chrout
  1314. iny
  1315. cpy temp
  1316. bne -
  1317. rts
  1318.  
  1319. center jsr linx
  1320. jsr get'number
  1321. tya
  1322. tax
  1323. ldy #0
  1324. clc
  1325. jsr plot
  1326.  
  1327. jsr get'string
  1328. sta temp
  1329.  
  1330. lsr
  1331. sta parms
  1332. lda #20
  1333. sec
  1334. sbc parms
  1335. sta 211
  1336. jsr 58732
  1337. jmp print'string
  1338.  
  1339. blocks'free jsr get'number
  1340. sty device
  1341. lda #7
  1342. ldx <dummy'name
  1343. ldy >dummy'name
  1344. jsr setnam
  1345. lda #2
  1346. jsr close
  1347. lda #2
  1348. ldx device
  1349. ldy #0
  1350. jsr setlfs
  1351. jsr open
  1352. lda #0
  1353. tay
  1354. tax
  1355. jsr setnam
  1356. jsr open'duh'error
  1357. jsr read'open'error
  1358.  
  1359. lda buffer
  1360. cmp "0"
  1361. bne bferror
  1362.  
  1363. jsr clrchn
  1364. ldx #2
  1365. jsr chkin
  1366. ldy #0
  1367. - jsr getin
  1368. sta buffer,y
  1369. iny
  1370. cpy #34
  1371. bne -
  1372.  
  1373. jsr getin
  1374. sta parms
  1375. jsr getin
  1376. sta parms+1
  1377.  
  1378. ldy #0
  1379. - lda buffer+7,y
  1380. sta buffer,y
  1381. iny
  1382. cpy #25
  1383. bne -
  1384.  
  1385. lda #24
  1386. sta wlength
  1387.  
  1388. jsr make'wstring
  1389. lda parms
  1390. sta 201
  1391. lda parms+1
  1392. sta 202
  1393. jsr make'variable
  1394. bferror jsr clear'buffer
  1395. lda #2
  1396. jsr close
  1397. lda #15
  1398. jsr close
  1399. jmp clrchn
  1400.  
  1401. delay ldx #0
  1402. ldy #0
  1403.  
  1404. - inx
  1405. bne -
  1406. iny
  1407. bne -
  1408. rts
  1409.  
  1410. pup lda menu'depth
  1411. cmp #10
  1412. bcc +
  1413. lda #10
  1414. + sta temp
  1415. lda #crsr'up
  1416. jmp keyboard
  1417.  
  1418. pdown lda menu'depth
  1419. cmp #10
  1420. bcc +
  1421. lda #10
  1422. + sta temp
  1423. lda #crsr'down
  1424.  
  1425. keyboard ldy #0
  1426. - sta 631,y
  1427. iny
  1428. cpy temp
  1429. bne -
  1430. lda temp
  1431. sta 198
  1432. rts
  1433.  
  1434. disk'command lda #15
  1435. jsr close
  1436. jsr get'string
  1437. jsr setnam
  1438. jsr get'number
  1439. sty device
  1440. lda #15
  1441. ldx device
  1442. ldy #15
  1443. jsr setlfs
  1444. jsr open
  1445.  
  1446. jsr read'open'error
  1447. jmp clear'buffer
  1448.  
  1449. make'variable lda "f"
  1450. sta 251
  1451. lda "%"
  1452. sta 252
  1453. lda #0
  1454. sta 253
  1455. lda $7a
  1456. pha
  1457. lda $7b
  1458. pha
  1459.  
  1460. lda <251
  1461. sta $7a
  1462. lda >251
  1463. sta $7b
  1464. jsr $b08b
  1465. ldy #0
  1466. lda 202 ;high byte
  1467. sta ($47),y
  1468. iny
  1469. lda 201;low byte
  1470. sta ($47),y
  1471. pla
  1472. sta $7b
  1473. pla
  1474. sta $7a
  1475. rts
  1476.  
  1477. brancher lda #0
  1478. sta 251
  1479. jsr get'string
  1480. sta 252
  1481. - jsr getin
  1482. beq -
  1483.  
  1484. ldy #0
  1485. - cmp ($22),y
  1486. bne +
  1487. iny
  1488. sty 201
  1489. ldy #0
  1490. sty 202
  1491. jmp make'variable
  1492. + iny
  1493. cpy 252
  1494. bne -
  1495. beq --
  1496.  
  1497. menu'entry lda #0
  1498. sta temp
  1499. sta flag
  1500. - jsr get'number
  1501. tya
  1502. ldy temp
  1503. sta parms,y
  1504. inc temp
  1505. cpy #6
  1506. bne -
  1507.  
  1508. menu jsr linx
  1509. ldx parms
  1510. ldy #0
  1511. sty 251
  1512. clc
  1513. jsr plot
  1514. jsr old'rom'patch
  1515.  
  1516. lda parms+5
  1517. sta tempy
  1518. jsr paint'line
  1519.  
  1520. menu'wait jsr getin
  1521. beq menu'wait
  1522.  
  1523. ldx 251
  1524. stx temp
  1525.  
  1526. cmp #crsr'down
  1527. beq menu'down
  1528.  
  1529. cmp #crsr'up
  1530. beq menu'up
  1531.  
  1532. cmp #13
  1533. beq menu'select
  1534.  
  1535. cmp parms+6
  1536. bne menu'wait'loop
  1537. dec flag
  1538. bmi menu'select
  1539.  
  1540. menu'wait'loop jmp menu'wait
  1541.  
  1542. menu'down inc 251
  1543. lda 251
  1544. cmp parms+3
  1545. bne highlight
  1546. lda #0
  1547. sta 251
  1548. beq highlight
  1549.  
  1550. menu'up dec 251
  1551. lda 251
  1552. cmp #255
  1553. beq +
  1554. bne highlight
  1555.  
  1556. + ldy parms+3
  1557. dey
  1558. sty 251
  1559. jmp highlight
  1560.  
  1561. menu'select lda 251
  1562. clc
  1563. adc parms
  1564. tax
  1565. ldy #0
  1566. jsr plot
  1567. jsr old'rom'patch
  1568.  
  1569. lda parms+4
  1570. sta tempy
  1571. jsr paint'line
  1572.  
  1573. bit flag
  1574. beq +
  1575. lda #255
  1576. sta 251
  1577. + ldy 251
  1578. iny
  1579. sty 201
  1580. lda #0
  1581. sta 202
  1582. jmp make'variable
  1583.  
  1584.  
  1585. highlight lda parms
  1586. clc
  1587. adc 251
  1588. tax
  1589. ldy #0
  1590. clc
  1591. jsr plot
  1592. jsr old'rom'patch
  1593. lda parms+5
  1594. sta tempy
  1595. jsr paint'line
  1596.  
  1597. lda parms
  1598. clc
  1599. adc temp
  1600. tax
  1601. ldy #0
  1602. clc
  1603. jsr plot
  1604. jsr old'rom'patch
  1605. lda parms+4
  1606. sta tempy
  1607. jsr paint'line
  1608.  
  1609. jmp menu'wait
  1610.  
  1611. paint'line ldy parms+1
  1612. - lda tempy
  1613. sta (243),y
  1614. bmi +
  1615. lda (209),y
  1616. eor #128
  1617. sta (209),y
  1618. + iny
  1619. cpy parms+2
  1620. beq -
  1621. bcc -
  1622. rts
  1623.  
  1624. reader lda #147
  1625. jsr chrout
  1626.  
  1627. jsr get'string
  1628. jsr setnam
  1629. jsr get'number
  1630. tya
  1631. tax
  1632. lda #2
  1633. ldy #2
  1634. jsr setlfs
  1635. jsr open
  1636. ldx #2
  1637. jsr chkin
  1638.  
  1639. - jsr getin
  1640. jsr chrout
  1641. sta 251
  1642. jsr readst
  1643. and #64
  1644. bne eof
  1645. lda 251
  1646. cmp #13
  1647. bne -
  1648. lda 214
  1649. cmp #22
  1650. bcc -
  1651.  
  1652. jsr linx
  1653. ldx #24
  1654. ldy #11
  1655. clc
  1656. jsr plot
  1657. inc 199
  1658.  
  1659. ldy >reader'text
  1660. lda <reader'text
  1661. jsr strout
  1662.  
  1663. jsr clrchn
  1664.  
  1665. - jsr getin
  1666. beq -
  1667.  
  1668. cmp " "
  1669. bne +
  1670. lda #147
  1671. jsr chrout
  1672. ldx #2
  1673. jsr chkin
  1674. jmp --
  1675.  
  1676. + cmp "q"
  1677. bne -
  1678. - lda #2
  1679. jsr close
  1680. jmp clrchn
  1681.  
  1682. eof jsr clrchn
  1683. - jsr getin
  1684. beq -
  1685. jmp --
  1686.  
  1687.  
  1688. ;sys source,end+1,dest
  1689. ;copy =addr
  1690. ;swap =addr+7
  1691. ;ROM in copy =addr+14
  1692.  
  1693. copymem lda #0      ;regular copy
  1694. sta 212     ;just using this as a flag
  1695. sec
  1696. bcs get'numbers
  1697. side'door lda #64 ;swap mode
  1698. sta 212
  1699. sec
  1700. bcs get'numbers
  1701.  
  1702. trap'door lda #128 ;original rom on
  1703. sta 212
  1704.  
  1705. get'numbers jsr get'number
  1706. sty source
  1707. sta source+1
  1708.  
  1709. jsr get'number
  1710.  
  1711. sty end
  1712. sta end+1
  1713.  
  1714. jsr get'number
  1715.  
  1716. lda end+1
  1717. cmp source+1  ;is end lower than source?
  1718. beq next'test 
  1719. bcs okay
  1720. bcc quit'copy      ;if so, bail out
  1721.  
  1722. next'test lda end
  1723. cmp source
  1724. bcc quit'copy
  1725. beq quit'copy
  1726.  
  1727. okay bit 212  ;leave ROM alone?
  1728. bmi +
  1729.  
  1730. sei    ;don't interrupt this groove
  1731. lda 1
  1732. pha           ;stash I/O status
  1733. lda #$74      ;knock 'em all out
  1734. sta 1
  1735.  
  1736. + ldy #0 
  1737. - lda (source),y
  1738. bit 212       ;Swap?
  1739. bvc +         ;if clear then nope
  1740. pha
  1741. lda (destination),y
  1742. sta (source),y
  1743. pla
  1744. + sta (destination),y
  1745.  
  1746. inc source    ;increment source and dest
  1747. bne +
  1748. inc source+1
  1749. + inc destination
  1750. bne +
  1751. inc destination+1
  1752.  
  1753. + lda source+1 ;finis?
  1754. cmp end+1
  1755. bcc -    ;not finished by page
  1756.  
  1757. lda source
  1758. cmp end
  1759. bcc -    ;just plain not finished
  1760.  
  1761. bit 212  ;was I/O reg stashed?
  1762. bmi quit'copy ;if not then don't restore
  1763.  
  1764. pla      ;get back original I/O reg
  1765. sta 1    ;back to normal
  1766. cli      ;interrupts back on
  1767. quit'copy lda #0
  1768. sta 212  ;make sure quote mode is off
  1769. rts
  1770.  
  1771. inpanyii jsr get'string
  1772. pha
  1773. tya
  1774. pha
  1775. txa
  1776. pha
  1777. jsr get'number
  1778. sty device
  1779. jsr get'number
  1780. sty sub'low
  1781. sta sub'high
  1782. jsr open'duh'error
  1783. pla
  1784. tax
  1785. pla
  1786. tay
  1787. pla
  1788. jsr setnam
  1789. lda #2
  1790. jsr close
  1791. lda #2
  1792. ldx device
  1793. ldy #2
  1794. jsr setlfs
  1795. jsr open
  1796. jsr clrchn
  1797. jsr read'open'error
  1798. jsr clrchn
  1799. ldx #2
  1800. jsr chkin
  1801. lda buffer
  1802. cmp "0"
  1803. beq get'line
  1804. jsr clear'buffer
  1805. lda #15
  1806. jsr close
  1807. lda #2
  1808. jsr close
  1809. jmp clrchn
  1810.  
  1811. get'line ldy #0
  1812. sty ilength
  1813.  
  1814. - jsr getin
  1815. cmp #13
  1816. bne +
  1817. - jsr make'warray
  1818. jsr readst
  1819. and #64
  1820. beq get'line
  1821. jmp iquit
  1822.  
  1823. + sta buffer,y
  1824. iny
  1825. inc ilength
  1826. cpy #87
  1827. bcc +
  1828. bcs -
  1829.  
  1830. + jsr readst
  1831. and #64
  1832. beq --
  1833. bne -
  1834.  
  1835. iquit lda sub'low
  1836. ldx sub'high
  1837. stx 202
  1838. sta 201
  1839. jsr make'variable
  1840. lda #2
  1841. jsr close
  1842. jsr clrchn
  1843. jsr read'open'error
  1844. jsr clrchn
  1845. lda #15
  1846. jmp close
  1847.  
  1848. make'warray ldy #3
  1849. lda " "
  1850. - sta istring'name+3,y
  1851. dey
  1852. bpl -
  1853.  
  1854. lda sub'high
  1855. ldx sub'low
  1856. sta $62
  1857. stx $63
  1858. ldx #$90
  1859. sec
  1860. jsr $bc49
  1861. jsr $bddf
  1862.  
  1863. sta 251
  1864. sty 252
  1865.  
  1866. ldy #0
  1867.  
  1868. - lda (251),y
  1869. beq +
  1870. sta istring'name+3,y
  1871. iny
  1872. cpy #4
  1873. bcc -
  1874.  
  1875. + ldx <istring'name
  1876. ldy >istring'name
  1877. jsr locvar
  1878. lda <ilength
  1879. ldy >ilength
  1880. jsr set'string
  1881. inc sub'low
  1882. bne +
  1883. inc sub'high
  1884.  
  1885. + jmp clear'buffer
  1886.  
  1887. get'word jsr get'number
  1888. sty text
  1889. jsr get'number
  1890. sty menu'highlight
  1891. jsr get'number
  1892. tya
  1893. and #63
  1894. sta limit
  1895.  
  1896. lda #0
  1897. sta 56328  ;rem start timer if not on
  1898. sta counter
  1899. sta length
  1900. jsr print'cursor
  1901.  
  1902. gget'key jsr getin
  1903. bne key'pressed
  1904. lda 56328
  1905. cmp old'time
  1906. beq gget'key
  1907.  
  1908. increment sta old'time
  1909. inc counter
  1910. lda counter
  1911. cmp #3
  1912. bne gget'key
  1913. lda #0
  1914. sta counter
  1915. lda 251
  1916. beq +
  1917. jsr un'print'cursor
  1918. jmp gget'key
  1919. + jsr print'cursor
  1920. jmp gget'key
  1921.  
  1922.  
  1923. key'pressed sta temp
  1924. ldx length
  1925. beq check'valid
  1926. cpx limit
  1927. bcc check'valid
  1928.  
  1929. cmp #13
  1930. beq return
  1931.  
  1932. cmp #20
  1933. beq delete
  1934.  
  1935. bne gget'key
  1936.  
  1937. check'valid ldy #0
  1938.  
  1939. - lda validation'string,y
  1940. cmp temp
  1941. beq found'it
  1942. iny
  1943. cpy #vallength
  1944. bne -
  1945. beq gget'key
  1946.  
  1947. found'it lda temp
  1948. cmp #13
  1949. beq return
  1950. cmp #20
  1951. beq delete
  1952.  
  1953. inc length
  1954. lda temp
  1955. jsr chrout
  1956. jsr print'cursor
  1957. ldy length
  1958. lda temp
  1959. sta buffer,y
  1960. jmp gget'key
  1961.  
  1962. return lda length
  1963. sta 252
  1964. sta glength
  1965. ldx <gstring'name
  1966. ldy >gstring'name
  1967. jsr locvar
  1968. lda <glength
  1969. ldy >glength
  1970. jsr set'string
  1971.  
  1972. jmp un'print'cursor
  1973.  
  1974. delete lda length
  1975. bne +
  1976. jmp gget'key
  1977. + dec length
  1978. lda #157
  1979. jsr chrout
  1980. lda " "
  1981. jsr chrout
  1982. jsr chrout
  1983. lda #157
  1984. jsr chrout
  1985. jsr chrout
  1986. jsr print'cursor
  1987. jmp gget'key
  1988.  
  1989.  
  1990. print'cursor lda #1
  1991. sta 251
  1992. sta 199
  1993. lda menu'highlight
  1994. sta 646
  1995. lda #32
  1996. jsr chrout
  1997. lda #0
  1998. sta 199
  1999. lda text
  2000. sta 646
  2001. lda #157
  2002. jmp chrout
  2003.  
  2004. un'print'cursor lda #0
  2005. sta 251
  2006. sta 199
  2007. lda #32
  2008. jsr chrout
  2009. lda #0
  2010. sta 199
  2011. lda text
  2012. sta 646
  2013. lda #157
  2014. jmp chrout
  2015.  
  2016. open'duh'error lda #15
  2017. jsr close
  2018. open'duh'channel lda #15
  2019. ldx device
  2020. ldy #15
  2021. jsr setlfs
  2022. lda #0
  2023. tax
  2024. tay
  2025. jsr setnam
  2026. jmp open
  2027.  
  2028. shade'area lda #3
  2029. sta parm'count
  2030. lda #255
  2031. sta shade
  2032. jsr box'ii
  2033. lda #0
  2034. sta shade
  2035. rts
  2036.  
  2037. limit =1019
  2038. length =1018
  2039.  
  2040. validation'string .asc "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  2041. .asc " _1234567890+-!#$%&'()<>[]^*.,/:=@\?;"
  2042. .byt 13,20
  2043. vallend =*
  2044. counter =1017
  2045. found =1016
  2046. xpos =1015
  2047. ypos =1014
  2048. old'time =1013
  2049. gstring'name .asc "w$":.byt 0
  2050. glength .byt 0
  2051. .word buffer+1
  2052.  
  2053. vallength =vallend-validation'string
  2054.  
  2055.  
  2056. istring'name .asc "w$(0000)":.byt 0
  2057. ilength .byt 0
  2058. .word buffer
  2059.  
  2060. initialize'name =validation'string+8
  2061.  
  2062. sub'low =1011
  2063. sub'high =1012
  2064.  
  2065. error'flag =1000
  2066. startingx =1001
  2067. endingx =1002
  2068. startingy =1003
  2069. endingy =1004
  2070. direction =1005
  2071. char =1006
  2072. color =1007
  2073. line =1008
  2074. top .word 0
  2075. device =983
  2076. address .buf 2
  2077. that's'it .byt 0
  2078. files .word 0
  2079. file .word 0
  2080. menu'x =990
  2081. menu'y =991
  2082. menu'color =992
  2083. menu'highlight =993
  2084. menu'depth =994
  2085. item =995
  2086. menu'item =996
  2087. tempy =997
  2088.  
  2089. parms .buf 8
  2090. string'name .asc "f$":.byt 0
  2091. wlength .byt 0
  2092. .word buffer
  2093. error'name .asc "e$":.byt 0
  2094. elength .byt 0
  2095. .word error'string
  2096. string'length .byt 0
  2097. error'string =buffer
  2098. prompt .asc " crsr/return/stop":.byt 0
  2099. dummy'name .asc "$:j0FfRe^"
  2100. zbuffer .buf 8
  2101. diff =989
  2102. orig =988 
  2103. tempx =987
  2104. flag =986
  2105. reader'text .asc " SPACE page/Q quit ":.byt 19,13,0
  2106. text .byt 0
  2107. shade'table .byt 1,15,9,14,2,6,0,5,9,11,2,0,11,5,6,12
  2108. shade =985
  2109. parm'count =984
  2110. .end
  2111.