-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspec.txt
More file actions
70 lines (61 loc) · 3.31 KB
/
Copy pathspec.txt
File metadata and controls
70 lines (61 loc) · 3.31 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---INSTRUCTIONS---
A mix of instructions from the syllabus, questions, and my own.
01 LDM #n Load number n into the ACC. If given a label, the corresponding address will be loaded.
02 LDD <address> Load whatever's in <address> into the ACC.
03 LDI <address> Load whatever's in the address stored in <address> to the ACC.
04 LDX <address> Load whatever's in <address> + <contents of IX> into the ACC.
05 LDR #n Load number n into the IX.
06 STO <address> Write the contents of ACC in <address>.
07 STX <address> Write the contents of ACC to <address> + <contents of IX>
08 STA #n Write #n to the address stored in the ACC.
09 ADD <address> Add the contents of <address> to the ACC.
10 INC <register> Increment (+1) <register>, either ACC or IX.
11 DEC <register> Decrement (-1) <register>, either ACC or IX.
12 JMP <address> Jump to <address>.
13 JMPA Jump to the address stored in the ACC.
14 CMPA <address> Compare the ACC to whatever's in <address>. Note the order of these for other instructions.
15 CMPV #n Compare, but with n rather than an address.
16 JPE <address> Jump to <address> if the previous CMP showed values were identical.
17 JPN <address> Jump to <address> if the previous CMP showed values were not identical.
18 JGT <address> Jump to <address> if the previous CMP showed ACC contents were greater than the contents of the compared address.
19 JLT <address> JGT, but if less than.
20 IN Blocks until a single character and a newline (enter) is entered in stdin. The ASCII ordinate is stored in the ACC.
21 OUT Output the character corresponding the ASCII ordinate in the ACC to stdout.
22 END Exit with a zero code. (may add other exit codes in future)
23 AND <address> Bitwise AND the contents of the ACC with the contents of <address>, and store in ACC.
24 OR <address> Bitwise OR the contents of the ACC with the contents of <address>, and store in ACC.
25 XOR <address> Bitwise XOR the contents of the ACC with the contents of <address>, and store in ACC.
25 WMI #n Wait <n> milliseconds unless keyboard input received (only interrupts with canvas enabled)
Note: Labeled addresses for storing values must be given a starting value, e.g "LABEL: #0" is valid but "LABEL:" is not.
---BYTECODE STUFF---
Constant values (#n) must be 16 bit to fit into memory.
Op structure:
Greatest 16 bits: Opcode. See ops.go.
The rest are the address or value.
Addresses are 16 bit
Memory blocks/Registers are 32-bit
Memory size is 32768 bits (32 bits * 1024)
COMP is a register used for CMP comparisons.
COMP == 1: Identical
COMP == 0: ACC Less than val
COMP == 2: ACC Greater than val
IX at 1023 (1024-1)
ACC at 1022 (1024-2)
PC at 1021 (1024-3)
COMP at 1020 (1024-4)
Memory address 0 jumps to the first instruction.
---MACROS---
LABEL: "Quoted ASCII string": Each byte is stored in sequential addresses (wasteful, i know).
PRINT <address>: Prints the character at the address, increments it, prints the next until a zero is encountered.
; example:
TEXT: "hi\n"
PRINT TEXT
; goes to:
LDR #0
LOOP:
LDX TEXT
OUT
INC IX
; newline code
CMPV #10
JPN LOOP