mirror of
https://github.com/wfjm/w11.git
synced 2026-02-28 09:37:47 +00:00
- tools/bin
- asm-11
- tools/tcode/cpu_(details|mmu).mac: use rt?jmp, hta??? macros
- BUGFIX expressions: allow uop after bop operator
- BUGFIX proper sign handling for '/','*' and .if ge,gt,le,lt
- add 'S' error when code size too large
- tcode/cpu_mmu.mac: remove <../100> expressions for 6 bit right shift
112 lines
3.6 KiB
Plaintext
112 lines
3.6 KiB
Plaintext
; $Id: test_0020_expr.mac 1360 2023-01-29 11:51:48Z mueller $
|
|
; SPDX-License-Identifier: GPL-3.0-or-later
|
|
; Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
|
;
|
|
; test assignment and expressions
|
|
;
|
|
.asect
|
|
|
|
a1 = 100 ;;!! 000100
|
|
a2 == 110 ;;!! 000110
|
|
a3 =: 120 ;;!! 000120
|
|
a4 ==: 130 ;;!! 000130
|
|
|
|
; unary operators
|
|
|
|
u1 = +200 ;;!! 000200
|
|
u2 = -300 ;;!! 177500
|
|
u3 = +-300 ;;!! 177500
|
|
u4 = -+-300 ;;!! 000300
|
|
u5 = ^c300 ;;!! 177477
|
|
u6 = ^c-300 ;;!! 000277
|
|
|
|
; unary operator precedence (matters for ^c,- sequences)
|
|
|
|
a = 1
|
|
am = -1
|
|
;
|
|
.word ^c-a ;;!! 000000 ; 000001 - 177777 ^c 000000
|
|
.word -^ca ;;!! 000002 ; 000001 ^c 177776 - 000002
|
|
.word ^c<-a> ;;!! 000000 ; 000001 - 177777 ^c 000000
|
|
.word -<^ca> ;;!! 000002 ; 000001 ^c 177776 - 000002
|
|
;
|
|
.word ^c-am ;;!! 177776 ; 177777 - 000001 ^c 177776
|
|
.word -^cam ;;!! 000000 ; 177777 ^c 000000 - 000000
|
|
.word ^c<-am> ;;!! 177776 ; 177777 - 000001 ^c 177776
|
|
.word -<^cam> ;;!! 000000 ; 177777 ^c 000000 - 000000
|
|
|
|
; binary operators
|
|
|
|
b1 = 1100 + 100 ;;!! 001200
|
|
b2 = 1311 - 100 ;;!! 001211
|
|
b3 = 400 * 3 ;;!! 001400
|
|
b4 = 2000 / 4 ;;!! 000400
|
|
b5 = 1770 & 0077 ;;!! 000070
|
|
b6 = 1000 ! 100 ;;!! 001100
|
|
|
|
; unary after binary operators and proper sign in * and /
|
|
|
|
.word 100.*5. ;;!! 000764
|
|
.word 100.*-5. ;;!! 177014
|
|
.word -100.*5. ;;!! 177014
|
|
.word -100.*-5. ;;!! 000764
|
|
;
|
|
.word 100./5. ;;!! 000024
|
|
.word 100./-5. ;;!! 177754
|
|
.word -100./5. ;;!! 177754
|
|
.word -100./-5. ;;!! 000024
|
|
;
|
|
a = 100.
|
|
b = 5.
|
|
.word a/b ;;!! 000024
|
|
.word a/-b ;;!! 177754
|
|
.word -a/b ;;!! 177754
|
|
.word -a/-b ;;!! 000024
|
|
.word -a/--b ;;!! 177754
|
|
;
|
|
ma = -100.
|
|
mb = -5.
|
|
.word a/b ;;!! 000024
|
|
.word a/mb ;;!! 177754
|
|
.word ma/b ;;!! 177754
|
|
.word ma/mb ;;!! 000024
|
|
|
|
; radix prefixes and suffixes
|
|
|
|
r1 = 11 ;;!! 000011
|
|
r2 = 11. ;;!! 000013
|
|
r3 = ^b11 ;;!! 000003
|
|
r4 = ^o11 ;;!! 000011
|
|
r5 = ^d11 ;;!! 000013
|
|
r6 = 99. ;;!! 000143
|
|
r7 = ^d99 ;;!! 000143
|
|
|
|
; combine ^c with radix prefixes and suffixes
|
|
|
|
r10 = ^c^o377 ;;!! 177400
|
|
r11 = ^c^b111 ;;!! 177770
|
|
r12 = ^c254. ;;!! 177401
|
|
|
|
; other prefixes
|
|
|
|
s1 = 'X ;;!! 000130
|
|
s2 = "XY ;;!! 054530
|
|
s3 = ^rabc ;;!! 003223
|
|
|
|
; long left-to-right expressions
|
|
|
|
e1 = 100 + 20 * 2 + 1 ;;!! 000241
|
|
e2 = 200 - 100 / 2 ;;!! 000040
|
|
e3 = 777 * 2 & 77 ;;!! 000076
|
|
|
|
; nested expressions
|
|
|
|
n1 = 400+200 ;;!! 000600
|
|
n2 = <400+200> ;;!! 000600
|
|
n3 = 400+ 2*100 ;;!! 040200
|
|
n4 = 400+<2*100> ;;!! 000600
|
|
n5 = 400+ 200-100 /2 ;;!! 000240
|
|
n6 = 400+<<200-100>/2> ;;!! 000440
|
|
|
|
.end
|