minor cleanup of verbosity
[dcpu16] / tests / test.s
1 ;
2 ; dcpu16 test asm
3 ;
4
5 ; Try some basic stuff
6 SET A, 0x30 ; 7c01 0030
7 SET [0x1000], 0x20 ; 7de1 1000 0020
8 SUB A, [0x1000] ; 7803 1000
9 IFN A, 0x10 ; c00d
10 SET PC, crash ; 7dc1 001a [*]
11
12 ; Do a loopy thing
13 SET I, 10 ; a861
14 SET A, 0x2000 ; 7c01 2000
15 :loop SET [0x2000+I], [A] ; 2161 2000
16 SUB I, 1 ; 8463
17 IFN I, 0 ; 806d
18 SET PC, loop ; 7dc1 000d [*]
19
20 ; Call a subroutine
21 SET X, 0x4 ; 9031
22 JSR testsub ; 7c10 0018 [*]
23 SET PC, crash ; 7dc1 001a [*]
24
25 :testsub SHL X, 4 ; 9037
26 SET PC, POP ; 61c1
27
28 ; Hang forever. X should now be 0x40 if everything went right.
29 :crash SET PC, crash ; 7dc1 001a [*]
30
31 ; [*]: Note that these can be one word shorter and one cycle faster by using the short form (0x00-0x1f) of literals,
32 ; but my assembler doesn't support short form labels yet.
33