PR005: sync ABI verifier/loader and regenerate stress cartridge

This commit is contained in:
2026-03-24 13:40:51 +00:00
parent c8b3b6afcc
commit 70ffadab6c
4 changed files with 258 additions and 2 deletions
+14 -2
View File
@@ -41,6 +41,13 @@ pub fn generate() -> Result<()> {
arg_slots: 2,
ret_slots: 0,
},
SyscallDecl {
module: "gfx".into(),
name: "set_sprite".into(),
version: 1,
arg_slots: 10,
ret_slots: 1,
},
];
heavy_load(&mut rom);
@@ -60,6 +67,7 @@ pub fn generate() -> Result<()> {
const_pool: vec![
ConstantPoolEntry::String("stress".into()),
ConstantPoolEntry::String("frame".into()),
ConstantPoolEntry::String("missing_tile_bank".into()),
],
functions,
code: rom,
@@ -100,7 +108,7 @@ fn heavy_load(rom: &mut Vec<u8>) {
// Loop:
// t = (t + 1)
// clear screen
// draw 100 discs using t for animation
// draw 500 discs using t for animation
// draw 20 texts using t for animation
// RET (runtime handles the frame loop)
@@ -115,6 +123,10 @@ fn heavy_load(rom: &mut Vec<u8>) {
// --- clear screen ---
rom.extend(asm("PUSH_I32 0\nHOSTCALL 0"));
// --- call status-first syscall path once per frame and drop status ---
rom.extend(asm(
"PUSH_CONST 2\nPUSH_I32 0\nPUSH_I32 0\nPUSH_I32 0\nPUSH_I32 0\nPUSH_I32 0\nPUSH_BOOL 0\nPUSH_BOOL 0\nPUSH_BOOL 0\nPUSH_I32 0\nHOSTCALL 4\nPOP_N 1",
));
// --- draw 500 discs ---
rom.extend(asm("PUSH_I32 0\nSET_LOCAL 1"));
@@ -145,7 +157,7 @@ fn heavy_load(rom: &mut Vec<u8>) {
// --- draw 20 texts ---
rom.extend(asm("PUSH_I32 0\nSET_LOCAL 1"));
let text_loop_start = rom.len() as u32;
rom.extend(asm("GET_LOCAL 1\nPUSH_I32 0\nLT"));
rom.extend(asm("GET_LOCAL 1\nPUSH_I32 20\nLT"));
let jif_text_end_offset = rom.len() + 2;
rom.extend(asm("JMP_IF_FALSE 0"));