home *** CD-ROM | disk | FTP | other *** search
/ Loadstar - Compleat Programmer / comprog2.d81 / reader.ebud < prev    next >
Encoding:
Text File  |  1990-01-01  |  16.1 KB  |  1,580 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. ;loadstar reader source
  8. ;4-26-922 by Jeff Jones
  9. ;"If you look, don't laugh."
  10.  
  11. open =$ffc0
  12. readst =$ffb7
  13. setlfs =$ffba
  14. setnam =$ffbd
  15. setmsg =$ff90
  16. load =$ffd5
  17. getin =$ffe4
  18. input'buffer =512
  19. clrchn =$ffcc
  20. close =$ffc3   ;a
  21. chrin =$ffcf
  22. chkout =$ffc9  ;x
  23. chkin =$ffc6   ;x
  24. plot =$fff0
  25. chrout =$ffd2
  26. color'pointer =243
  27. screen'line'pointer =209
  28. print'number =$bdcd ;x,a
  29. clear'line =59903
  30. background =53281
  31. border =53280
  32. strout = $ab1e; .A low .Y high
  33. unlisten =$ffae
  34. clall =$ffe7
  35. color1 =53282
  36. color2 =53283
  37. color3 =53284
  38. white =5
  39. crsr'down =17
  40. rvs'on =18
  41. home =19
  42. del =20
  43. red =28
  44. crsr'right =29
  45. green =30
  46. blue =31
  47. black =144
  48. lowercase =14
  49. uppercase =142
  50. crsr'up =145
  51. rvs'off =146
  52. clr =147
  53. insert =148
  54. brown =149
  55. light'red =150
  56. dark'grey =151
  57. medium'grey =152
  58. light'green =153
  59. light'blue =154
  60. light'grey =155
  61. purple =156
  62. crsr'left =157
  63. yellow =158
  64. cyan =159
  65. top'left =176
  66. top'right =174
  67. bottom'left =173
  68. bottom'right =189
  69.  
  70. .org $c000
  71. .obj "@0:reader c000"
  72. .mem
  73. jmp load'file;27
  74. jmp box'entry;;    3
  75. jmp linx;          12
  76. jmp print'at;15
  77. jmp center;18
  78. jmp read'existing;30
  79. jmp bload;51
  80. jmp frame'entry;54
  81. jmp get'scroll'up;57
  82. jmp get'scroll'down;60
  83. jmp clear'row;63
  84.  
  85.  
  86. ;sys,addr y,x1,x2,number items,text,highlight,esc
  87.  
  88. ;***sys addr,x,to x,y,to y,s-code,color
  89.  
  90. box'entry lda #5
  91. sta parm'count
  92. box'ii lda #0
  93. sta temp
  94. - jsr get'number
  95. tya
  96. ldy temp
  97. sta box'parameters,y
  98. inc temp
  99. cpy parm'count
  100. bne -
  101.  
  102. fill'box jsr linx
  103. lda 214
  104. pha
  105. lda 211
  106. pha
  107. box'start ldx box'parameters+2
  108. ldy #0
  109. clc
  110. jsr $fff0
  111. jsr old'rom'patch
  112. dec box'parameters
  113. ;inc box'parameters+3
  114.  
  115. - ldy box'parameters+1
  116. - lda box'parameters+4
  117. cmp #255
  118. beq +
  119. sta (209),y
  120. + lda box'parameters+5
  121. store'color sta (243),y
  122. dey
  123. cpy box'parameters
  124. bne -
  125. lda 214
  126. cmp box'parameters+3
  127. beq +
  128.  
  129. inc 214
  130. jsr 58732
  131. jsr old'rom'patch
  132. jmp --
  133. + lda #home
  134. jsr $ffd2
  135. pla
  136. sta 211
  137. pla
  138. sta 214
  139. jmp 58732
  140.  
  141. linx ldy #24
  142. - lda 217,y
  143. ora #128
  144. sta 217,y
  145. dey
  146. bpl -
  147. rts
  148.  
  149. ;**** get number from BASIC ****
  150.  
  151. get'number jsr $aefd
  152. jsr $ad8a
  153. jmp $b7f7
  154.  
  155. ;***** get string from BASIC ****
  156.  
  157. get'string jsr $aefd
  158. jsr $ad9e
  159. jsr $b6a3
  160.  
  161. ldx $22
  162. ldy $23
  163. rts
  164.  
  165. print'at jsr linx
  166. jsr get'number
  167. sty 211
  168. jsr get'number
  169. sty 214
  170. jsr 58732
  171. jsr get'string
  172. sta temp
  173.  
  174. print'string lda temp
  175. beq +
  176. ldy #0
  177. - lda ($22),y
  178. jsr chrout
  179. iny
  180. cpy temp
  181. bne -
  182. + rts
  183.  
  184. center jsr get'number
  185. tya
  186. tax
  187. ldy #0
  188. clc
  189. jsr plot
  190.  
  191. jsr get'string
  192. mcenter sta temp
  193.  
  194. lsr
  195. sta flag
  196. lda #20
  197. sec
  198. sbc flag
  199. sta 211
  200. jsr 58732
  201. jmp print'string
  202.  
  203. old'rom'patch lda 210
  204. sec
  205. sbc 648
  206. clc
  207. adc #$d8
  208. sta 244
  209. lda 209
  210. sta 243
  211. rts
  212.  
  213. bload jsr get'string
  214. jsr setnam
  215. jsr get'number
  216. tya
  217. tax
  218. lda #2
  219. ldy #0
  220. jsr setlfs
  221. jsr get'number
  222. sty base
  223. sta base+1
  224. ldx $14
  225. ldy $15
  226. lda #0
  227. jmp load
  228.  
  229. do'box stx 251
  230. sty 252
  231. ldy #5
  232. - lda (251),y
  233. sta box'parameters,y
  234. dey
  235. bpl -
  236. jmp fill'box
  237.  
  238. do'frame stx 251
  239. sty 252
  240. ldy #4
  241. - lda (251),y
  242. sta box'parameters,y
  243. dey
  244. bpl -
  245. jmp frame'up
  246.  
  247. frame'entry lda #4
  248. sta parm'count
  249. frame'ii lda #0
  250. sta temp
  251. - jsr get'number
  252. tya
  253. ldy temp
  254. sta box'parameters,y
  255. inc temp
  256. cpy parm'count
  257. bne -
  258.  
  259. frame'up jsr linx
  260. lda 214
  261. pha
  262. lda 211
  263. pha
  264. frame'start ldx box'parameters+2
  265. ldy #0
  266. clc
  267. jsr plot  
  268. jsr old'rom'patch
  269. ;dec box'parameters
  270.  
  271. ldy box'parameters+1
  272. lda box'parameters+4
  273. pha
  274. and #128
  275. ora #110
  276. sta (209),y
  277. pla 
  278. sta (243),y
  279. dey
  280.  
  281. - lda box'parameters+4
  282. pha
  283. and #128
  284. ora #64
  285. sta (209),y
  286. pla
  287. sta (243),y
  288. dey
  289. cpy box'parameters
  290. bne -
  291.  
  292. lda box'parameters+4
  293. pha
  294. and #128
  295. ora #112
  296. sta (209),y
  297. pla 
  298. sta (243),y
  299.  
  300. - lda #13
  301. jsr chrout
  302. jsr old'rom'patch
  303.  
  304. lda 214
  305. cmp box'parameters+3
  306. bcs do'bottom
  307.  
  308. lda box'parameters+4
  309. pha
  310. and #128
  311. ora #93
  312. ldy box'parameters
  313. sta (209),y
  314. ldy box'parameters+1
  315. sta (209),y
  316. pla
  317. sta (243),y
  318. ldy box'parameters
  319. sta (243),y
  320. jmp -
  321.  
  322. do'bottom ldy box'parameters+1
  323. lda box'parameters+4
  324. pha
  325. and #128
  326. ora #125
  327. sta (209),y
  328. pla 
  329. sta (243),y
  330. dey
  331.  
  332. - lda box'parameters+4
  333. pha
  334. and #128
  335. ora #64
  336. sta (209),y
  337. pla
  338. sta (243),y
  339. dey
  340. cpy box'parameters
  341. bne -
  342.  
  343. lda box'parameters+4
  344. pha
  345. and #128
  346. ora #109
  347. sta (209),y
  348. pla 
  349. sta (243),y
  350.  
  351. pla
  352. sta 211
  353. pla
  354. sta 214
  355. jsr 58732
  356. jmp linx
  357.  
  358. zero'stash ldy #9
  359. - lda 245,y
  360. sta zero'buf,y
  361. dey
  362. bpl -
  363. rts
  364.  
  365. zero'restore ldy #9
  366. - lda zero'buf,y
  367. sta 245,y
  368. dey
  369. bpl -
  370. rts
  371.  
  372. read'existing jsr get'number
  373. sty 174
  374. sta 175
  375. sty base
  376. sta base+1
  377. ldy #0
  378. sei
  379. lda #$74
  380. sta 1
  381. - lda (174),y
  382. bne +
  383. beq ++
  384. + inc 174
  385. bne -
  386. inc 175
  387. jmp -
  388. + lda 174
  389. sta eof
  390. lda 175
  391. sta eof+1
  392. lda #$77
  393. sta 1
  394. cli
  395. lda #0
  396. jmp +
  397.  
  398. load'file jsr bload
  399. stx eof
  400. sty eof+1
  401. + ldy #0
  402. sty setup'flag
  403. tya
  404. sta (174),y
  405. sta bottom'flag
  406. lda #147
  407. jsr chrout
  408. lda #32
  409. sta text'color-1
  410. jsr get'number
  411. sty text'color
  412. sty top'frame'color
  413. tya
  414. and #128
  415. ora text'color-1
  416. sta text'color-1
  417. jsr get'number
  418. sty frame'color
  419. sty top'box'color
  420. jsr count'lines
  421.  
  422. setup lda #0
  423. sta bottom'flag
  424. ldx <frame'parms
  425. ldy >frame'parms
  426. jsr do'frame
  427.  
  428. ldx <top'frame'parms
  429. ldy >top'frame'parms
  430. jsr do'frame
  431.  
  432. lda top'box'color
  433. sta 646
  434. and #128
  435. sta 199
  436. bit setup'flag
  437. bmi +
  438. lda top'box'parms+4
  439. ora 199
  440. sta top'box'parms+4
  441. ldx <top'box'parms
  442. ldy >top'box'parms
  443. jsr do'box
  444. ldx #2
  445. ldy #0
  446. clc
  447. jsr plot
  448. jsr get'string
  449. jsr mcenter
  450. + lda #255
  451. sta setup'flag
  452. ldx <text'parms
  453. ldy >text'parms
  454. jsr do'box
  455. ldx frame'parms+3
  456. inx
  457. jsr 59903
  458. ldx frame'parms+3
  459. inx
  460. ldy #5
  461. clc
  462. jsr plot
  463. lda frame'parms+4
  464. sta 646
  465.  
  466. lda <line'text
  467. ldy >line'text
  468. jsr strout
  469. ldx #18
  470. stx 211
  471. jsr 58732
  472.  
  473. lda text'parms+5
  474. sta 646
  475.  
  476. ldx line'count
  477. lda line'count+1
  478. jsr print'number
  479.  
  480. lda frame'parms+4
  481. sta 646
  482. inc 214
  483. lda #1
  484. sta 211
  485. jsr 58732
  486. lda <lil'menu
  487. ldy >lil'menu
  488. jsr strout
  489.  
  490. inc 214
  491. lda #8
  492. sta 211
  493. jsr 58732
  494. lda <lil'too
  495. ldy >lil'too
  496. jsr strout
  497. ldx 214
  498. dex
  499. ldy #1
  500. clc
  501. jsr plot
  502. jsr old'rom'patch
  503.  
  504. ldy #80
  505. - lda (209),y
  506. bpl +
  507. and #127
  508. sta (209),y
  509. lda text'parms+5
  510. sta (243),y
  511. + dey
  512. bpl -
  513.  
  514. lda base
  515. sta 251
  516. lda base+1
  517. sta 252
  518. lda #0
  519. sta text'loc
  520. sta text'loc+1
  521. sta cur'line
  522. sta cur'line+1
  523. inc cur'line
  524. lda cur'line
  525.  
  526. jsr page
  527. jsr print'line'no
  528.  
  529. get'text'key jsr getin
  530. beq get'text'key
  531. cmp #17
  532. bne +
  533. jsr text'down
  534. jsr print'line'no
  535. jmp get'text'key
  536. + cmp #145
  537. bne +
  538. jsr text'up
  539. jsr print'line'no
  540. jmp get'text'key
  541. + cmp #19
  542. bne +
  543. jmp setup
  544.  
  545. + cmp #crsr'right
  546. bne +
  547. jmp page'down
  548.  
  549. + cmp #crsr'left
  550. bne +
  551. jmp page'up
  552.  
  553. + cmp #147
  554. bne +
  555. jsr move'bottom
  556. jsr print'line'no
  557. jmp get'text'key
  558. + cmp "q"
  559. bne +
  560. rts
  561. + cmp "p"
  562. bne get'text'key
  563. jsr print'text
  564. jmp setup
  565.  
  566.  
  567. text'down lda bottom'flag
  568. beq +
  569. rts
  570. + jsr zero'stash
  571. ldx <text'parms
  572. ldy >text'parms
  573. jsr do'scroll'down
  574. inc cur'line
  575. bne +
  576. inc cur'line+1
  577.  
  578. + jmp zero'restore
  579.  
  580. do'scroll'down stx 251
  581. sty 252
  582. ldy #3
  583. - lda (251),y
  584. sta startingx,y
  585. dey
  586. bpl -
  587. jsr scroll'up
  588.  
  589. lda text'color-1
  590. sta char
  591. lda text'color
  592. sta color
  593. jsr clear'ii
  594.  
  595. print'new'bottom'line lda text'loc
  596. sta 251
  597. lda text'loc+1
  598. sta 252
  599. jsr page'loop
  600. jsr rom'out
  601. ldy #0
  602. lda box'top
  603. sta 251
  604. lda box'top+1
  605. sta 252
  606. lda text'color
  607. and 3128
  608. sta 199
  609. - lda (251),y
  610. cmp #13
  611. beq nbo
  612. inc 251
  613. bne +
  614. inc 252
  615. + jmp -
  616. nbo lda 251
  617. sta box'top
  618. lda 252
  619. sta box'top+1
  620. jmp rom'in
  621.  
  622.  
  623. page lda text'color
  624. sta 646
  625. and #128
  626. sta 199
  627.  
  628. ldy text'parms
  629. ldx text'parms+2
  630. clc
  631. jsr plot
  632.  
  633. page'loop ldy #0
  634. - jsr rom'out
  635. lda (251),y
  636. jsr bump'251
  637. cmp #0
  638. beq hit'bottom
  639. jsr rom'in
  640. jsr chrout
  641. lda 211
  642. bne -
  643.  
  644. lda text'color
  645. and #128
  646. sta 199
  647. lda #29
  648. jsr chrout
  649. lda 214
  650. cmp frame'parms+3
  651. bcs +
  652. jmp -
  653. / lda 251
  654. sta text'loc
  655. lda 252
  656. sta text'loc+1
  657. rts
  658.  
  659. hit'bottom jsr rom'in
  660. lda #1
  661. sta bottom'flag
  662. jmp -
  663.  
  664. page'down lda #14
  665. sta wordbuf
  666. - lda #0
  667. sta 199
  668. jsr text'down
  669. dec wordbuf
  670. bpl -
  671. jsr print'line'no
  672. jmp get'text'key
  673.  
  674. page'up lda #14
  675. sta wordbuf
  676. - jsr text'up
  677. lda cur'line+1
  678. bne +
  679. lda cur'line
  680. cmp #1
  681. beq ++
  682. + dec wordbuf
  683. bpl -
  684. + jsr print'line'no
  685. jmp get'text'key
  686.  
  687. rom'out pha
  688. sei
  689. lda #$74
  690. sta 1
  691. pla
  692. rts
  693.  
  694. rom'in pha
  695. lda #$77
  696. sta 1
  697. cli
  698. pla
  699. rts
  700.  
  701. bump'251 inc 251
  702. bne +
  703. inc 252
  704. + rts
  705.  
  706. get'scroll'up jsr get'scroll'parms
  707. jmp scroll'up
  708.  
  709. get'scroll'down jsr get'scroll'parms
  710. jmp scroll'down
  711.  
  712. get'scroll'parms lda #0
  713. sta temp
  714. - jsr get'number
  715. tya
  716. ldx temp
  717. sta startingx,x
  718. inc temp
  719. inx
  720. cpx #4
  721. bcc -
  722. rts
  723.  
  724. scroll'up ldy startingx
  725. ldx startingy
  726. stx line
  727. clc
  728. jsr plot
  729. jsr old'rom'patch
  730.  
  731. scroll'up'math clc
  732. lda 209
  733. adc <40
  734. sta 251
  735. lda 210
  736. adc >40
  737. sta 252
  738.  
  739. clc
  740. lda 243
  741. adc <40
  742. sta 253
  743. lda 244
  744. adc >40
  745. sta 254
  746.  
  747. ldy startingx
  748.  
  749. - lda (251),y
  750. sta (209),y
  751. lda (253),y
  752. sta (243),y
  753. iny
  754. cpy endingx
  755. beq -
  756. bcc -
  757.  
  758. inc line
  759. lda line
  760. cmp endingy
  761. bcs through'scrolling'up
  762.  
  763. clc
  764. lda 209
  765. adc <40
  766. sta 209
  767. lda 210
  768. adc >40
  769. sta 210
  770.  
  771. clc
  772. lda 243
  773. adc <40
  774. sta 243
  775. lda 244
  776. adc >40
  777. sta 244
  778. jmp scroll'up'math
  779.  
  780. through'scrolling'up ldx endingy
  781. ldy startingx
  782. clc
  783. jsr plot
  784. jmp old'rom'patch
  785.  
  786. scroll'down ldy startingx
  787. ldx endingy
  788. stx line
  789. clc
  790. jsr plot
  791. jsr old'rom'patch
  792.  
  793. scroll'down'math sec
  794. lda 209
  795. sbc <40
  796. sta 251
  797. lda 210
  798. sbc >40
  799. sta 252
  800.  
  801. sec
  802. lda 243
  803. sbc <40
  804. sta 253
  805. lda 244
  806. sbc >40
  807. sta 254
  808.  
  809. ldy startingx
  810.  
  811. - lda (251),y
  812. sta (209),y
  813. lda (253),y
  814. sta (243),y
  815. iny
  816. cpy endingx
  817. beq -
  818. bcc -
  819.  
  820. dec line
  821. lda line
  822. cmp startingy
  823. beq through'scrolling'down
  824.  
  825. sec
  826. lda 209
  827. sbc <40
  828. sta 209
  829. lda 210
  830. sbc >40
  831. sta 210
  832.  
  833. sec
  834. lda 243
  835. sbc <40
  836. sta 243
  837. lda 244
  838. sbc >40
  839. sta 244
  840. jmp scroll'down'math
  841.  
  842. through'scrolling'down ldx startingy
  843. ldy startingx
  844. clc
  845. jsr plot
  846. jmp old'rom'patch
  847.  
  848. clear'row jsr get'number
  849. sty char
  850. jsr get'number
  851. sty color
  852.  
  853. clear'ii ldy startingx
  854. - lda char
  855. sta (209),y
  856. lda color
  857. sta (243),y
  858. iny
  859. cpy endingx
  860. beq -
  861. bcc -
  862. rts
  863.  
  864. text'up jsr zero'stash
  865. lda cur'line+1
  866. bne ++
  867. lda cur'line
  868. cmp #1
  869. beq +
  870. bcs ++
  871. + lda base
  872. sta 251
  873. lda base+1
  874. sta 252
  875. jmp page
  876.  
  877.  
  878.  
  879. + sec
  880. lda cur'line
  881. sbc #1
  882. sta cur'line
  883. lda cur'line+1
  884. sbc #0
  885. sta cur'line+1
  886.  
  887. lda cur'line+1
  888. bne +
  889. lda cur'line
  890. cmp #1
  891. bne +
  892.  
  893. ldx <text'parms
  894. ldy >text'parms
  895. jsr do'box
  896. lda base
  897. sta 251
  898. lda base+1
  899. sta 252
  900. jmp page
  901.  
  902. + ldx <text'parms
  903. ldy >text'parms
  904. jsr do'scroll'up
  905. jmp zero'restore
  906.  
  907. do'scroll'up stx 251
  908. sty 252
  909. ldy #3
  910. - lda (251),y
  911. sta startingx,y
  912. dey
  913. bpl -
  914. jsr scroll'down
  915. lda #0
  916. sta bottom'flag
  917.  
  918. lda text'color-1
  919. sta char
  920. lda text'color
  921. sta color
  922. jsr clear'ii
  923.  
  924. count'back lda #0
  925. sta temp
  926. lda text'loc
  927. sta 251
  928. lda text'loc+1
  929. sta 252
  930. ldy #0
  931. - dec 251
  932. lda 251
  933. cmp #255
  934. bne +
  935. dec 252
  936. + jsr rom'out
  937. lda (251),y
  938. jsr rom'in
  939. beq +
  940. cmp #13
  941. bne -
  942. + inc temp
  943. lda temp
  944. cmp #2
  945. bne +
  946. jsr bump'251
  947. lda 251
  948. sta text'loc
  949. lda 252
  950. sta text'loc+1
  951. jmp -
  952. + cmp #18
  953. bne -
  954.  
  955. top'line inc 251
  956. bne +
  957. inc 252
  958. + jsr rom'in
  959.  
  960. print'new'top lda text'color
  961. sta 646
  962. and #128
  963. sta 199
  964.  
  965. ;ldy text'parms
  966. ;ldx text'parms+2
  967. ;clc
  968. ;jsr plot
  969.  
  970. ldy #0
  971. - jsr rom'out
  972. lda (251),y
  973. beq suo
  974. jsr bump'251
  975. jsr rom'in
  976. jsr chrout
  977. lda 211
  978. bne -
  979.  
  980. suo jmp rom'in
  981.  
  982. print'line'no sec
  983. jsr plot
  984. stx menuy
  985. sty menux1
  986.  
  987. ldx frame'parms+3
  988. inx
  989. ldy #32
  990. clc
  991. jsr plot
  992.  
  993. ldy #32
  994. lda text'color-1
  995. - sta (209),y
  996. iny
  997. cpy #38
  998. bne -
  999.  
  1000. lda #0
  1001. sta 199
  1002. ldx cur'line
  1003. lda cur'line+1
  1004. jsr print'number
  1005.  
  1006. clc
  1007. ldx menuy
  1008. ldy menux1
  1009. jmp plot
  1010.  
  1011.  
  1012. count'lines jsr zero'stash
  1013. lda #0
  1014. sta line'count
  1015. sta line'count+1
  1016. lda base
  1017. sta 251
  1018. lda base+1
  1019. sta 252
  1020. ldy #0
  1021. jsr rom'out
  1022. - lda (251),y
  1023. beq count'done
  1024. inc 251
  1025. bne +
  1026. inc 252
  1027. + cmp #13
  1028. bne -
  1029. inc line'count
  1030. bne -
  1031. inc line'count+1
  1032. jmp -
  1033.  
  1034. count'done jsr rom'in
  1035. lda line'count
  1036. sec
  1037. sbc #13
  1038. sta line'count
  1039. lda line'count+1
  1040. sbc #0
  1041. sta line'count+1
  1042. jmp zero'restore
  1043.  
  1044. move'bottom lda eof
  1045. sta 251
  1046. sta text'loc
  1047. lda eof+1
  1048. sta 252
  1049. sta text'loc+1
  1050.  
  1051. lda #0
  1052. sta temp
  1053. ldy #0
  1054. - dec 251
  1055. lda 251
  1056. cmp #255
  1057. bne +
  1058. dec 252
  1059. + jsr rom'out
  1060. lda (251),y
  1061. jsr rom'in
  1062. beq +
  1063. cmp #13
  1064. bne -
  1065. + inc temp
  1066. lda temp
  1067. cmp #2
  1068. bne +
  1069. jsr bump'251
  1070. lda 251
  1071. sta text'loc
  1072. lda 252
  1073. sta text'loc+1
  1074. jmp -
  1075. + cmp #16
  1076. bne -
  1077.  
  1078. jsr bump'251
  1079. jsr rom'in
  1080. lda 252
  1081. cmp base+1
  1082. beq +
  1083. bcs ++
  1084. + lda 251
  1085. cmp base
  1086. bcs +
  1087. lda base
  1088. sta 251
  1089. lda base+1
  1090. sta 252
  1091. + jsr zero'stash
  1092. ldx <text'parms
  1093. ldy >text'parms
  1094. jsr do'box
  1095. jsr zero'restore
  1096. jsr page
  1097. lda line'count
  1098. sta cur'line
  1099. lda line'count+1
  1100. sta cur'line+1
  1101. jmp zero'stash
  1102.  
  1103.  
  1104. print'text ldx <text'parms
  1105. ldy >text'parms
  1106. jsr do'box
  1107.  
  1108. lda text'color
  1109. and #128
  1110. sta 199
  1111.  
  1112. ldx text'parms+2
  1113. inx
  1114. inx
  1115. ldy #1
  1116. clc
  1117. jsr plot
  1118. lda <tractor'prompt
  1119. ldy >tractor'prompt
  1120. jsr strout
  1121.  
  1122. lda #1
  1123. sta pageno
  1124. sta pageno+1
  1125.  
  1126. - jsr getin
  1127. beq -
  1128. and #127
  1129. cmp "s"
  1130. beq do'normal'print
  1131. cmp "t"
  1132. beq do'normal'print
  1133. cmp "q"
  1134. beq +
  1135. bne -
  1136. + rts
  1137.  
  1138. do'normal'print sta print'mode
  1139. inc 214
  1140. inc 214
  1141. lda #3
  1142. sta 211
  1143. jsr 58732
  1144.  
  1145. lda <formfeed'prompt
  1146. ldy >formfeed'prompt
  1147. jsr strout
  1148.  
  1149. - jsr getin
  1150. beq -
  1151. and #127
  1152. cmp "q"
  1153. bne +
  1154. rts
  1155. + cmp "y"
  1156. beq +
  1157. cmp "n"
  1158. beq +
  1159. jmp -
  1160.  
  1161. + sta formfeed'mode
  1162.  
  1163. lda base
  1164. sta 249
  1165. lda base+1
  1166. sta 250
  1167. jsr do'printing'prompt
  1168. lda #0
  1169. jsr setnam
  1170. ldx #4
  1171. lda #4
  1172. ldy #7
  1173. jsr setlfs
  1174. jsr open
  1175. jsr clrchn
  1176. ldx #4
  1177. jsr chkout
  1178. lda #1
  1179. sta pos
  1180. sta wordlen
  1181. sta endpflag
  1182. sta retcount
  1183. inc retcount
  1184. lda #" "
  1185. ldx #4
  1186. stx p'line
  1187. jsr repeat
  1188. jsr leftmrgn ;position printer
  1189. jsr setprt
  1190.  
  1191. heregoes jsr findword ;find a word
  1192. jsr printwrd ;print the word
  1193. jsr advcntr ;advance hi/lo pointer
  1194. ldx 197
  1195. cpx #10
  1196. beq formfeed
  1197. ldx endpflag
  1198. bpl heregoes;if not end then loop
  1199.  
  1200. formfeed lda formfeed'mode
  1201. cmp "n"
  1202. beq +
  1203. lda #12
  1204. jsr chrout
  1205. jmp bailout
  1206.  
  1207. + lda #13
  1208. jsr chrout
  1209. inc p'line
  1210. lda p'line
  1211. cmp #64
  1212. bcc formfeed
  1213. lda pageno
  1214. cmp #2
  1215. bcc bailout
  1216. lda #" "
  1217. ldx #38
  1218. jsr repeat
  1219. lda #"-"
  1220. jsr chrout
  1221. lda #0
  1222. ldx pageno
  1223. jsr $bdcd
  1224. lda #"-"
  1225. jsr chrout
  1226.  
  1227. bailout lda #13
  1228. ldx #6
  1229. jsr repeat
  1230. lda #4
  1231. jsr close:dec 154
  1232. lda #19
  1233. sta 631
  1234. lda #1
  1235. sta 198
  1236. rts
  1237.  
  1238. repeat jsr chrout
  1239. dex
  1240. bne repeat
  1241. rts
  1242.  
  1243. leftmrgn lda #13
  1244. jsr chrout
  1245. ldx #10:stx pos
  1246. lda #" "
  1247. jsr repeat
  1248. inc p'line
  1249. ldx p'line
  1250. cpx #61
  1251. beq +
  1252. jmp notyet
  1253. + lda formfeed'mode
  1254. cmp "n"
  1255. beq +
  1256. lda #12
  1257. jsr chrout
  1258. lda 249
  1259. sta tempoint
  1260. lda 250
  1261. sta tempoint+1
  1262. sty tempy
  1263. ldx #5
  1264. lda #13
  1265. jmp npage
  1266.  
  1267. + lda #13
  1268. jsr chrout
  1269. jsr chrout
  1270. jsr chrout
  1271. ldx pageno
  1272. cpx #2
  1273. bcc snick
  1274. lda 249
  1275. sta tempoint
  1276. lda 250
  1277. sta tempoint+1
  1278. sty tempy
  1279. lda #" "
  1280. ldx #38
  1281. jsr repeat
  1282. lda #"-"
  1283. jsr chrout
  1284. ldx pageno
  1285. lda #0
  1286. jsr $bdcd
  1287. lda #"-"
  1288. jsr chrout
  1289. ldy tempy
  1290. lda tempoint
  1291. sta 249
  1292. lda tempoint+1
  1293. sta 250
  1294.  
  1295. snick ldx #7
  1296. lda #13
  1297.  
  1298. npage jsr chrout
  1299. dex
  1300. bne npage
  1301.  
  1302. pagewait lda print'mode
  1303. cmp "t"
  1304. beq newpage
  1305.  
  1306. jsr do'sheet'prompt
  1307. jsr do'printing'prompt
  1308.  
  1309. newpage lda #5
  1310. sta p'line
  1311. lda #" "
  1312. ldx #10
  1313. stx pos
  1314. jsr repeat
  1315. inc pageno
  1316.  
  1317. notyet rts
  1318.  
  1319. setprt lda base
  1320. sta 249
  1321. lda base+1
  1322. sta 250
  1323. rts
  1324.  
  1325. findword ldy #0
  1326. lda 1
  1327. and #254
  1328. sta 1
  1329. fw1 jsr rom'out
  1330. lda (249),y
  1331. jsr rom'in
  1332. bne nonzero
  1333. ldx #129
  1334. stx endpflag
  1335.  
  1336. nonzero sta wordbuf,y
  1337.  
  1338. notret and #95 ;32 or 160 will zero
  1339. beq aha  ;found a space or shift
  1340. cpy #41
  1341. beq aha ;word buffer is full
  1342. iny
  1343. bne fw1
  1344. aha clc
  1345. lda 1
  1346. ora #1
  1347. sta 1
  1348. tya
  1349. sta wordlen
  1350. adc pos
  1351. cmp #76 ;right margin
  1352. bcc short
  1353. jsr leftmrgn
  1354.  
  1355. short rts
  1356.  
  1357. printwrd ldy #0
  1358. inc wordlen
  1359. ptwd1 lda wordbuf,y
  1360. iny
  1361. ldx wordbuf,y
  1362. dey
  1363. stx nchar
  1364. jsr checkrt
  1365. cmp #0
  1366. beq ptwd2
  1367. jsr chrout
  1368. inc pos
  1369.  
  1370. ptwd2 iny
  1371. cpy wordlen
  1372. bne ptwd1
  1373. dec wordlen
  1374. rts
  1375.  
  1376. incprt inc 249
  1377. bne inprtout
  1378. inc 250
  1379.  
  1380. inprtout rts
  1381. decprt dec 249
  1382. bne deprtout
  1383. dec 250
  1384.  
  1385. deprtout rts
  1386.  
  1387. zeroret ldx #2
  1388. stx retcount
  1389. rts
  1390.  
  1391. checkrt cmp #13
  1392. beq checkrt1
  1393.  
  1394. jmp zeroret
  1395.  
  1396.  
  1397. checkrt1 ldx nchar
  1398. cpx #32
  1399. beq checksp2
  1400. cpx #13
  1401. beq checkrt3
  1402.  
  1403. checkrt2 dec retcount
  1404. beq checkrt3
  1405. lda #" "
  1406. rts
  1407.  
  1408. checkrt3 jsr zeroret
  1409. jsr leftmrgn
  1410. lda #0
  1411. rts
  1412.  
  1413. checksp2 jsr leftmrgn
  1414. lda #" "
  1415. rts
  1416.  
  1417. advcntr ldy wordlen
  1418. advcntr1 jsr incprt
  1419. dey
  1420. bpl advcntr1
  1421. rts
  1422.  
  1423. do'sheet'prompt pha
  1424. tya
  1425. pha
  1426. txa
  1427. pha
  1428. lda 53280
  1429. sta menuy
  1430. ldx <text'parms
  1431. ldy >text'parms
  1432. jsr do'box
  1433. lda text'color
  1434. and #128
  1435. sta 251
  1436.  
  1437. ldx text'parms+2
  1438. inx
  1439. inx
  1440. ldy #11
  1441. clc
  1442. jsr plot
  1443.  
  1444. ldy #11
  1445. ldx #0
  1446. - lda sht,x
  1447. beq +
  1448. ora 251
  1449. sta (209),y
  1450. iny
  1451. inx
  1452. bne -
  1453.  
  1454. / inc 53280
  1455. lda 197
  1456. cmp #64
  1457. beq -
  1458. lda #0
  1459. sta 198
  1460. pla
  1461. tay
  1462. pla
  1463. tax
  1464. pla
  1465. lda menuy
  1466. sta 53280
  1467.  
  1468. rts
  1469.  
  1470. do'printing'prompt pha
  1471. tya
  1472. pha
  1473. txa
  1474. pha
  1475. ldx <text'parms
  1476. ldy >text'parms
  1477. jsr do'box
  1478. lda text'color
  1479. and #128
  1480. sta 251
  1481.  
  1482. ldx text'parms+2
  1483. inx
  1484. inx
  1485. ldy #11
  1486. clc
  1487. jsr plot
  1488.  
  1489. ldy #9
  1490. ldx #0
  1491. - lda prt,x
  1492. beq +
  1493. ora 251
  1494. sta (209),y
  1495. iny
  1496. inx
  1497. bne -
  1498.  
  1499. + pla
  1500. tay
  1501. pla
  1502. tax
  1503. pla
  1504. rts
  1505.  
  1506. sht .scr "Next Sheet/Any Key":.byt 0
  1507. prt .scr "P R I N T I N G . . .":.byt 0
  1508.  
  1509. ;print'method .byt 0
  1510.  
  1511. no'print .byt 0
  1512. column .byt 0,0
  1513. prlen .byte 0,0
  1514. prloc .byte 0,0
  1515. pos .byte 0
  1516. p'line .byte 0
  1517. wordlen .byte 0
  1518. wordbuf .buf 42
  1519. retcount .byte 1
  1520. endpflag .byte 1
  1521. nchar .byte 1
  1522. pageno .byt 0,0
  1523. tempoint .byte 0,0
  1524. tempy .byte 0
  1525. print'mode .asc "t"
  1526.  
  1527.  
  1528. zero'buf .buf 10
  1529.  
  1530. menuy .byt 0
  1531. menux1 .byt 0
  1532. menux2 .byt 0
  1533.  
  1534. menu'current .byt 0
  1535. mcolor .byt 0
  1536. parm'count .byt 0
  1537. box'parameters .buf 6
  1538. flag .byt 0
  1539. temp .byt 0
  1540. base .word 0
  1541.  
  1542. text'parms .byt 1,38,5,19,160
  1543. text'color .byt 3
  1544.  
  1545. frame'parms .byt 0,39,4,20
  1546. frame'color .byte 0
  1547.  
  1548. top'frame'parms .byt 0,39,1,3
  1549. top'frame'color .byt 0
  1550. top'box'parms .byte 1,38,2,2,32
  1551. top'box'color .byt 0
  1552.  
  1553.  
  1554. setup'flag .byt 0
  1555. startingx .byt 0
  1556. endingx .byt 0
  1557. startingy .byt 0
  1558. endingy .byt 0
  1559. char .byt 0
  1560. color .byt 0
  1561. line .byt 0
  1562. page'mode .byt 0
  1563. text'loc .buf 2
  1564. box'top .buf 2
  1565. bottom'flag .byt 0
  1566. bottom'one .buf 2
  1567. cur'line .word 0
  1568. line'text .asc "Total Lines:      Current:   ":.byt 0
  1569. lil'menu .byt 18:.asc "Up/Down":.byt 146:.asc " - Scroll ":.byt 18:.asc "HOME/CLR":.byt 146:.asc " - Top/Bottom":.byt 0
  1570. lil'too .byt 18:.asc "P":.byt 146:.asc " - Print  ":.byt 18:.asc "Q":.byt 146:.asc " - Quit Text":.byte 0
  1571. line'count .word 0
  1572. tractor'prompt .asc "Single sheet or Tractor feed? (S/T/Q)":.byt 0
  1573. eof .word 0
  1574. formfeed'prompt .asc "Use form feed on each page? (Y/N)":.byt 0
  1575. formfeed'mode .byt 1
  1576.  
  1577.  
  1578.  
  1579. .end
  1580.