mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-14 23:55:09 +00:00
If the command line option yus to allow the underscore character in symbols is NOT selected, then interpret underscore as a new binary operator meaning to do a left shift of the left side value by the number of bit positions indicated by the right side value. As for the arithmetic operators, both values must be literal (numeric constants or symbols equated to a numeric constant).
103 lines
2.3 KiB
Plaintext
103 lines
2.3 KiB
Plaintext
;;;;;
|
|
;
|
|
; Test operator precedencce
|
|
; or rather the lack thereof
|
|
;
|
|
.word 1 + 2 + 3 ; 6
|
|
.word 1 + 2 * 3 ; 3*3 = 11
|
|
.word 1 & 2 ! 4 ; 0 ! 4 = 4
|
|
.word 1 ! 2 & 4 ; 3 & 4 = 0
|
|
.word 1 ! 2 & 7 ; 3 & 7 = 3
|
|
.word 1+1 ! 2+3 ; 2!2+3 = 2+3 = 5
|
|
|
|
;;;;;
|
|
;
|
|
; Test all operators at least once
|
|
;
|
|
.word 3 + 4 ; 000007
|
|
.word 4 - 3 ; 000001
|
|
.word 3 * 4 ; 000014
|
|
.word 12. / 4 ; 000003
|
|
.word 123 & 771 ; 000121
|
|
.word 123121 ! 322 ; 123323
|
|
five = 5
|
|
a: .word 123 _ 3 ; 001230
|
|
.word five _ 6 ; 000500
|
|
.word 101_five ; 004040
|
|
.word a _ 3 ; Invalid expression
|
|
|
|
.word - 377 ; 177401
|
|
.word + 377 ; 000377
|
|
|
|
.word ^C 377 ; 177400
|
|
.word ^c 377 ; 177400
|
|
.word ^B 0101010101010101 ; 052525
|
|
.word ^b 1010101010101010 ; 125252
|
|
.word ^d 100 ; 000144
|
|
.word 100. ; 000144
|
|
.word ^x 100 ; 000400 hexadecimal is an extension
|
|
.word ^rRAD ; 070254 up to 3 characters; no leading spaces
|
|
.word ^rA ; 003100 up to 3 characters
|
|
.word ^r A ; 000050 up to 3 characters
|
|
.word ^r A ; 000001 up to 3 characters
|
|
.word ^r AA ; 000051
|
|
.word ^rA A ; 003101
|
|
.word ^rAA ; 003150
|
|
.word ^r^/AAA/ ; bracketed strings are an extension
|
|
.word ^r<RAD> ; bracketed strings are an extension
|
|
.word ^r< AD> ; bracketed strings are an extension
|
|
.word ^r< D> ; bracketed strings are an extension
|
|
.word ^r<R D> ; bracketed strings are an extension
|
|
.word ^r<RA > ; bracketed strings are an extension
|
|
.word ^R50. ; 157614 there is no whitespace in between.
|
|
.word ^f 1.5 ; 040300
|
|
|
|
;;;;;
|
|
;
|
|
; Test bracketing
|
|
;
|
|
.word 1 + < 2 * 3 > ; 1 + 6 = 7
|
|
.word 1 + ^! 2 * 3 ! ; 1 + 6 = 7
|
|
.word 1 + ^/ 2 * 3 / ; 1 + 6 = 7
|
|
.word 1 + ^$ 2 * 3 $ ; 1 + 6 = 7
|
|
.word 1 + ^* 2 * 3 * ; Invalid expression
|
|
|
|
;;;;;
|
|
;
|
|
; There was an obscure bug in parse_expr(), used to evaluate 'if df',
|
|
; where it could skip past the end of the line marker.
|
|
;
|
|
; If this happened inside an expanded macro, then after that was the
|
|
; next line...
|
|
; In other cases it might be worse.
|
|
;
|
|
.macro dirdef name, flags, cond
|
|
.rad50 /.'name/
|
|
.byte flags+0, 0
|
|
.if df cond
|
|
.globl opcerr
|
|
.word opcerr
|
|
.iff
|
|
.globl name
|
|
.word name
|
|
.endc
|
|
.endm
|
|
|
|
dirdef name
|
|
|
|
.word (
|
|
(
|
|
|
|
.word _,$
|
|
_
|
|
$
|
|
.word /
|
|
/
|
|
.word ^px
|
|
^px
|
|
.word ^px / 256
|
|
^px / 256
|
|
|
|
1,2,3
|
|
.1,.2,.3
|