Open amyipdev opened 2 years ago
Just pushed some commits to libxas which makes this assemblable. Here's the (GPLv2) assembly for BRIX:
.text
mov $0x5,%ve
mov $0x0,%v5
mov $0x6,%vb
mov $0x0,%va
ref 0x30c
draw $0x1,%va,%vb
add $0x4,%va
je $0x40,%va
// 0x10=0x210
jmp 0x208
add $0x2,%vb
je $0x12,%vb
jmp 0x206
mov $0x20,%vc
mov $0x1f,%vd
ref 0x310
draw $0x1,%vc,%vd
// 0x20=0x220
call 0x2f6
mov $0x0,%v0
mov $0x0,%v1
ref 0x312
draw $0x1,%v0,%v1
add $0x8,%v0
ref 0x30e
draw $0x1,%v0,%v1
// 0x30=0x230
mov $0x40,%v0
sdl %v0
gdl %v0
je $0x0,%v0
jmp 0x234
rnd $0xf,%v6
mov $0x1e,%v7
mov $0x1,%v8
// 0x40=0x240
mov $0xff,%v9
ref 0x30e
draw $0x1,%v6,%v7
ref 0x310
draw $0x1,%vc,%vd
mov $0x4,%v0
kyn %v0
add $0xfe,%vc
// 0x50=0x250
mov $0x6,%v0
kyn %v0
add $0x2,%vc
mov $0x3f,%v0
and %v0,%vc
draw $0x1,%vc,%vd
ref 0x30e
draw $0x1,%v6,%v7
// 0x60=0x260
add %v8,%v6
add %v9,%v7
mov $0x3f,%v0
and %v0,%v6
mov $0x1f,%v1
and %v1,%v7
jne $0x1f,%v7
jmp 0x2ac
// 0x70=0x270
jne $0x0,%v6
mov $0x1,%v8
jne $0x3f,%v6
mov $0xff,%v8
jne $0x0,%v7
mov $0x1,%v9
draw $0x1,%v6,%v7
je $0x1,%vf
jmp 0x2aa
jne $0x1f,%v7
jmp 0x2aa
mov $0x5,%v0
sub %v7,%v0
je $0x0,%vf
jmp 0x2aa
mov $0x1,%v0
sds %v0
mov %v6,%v0
mov $0xfc,%v1
and %v1,%v0
ref 0x30c
draw $0x1,%v0,%v7
mov $0xfe,%v0
xor %v0,%v9
call 0x2f6
add $0x1,%v5
call 0x2f6
jne $0x60,%v5
jmp 0x2de
jmp 0x246
mov $0xff,%v9
mov %v6,%v0
sub %vc,%v0
je $0x1,%vf
jmp 0x2ca
mov $0x2,%v1
sub %v1,%v0
je $0x1,%vf
jmp 0x2e0
sub %v1,%v0
je $0x1,%vf
jmp 0x2ee
sub %v1,%v0
je $0x1,%vf
jmp 0x2e8
mov $0x20,%v0
sds %v0
ref 0x30e
add $0xff,%ve
mov %ve,%v0
add %v0,%v0
mov $0x0,%v1
draw $0x1,%v0,%v1
je $0x0,%ve
jmp 0x230
jmp 0x2de
add $0xff,%v8
jne $0xfe,%v8
mov $0xff,%v8
jmp 0x2ee
add $0x1,%v8
jne $0x2,%v8
mov $0x1,%v8
mov $0x4,%v0
sds %v0
mov $0xff,%v9
jmp 0x270
ref 0x314
bcd %v5
lod %v2
lds %v1
mov $0x37,%v3
mov $0x0,%v4
draw $0x5,%v3,%v4
add $0x5,%v3
lds %v2
draw $0x5,%v3,%v4
ret
.byte 0xe0
.byte 0x0
.byte 0x80
.byte 0x00
.byte 0xfc
.byte 0x0
.byte 0xaa
.byte 0x0
.byte 0x0
.byte 0x0
.byte 0x0
.byte 0x0
I can if desired clean it up a bit - put in labels for jumps/calls/refs, use larger constant insertion sizes, etc. Here's a MRE for how to assemble it (given that you supply a Cargo.toml for it that loads libxas):
extern crate libxas;
fn main() {
let src = include_str!("../../BRIX.xas").to_string();
let platform: libxas::platform::Platform = libxas::platform::Platform::from_platform_double("c8-bin");
std::fs::write("BRIX.o", libxas::eaf::assemble_full_source(&src, &platform));
println!("sucessful");
}
Having the source assembly for these ROMs would be great. I know there isn't really a standard for CHIP8 assembly, so perhaps whatever works through libxas? I'm working on a BRIX translation to assembly (will need to make some additions to libxas for it, since a lot of the necessary macros are WIP) and would love to contribute it back.