• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Deriving a new dialect of Very Tiny Language from VTL-2 6800 version


コミットメタ情報

リビジョン9de7be94eefefd8d5868b6b3edd54937b1e16a5e (tree)
日時2022-09-25 20:11:06
作者Joel Matthew Rees <joel.rees@gmai...>
コミッターJoel Matthew Rees

ログメッセージ

Moving the VTL variables out of the direct page for stability

変更サマリ

差分

--- /dev/null
+++ b/VTL_6800_exorsim_clr_dp.ASM
@@ -0,0 +1,623 @@
1+* VTL-2
2+* V-3.6
3+* 9-23-76
4+* BY GARY SHANNON
5+* & FRANK MCCOY
6+* COPYWRIGHT 1976, THE COMPUTER STORE
7+*
8+* Modifications for exorsim by Joel Matthew Rees
9+* Copyright 2022, Joel Matthew Rees
10+*
11+* DEFINE LOCATIONS IN MONITOR
12+* INCH EQU $FF00 ; per VTL.ASM
13+EINCH EQU $F012 ; exorsim mdos Input byte with echo unless AECHO is set
14+* INCH EQU $F015 ; exorsim mdos Input char with echo (F012 -> strip bit 7)
15+* POLCAT EQU $FF24 ; from VTL.ASM
16+* OUTCH EQU $FF81 ; from VTL.ASM
17+EOUTCH EQU $F018 ; exorsim mdos Output character with NULs
18+* OUTS EQU $FF82 ; from VTL.ASM
19+EPCRLF EQU $F021 ; Primarily for forced initialization in exorsim.
20+*
21+* FOR SBC6800
22+BREAK EQU $1B ; BREAK KEY
23+* For exorsim
24+ACIACS EQU $FCF4 ; exorcisor
25+ACIADA EQU $FCF5 ; exorcisor
26+*
27+* SET ASIDE FOUR BYTES FOR USER
28+* DEFINED INTERUPT ROUTINE IF NEEDED
29+ ORG $0200
30+ZERO RMB 4 ; INTERUPT VECTOR
31+AT RMB 2 ; CANCEL & C-R
32+*
33+* GENERAL PURPOSE STORRGE
34+VARS RMB 52 ; VARIABLES(A-Z)
35+BRAK RMB 2 ; [
36+SAVE10 RMB 2 ; BACK SLASH
37+BRIK RMB 2 ; ]
38+UP RMB 2 ; ^
39+SAVE11 RMB 2
40+*
41+SAVE14 RMB 2 ; SPACE
42+EXCL RMB 2 ; !
43+QUOTE RMB 2 ; "
44+DOLR RMB 2 ; #
45+DOLLAR RMB 2 ; $
46+REMN RMB 2 ; %
47+AMPR RMB 2 ; &
48+QUITE RMB 2 ; '
49+PAREN RMB 2 ; (
50+PARIN RMB 2 ; )
51+STAR RMB 2 ; *
52+PLUS RMB 2 ; +
53+COMA RMB 2 ; ,
54+MINS RMB 2 ; -
55+PERD RMB 2 ; .
56+SLASH RMB 2 ; /
57+*
58+SAVE0 RMB 2
59+SAVE1 RMB 2
60+SAVE2 RMB 2
61+SAVE3 RMB 2
62+SAVE4 RMB 2
63+SAVE5 RMB 2
64+SAVE6 RMB 2
65+SAVE7 RMB 2
66+SAVE8 RMB 2
67+SAVE9 RMB 2
68+COLN RMB 2 ; :
69+SEMI RMB 2 ; ;
70+LESS RMB 2 ; <
71+EQAL RMB 2 ; =
72+GRRT RMB 1 ; >
73+DECB_1 RMB 1
74+*
75+DECBUF RMB 4
76+LASTD RMB 1
77+DELIM RMB 1
78+LINBUF RMB 73 ; LINE LENGTH +1
79+*
80+ ORG $02F1
81+STACK RMB 1
82+*
83+ ORG $0300
84+MI RMB 4 ; INTERUPT VECTORS
85+NMI RMB 4
86+PRGM EQU * ; PROGRAM STARTS HERE
87+* Must have some RAM here.
88+*
89+ ORG $7800
90+*
91+COLD LDS #STACK ; S on 6800 is first free byte on stack.
92+ JSR TRMINI
93+ LDX #PRGM ; initialize program area base
94+ STX AMPR
95+ LDAA #$5A ; Probe RAM limit
96+ LDAB #$A5
97+ BRA PROBET
98+PROBE STAA 0,X
99+ CMPA 0,X
100+ BNE NOTRAM
101+ STAB 0,X
102+ CMPB 0,X
103+ BNE NOTRAM
104+ INX ; all bits seem to be R/W.
105+PROBET CPX #COLD
106+ BNE PROBE ; CPX on 6800 doesn't do less/greater very well.
107+NOTRAM DEX
108+ STX STAR
109+START LDS #STACK ; re-initialize at beginning of each evaluate
110+ CLRA ; delimiter
111+ LDX #OKM
112+ BSR STRGT
113+*
114+LOOP CLRA
115+ STAA DOLR
116+ STAA DOLR+1
117+ JSR CVTLN
118+ BCC STMNT ; NO LINE# THEN EXEC
119+ BSR EXEC
120+ BEQ START
121+*
122+LOOP2 BSR FIND ; FIND LINE
123+EQSTRT BEQ START ; IF END THEN STOP
124+ LDX 0,X ; LOAD REAL LINE #
125+ STX DOLR ; SAVE IT
126+ LDX SAVE11 ; GET LINE
127+ INX ; BUMP PAST LINE #
128+ INX ; BUMP PAST LINE #
129+ INX ; BUMP PAST SPACE
130+ BSR EXEC ; EXECUTE IT
131+ BEQ LOOP3 ; IF ZERO, CONTINUE
132+ LDX SAVE11 ; FIND LINE
133+ LDX 0,X ; GET IT
134+ CPX DOLR ; HAS IT CHANGED?
135+ BEQ LOOP3 ; IF NOT GET NEXT
136+*
137+ INX ; INCREMENT OLD LINE#
138+ STX EXCL ; SAVE FOR RETURN
139+ BRA LOOP2 ; CONTINUE
140+*
141+LOOP3 BSR FND3 ; FIND NEXT LINE
142+ BRA EQSTRT ; CONTINUE
143+*
144+EXEC STX SAVE7 ; EXECUTE LINE
145+ JSR VAR2
146+ INX
147+*
148+SKIP LDAA 0,X ; GET FIRST TERM
149+ BSR EVIL ; EVALUATE EXPRESSION
150+OUTX LDX DOLR ; GET LINE #
151+ RTS
152+*
153+EVIL CMPA #$22 ; IF " THEN BRANCH
154+ BNE EVALU
155+ INX
156+STRGT JMP STRING ; TO PRINT IT
157+*
158+STMNT STX SAVE8 ; SAVE LINE #
159+ STAA DOLR
160+ STAB DOLR+1
161+ LDX DOLR
162+ BNE SKP2 ; IF LINE# <> 0
163+*
164+ LDX #PRGM ; LIST PROGRAM
165+LST2 CPX AMPR ; END OF PROGRAM
166+ BEQ EQSTRT
167+ STX SAVE11 ; LINE # FOR CVDEC
168+ LDAA 0,X
169+ LDAB 1,X
170+ JSR PRNT2
171+ LDX SAVE11
172+ INX
173+ INX
174+ JSR PNTMSG
175+ JSR CRLF
176+ BRA LST2
177+*
178+NXTXT LDX SAVE11 ; GET POINTER
179+ INX ; BUMP PAST LINE#
180+LOOKAG INX ; FIND END OF LINE
181+ TST 0,X
182+ BNE LOOKAG
183+ INX
184+ RTS
185+*
186+FIND LDX #PRGM ; FIND LINE
187+FND2 STX SAVE11
188+ CPX AMPR
189+ BEQ RTS1
190+ LDAA 1,X
191+ SUBA DOLR+1
192+ LDAA 0,X
193+ SBCA DOLR
194+ BCC SET
195+FND3 BSR NXTXT
196+ BRA FND2
197+*
198+SET LDAA #$FF ; SET NOT EQUAL
199+RTS1 RTS
200+*
201+EVALU JSR EVAL ; EVALUATE LINE
202+ PSHB
203+ PSHA
204+ LDX SAVE7
205+ JSR CONVP
206+ PULA
207+ CMPB #'$ ; STRING?
208+ BNE AR1
209+ PULB
210+ JMP OUTCH ; THEN PRINT IT
211+AR1 SUBB #'? ; PRINT?
212+ BNE AR11
213+ JMP PRNT ; THEN DO IT
214+AR11 INCB ; MACHINE LANGUAGE?
215+ PULB
216+ BNE AR2
217+ SWI ; THEN INTERUPT
218+*
219+AR2 STAA 0,X ; STORE NEW VALUE
220+ STAB 1,X
221+ ADDB QUITE ; RANDOMIZER
222+ ADCA QUITE+1
223+ STAA QUITE
224+ STAB QUITE+1
225+ RTS
226+*
227+SKP2 BSR FIND ; FIND LINE
228+ BEQ INSRT ; IF NOT THERE
229+ LDX 0,X ; THEN INSERT
230+ CPX DOLR ; NEW LINE
231+ BNE INSRT
232+*
233+ BSR NXTXT ; SETUP REGISTERS
234+ LDS SAVE11 ; FOR DELETE
235+*
236+DELT CPX AMPR ; DELETE OLD LINE
237+ BEQ FITIT
238+ LDAA 0,X
239+ PSHA
240+ INX
241+ INS
242+ INS
243+ BRA DELT
244+*
245+FITIT STS AMPR ; STORE NEW END
246+*
247+INSRT LDX SAVE8 ; COUNT NEW LINE LENGTH
248+ LDAB #$03
249+ TST 0,X
250+ BEQ GOTIT ; IF NO LINE THEN STOP
251+CNTLN INCB
252+ INX
253+ TST 0,X
254+ BNE CNTLN
255+*
256+OPEN CLRA ; CALCULATE NEW END
257+ ADDB AMPR+1
258+ ADCA AMPR
259+ STAA SAVE10
260+ STAB SAVE10+1
261+ SUBB STAR+1
262+ SBCA STAR
263+ BCC RSTRT ; IF TOO BIG THEN STOP
264+ LDX AMPR
265+ LDS SAVE10
266+ STS AMPR
267+*
268+ INX ; SLIDE OPEN GAP
269+SLIDE DEX
270+ LDAB 0,X
271+ PSHB
272+ CPX SAVE11
273+ BNE SLIDE
274+*
275+DON LDS DOLR ; STORE LINE #
276+ STS 0,X
277+ LDS SAVE8 ; GET NEW LINE
278+ DES
279+*
280+MOVL INX ; INSERT NEW LINE
281+ PULB
282+ STAB 1,X
283+ BNE MOVL
284+*
285+GOTIT LDS #STACK
286+ JMP LOOP
287+*
288+RSTRT JMP START
289+*
290+PRNT PULB ; PRINT DECIMAL
291+PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL
292+ STX SAVE4
293+ LDX #PWRS10
294+CVD1 STX SAVE5
295+ LDX 0,X
296+ STX SAVE6
297+ LDX #SAVE6
298+ JSR DIVIDE
299+ PSHA
300+ LDX SAVE4
301+ LDAA SAVE2+1
302+ ADDA #'0
303+ STAA 0,X
304+ INX
305+ STX SAVE4
306+ LDX SAVE5
307+ PULA
308+ INX
309+ INX
310+ TST 1,X
311+ BNE CVD1
312+*
313+ LDX #DECB_1
314+ COM 5,X ; ZERO SUPPRESS
315+ZRSUP INX
316+ LDAB 0,X
317+ CMPB #'0
318+ BEQ ZRSUP
319+ COM LASTD
320+*
321+PNTMSG CLRA ; ZERO FOR DELIM
322+STRTMS STAA DELIM ; STORE DELIMTER
323+*
324+OUTMSG LDAB 0,X ; GENERAL PURPOSE PRINT
325+ INX
326+ CMPB DELIM
327+ BEQ CTLC
328+ JSR OUTCH
329+ BRA OUTMSG
330+*
331+CTLC JSR POLCAT ; POL FOR CHARACTER
332+ BCC RTS2
333+ BSR INCH2
334+ CMPB #BREAK ; BREAK KEY?
335+ BEQ RSTRT
336+*
337+INCH2 JMP INCH
338+*
339+STRING BSR STRTMS ; PRINT STRING LITERAL
340+ LDAA 0,X
341+ CMPA #';
342+ BEQ OUTD
343+ JMP CRLF
344+*
345+EVAL BSR GETVAL ; EVALUATE EXPRESSION
346+*
347+NXTRM PSHA
348+ LDAA 0,X ; END OF LINE?
349+ BEQ OUTN
350+ CMPA #')
351+OUTN PULA
352+ BEQ OUTD
353+ BSR TERM
354+ LDX SAVE0
355+ BRA NXTRM
356+*
357+TERM PSHA ; GET VALUE
358+ PSHB
359+ LDAA 0,X
360+ PSHA
361+ INX
362+ BSR GETVAL
363+ STAA SAVE3
364+ STAB SAVE3+1
365+ STX SAVE0
366+ LDX #SAVE3
367+ PULA
368+ PULB
369+*
370+ CMPA #'* ; SEE IF *
371+ BNE EVAL2
372+ PULA ; MULTIPLY
373+MULTIP STAA SAVE2
374+ STAB SAVE2+1 ; 2'S COMPLEMENT
375+ LDAB #$10
376+ STAB SAVE1
377+ CLRA
378+ CLRB
379+*
380+MULT LSR SAVE2
381+ ROR SAVE2+1
382+ BCC NOAD
383+MULTI BSR ADD
384+NOAD ASL 1,X
385+ ROL 0,X
386+ DEC SAVE1
387+ BNE MULT ; LOOP TIL DONE
388+RTS2 RTS
389+*
390+GETVAL JSR CVBIN ; GET VALUE
391+ BCC OUTV
392+ CMPB #'? ; OF LITERAL
393+ BNE VAR
394+ STX SAVE9 ; OR INPUT
395+ JSR INLN
396+ BSR EVAL
397+ LDX SAVE9
398+OUTD INX
399+OUTV RTS
400+*
401+VAR CMPB #'$ ; OR STRING
402+ BNE VAR1
403+ BSR INCH2
404+ CLRA
405+ INX
406+ RTS
407+*
408+VAR1 CMPB #'(
409+ BNE VAR2
410+ INX
411+ BRA EVAL
412+*
413+VAR2 BSR CONVP ; OR VARIABLE
414+ LDAA 0,X ; OR ARRAY ELEMENT
415+ LDAB 1,X
416+ LDX SAVE6 ; LOAD OLD INDEX
417+ RTS
418+*
419+ARRAY JSR EVAL ; LOCATE ARRAY ELEMENT
420+ ASLB
421+ ROLA
422+ ADDB AMPR+1
423+ ADCA AMPR
424+ BRA PACK
425+*
426+CONVP LDAB 0,X ; GET LOCATION
427+ INX
428+ PSHB
429+ CMPB #':
430+ BEQ ARRAY ; OF VARIABLE OR
431+ CLRA ; ARRAY ELEMENT
432+ ANDB #$3F
433+ ADDB #$02
434+ ASLB
435+*
436+PACK STX SAVE6 ; STORE OLD INDEX
437+ STAA SAVE4
438+ STAB SAVE4+1
439+ LDX SAVE4 ; LOAD NEW INDEX
440+ PULB
441+ RTS
442+*
443+EVAL2 CMPA #'+ ; ADDITION
444+ BNE EVAL3
445+ PULA
446+ADD ADDB 1,X
447+ ADCA 0,X
448+ RTS
449+*
450+EVAL3 CMPA #'- ; SUBTRACTION
451+ BNE EVAL4
452+ PULA
453+SUBTR SUBB 1,X
454+ SBCA 0,X
455+ RTS
456+*
457+EVAL4 CMPA #'/ ; SEE IF IT'S DIVIDE
458+ BNE EVAL5
459+ PULA
460+ BSR DIVIDE
461+ STAA REMN
462+ STAB REMN+1
463+ LDAA SAVE2
464+ LDAB SAVE2+1
465+ RTS
466+*
467+EVAL5 SUBA #'= ; SEE IF EQUAL TEST
468+ BNE EVAL6
469+ PULA
470+ BSR SUBTR
471+ BNE NOTEQ
472+ TSTB
473+ BEQ EQL
474+NOTEQ LDAB #$FF
475+EQL BRA COMBOUT
476+*
477+EVAL6 DECA ; SEE IF LESS THAN TEST
478+ PULA
479+ BEQ EVAL7
480+*
481+SUB2 BSR SUBTR
482+ ROLB
483+COMOUT CLRA
484+ ANDB #$01
485+ RTS
486+*
487+EVAL7 BSR SUB2 ; GT TEST
488+COMBOUT COMB
489+ BRA COMOUT
490+*
491+PWRS10 FCB $27 ; 10000
492+ FCB $10
493+ FCB $03 ; 1000
494+ FCB $E8
495+ FCB $00 ; 100
496+ FCB $64
497+ FCB $00 ; 10
498+ FCB $0A
499+ FCB $00 ; 1
500+ FCB $01
501+*
502+DIVIDE CLR SAVE1 ; DEVIDE 16-BITS
503+GOT INC SAVE1
504+ ASL 1,X
505+ ROL 0,X
506+ BCC GOT
507+ ROR 0,X
508+ ROR 1,X
509+ CLR SAVE2
510+ CLR SAVE2+1
511+DIV2 BSR SUBTR
512+ BCC OK
513+ BSR ADD
514+ CLC
515+ FCB $9C ; WHAT? (Waste CPX <$0D to skip SEC.)
516+OK SEC ; $0D
517+ ROL SAVE2+1
518+ ROL SAVE2
519+ DEC SAVE1
520+ BEQ DONE
521+ LSR 0,X
522+ ROR 1,X
523+ BRA DIV2
524+*
525+TSTN LDAB 0,X ; TEST FOR NUMERIC
526+ CMPB #$3A
527+ BPL NOTDEC
528+ CMPB #'0
529+ BGE DONE
530+NOTDEC SEC
531+ RTS
532+DONE CLC
533+DUN RTS
534+*
535+CVTLN BSR INLN
536+*
537+CVBIN BSR TSTN ; CONVERT TO BINARY
538+ BCS DUN
539+CONT CLRA
540+ CLRB
541+CBLOOP ADDB 0,X
542+ ADCA #$00
543+ SUBB #'0
544+ SBCA #$00
545+ STAA SAVE1
546+ STAB SAVE1+1
547+ INX
548+ PSHB
549+ BSR TSTN
550+ PULB
551+ BCS DONE
552+ ASLB
553+ ROLA
554+ ASLB
555+ ROLA
556+ ADDB SAVE1+1
557+ ADCA SAVE1
558+ ASLB
559+ ROLA
560+ BRA CBLOOP
561+*
562+INLN6 CMPB #'@ ; CANCEL
563+ BEQ NEWLIN
564+ INX ; '.'
565+ CPX #74 ; LINE LENGTH +2 (Here's part of what we have to fix for moving the variables.)
566+ BNE INLN2
567+NEWLIN BSR CRLF
568+*
569+INLN LDX #ZERO+2 ; INPUT LINE FROM TERMINAL
570+INLN5 DEX
571+ BEQ NEWLIN ; implicit zero compare X
572+INLN2 JSR INCH ; INPUT CHARACTER
573+ STAB $87,X ; STORE IT
574+ CMPB #$5F ; BACKSPACE?
575+ BEQ INLN5
576+*
577+INLIN3 CMPB #$0D ; CARRIAGE RETURN
578+ BMI INLN2
579+ BNE INLN6
580+*
581+INLIN4 CLR $87,X ; CLEAR LAST CHAR
582+ LDX #LINBUF
583+ BRA LF
584+*
585+* CRLF JSR EPCRLF
586+CRLF LDAB #$0D ; CARR-RET
587+ BSR OUTCH2
588+LF LDAB #$0A ; LINE FEED
589+OUTCH2 JMP OUTCH
590+*
591+OKM FCB $0D
592+ FCB $0A
593+ FCC 'OK'
594+ FCB $00
595+*
596+TRMINI LDAB #40
597+TRMILP JSR EPCRLF
598+ DECB
599+ BNE TRMILP
600+ RTS
601+*
602+* RECEIVER POLLING
603+POLCAT LDAB ACIACS
604+ ASRB
605+ RTS
606+*
607+* INPUT ONE CHAR INTO B ACCUMULATOR
608+INCH PSHA
609+ JSR EINCH
610+ TAB
611+ PULA
612+ RTS
613+*
614+* OUTPUT ONE CHAR
615+OUTCH PSHA
616+ TBA
617+ JSR EOUTCH
618+ PULA
619+ RTS
620+*
621+ ORG COLD
622+*
623+ END