Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -2,7 +2,7 @@ V x = 10
|
|||
V y = 2
|
||||
print(‘x = ’x)
|
||||
print(‘y = ’y)
|
||||
print(‘NOT x = ’(-)x)
|
||||
print(‘NOT x = ’(~x))
|
||||
print(‘x AND y = ’(x [&] y))
|
||||
print(‘x OR y = ’(x [|] y))
|
||||
print(‘x XOR y = ’(x (+) y))
|
||||
|
|
|
|||
11
Task/Bitwise-operations/S-BASIC/bitwise-operations.basic
Normal file
11
Task/Bitwise-operations/S-BASIC/bitwise-operations.basic
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
var a, b = integer
|
||||
a = 10
|
||||
b = 2
|
||||
print "a ="; a; tab(16); hex$(a)
|
||||
print "b ="; b; tab(16); hex$(b)
|
||||
print "a and b ="; a and b; tab(16); hex$(a and b)
|
||||
print "a or b ="; a or b; tab(16); hex$(a or b)
|
||||
print "a xor b ="; a xor b; tab(16); hex$(a xor b)
|
||||
print "not a ="; not a; tab(16); hex$(not a)
|
||||
|
||||
end
|
||||
67
Task/Bitwise-operations/Uxntal/bitwise-operations.uxnatl
Normal file
67
Task/Bitwise-operations/Uxntal/bitwise-operations.uxnatl
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
|00 @System [ &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|
||||
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|
||||
|
||||
( program )
|
||||
|0100 @on-reset ( -> )
|
||||
#0a02
|
||||
DUP2 SWP ;Labels/a <print-arg> ;Labels/b <print-arg>
|
||||
bitwise
|
||||
halt
|
||||
BRK
|
||||
|
||||
@bitwise ( a b -- )
|
||||
;Labels/not <print-str> ;Labels/a <print-str> ;Labels/equ <print-str> DUP2 [ POP #ff EOR ] <print-result>
|
||||
;Labels/and <print-label> DUP2 [ AND ] <print-result>
|
||||
;Labels/or <print-label> DUP2 [ ORA ] <print-result>
|
||||
;Labels/xor <print-label> DUP2 [ EOR ] <print-result>
|
||||
;Labels/shl <print-label> DUP2 [ #40 SFT SFT ] <print-result>
|
||||
;Labels/shr <print-label> DUP2 [ SFT ] <print-result>
|
||||
;Labels/rol <print-label> DUP2 [ #40 SFT #00 ROT ROT SFT2 ORA ] <print-result>
|
||||
;Labels/ror <print-label> [ SWP #00 ROT SFT2 ORA ] <print-result>
|
||||
JMP2r
|
||||
|
||||
@halt ( -- )
|
||||
#01 .System/halt DEO
|
||||
BRK
|
||||
|
||||
@<print-arg> ( a name* -- )
|
||||
<print-str> ;Labels/equ <print-str> <print-result>
|
||||
JMP2r
|
||||
|
||||
@<print-result> ( a -- )
|
||||
<print-hex> ;Labels/newline <print-str>
|
||||
JMP2r
|
||||
|
||||
@<print-label> ( label* -- )
|
||||
;Labels/a <print-str>
|
||||
<print-str>
|
||||
;Labels/b <print-str>
|
||||
;Labels/equ <print-str>
|
||||
JMP2r
|
||||
|
||||
@<print-hex> ( byte -- )
|
||||
[ LIT "$ ] .Console/write DEO
|
||||
DUP #04 SFT <print-hex>/l
|
||||
&l ( -- )
|
||||
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD .Console/write DEO
|
||||
JMP2r
|
||||
|
||||
@<print-str> ( str* -- )
|
||||
&while ( -- )
|
||||
LDAk .Console/write DEO
|
||||
INC2 LDAk ?&while
|
||||
POP2 JMP2r
|
||||
|
||||
@Labels
|
||||
&a "a 20 $1
|
||||
&b "b 20 $1
|
||||
&equ "= 20 $1
|
||||
&newline 0a $1
|
||||
¬ "NOT 20 $1
|
||||
&and "AND 20 $1
|
||||
&or "OR 20 $1
|
||||
&xor "XOR 20 $1
|
||||
&shl "SHL 20 $1
|
||||
&shr "SHR 20 $1
|
||||
&rol "ROL 20 $1
|
||||
&ror "ROR 20 $1
|
||||
Loading…
Add table
Add a link
Reference in a new issue