Init
This commit is contained in:
commit
d23a3e49ff
22 changed files with 979 additions and 0 deletions
BIN
tests/UARTcat.bin
Normal file
BIN
tests/UARTcat.bin
Normal file
Binary file not shown.
9
tests/UARTcat.hex
Normal file
9
tests/UARTcat.hex
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
E9 7F CFFFFFFFFFFFFFFD # UART TX
|
||||
E9 7E CFFFFFFFFFFFFFFE # UART RX
|
||||
# my assembler is shit and doesn't have labels
|
||||
# this point is 0x4000000000000014 though
|
||||
93 01 7E # Ld8 r1, RX
|
||||
92 01 7F # St8 r1, TX
|
||||
E9 03 4000000000000014 # jumpback addr
|
||||
C0 03 # jump back
|
||||
00
|
||||
8
tests/UARTtruthMachine.hex
Normal file
8
tests/UARTtruthMachine.hex
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
E9 7D CFFFFFFFFFFFFFFD # MovI64 7F UART_TX
|
||||
E9 7E CFFFFFFFFFFFFFFE # MovI64 7F UART_RX
|
||||
93 02 7E # Ld8 02, UART_RX
|
||||
E9 01 0000000000000030 # MovI64 R1, 48
|
||||
6F 01 02 # SubR64, R1, R2 (if R1 > 0 loop)
|
||||
82 01 # RSetF R1
|
||||
# This is 0x4000000000000026
|
||||
|
||||
BIN
tests/cat
Normal file
BIN
tests/cat
Normal file
Binary file not shown.
11
tests/cat.asm
Normal file
11
tests/cat.asm
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
include 'fvm.inc'
|
||||
org 0x4000000000000000
|
||||
start:
|
||||
MovI64 r95, UART_TX
|
||||
MovI64 r94, UART_RX
|
||||
LoopHead:
|
||||
Ld8 r1, r94
|
||||
St8 r1, r95
|
||||
MovI64 r3, LoopHead
|
||||
JmpR r3
|
||||
Halt
|
||||
267
tests/fvm.inc
Normal file
267
tests/fvm.inc
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
define NULL 0
|
||||
|
||||
define r0 0
|
||||
define r1 1
|
||||
define r2 2
|
||||
define r3 3
|
||||
define r4 4
|
||||
define r5 5
|
||||
define r6 6
|
||||
define r7 7
|
||||
define r8 8
|
||||
define r9 9
|
||||
define r10 10
|
||||
define r11 11
|
||||
define r12 12
|
||||
define r13 13
|
||||
define r14 14
|
||||
define r15 15
|
||||
define r16 16
|
||||
define r17 17
|
||||
define r18 18
|
||||
define r19 19
|
||||
define r20 20
|
||||
define r21 21
|
||||
define r22 22
|
||||
define r23 23
|
||||
define r24 24
|
||||
define r25 25
|
||||
define r26 26
|
||||
define r27 27
|
||||
define r28 28
|
||||
define r29 29
|
||||
define r30 30
|
||||
define r31 31
|
||||
define r32 32
|
||||
define r33 33
|
||||
define r34 34
|
||||
define r35 35
|
||||
define r36 36
|
||||
define r37 37
|
||||
define r38 38
|
||||
define r39 39
|
||||
define r40 40
|
||||
define r41 41
|
||||
define r42 42
|
||||
define r43 43
|
||||
define r44 44
|
||||
define r45 45
|
||||
define r46 46
|
||||
define r47 47
|
||||
define r48 48
|
||||
define r49 49
|
||||
define r50 50
|
||||
define r51 51
|
||||
define r52 52
|
||||
define r53 53
|
||||
define r54 54
|
||||
define r55 55
|
||||
define r56 56
|
||||
define r57 57
|
||||
define r58 58
|
||||
define r59 59
|
||||
define r60 60
|
||||
define r61 61
|
||||
define r62 62
|
||||
define r63 63
|
||||
define r64 64
|
||||
define r65 65
|
||||
define r66 66
|
||||
define r67 67
|
||||
define r68 68
|
||||
define r69 69
|
||||
define r70 70
|
||||
define r71 71
|
||||
define r72 72
|
||||
define r73 73
|
||||
define r74 74
|
||||
define r75 75
|
||||
define r76 76
|
||||
define r77 77
|
||||
define r78 78
|
||||
define r79 79
|
||||
define r80 80
|
||||
define r81 81
|
||||
define r82 82
|
||||
define r83 83
|
||||
define r84 84
|
||||
define r85 85
|
||||
define r86 86
|
||||
define r87 87
|
||||
define r88 88
|
||||
define r89 89
|
||||
define r90 90
|
||||
define r91 91
|
||||
define r92 92
|
||||
define r93 93
|
||||
define r94 94
|
||||
define r95 95
|
||||
|
||||
define xSp 252
|
||||
define xBp 253
|
||||
define xPc 255
|
||||
|
||||
define h0 0
|
||||
define h1 1
|
||||
define h2 2
|
||||
define h3 3
|
||||
define h4 4
|
||||
define h5 5
|
||||
define h6 6
|
||||
define h7 7
|
||||
define h8 8
|
||||
define h9 9
|
||||
define h10 10
|
||||
define h11 11
|
||||
define h12 12
|
||||
define h13 13
|
||||
define h14 14
|
||||
define h15 15
|
||||
define h16 16
|
||||
define h17 17
|
||||
define h18 18
|
||||
define h19 19
|
||||
define h20 20
|
||||
define h21 21
|
||||
define h22 22
|
||||
define h23 23
|
||||
define h24 24
|
||||
define h25 25
|
||||
define h26 26
|
||||
define h27 27
|
||||
define h28 28
|
||||
define h29 29
|
||||
define h30 30
|
||||
define h31 31
|
||||
define h32 32
|
||||
define h33 33
|
||||
define h34 34
|
||||
define h35 35
|
||||
define h36 36
|
||||
define h37 37
|
||||
define h38 38
|
||||
define h39 39
|
||||
define h40 40
|
||||
define h41 41
|
||||
define h42 42
|
||||
define h43 43
|
||||
define h44 44
|
||||
define h45 45
|
||||
define h46 46
|
||||
define h47 47
|
||||
define h48 48
|
||||
define h49 49
|
||||
define h50 50
|
||||
define h51 51
|
||||
define h52 52
|
||||
define h53 53
|
||||
define h54 54
|
||||
define h55 55
|
||||
define h56 56
|
||||
define h57 57
|
||||
define h58 58
|
||||
define h59 59
|
||||
define h60 60
|
||||
define h61 61
|
||||
define h62 62
|
||||
define h63 63
|
||||
define h64 64
|
||||
define h65 65
|
||||
define h66 66
|
||||
define h67 67
|
||||
define h68 68
|
||||
define h69 69
|
||||
define h70 70
|
||||
define h71 71
|
||||
define h72 72
|
||||
define h73 73
|
||||
define h74 74
|
||||
define h75 75
|
||||
define h76 76
|
||||
define h77 77
|
||||
define h78 78
|
||||
define h79 79
|
||||
define h80 80
|
||||
define h81 81
|
||||
define h82 82
|
||||
define h83 83
|
||||
define h84 84
|
||||
define h85 85
|
||||
define h86 86
|
||||
define h87 87
|
||||
define h88 88
|
||||
define h89 89
|
||||
define h90 90
|
||||
define h91 91
|
||||
define h92 92
|
||||
define h93 93
|
||||
define h94 94
|
||||
define h95 95
|
||||
|
||||
define UART_TX 0xCFFFFFFFFFFFFFFD
|
||||
define UART_RX 0xCFFFFFFFFFFFFFFE
|
||||
|
||||
macro _dq_be val
|
||||
db (val shr 56) and 0FFh
|
||||
db (val shr 48) and 0FFh
|
||||
db (val shr 40) and 0FFh
|
||||
db (val shr 32) and 0FFh
|
||||
db (val shr 24) and 0FFh
|
||||
db (val shr 16) and 0FFh
|
||||
db (val shr 8) and 0FFh
|
||||
db (val shr 0) and 0FFh
|
||||
end macro
|
||||
|
||||
macro MovI64 dst, val
|
||||
db 0xE9
|
||||
db dst
|
||||
_dq_be val
|
||||
end macro
|
||||
|
||||
macro Ld8 dst, addr
|
||||
db 0x93
|
||||
db dst
|
||||
db addr
|
||||
end macro
|
||||
|
||||
macro St8 dst, addr
|
||||
db 0x92
|
||||
db dst
|
||||
db addr
|
||||
end macro
|
||||
|
||||
macro AddR64 dst, src
|
||||
db 0x60
|
||||
db dst
|
||||
db src
|
||||
end macro
|
||||
|
||||
macro RSetF reg
|
||||
db 0x42
|
||||
db reg
|
||||
end macro
|
||||
|
||||
macro JmpR addr
|
||||
db 0xC0
|
||||
db addr
|
||||
end macro
|
||||
|
||||
macro Jmp addr
|
||||
MovI64 127, addr
|
||||
JmpR 127
|
||||
end macro
|
||||
|
||||
macro JmpRIZ addr
|
||||
db 0xC1
|
||||
db addr
|
||||
end macro
|
||||
|
||||
macro JmpIZ addr
|
||||
MovI64 127, addr
|
||||
JmpRIZ 127
|
||||
end macro
|
||||
|
||||
macro Halt
|
||||
db 0
|
||||
end macro
|
||||
|
||||
BIN
tests/halt.bin
Normal file
BIN
tests/halt.bin
Normal file
Binary file not shown.
BIN
tests/hw
Normal file
BIN
tests/hw
Normal file
Binary file not shown.
17
tests/hw.asm
Normal file
17
tests/hw.asm
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
include 'fvm.inc'
|
||||
|
||||
org 0x4000000000000000
|
||||
start:
|
||||
MovI64 r3, msg
|
||||
MovI64 r1, 1
|
||||
MovI64 r95, UART_TX
|
||||
LoopHead:
|
||||
Ld8 r2, r3
|
||||
RSetF r2
|
||||
JmpIZ LoopTail
|
||||
St8 r2, r95
|
||||
AddR64 r3, r1
|
||||
Jmp LoopHead
|
||||
LoopTail:
|
||||
Halt
|
||||
msg db 'Hello World!', 10, 0
|
||||
BIN
tests/movi64.bin
Normal file
BIN
tests/movi64.bin
Normal file
Binary file not shown.
BIN
tests/uartH.bin
Normal file
BIN
tests/uartH.bin
Normal file
Binary file not shown.
BIN
tests/uartHW.bin
Normal file
BIN
tests/uartHW.bin
Normal file
Binary file not shown.
29
tests/uartHW.hex
Normal file
29
tests/uartHW.hex
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
E9 01 CFFFFFFFFFFFFFFD # MovI64 r1, ...
|
||||
E9 02 0000000000000048 # MovI64 r2, 'H'
|
||||
92 02 01 # send 2 uart
|
||||
E9 02 0000000000000065 # 'e'
|
||||
92 02 01
|
||||
E9 02 000000000000006C # 'l'*2
|
||||
92 02 01
|
||||
92 02 01
|
||||
E9 02 000000000000006F # 'o'
|
||||
92 02 01
|
||||
E9 02 000000000000002C # ','
|
||||
92 02 01
|
||||
E9 02 0000000000000020 # ' '
|
||||
92 02 01
|
||||
E9 02 0000000000000057 # 'W'
|
||||
92 02 01
|
||||
E9 02 000000000000006F # 'o'
|
||||
92 02 01
|
||||
E9 02 0000000000000072 # 'r'
|
||||
92 02 01
|
||||
E9 02 000000000000006C # 'l'
|
||||
92 02 01
|
||||
E9 02 0000000000000064 # 'd'
|
||||
92 02 01
|
||||
E9 02 0000000000000021 # '!'
|
||||
92 02 01
|
||||
E9 02 000000000000000A # '\n'
|
||||
92 02 01
|
||||
00
|
||||
Loading…
Add table
Add a link
Reference in a new issue