Skip to content

Commit ad76bb5

Browse files
committed
BSAC304: Use nicer mnemonics, fix nops
1 parent e49fd68 commit ad76bb5

2 files changed

Lines changed: 26 additions & 26 deletions

File tree

examples/bsac304/fibo2.asm

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
%include "common"
22

33
start:
4-
upd0 A
5-
add _1
6-
upd A
7-
add _1
8-
upd B
4+
T var_x
5+
A const_1
6+
U var_x
7+
A const_1
8+
U var_y
99
loop:
10-
add A
11-
upd A
12-
add B
13-
upd B
14-
jgz loop
15-
halt
16-
_1:
10+
A var_x
11+
U var_x
12+
A var_y
13+
U var_y
14+
E loop
15+
Z
16+
const_1:
1717
data 1
18-
A:
18+
var_x:
1919
data 0
20-
B:
20+
var_y:
2121
data 0

tptasm/archs/bsac.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ local includes = {
2323

2424
local dw_bits = 30
2525

26-
local nop = opcode.make(32):merge(0x10000000, 0)
26+
local nop = opcode.make(32):merge(0, 0)
2727

2828
local entities = {}
2929
local mnemonics = {}
3030

3131
local mnemonic_to_class_code = {
32-
[ "add" ] = { operands = 1, code = 0x14000000 },
33-
[ "sub" ] = { operands = 1, code = 0x16000000 },
34-
[ "upd" ] = { operands = 1, code = 0x20000000 },
35-
[ "upd0" ] = { operands = 1, code = 0x22000000 },
36-
[ "nop" ] = { operands = 0, code = 0x10000000 },
37-
[ "halt" ] = { operands = 0, code = 0x3E000000 },
38-
[ "jlz" ] = { operands = 1, code = 0x02000000 },
39-
[ "jgz" ] = { operands = 1, code = 0x04000000 },
40-
[ "jez" ] = { operands = 1, code = 0x06000000 },
32+
[ "A" ] = { operands = 1, code = 0x14000000 },
33+
[ "S" ] = { operands = 1, code = 0x16000000 },
34+
[ "U" ] = { operands = 1, code = 0x20000000 },
35+
[ "T" ] = { operands = 1, code = 0x22000000 },
36+
[ "X" ] = { operands = 0, code = 0x10000000 },
37+
[ "Z" ] = { operands = 0, code = 0x3E000000 },
38+
[ "G" ] = { operands = 1, code = 0x02000000 },
39+
[ "E" ] = { operands = 1, code = 0x04000000 },
40+
[ "J" ] = { operands = 1, code = 0x06000000 },
4141
}
4242

4343
local mnemonic_desc = {}
@@ -107,8 +107,8 @@ local function flash(model, target, opcodes)
107107
end
108108

109109
for index = 0, space_available - 1 do
110-
local id = sim.partID(x + 525 - index, y - 137)
111-
local opcode = opcodes[index] and opcodes[index].dwords[1] or nop.dwords[1]
110+
local id = sim.partID(x + 16 - index, y + 4)
111+
local opcode = opcodes[index] and opcodes[index].dwords[1] or 0x11FFFFFF
112112
sim.partProperty(id, "ctype", opcode)
113113
end
114114
end

0 commit comments

Comments
 (0)