This should give you vtl-2 running on the Tandy/Radio Shack MC-10, even in a stock 4K RAM configuration. You can assemble it with my asm68c assembler.

形式
Asm
投稿日時
2022-09-03 22:09
公開期間
無期限
  1. OPT 6801
  2. * VTL-2 for 6801
  3. * V-3.6
  4. * 9-23-76
  5. * BY GARY SHANNON
  6. * & FRANK MCCOY
  7. * COPYWRIGHT 1976, THE COMPUTER STORE
  8. *
  9. * Modifications for 6803-based MC-10
  10. * including moving variables out of direct page, etc.
  11. * by Joel Matthew Rees
  12. * Copyright 2022, Joel Matthew Rees
  13. *
  14. * Modifications explained at
  15. * https://joels-programming-fun.blogspot.com/2022/08/trs-mc-10-assembly-lang-pt1-vtl-2.html
  16. *
  17. * DEFINE LOCATIONS IN MONITOR
  18. * INCH EQU $FF00 ; per VTL.ASM
  19. * EINCH EQU $F012 ; exorsim mdos Input byte with echo unless AECHO is set
  20. * INCH EQU $F015 ; exorsim mdos Input char with echo (F012 -> strip bit 7)
  21. * POLCAT EQU $FF24 ; from VTL.ASM
  22. * OUTCH EQU $FF81 ; from VTL.ASM
  23. * EOUTCH EQU $F018 ; exorsim mdos Output character with NULs
  24. * OUTS EQU $FF82 ; from VTL.ASM
  25. * EPCRLF EQU $F021 ; Primarily for forced initialization in exorsim.
  26. *
  27. * FOR SBC6800:
  28. *BREAK EQU $1B ; BREAK KEY
  29. * For MC-10:
  30. BREAK EQU $03
  31. * For exorsim
  32. *ACIACS EQU $FCF4 ; exorcisor
  33. *ACIADA EQU $FCF5 ; exorcisor
  34. *
  35. * A few interpreter variables in the direct page won't hurt.
  36. * (Yes, I can hear voices of complaint that it's not as "tight" as it could be.)
  37. * (This allows us to save more ROM space and uses DP that would otherwise go wasted.)
  38. * (Trade-offs.)
  39. * (It also helps us understand the code, so we can do a better 6809 transliteration.)
  40. * (I hope the names are meaningful.)
  41. *
  42. * In .c10 format, the following as ORG and RMBs will cause object code output,
  43. * which will prevent the code from loading.
  44. * Changed to EQU for the MC10.
  45. * ORG $C0 ; Move this according to your environment's needs.
  46. DPBASE EQU $C0 ; Change this to move the registers.
  47. * PARSET RMB 2 ; Instead of SAVE0 in TERM/NXTRM
  48. PARSET EQU DPBASE+2
  49. * CVTSUM RMB 2 ; Instead of SAVE1 in CBLOOP
  50. CVTSUM EQU PARSET+2
  51. * MLDVCT EQU CVTSUM ; Instead of SAVE1 in mul/div (1 byte only)
  52. MLDVCT EQU CVTSUM
  53. * DIVQUO RMB 2 ; Instead of SAVE2 in DIV
  54. DIVQUO EQU MLDVCT+2
  55. * MPLIER EQU DIVQUO ; Instead of SAVE2 in MULTIP
  56. MPLIER EQU DIVQUO
  57. * EVALPT RMB 2 ; Instead of SAVE3
  58. EVALPT EQU MPLIER+2
  59. * CNVPTR RMB 2 ; Instead of SAVE4
  60. CNVPTR EQU EVALPT+2
  61. * VARADR RMB 2 ; Instead of SAVE6
  62. VARADR EQU CNVPTR+2
  63. * OPRLIN RMB 2 ; Instead of SAVE7
  64. OPRLIN EQU VARADR+2
  65. * EDTLIN RMB 2 ; Instead of SAVE8
  66. EDTLIN EQU OPRLIN+2
  67. * INSPTR RMB 2 ; Instead of SAVE10 (maybe? Will some VTL programs want it back?)
  68. INSPTR EQU EDTLIN+2
  69. * SAVLIN RMB 2 ; Instead of SAVE11
  70. SAVLIN EQU INSPTR+2
  71. * SRC RMB 2 ; For copy routine
  72. SRC EQU SAVLIN+2
  73. * DST RMB 2 ; ditto
  74. DST EQU SRC+2
  75. STKMRK EQU DST+2 ; to restore the stack on each pass.
  76. DPALLOC EQU STKMRK+2 ; total storage declared in the direct page
  77. *
  78. * SET ASIDE FOUR BYTES FOR USER
  79. * DEFINED INTERUPT ROUTINE IF NEEDED
  80. ORG $4300
  81. * ZERO must be set at even $100 boundary for address math to work.
  82. ZERO RMB 4 ; INTERUPT VECTOR
  83. AT RMB 2 ; CANCEL & C-R
  84. *
  85. * GENERAL PURPOSE STORRGE
  86. VARS RMB 52 ; VARIABLES(A-Z)
  87. BRAK RMB 2 ; [
  88. * SAVE10 has me worried about implicit linkage in VTL programs. Might need to leave it here.
  89. SAVE10 RMB 2 ; BACK SLASH
  90. BRIK RMB 2 ; ]
  91. UP RMB 2 ; ^
  92. SAVE11 RMB 2 ; Need something in each SAVE to reserve space
  93. * ; to keep the math straight.
  94. * ; Leave the SAVEs declared as they are.
  95. *
  96. SAVE14 RMB 2 ; SPACE (originally unused)
  97. EXCL RMB 2 ; !
  98. QUOTE RMB 2 ; "
  99. DOLR RMB 2 ; #
  100. DOLLAR RMB 2 ; $
  101. REMN RMB 2 ; %
  102. AMPR RMB 2 ; &
  103. QUITE RMB 2 ; '
  104. PAREN RMB 2 ; (
  105. PARIN RMB 2 ; )
  106. STAR RMB 2 ; *
  107. PLUS RMB 2 ; +
  108. COMA RMB 2 ; ,
  109. MINS RMB 2 ; -
  110. PERD RMB 2 ; .
  111. SLASH RMB 2 ; /
  112. *
  113. SAVE0 RMB 2 ; unused
  114. SAVE1 RMB 2 ; unused
  115. SAVE2 RMB 2 ; unused
  116. SAVE3 RMB 2 ; unused
  117. SAVE4 RMB 2 ; unused
  118. SAVE5 RMB 2 ; unused (PSH/PULX)
  119. SAVE6 RMB 2 ; unused
  120. SAVE7 RMB 2 ; unused
  121. SAVE8 RMB 2 ; unused
  122. SAVE9 RMB 2 ; unused (PSH/PULX)
  123. COLN RMB 2 ; :
  124. SEMI RMB 2 ; ;
  125. LESS RMB 2 ; <
  126. EQAL RMB 2 ; =
  127. GRRT RMB 1 ; >
  128. DECB_1 RMB 1
  129. *
  130. DECBUF RMB 4
  131. LASTD RMB 1
  132. DELIM RMB 1
  133. LINLEN EQU 72
  134. LINBUF RMB LINLEN+1
  135. BUFOFF EQU LINBUF-ZERO ; Unmagic 87. Some assemblers will cough at this.
  136. *
  137. ORG $43F1
  138. STACK RMB 1
  139. *
  140. ORG $4400
  141. MI RMB 4 ; INTERUPT VECTORS
  142. NMI RMB 4
  143. PRGM EQU * ; PROGRAM STARTS HERE
  144. * Must have some RAM here.
  145. *
  146. ORG $4C00
  147. *
  148. * The COLD boot can be removed or ignored to restore the original behavior,
  149. * but if you do that don't forget to set & (AMPR) and * (STAR) values
  150. * by hand immediately after STARTing.
  151. *
  152. * Also, instead of PROBEing, if you know the limits for a particular ROM
  153. * application, you can set STAR directly:
  154. * LDX #PRGM
  155. * STX AMPR
  156. * LDX #RAMLIM
  157. * STX STAR
  158. * START ...
  159. *
  160. COLD STS STKMRK ; Mark the stack,
  161. * LDS #STACK ; but use BASIC's stack. (S on 6800 points to next free byte.)
  162. * JSR TRMINI
  163. LDX #PRGM ; initialize program area base
  164. STX AMPR
  165. LDAA #$5A ; Probe RAM limit
  166. LDAB #$A5
  167. BRA PROBET
  168. PROBE STAA 0,X
  169. CMPA 0,X
  170. BNE NOTRAM
  171. STAB 0,X
  172. CMPB 0,X
  173. BNE NOTRAM
  174. INX ; all bits seem to be R/W.
  175. PROBET CPX #COLD
  176. BLO PROBE ; CPX on 6801 works right.
  177. NOTRAM DEX
  178. STX STAR
  179. START
  180. * LDS #STACK ; re-initialize at beginning of each evaluate
  181. LDS STKMRK ; from mark instead of constant
  182. STS SEMI ; DBG Comment this out when we no longer need to see the stack pointer BASIC gives us.
  183. CLRA ; NUL delimiter
  184. LDX #OKM
  185. BSR STRGT
  186. *
  187. LOOP CLRA
  188. STAA DOLR
  189. STAA DOLR+1
  190. JSR CVTLN
  191. BCC STMNT ; NO LINE# THEN EXEC
  192. BSR EXEC
  193. BEQ START
  194. *
  195. LOOP2 BSR FIND ; FIND LINE
  196. EQSTRT BEQ START ; IF END THEN STOP
  197. LDX 0,X ; LOAD REAL LINE #
  198. STX DOLR ; SAVE IT
  199. LDX SAVLIN ; GET LINE
  200. INX ; BUMP PAST LINE #
  201. INX ; BUMP PAST LINE #
  202. INX ; BUMP PAST SPACE
  203. BSR EXEC ; EXECUTE IT
  204. BEQ LOOP3 ; IF ZERO, CONTINUE
  205. LDX SAVLIN ; FIND LINE
  206. LDX 0,X ; GET IT
  207. CPX DOLR ; HAS IT CHANGED?
  208. BEQ LOOP3 ; IF NOT GET NEXT
  209. *
  210. INX ; INCREMENT OLD LINE#
  211. STX EXCL ; SAVE FOR RETURN
  212. BRA LOOP2 ; CONTINUE
  213. *
  214. LOOP3 BSR FND3 ; FIND NEXT LINE
  215. BRA EQSTRT ; CONTINUE
  216. *
  217. EXEC STX OPRLIN ; EXECUTE LINE
  218. JSR VAR2
  219. INX
  220. *
  221. SKIP LDAA 0,X ; GET FIRST TERM
  222. BSR EVIL ; EVALUATE EXPRESSION
  223. OUTX LDX DOLR ; GET LINE #
  224. RTS
  225. *
  226. EVIL CMPA #$22 ; IF " THEN BRANCH
  227. BNE EVALU
  228. INX
  229. STRGT JMP STRING ; TO PRINT IT
  230. *
  231. STMNT STX EDTLIN ; SAVE LINE #
  232. STD DOLR
  233. LDX DOLR
  234. BNE SKP2 ; IF LINE# <> 0
  235. *
  236. LDX #PRGM ; LIST PROGRAM
  237. LST2 CPX AMPR ; END OF PROGRAM
  238. BEQ EQSTRT
  239. STX SAVLIN ; LINE # FOR CVDEC
  240. LDD 0,X
  241. JSR PRNT2
  242. LDX SAVLIN
  243. INX
  244. INX
  245. JSR PNTMSG
  246. JSR CRLF
  247. BRA LST2
  248. *
  249. NXTXT LDX SAVLIN ; GET POINTER
  250. INX ; BUMP PAST LINE#
  251. LOOKAG INX ; FIND END OF LINE
  252. TST 0,X
  253. BNE LOOKAG
  254. INX
  255. RTS
  256. *
  257. FIND LDX #PRGM ; FIND LINE
  258. FND2 STX SAVLIN
  259. CPX AMPR
  260. BEQ RTS1
  261. * LDAA 1,X ; almost missed this.
  262. * SUBA DOLR+1 ; This was necessary because no SUBD
  263. * LDAA 0,X ; and CPX does not affect C flag on 6800
  264. * SBCA DOLR
  265. * PSHB ; B does not seem to be in use.
  266. LDD 0,X ; Use D because we think we want to keep X.
  267. SUBD DOLR
  268. * PULB
  269. BCC SET
  270. FND3 BSR NXTXT
  271. BRA FND2
  272. *
  273. SET LDAA #$FF ; SET NOT EQUAL
  274. RTS1 RTS
  275. *
  276. EVALU JSR EVAL ; EVALUATE LINE
  277. PSHB
  278. PSHA
  279. LDX OPRLIN
  280. JSR CONVP
  281. PULA
  282. CMPB #'$ ; STRING?
  283. BNE AR1
  284. PULB
  285. JMP OUTCH ; THEN PRINT IT
  286. AR1 SUBB #'? ; PRINT?
  287. BNE AR11 ; was out of range.
  288. JMP PRNT ; THEN DO IT
  289. * BEQ PRNT ; When we bring it back within range.
  290. AR11 INCB ; MACHINE LANGUAGE?
  291. PULB
  292. BNE AR2
  293. SWI ; THEN INTERUPT
  294. *
  295. AR2 STD 0,X ; STORE NEW VALUE
  296. ADDD QUITE ; RANDOMIZER
  297. STD QUITE
  298. RTS
  299. *
  300. SKP2 BSR FIND ; FIND LINE
  301. BEQ INSRT ; IF NOT THERE
  302. LDX 0,X ; THEN INSERT
  303. CPX DOLR ; NEW LINE
  304. BNE INSRT
  305. *
  306. BSR NXTXT ; SETUP REGISTERS
  307. * LDS SAVLIN ; FOR DELETE
  308. STX SRC
  309. LDX SAVLIN
  310. STX DST
  311. *
  312. DELT LDX SRC
  313. CPX AMPR ; DELETE OLD LINE
  314. BEQ FITIT
  315. LDAA 0,X
  316. INX
  317. STX SRC
  318. * PSHA
  319. * INX
  320. * INS
  321. * INS
  322. LDX DST
  323. STA 0,X
  324. INX
  325. STX DST
  326. BRA DELT
  327. *
  328. * FITIT STS AMPR ; STORE NEW END
  329. FITIT LDX DST
  330. STX AMPR ; STORE NEW END
  331. *
  332. INSRT LDX EDTLIN ; COUNT NEW LINE LENGTH
  333. LDAB #$03
  334. TST 0,X
  335. BEQ GOTIT ; IF NO LINE THEN STOP
  336. CNTLN INCB ; count bytes
  337. INX
  338. TST 0,X ; Find trailing NUL
  339. BNE CNTLN
  340. *
  341. OPEN CLRA ; CALCULATE NEW END
  342. ADDD AMPR
  343. STD INSPTR
  344. SUBD STAR
  345. BCC RSTRT ; IF TOO BIG THEN STOP
  346. LDX AMPR
  347. * LDS INSPTR ; remember that the 6800/6801 stack is postdecrement push.
  348. * STS AMPR
  349. LDD INSPTR ; remember that the 6800/6801 stack is postdecrement push.
  350. STD AMPR
  351. *
  352. * LDS AMPR
  353. STD DST
  354. INX ; SLIDE OPEN GAP
  355. SLIDE DEX ; going down
  356. STX SRC
  357. LDAB 0,X
  358. * PSHB ; stack blast it
  359. LDX DST
  360. STAB 0,X ; mimic 6800 push
  361. DEX
  362. STX DST
  363. LDX SRC
  364. CPX SAVLIN
  365. BHI SLIDE
  366. *
  367. * DON LDS DOLR ; STORE LINE #
  368. * STS 0,X
  369. DON LDD DOLR ; STORE LINE #
  370. STD 0,X
  371. STX DST ; will skip by offset store
  372. * LDS EDTLIN ; GET NEW LINE
  373. * DES ; pre-increment
  374. LDD EDTLIN ; GET NEW LINE
  375. STD SRC
  376. *
  377. *MOVL INX ; INSERT NEW LINE (skip over LINE # hi byte)
  378. * PULB
  379. * STAB 1,X ; (skips over low byte, BTW)
  380. MOVL LDX SRC
  381. LDAB 0,X
  382. INX
  383. STX SRC
  384. LDX DST
  385. INX ; skip over what was already stored (too tricky for words).
  386. STX DST
  387. STAB 1,X ; note offset store
  388. BNE MOVL ; until NUL stored
  389. *
  390. GOTIT
  391. * LDS #STACK ; Ready for a new line of input.
  392. LDS STKMRK ; restore from mark
  393. JMP LOOP
  394. *
  395. RSTRT JMP START ; warm start over
  396. *
  397. PRNT PULB ; PRINT DECIMAL
  398. PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL
  399. STX CNVPTR
  400. LDX #PWRS10
  401. CVD1 PSHX
  402. LDX 0,X
  403. STX VARADR
  404. LDX #VARADR
  405. JSR DIVIDE
  406. PSHA
  407. LDX CNVPTR
  408. LDAA DIVQUO+1
  409. ADDA #'0
  410. STAA 0,X
  411. PULA
  412. INX
  413. STX CNVPTR
  414. PULX
  415. INX
  416. INX
  417. TST 1,X
  418. BNE CVD1
  419. *
  420. LDX #DECB_1
  421. COM 5,X ; ZERO SUPPRESS
  422. ZRSUP INX
  423. LDAB 0,X
  424. CMPB #'0
  425. BEQ ZRSUP
  426. COM LASTD
  427. *
  428. PNTMSG CLRA ; ZERO FOR DELIM
  429. STRTMS STAA DELIM ; STORE DELIMTER
  430. *
  431. OUTMSG LDAB 0,X ; GENERAL PURPOSE PRINT
  432. INX
  433. CMPB DELIM
  434. BEQ CTLC
  435. JSR OUTCH
  436. BRA OUTMSG
  437. *
  438. CTLC JSR POLCAT ; POL FOR CHARACTER
  439. BCC RTS2
  440. BSR INCH2
  441. CMPB #BREAK ; BREAK KEY?
  442. BEQ RSTRT
  443. *
  444. INCH2 JMP INCH
  445. *
  446. STRING BSR STRTMS ; PRINT STRING LITERAL
  447. LDAA 0,X
  448. CMPA #';
  449. BEQ OUTD
  450. JMP CRLF
  451. *
  452. EVAL BSR GETVAL ; EVALUATE EXPRESSION
  453. *
  454. NXTRM PSHA
  455. LDAA 0,X ; END OF LINE?
  456. BEQ OUTN
  457. CMPA #')
  458. OUTN PULA
  459. BEQ OUTD
  460. BSR TERM
  461. LDX PARSET
  462. BRA NXTRM
  463. *
  464. TERM PSHA ; GET VALUE
  465. PSHB
  466. LDAA 0,X
  467. PSHA
  468. INX
  469. BSR GETVAL
  470. STD EVALPT
  471. STX PARSET
  472. LDX #EVALPT
  473. PULA
  474. PULB
  475. *
  476. CMPA #'* ; SEE IF *
  477. BNE EVAL2
  478. PULA ; MULTIPLY
  479. MULTIP STD MPLIER ; 2'S COMPLEMENT
  480. LDAB #$10
  481. STAB MLDVCT
  482. CLRA
  483. CLRB
  484. *
  485. MULT LSR MPLIER
  486. ROR MPLIER+1
  487. BCC NOAD
  488. MULTI ADDD 0,X
  489. NOAD ASL 1,X
  490. ROL 0,X
  491. DEC MLDVCT
  492. BNE MULT ; LOOP TIL DONE
  493. RTS2 RTS
  494. *
  495. GETVAL JSR CVBIN ; GET VALUE
  496. BCC OUTV
  497. CMPB #'? ; OF LITERAL
  498. BNE VAR
  499. PSHX ; OR INPUT
  500. JSR INLN
  501. BSR EVAL
  502. PULX
  503. OUTD INX
  504. OUTV RTS
  505. *
  506. VAR CMPB #'$ ; OR STRING
  507. BNE VAR1
  508. BSR INCH2
  509. CLRA
  510. INX
  511. RTS
  512. *
  513. VAR1 CMPB #'(
  514. BNE VAR2
  515. INX
  516. BRA EVAL
  517. *
  518. VAR2 BSR CONVP ; OR VARIABLE
  519. LDD 0,X ; OR ARRAY ELEMENT
  520. LDX VARADR ; LOAD OLD INDEX
  521. RTS
  522. *
  523. ARRAY JSR EVAL ; LOCATE ARRAY ELEMENT
  524. ASLD
  525. ADDD AMPR
  526. BRA PACK
  527. *
  528. CONVP LDAB 0,X ; GET LOCATION
  529. INX
  530. PSHB
  531. CMPB #':
  532. BEQ ARRAY ; OF VARIABLE OR
  533. CLRA ; ARRAY ELEMENT
  534. ANDB #$3F ; mask out-of-variable-range
  535. ADDB #$02 ; bump past "interrupt vectors"
  536. ASLB ; make into offset (would be address in DP in original)
  537. ADDD #ZERO ; The 6801 can do this right.
  538. *
  539. PACK STX VARADR ; STORE OLD INDEX
  540. STD CNVPTR
  541. LDX CNVPTR ; LOAD NEW INDEX
  542. PULB
  543. RTS
  544. *
  545. EVAL2 CMPA #'+ ; ADDITION
  546. BNE EVAL3
  547. PULA
  548. ADD ADDD 0,X
  549. RTS
  550. *
  551. EVAL3 CMPA #'- ; SUBTRACTION
  552. BNE EVAL4
  553. PULA
  554. SUBTR SUBD 0,X
  555. RTS
  556. *
  557. EVAL4 CMPA #'/ ; SEE IF IT'S DIVIDE
  558. BNE EVAL5
  559. PULA
  560. BSR DIVIDE
  561. STD REMN
  562. LDD DIVQUO
  563. RTS
  564. *
  565. EVAL5 SUBA #'= ; SEE IF EQUAL TEST
  566. BNE EVAL6
  567. PULA
  568. BSR SUBTR
  569. BNE NOTEQ
  570. TSTB
  571. BEQ EQL
  572. NOTEQ LDAB #$FF
  573. EQL BRA COMBOUT
  574. *
  575. EVAL6 DECA ; SEE IF LESS THAN TEST
  576. PULA
  577. BEQ EVAL7
  578. *
  579. SUB2 BSR SUBTR
  580. ROLB
  581. COMOUT CLRA
  582. ANDB #$01
  583. RTS
  584. *
  585. EVAL7 BSR SUB2 ; GT TEST
  586. COMBOUT COMB
  587. BRA COMOUT
  588. *
  589. PWRS10 FCB $27 ; 10000
  590. FCB $10
  591. FCB $03 ; 1000
  592. FCB $E8
  593. FCB $00 ; 100
  594. FCB $64
  595. FCB $00 ; 10
  596. FCB $0A
  597. FCB $00 ; 1
  598. FCB $01
  599. *
  600. DIVIDE CLR MLDVCT ; DEVIDE 16-BITS
  601. GOT INC MLDVCT
  602. ASL 1,X
  603. ROL 0,X
  604. BCC GOT
  605. ROR 0,X
  606. ROR 1,X
  607. CLR DIVQUO
  608. CLR DIVQUO+1
  609. DIV2 BSR SUBTR
  610. BCC OK
  611. ADDD 0,X
  612. CLC
  613. BRA DIVNOC ; instead of the trick
  614. * The 6801 CPX affects all relevant flags, can't use this trick.
  615. * FCB $9C ; CPX
  616. OK SEC ; $0D
  617. DIVNOC ROL DIVQUO+1
  618. ROL DIVQUO
  619. DEC MLDVCT
  620. BEQ DONE
  621. LSR 0,X
  622. ROR 1,X
  623. BRA DIV2
  624. *
  625. TSTN LDAB 0,X ; TEST FOR NUMERIC
  626. CMPB #$3A
  627. BPL NOTDEC
  628. CMPB #'0
  629. BGE DONE
  630. NOTDEC SEC
  631. RTS
  632. DONE CLC
  633. DUN RTS
  634. *
  635. CVTLN BSR INLN
  636. *
  637. CVBIN BSR TSTN ; CONVERT TO BINARY
  638. BCS DUN
  639. CONT CLRA
  640. CLRB
  641. CBLOOP ADDB 0,X
  642. ADCA #$00
  643. SUBB #'0
  644. SBCA #$00
  645. STD CVTSUM
  646. INX
  647. PSHB
  648. BSR TSTN
  649. PULB
  650. BCS DONE
  651. ASLD
  652. ASLD
  653. ADDD CVTSUM
  654. ASLD
  655. BRA CBLOOP
  656. *
  657. INLN6 CMPB #'@ ; CANCEL
  658. BEQ NEWLIN
  659. INX ; '.'
  660. CPX #ZERO+LINLEN+2 ; (Here's part of what we had to fix for moving the variables.)
  661. BNE INLN2
  662. NEWLIN BSR CRLF
  663. *
  664. INLN LDX #ZERO+2 ; INPUT LINE FROM TERMINAL
  665. INLN5 DEX
  666. CPX #ZERO ; Make this explicit to enable variables moved out of DP.
  667. BEQ NEWLIN ; (Was implicit zero compare X from DEX, now explicit.)
  668. INLN2 JSR INCH ; INPUT CHARACTER
  669. STAB BUFOFF-1,X ; STORE IT
  670. CMPB #$5F ; BACKSPACE?
  671. BEQ INLN5
  672. *
  673. INLIN3 CMPB #$0D ; CARRIAGE RETURN
  674. BMI INLN2
  675. BNE INLN6
  676. *
  677. INLIN4 CLR BUFOFF-1,X ; CLEAR LAST CHAR
  678. LDX #LINBUF
  679. BRA LF
  680. *
  681. * CRLF JSR EPCRLF
  682. CRLF LDAB #$0D ; CARR-RET
  683. BSR OUTCH2
  684. LF LDAB #$0A ; LINE FEED
  685. OUTCH2 BRA OUTCH
  686. *
  687. OKM FCB $0D
  688. FCB $0A
  689. FCC 'OK'
  690. FCB $00
  691. *
  692. *TRMINI LDAB #40
  693. *TRMILP JSR EPCRLF
  694. * DECB
  695. * BNE TRMILP
  696. * RTS
  697. *
  698. * MC-10 BASIC ROM vectors
  699. INCHV EQU $FFDC ; Scan keyboard
  700. OUTCHV EQU $FFDE ; Write char to screen
  701. *
  702. * RECEIVER POLLING
  703. POLCAT PSHA
  704. PSHX
  705. LDX INCHV ; at any rate, don't wait.
  706. JSR 0,X ;
  707. TAB ; MC-10 ROM says NUL is not input.
  708. SEC
  709. BNE POLCATR ; Don't wait.
  710. CLC
  711. POLCATR PULX
  712. PULA
  713. RTS
  714. *POLCAT LDAB ACIACS
  715. * ASRB
  716. * RTS
  717. *
  718. * INPUT ONE CHAR INTO B ACCUMULATOR
  719. INCH BSR POLCAT
  720. BCC INCH ; Wait here.
  721. BSR OUTCH
  722. RTS
  723. *
  724. * OUTPUT ONE CHAR
  725. OUTCH PSHA
  726. PSHX
  727. LDX OUTCHV
  728. TBA
  729. JSR 0,X
  730. PULX
  731. PULA
  732. RTS
  733. *
  734. ORG COLD
  735. *
  736. END
ダウンロード 印刷用表示

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト