adjustments on capabilities on cartridges
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
use anyhow::Result;
|
||||
use prometeu_bytecode::assembler::assemble;
|
||||
use prometeu_bytecode::model::{BytecodeModule, ConstantPoolEntry, DebugInfo, Export, FunctionMeta};
|
||||
use prometeu_bytecode::model::{
|
||||
BytecodeModule, ConstantPoolEntry, DebugInfo, Export, FunctionMeta,
|
||||
};
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn asm(s: &str) -> Vec<u8> { assemble(s).expect("assemble") }
|
||||
fn asm(s: &str) -> Vec<u8> {
|
||||
assemble(s).expect("assemble")
|
||||
}
|
||||
|
||||
pub fn generate() -> Result<()> {
|
||||
let mut rom: Vec<u8> = Vec::new();
|
||||
@@ -12,16 +16,14 @@ pub fn generate() -> Result<()> {
|
||||
heavy_load(&mut rom);
|
||||
// light_load(&mut rom);
|
||||
|
||||
let functions = vec![
|
||||
FunctionMeta {
|
||||
code_offset: 0,
|
||||
code_len: rom.len() as u32,
|
||||
param_slots: 0,
|
||||
local_slots: 2,
|
||||
return_slots: 0,
|
||||
max_stack_slots: 16,
|
||||
},
|
||||
];
|
||||
let functions = vec![FunctionMeta {
|
||||
code_offset: 0,
|
||||
code_len: rom.len() as u32,
|
||||
param_slots: 0,
|
||||
local_slots: 2,
|
||||
return_slots: 0,
|
||||
max_stack_slots: 16,
|
||||
}];
|
||||
|
||||
let module = BytecodeModule {
|
||||
version: 0,
|
||||
@@ -72,7 +74,7 @@ fn heavy_load(mut rom: &mut Vec<u8>) {
|
||||
// draw 100 discs using t for animation
|
||||
// draw 20 texts using t for animation
|
||||
// RET (runtime handles the frame loop)
|
||||
|
||||
|
||||
// --- init locals ---
|
||||
// local 0: scratch
|
||||
// local 1: loop counter for discs
|
||||
@@ -119,7 +121,9 @@ fn heavy_load(mut rom: &mut Vec<u8>) {
|
||||
rom.extend(asm("JMP_IF_FALSE 0"));
|
||||
|
||||
// x = (t * 3 + i * 40) % 320
|
||||
rom.extend(asm("GET_GLOBAL 0\nPUSH_I32 3\nMUL\nGET_LOCAL 1\nPUSH_I32 40\nMUL\nADD\nPUSH_I32 320\nMOD"));
|
||||
rom.extend(asm(
|
||||
"GET_GLOBAL 0\nPUSH_I32 3\nMUL\nGET_LOCAL 1\nPUSH_I32 40\nMUL\nADD\nPUSH_I32 320\nMOD",
|
||||
));
|
||||
// y = (i * 30 + t) % 180
|
||||
rom.extend(asm("GET_LOCAL 1\nPUSH_I32 30\nMUL\nGET_GLOBAL 0\nADD\nPUSH_I32 180\nMOD"));
|
||||
// string (toggle between "stress" and "frame")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use anyhow::Result;
|
||||
|
||||
fn main() -> Result<()> { pbxgen_stress::generate() }
|
||||
fn main() -> Result<()> {
|
||||
pbxgen_stress::generate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user