-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsample
More file actions
34 lines (34 loc) · 1.29 KB
/
sample
File metadata and controls
34 lines (34 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Commands are usually CMD b, a
aaaaaabbbbbooooo process a, then b
Basic stuff translation:
| Op Bits(a b o) | compil-| Next word(s)
| 6 5 5 | ed |
----------------------|----------------| ----------------------
SET A, 0x30 | 0x1f 0x00 0x01 | 0x7c01 0x0030
SET [0x1000], 0x20 | 0x1f 0x1e 0x01 | 0x7Fc1 0x0020 0x1000
SUB A, [0x1000] | 0x1e 0x00 0x03 | 0x7803 0x1000
IFN A, 0x10 | 0x30 0x00 0x13 | 0xc013
SET PC, end(0x20) | 0x1f 0x1c 0x01 | 0x7f81 0x0020
;;Do a loopy thing
SET I, 10 | 0x2A 0x06 0x01 | 0xa8c1
SET A, 0x2000 | 0x1f 0x00 0x01 | 0x7C01 0x2000
:loop (13 or 0x0D)
SET [0x2000+I], [A] | 0x08 0x16 0x01 | 0x22c1 0x2000
SUB I, 1 | 0x21 0x06 0x03 | 0x84c3
IFN I, 0 | 0x20 0x06 0x13 | 0x80d3
SET PC, loop | 0x2d 0x1c 0x01 | 0xB781
; Test ops:
SET A, 0x10 | 0x30 0x00 0x01 | 0xc001
SET B, 0x20 | 0x1f 0x01 0x01 | 0x7c21 0x0020
ADD B, A \ 0x30 | 0x00 0x01 0x02 | 0x0022
DIV B, A \ 0x3 | 0x00 0x01 0x06 | 0x0026
MUL B, A \ 0x30 | 0x00 0x01 0x04 | 0x0024
; Call a subroutine
SET X, 0x4 |
JSR testsub |
SET PC, crash |
:testsub
SHL X, 4 |
SET PC, POP |
:crash
SET PC, crash