more improvements on compiler
This commit is contained in:
parent
ecda79bcc6
commit
c2ea4aabd2
@ -48,14 +48,48 @@ impl Codegen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn compile_program(&mut self, program: &Program) -> Result<Vec<u8>> {
|
pub fn compile_program(&mut self, program: &Program) -> Result<Vec<u8>> {
|
||||||
// Find tick function
|
self.compile_programs(vec![(self.file_name.clone(), self.source_text.clone(), program)])
|
||||||
let mut tick_fn = None;
|
}
|
||||||
|
|
||||||
|
pub fn compile_programs(&mut self, programs: Vec<(String, String, &Program)>) -> Result<Vec<u8>> {
|
||||||
|
// First pass: collect all functions and their indices
|
||||||
|
let mut all_functions = Vec::new();
|
||||||
|
for (file, source, program) in &programs {
|
||||||
for item in &program.body {
|
for item in &program.body {
|
||||||
if let Statement::ExportNamedDeclaration(decl) = item {
|
match item {
|
||||||
|
Statement::FunctionDeclaration(f) => {
|
||||||
|
all_functions.push((file.clone(), source.clone(), f.as_ref()));
|
||||||
|
}
|
||||||
|
Statement::ExportNamedDeclaration(decl) => {
|
||||||
if let Some(Declaration::FunctionDeclaration(f)) = &decl.declaration {
|
if let Some(Declaration::FunctionDeclaration(f)) = &decl.declaration {
|
||||||
|
all_functions.push((file.clone(), source.clone(), f.as_ref()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find tick function (should be in the first program, which is the entry)
|
||||||
|
let mut tick_fn_name = None;
|
||||||
|
if let Some((_, _, entry_program)) = programs.first() {
|
||||||
|
for item in &entry_program.body {
|
||||||
|
let f_opt = match item {
|
||||||
|
Statement::FunctionDeclaration(f) => Some(f.as_ref()),
|
||||||
|
Statement::ExportNamedDeclaration(decl) => {
|
||||||
|
if let Some(Declaration::FunctionDeclaration(f)) = &decl.declaration {
|
||||||
|
Some(f.as_ref())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(f) = f_opt {
|
||||||
if let Some(ident) = &f.id {
|
if let Some(ident) = &f.id {
|
||||||
if ident.name == "tick" {
|
if ident.name == "tick" {
|
||||||
tick_fn = Some(f);
|
tick_fn_name = Some(ident.name.to_string());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,19 +97,26 @@ impl Codegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let tick_fn = tick_fn.ok_or_else(|| anyhow!("export function tick() not found"))?;
|
let tick_fn_name = tick_fn_name.ok_or_else(|| anyhow!("export function tick() not found in entry file"))?;
|
||||||
|
|
||||||
// Entry point: loop calling tick
|
// Entry point: loop calling tick
|
||||||
self.emit_label("entry".to_string());
|
self.emit_label("entry".to_string());
|
||||||
self.emit_op(OpCode::Call, vec![Operand::Label("tick".to_string()), Operand::U32(0)], Span::default());
|
self.emit_op(OpCode::Call, vec![Operand::Label(tick_fn_name), Operand::U32(0)], Span::default());
|
||||||
self.emit_op(OpCode::Pop, vec![], Span::default());
|
self.emit_op(OpCode::Pop, vec![], Span::default());
|
||||||
self.emit_op(OpCode::FrameSync, vec![], Span::default());
|
self.emit_op(OpCode::FrameSync, vec![], Span::default());
|
||||||
self.emit_op(OpCode::Jmp, vec![Operand::Label("entry".to_string())], Span::default());
|
self.emit_op(OpCode::Jmp, vec![Operand::Label("entry".to_string())], Span::default());
|
||||||
|
|
||||||
// Function tick
|
// Compile all functions
|
||||||
self.emit_label("tick".to_string());
|
for (file, source, f) in all_functions {
|
||||||
self.compile_function(tick_fn)?;
|
self.file_name = file;
|
||||||
|
self.source_text = source;
|
||||||
|
if let Some(ident) = &f.id {
|
||||||
|
let name = ident.name.to_string();
|
||||||
|
self.emit_label(name);
|
||||||
|
self.compile_function(f)?;
|
||||||
self.emit_op(OpCode::Ret, vec![], Span::default());
|
self.emit_op(OpCode::Ret, vec![], Span::default());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let asm_vec: Vec<Asm> = self.instructions.iter().map(|(a, _)| a.clone()).collect();
|
let asm_vec: Vec<Asm> = self.instructions.iter().map(|(a, _)| a.clone()).collect();
|
||||||
let bytecode = assemble(&asm_vec).map_err(|e| anyhow!("Assemble error: {}", e))?;
|
let bytecode = assemble(&asm_vec).map_err(|e| anyhow!("Assemble error: {}", e))?;
|
||||||
@ -95,6 +136,19 @@ impl Codegen {
|
|||||||
self.locals.clear();
|
self.locals.clear();
|
||||||
self.next_local = 0;
|
self.next_local = 0;
|
||||||
|
|
||||||
|
// Start scope for parameters and local variables
|
||||||
|
self.emit_op(OpCode::PushScope, vec![], f.span);
|
||||||
|
|
||||||
|
// Map parameters to locals
|
||||||
|
for param in &f.params.items {
|
||||||
|
if let BindingPattern::BindingIdentifier(ident) = ¶m.pattern {
|
||||||
|
let name = ident.name.to_string();
|
||||||
|
let id = self.next_local;
|
||||||
|
self.locals.insert(name, id);
|
||||||
|
self.next_local += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(body) = &f.body {
|
if let Some(body) = &f.body {
|
||||||
for stmt in &body.statements {
|
for stmt in &body.statements {
|
||||||
self.compile_stmt(stmt)?;
|
self.compile_stmt(stmt)?;
|
||||||
@ -105,6 +159,7 @@ impl Codegen {
|
|||||||
// If the function doesn't have a return statement, we push Null.
|
// If the function doesn't have a return statement, we push Null.
|
||||||
// For now, we always push Null at the end if it's not a return.
|
// For now, we always push Null at the end if it's not a return.
|
||||||
// In a more complex compiler, we would check if all paths return.
|
// In a more complex compiler, we would check if all paths return.
|
||||||
|
self.emit_op(OpCode::PopScope, vec![], Span::default());
|
||||||
self.emit_op(OpCode::PushConst, vec![Operand::U32(0)], Span::default()); // Index 0 is Null in PBC
|
self.emit_op(OpCode::PushConst, vec![Operand::U32(0)], Span::default()); // Index 0 is Null in PBC
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -148,9 +203,11 @@ impl Codegen {
|
|||||||
self.emit_label(end_label);
|
self.emit_label(end_label);
|
||||||
}
|
}
|
||||||
Statement::BlockStatement(block) => {
|
Statement::BlockStatement(block) => {
|
||||||
|
self.emit_op(OpCode::PushScope, vec![], block.span);
|
||||||
for stmt in &block.body {
|
for stmt in &block.body {
|
||||||
self.compile_stmt(stmt)?;
|
self.compile_stmt(stmt)?;
|
||||||
}
|
}
|
||||||
|
self.emit_op(OpCode::PopScope, vec![], block.span);
|
||||||
}
|
}
|
||||||
_ => return Err(anyhow!("Unsupported statement type at {:?}", stmt.span())),
|
_ => return Err(anyhow!("Unsupported statement type at {:?}", stmt.span())),
|
||||||
}
|
}
|
||||||
@ -190,8 +247,8 @@ impl Codegen {
|
|||||||
let name = ident.name.to_string();
|
let name = ident.name.to_string();
|
||||||
self.compile_expr(&assign.right)?;
|
self.compile_expr(&assign.right)?;
|
||||||
if let Some(&id) = self.locals.get(&name) {
|
if let Some(&id) = self.locals.get(&name) {
|
||||||
self.emit_op(OpCode::Dup, vec![], assign.span);
|
|
||||||
self.emit_op(OpCode::SetLocal, vec![Operand::U32(id)], assign.span);
|
self.emit_op(OpCode::SetLocal, vec![Operand::U32(id)], assign.span);
|
||||||
|
self.emit_op(OpCode::GetLocal, vec![Operand::U32(id)], assign.span);
|
||||||
} else {
|
} else {
|
||||||
return Err(anyhow!("Undefined variable: {} at {:?}", name, ident.span));
|
return Err(anyhow!("Undefined variable: {} at {:?}", name, ident.span));
|
||||||
}
|
}
|
||||||
@ -287,7 +344,13 @@ impl Codegen {
|
|||||||
self.emit_op(OpCode::Syscall, vec![Operand::U32(syscall_id)], call.span);
|
self.emit_op(OpCode::Syscall, vec![Operand::U32(syscall_id)], call.span);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(anyhow!("Unsupported function call: {} at {:?}", name, call.span));
|
// Local function call
|
||||||
|
for arg in &call.arguments {
|
||||||
|
if let Some(expr) = arg.as_expression() {
|
||||||
|
self.compile_expr(expr)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.emit_op(OpCode::Call, vec![Operand::Label(name), Operand::U32(call.arguments.len() as u32)], call.span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expression::StaticMemberExpression(member) => {
|
Expression::StaticMemberExpression(member) => {
|
||||||
|
|||||||
@ -7,29 +7,50 @@ use crate::codegen::ast_util;
|
|||||||
|
|
||||||
pub struct Validator {
|
pub struct Validator {
|
||||||
errors: Vec<String>,
|
errors: Vec<String>,
|
||||||
|
local_functions: std::collections::HashSet<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Validator {
|
impl Validator {
|
||||||
pub fn validate(program: &Program) -> Result<()> {
|
pub fn validate(program: &Program) -> Result<()> {
|
||||||
let mut validator = Self { errors: Vec::new() };
|
let mut validator = Self {
|
||||||
|
errors: Vec::new(),
|
||||||
|
local_functions: std::collections::HashSet::new(),
|
||||||
|
};
|
||||||
|
|
||||||
// 1. Check for exported tick function
|
// 1. Collect all local function names
|
||||||
let mut tick_fn_found = false;
|
|
||||||
for item in &program.body {
|
for item in &program.body {
|
||||||
if let Statement::ExportNamedDeclaration(decl) = item {
|
match item {
|
||||||
|
Statement::FunctionDeclaration(f) => {
|
||||||
|
if let Some(ident) = &f.id {
|
||||||
|
validator.local_functions.insert(ident.name.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Statement::ExportNamedDeclaration(decl) => {
|
||||||
if let Some(Declaration::FunctionDeclaration(f)) = &decl.declaration {
|
if let Some(Declaration::FunctionDeclaration(f)) = &decl.declaration {
|
||||||
if let Some(ident) = &f.id {
|
if let Some(ident) = &f.id {
|
||||||
if ident.name == "tick" {
|
validator.local_functions.insert(ident.name.to_string());
|
||||||
tick_fn_found = true;
|
}
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
Statement::ImportDeclaration(decl) => {
|
||||||
|
if let Some(specifiers) = &decl.specifiers {
|
||||||
|
for specifier in specifiers {
|
||||||
|
match specifier {
|
||||||
|
ImportDeclarationSpecifier::ImportSpecifier(s) => {
|
||||||
|
validator.local_functions.insert(s.local.name.to_string());
|
||||||
|
}
|
||||||
|
ImportDeclarationSpecifier::ImportDefaultSpecifier(s) => {
|
||||||
|
validator.local_functions.insert(s.local.name.to_string());
|
||||||
|
}
|
||||||
|
ImportDeclarationSpecifier::ImportNamespaceSpecifier(s) => {
|
||||||
|
validator.local_functions.insert(s.local.name.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
if !tick_fn_found {
|
}
|
||||||
validator.errors.push("export function tick() not found".to_string());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Recursive validation of the AST
|
// 2. Recursive validation of the AST
|
||||||
@ -51,6 +72,7 @@ impl<'a> Visit<'a> for Validator {
|
|||||||
Statement::IfStatement(_) |
|
Statement::IfStatement(_) |
|
||||||
Statement::BlockStatement(_) |
|
Statement::BlockStatement(_) |
|
||||||
Statement::ExportNamedDeclaration(_) |
|
Statement::ExportNamedDeclaration(_) |
|
||||||
|
Statement::ImportDeclaration(_) |
|
||||||
Statement::FunctionDeclaration(_) => {
|
Statement::FunctionDeclaration(_) => {
|
||||||
// Supported
|
// Supported
|
||||||
walk::walk_statement(self, stmt);
|
walk::walk_statement(self, stmt);
|
||||||
@ -118,7 +140,7 @@ impl<'a> Visit<'a> for Validator {
|
|||||||
|
|
||||||
fn visit_call_expression(&mut self, expr: &CallExpression<'a>) {
|
fn visit_call_expression(&mut self, expr: &CallExpression<'a>) {
|
||||||
if let Ok(name) = ast_util::get_callee_name(&expr.callee) {
|
if let Ok(name) = ast_util::get_callee_name(&expr.callee) {
|
||||||
if syscall_map::map_syscall(&name).is_none() {
|
if syscall_map::map_syscall(&name).is_none() && !self.local_functions.contains(&name) {
|
||||||
self.errors.push(format!("Unsupported function call: {} at {:?}", name, expr.span));
|
self.errors.push(format!("Unsupported function call: {} at {:?}", name, expr.span));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
use std::path::Path;
|
use std::path::{Path, PathBuf};
|
||||||
use anyhow::{Result, Context};
|
use anyhow::{Result, Context, anyhow};
|
||||||
use oxc_allocator::Allocator;
|
use oxc_allocator::Allocator;
|
||||||
use oxc_parser::Parser;
|
use oxc_parser::Parser;
|
||||||
use oxc_span::SourceType;
|
use oxc_span::SourceType;
|
||||||
|
use oxc_ast::ast::*;
|
||||||
use crate::codegen::Codegen;
|
use crate::codegen::Codegen;
|
||||||
use crate::codegen::validator::Validator;
|
use crate::codegen::validator::Validator;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::collections::{HashMap, VecDeque};
|
||||||
use prometeu_bytecode::disasm::disasm;
|
use prometeu_bytecode::disasm::disasm;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
@ -67,28 +69,83 @@ impl CompilationUnit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn resolve_import(base_path: &Path, import_str: &str) -> Result<PathBuf> {
|
||||||
|
let mut path = base_path.parent().unwrap().join(import_str);
|
||||||
|
if !path.exists() {
|
||||||
|
if path.with_extension("ts").exists() {
|
||||||
|
path.set_extension("ts");
|
||||||
|
} else if path.with_extension("js").exists() {
|
||||||
|
path.set_extension("js");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !path.exists() {
|
||||||
|
return Err(anyhow!("Cannot resolve import '{}' from {:?}", import_str, base_path));
|
||||||
|
}
|
||||||
|
Ok(path.canonicalize()?)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn compile(entry: &Path) -> Result<CompilationUnit> {
|
pub fn compile(entry: &Path) -> Result<CompilationUnit> {
|
||||||
let source_text = fs::read_to_string(entry)
|
|
||||||
.with_context(|| format!("Failed to read entry file: {:?}", entry))?;
|
|
||||||
|
|
||||||
let allocator = Allocator::default();
|
let allocator = Allocator::default();
|
||||||
let source_type = SourceType::from_path(entry).unwrap_or_default();
|
let mut modules = HashMap::new();
|
||||||
|
let mut queue = VecDeque::new();
|
||||||
|
|
||||||
let mut codegen = Codegen::new(entry.to_string_lossy().to_string(), source_text.clone());
|
let entry_abs = entry.canonicalize()
|
||||||
let rom = {
|
.with_context(|| format!("Failed to canonicalize entry path: {:?}", entry))?;
|
||||||
let ret = Parser::new(&allocator, &source_text, source_type).parse();
|
queue.push_back(entry_abs.clone());
|
||||||
|
|
||||||
if !ret.errors.is_empty() {
|
while let Some(path) = queue.pop_front() {
|
||||||
for error in ret.errors {
|
let path_str = path.to_string_lossy().to_string();
|
||||||
|
if modules.contains_key(&path_str) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let source_text = fs::read_to_string(&path)
|
||||||
|
.with_context(|| format!("Failed to read file: {:?}", path))?;
|
||||||
|
|
||||||
|
// Allocate source_text in the allocator to keep it alive
|
||||||
|
let source_text_ptr: &str = allocator.alloc_str(&source_text);
|
||||||
|
|
||||||
|
let source_type = SourceType::from_path(&path).unwrap_or_default();
|
||||||
|
let parser_ret = Parser::new(&allocator, source_text_ptr, source_type).parse();
|
||||||
|
|
||||||
|
if !parser_ret.errors.is_empty() {
|
||||||
|
for error in parser_ret.errors {
|
||||||
eprintln!("{:?}", error);
|
eprintln!("{:?}", error);
|
||||||
}
|
}
|
||||||
return Err(anyhow::anyhow!("Failed to parse module"));
|
return Err(anyhow!("Failed to parse module: {:?}", path));
|
||||||
}
|
}
|
||||||
|
|
||||||
Validator::validate(&ret.program)?;
|
// Validate individual module
|
||||||
|
Validator::validate(&parser_ret.program)?;
|
||||||
|
|
||||||
codegen.compile_program(&ret.program)?
|
// Find imports to add to queue
|
||||||
};
|
for item in &parser_ret.program.body {
|
||||||
|
if let Statement::ImportDeclaration(decl) = item {
|
||||||
|
let import_path = decl.source.value.as_str();
|
||||||
|
let resolved = resolve_import(&path, import_path)?;
|
||||||
|
queue.push_back(resolved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modules.insert(path_str, (source_text_ptr, parser_ret.program));
|
||||||
|
}
|
||||||
|
|
||||||
|
let entry_str = entry_abs.to_string_lossy().to_string();
|
||||||
|
let mut program_list = Vec::new();
|
||||||
|
|
||||||
|
// Add entry program first
|
||||||
|
let entry_data = modules.get(&entry_str).ok_or_else(|| anyhow!("Entry module not found after loading"))?;
|
||||||
|
program_list.push((entry_str.clone(), entry_data.0.to_string(), &entry_data.1));
|
||||||
|
|
||||||
|
// Add all other programs
|
||||||
|
for (path, (source, program)) in &modules {
|
||||||
|
if path != &entry_str {
|
||||||
|
program_list.push((path.clone(), source.to_string(), program));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut codegen = Codegen::new(entry_str.clone(), entry_data.0.to_string());
|
||||||
|
let rom = codegen.compile_programs(program_list)?;
|
||||||
|
|
||||||
Ok(CompilationUnit {
|
Ok(CompilationUnit {
|
||||||
rom,
|
rom,
|
||||||
|
|||||||
80
symbols.json
Normal file
80
symbols.json
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"pc": 20,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 1,
|
||||||
|
"col": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 22,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 2,
|
||||||
|
"col": 13
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 28,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 2,
|
||||||
|
"col": 17
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 34,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 2,
|
||||||
|
"col": 13
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 46,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 5,
|
||||||
|
"col": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 48,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 6,
|
||||||
|
"col": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 54,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 6,
|
||||||
|
"col": 14
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 60,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 6,
|
||||||
|
"col": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 70,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 6,
|
||||||
|
"col": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 72,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 7,
|
||||||
|
"col": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 78,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 7,
|
||||||
|
"col": 18
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 84,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 7,
|
||||||
|
"col": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pc": 90,
|
||||||
|
"file": "temp_test_2.ts",
|
||||||
|
"line": 7,
|
||||||
|
"col": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
23
temp_test_2.disasm.txt
Normal file
23
temp_test_2.disasm.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
00000000 Call U32(46) U32(0)
|
||||||
|
0000000A Pop
|
||||||
|
0000000C FrameSync
|
||||||
|
0000000E Jmp U32(0)
|
||||||
|
00000014 PushScope ; temp_test_2.ts:1
|
||||||
|
00000016 GetLocal U32(0) ; temp_test_2.ts:2
|
||||||
|
0000001C GetLocal U32(1) ; temp_test_2.ts:2
|
||||||
|
00000022 Add ; temp_test_2.ts:2
|
||||||
|
00000024 PopScope
|
||||||
|
00000026 PushConst U32(0)
|
||||||
|
0000002C Ret
|
||||||
|
0000002E PushScope ; temp_test_2.ts:5
|
||||||
|
00000030 PushI32 U32(10) ; temp_test_2.ts:6
|
||||||
|
00000036 PushI32 U32(20) ; temp_test_2.ts:6
|
||||||
|
0000003C Call U32(20) U32(2) ; temp_test_2.ts:6
|
||||||
|
00000046 Pop ; temp_test_2.ts:6
|
||||||
|
00000048 PushI32 U32(1) ; temp_test_2.ts:7
|
||||||
|
0000004E PushConst U32(1) ; temp_test_2.ts:7
|
||||||
|
00000054 Syscall U32(20481) ; temp_test_2.ts:7
|
||||||
|
0000005A Pop ; temp_test_2.ts:7
|
||||||
|
0000005C PopScope
|
||||||
|
0000005E PushConst U32(0)
|
||||||
|
00000064 Ret
|
||||||
@ -2,131 +2,157 @@
|
|||||||
0000000A Pop
|
0000000A Pop
|
||||||
0000000C FrameSync
|
0000000C FrameSync
|
||||||
0000000E Jmp U32(0)
|
0000000E Jmp U32(0)
|
||||||
00000014 PushI32 U32(18448) ; ./src/main.ts:2
|
00000014 PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:5
|
||||||
0000001A Syscall U32(4097) ; ./src/main.ts:2
|
00000016 Call U32(428) U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:6
|
||||||
00000020 Pop ; ./src/main.ts:2
|
00000020 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:6
|
||||||
00000022 PushI32 U32(10) ; ./src/main.ts:4
|
00000022 Call U32(236) U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:7
|
||||||
00000028 PushI32 U32(10) ; ./src/main.ts:4
|
0000002C Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:7
|
||||||
0000002E PushI32 U32(50) ; ./src/main.ts:4
|
0000002E Call U32(362) U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:8
|
||||||
00000034 PushI32 U32(50) ; ./src/main.ts:4
|
00000038 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:8
|
||||||
0000003A PushI32 U32(63488) ; ./src/main.ts:4
|
0000003A Call U32(92) U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:9
|
||||||
00000040 Syscall U32(4098) ; ./src/main.ts:4
|
00000044 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:9
|
||||||
00000046 Pop ; ./src/main.ts:4
|
00000046 Call U32(644) U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:10
|
||||||
00000048 PushI32 U32(0) ; ./src/main.ts:5
|
00000050 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/main.ts:10
|
||||||
0000004E PushI32 U32(0) ; ./src/main.ts:5
|
00000052 PopScope
|
||||||
00000054 PushI32 U32(128) ; ./src/main.ts:5
|
00000054 PushConst U32(0)
|
||||||
0000005A PushI32 U32(128) ; ./src/main.ts:5
|
0000005A Ret
|
||||||
00000060 PushI32 U32(65535) ; ./src/main.ts:5
|
0000005C PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:1
|
||||||
00000066 Syscall U32(4099) ; ./src/main.ts:5
|
0000005E PushConst U32(1) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:2
|
||||||
0000006C Pop ; ./src/main.ts:5
|
00000064 Syscall U32(16385) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:2
|
||||||
0000006E PushI32 U32(64) ; ./src/main.ts:6
|
0000006A GetLocal U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:3
|
||||||
00000074 PushI32 U32(64) ; ./src/main.ts:6
|
00000070 PushI32 U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:3
|
||||||
0000007A PushI32 U32(20) ; ./src/main.ts:6
|
00000076 Gte ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:3
|
||||||
00000080 PushI32 U32(31) ; ./src/main.ts:6
|
00000078 JmpIfFalse U32(226) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:3
|
||||||
00000086 Syscall U32(4100) ; ./src/main.ts:6
|
0000007E PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:3
|
||||||
0000008C Pop ; ./src/main.ts:6
|
00000080 GetLocal U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:4
|
||||||
0000008E PushI32 U32(100) ; ./src/main.ts:7
|
00000086 PushConst U32(2) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:4
|
||||||
00000094 PushI32 U32(100) ; ./src/main.ts:7
|
0000008C Syscall U32(16387) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:4
|
||||||
0000009A PushI32 U32(10) ; ./src/main.ts:7
|
00000092 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:4
|
||||||
000000A0 PushI32 U32(2016) ; ./src/main.ts:7
|
00000094 GetLocal U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:5
|
||||||
000000A6 PushI32 U32(65504) ; ./src/main.ts:7
|
0000009A Syscall U32(16386) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:5
|
||||||
000000AC Syscall U32(4101) ; ./src/main.ts:7
|
000000A0 GetLocal U32(1) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:6
|
||||||
000000B2 Pop ; ./src/main.ts:7
|
000000A6 JmpIfFalse U32(204) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:6
|
||||||
000000B4 PushI32 U32(20) ; ./src/main.ts:8
|
000000AC PushI32 U32(2) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:6
|
||||||
000000BA PushI32 U32(100) ; ./src/main.ts:8
|
000000B2 PushI32 U32(101) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:6
|
||||||
000000C0 PushI32 U32(30) ; ./src/main.ts:8
|
000000B8 GetLocal U32(1) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:6
|
||||||
000000C6 PushI32 U32(30) ; ./src/main.ts:8
|
000000BE Syscall U32(20482) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:6
|
||||||
000000CC PushI32 U32(2047) ; ./src/main.ts:8
|
000000C4 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:6
|
||||||
000000D2 PushI32 U32(63519) ; ./src/main.ts:8
|
000000C6 Jmp U32(204)
|
||||||
000000D8 Syscall U32(4102) ; ./src/main.ts:8
|
000000CC GetLocal U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:7
|
||||||
000000DE Pop ; ./src/main.ts:8
|
000000D2 Syscall U32(16388) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:7
|
||||||
000000E0 PushI32 U32(0) ; ./src/main.ts:10
|
000000D8 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:7
|
||||||
000000E6 Syscall U32(8193) ; ./src/main.ts:10
|
000000DA PopScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_fs.ts:3
|
||||||
000000EC JmpIfFalse U32(268) ; ./src/main.ts:10
|
000000DC Jmp U32(226)
|
||||||
000000F2 PushI32 U32(2) ; ./src/main.ts:11
|
000000E2 PopScope
|
||||||
000000F8 PushConst U32(1) ; ./src/main.ts:11
|
000000E4 PushConst U32(0)
|
||||||
000000FE Syscall U32(20481) ; ./src/main.ts:11
|
000000EA Ret
|
||||||
00000104 Pop ; ./src/main.ts:11
|
000000EC PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:1
|
||||||
00000106 Jmp U32(268)
|
000000EE PushI32 U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:2
|
||||||
0000010C PushI32 U32(4) ; ./src/main.ts:14
|
000000F4 Syscall U32(8193) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:2
|
||||||
00000112 Syscall U32(8194) ; ./src/main.ts:14
|
000000FA JmpIfFalse U32(286) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:2
|
||||||
00000118 JmpIfFalse U32(330) ; ./src/main.ts:14
|
00000100 PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:2
|
||||||
0000011E PushI32 U32(1) ; ./src/main.ts:15
|
00000102 PushI32 U32(2) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:3
|
||||||
00000124 PushI32 U32(0) ; ./src/main.ts:15
|
00000108 PushConst U32(3) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:3
|
||||||
0000012A PushI32 U32(255) ; ./src/main.ts:15
|
0000010E Syscall U32(20481) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:3
|
||||||
00000130 PushI32 U32(128) ; ./src/main.ts:15
|
00000114 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:3
|
||||||
00000136 PushI32 U32(1) ; ./src/main.ts:15
|
00000116 PopScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:2
|
||||||
0000013C Syscall U32(12289) ; ./src/main.ts:15
|
00000118 Jmp U32(286)
|
||||||
00000142 Pop ; ./src/main.ts:15
|
0000011E PushI32 U32(4) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:6
|
||||||
00000144 Jmp U32(330)
|
00000124 Syscall U32(8194) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:6
|
||||||
0000014A Syscall U32(8451) ; ./src/main.ts:18
|
0000012A JmpIfFalse U32(352) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:6
|
||||||
00000150 JmpIfFalse U32(380) ; ./src/main.ts:18
|
00000130 PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:6
|
||||||
00000156 Syscall U32(8449) ; ./src/main.ts:19
|
00000132 PushI32 U32(1) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:7
|
||||||
0000015C Syscall U32(8450) ; ./src/main.ts:19
|
00000138 PushI32 U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:7
|
||||||
00000162 PushI32 U32(5) ; ./src/main.ts:19
|
0000013E PushI32 U32(255) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:7
|
||||||
00000168 PushI32 U32(65535) ; ./src/main.ts:19
|
00000144 PushI32 U32(128) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:7
|
||||||
0000016E Syscall U32(4100) ; ./src/main.ts:19
|
0000014A PushI32 U32(1) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:7
|
||||||
00000174 Pop ; ./src/main.ts:19
|
00000150 Syscall U32(12289) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:7
|
||||||
00000176 Jmp U32(380)
|
00000156 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:7
|
||||||
0000017C PushConst U32(2) ; ./src/main.ts:22
|
00000158 PopScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:6
|
||||||
00000182 Syscall U32(16385) ; ./src/main.ts:22
|
0000015A Jmp U32(352)
|
||||||
00000188 GetLocal U32(0) ; ./src/main.ts:23
|
00000160 PopScope
|
||||||
0000018E PushI32 U32(0) ; ./src/main.ts:23
|
00000162 PushConst U32(0)
|
||||||
00000194 Gte ; ./src/main.ts:23
|
00000168 Ret
|
||||||
00000196 JmpIfFalse U32(508) ; ./src/main.ts:23
|
0000016A PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:11
|
||||||
0000019C GetLocal U32(0) ; ./src/main.ts:24
|
0000016C Syscall U32(8451) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:12
|
||||||
000001A2 PushConst U32(3) ; ./src/main.ts:24
|
00000172 JmpIfFalse U32(418) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:12
|
||||||
000001A8 Syscall U32(16387) ; ./src/main.ts:24
|
00000178 PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:12
|
||||||
000001AE Pop ; ./src/main.ts:24
|
0000017A Syscall U32(8449) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:13
|
||||||
000001B0 GetLocal U32(0) ; ./src/main.ts:25
|
00000180 Syscall U32(8450) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:13
|
||||||
000001B6 Syscall U32(16386) ; ./src/main.ts:25
|
00000186 PushI32 U32(5) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:13
|
||||||
000001BC GetLocal U32(1) ; ./src/main.ts:26
|
0000018C PushI32 U32(65535) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:13
|
||||||
000001C2 JmpIfFalse U32(488) ; ./src/main.ts:26
|
00000192 Syscall U32(4100) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:13
|
||||||
000001C8 PushI32 U32(2) ; ./src/main.ts:26
|
00000198 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:13
|
||||||
000001CE PushI32 U32(101) ; ./src/main.ts:26
|
0000019A PopScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_input.ts:12
|
||||||
000001D4 GetLocal U32(1) ; ./src/main.ts:26
|
0000019C Jmp U32(418)
|
||||||
000001DA Syscall U32(20482) ; ./src/main.ts:26
|
000001A2 PopScope
|
||||||
000001E0 Pop ; ./src/main.ts:26
|
000001A4 PushConst U32(0)
|
||||||
000001E2 Jmp U32(488)
|
000001AA Ret
|
||||||
000001E8 GetLocal U32(0) ; ./src/main.ts:27
|
000001AC PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:1
|
||||||
000001EE Syscall U32(16388) ; ./src/main.ts:27
|
000001AE PushI32 U32(18448) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:2
|
||||||
000001F4 Pop ; ./src/main.ts:27
|
000001B4 Syscall U32(4097) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:2
|
||||||
000001F6 Jmp U32(508)
|
000001BA Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:2
|
||||||
000001FC PushI32 U32(255) ; ./src/main.ts:30
|
000001BC PushI32 U32(10) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:3
|
||||||
00000202 PushI32 U32(3) ; ./src/main.ts:30
|
000001C2 PushI32 U32(10) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:3
|
||||||
00000208 Shr ; ./src/main.ts:30
|
000001C8 PushI32 U32(50) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:3
|
||||||
0000020A PushI32 U32(11) ; ./src/main.ts:30
|
000001CE PushI32 U32(50) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:3
|
||||||
00000210 Shl ; ./src/main.ts:30
|
000001D4 PushI32 U32(63488) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:3
|
||||||
00000212 PushI32 U32(128) ; ./src/main.ts:30
|
000001DA Syscall U32(4098) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:3
|
||||||
00000218 PushI32 U32(2) ; ./src/main.ts:30
|
000001E0 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:3
|
||||||
0000021E Shr ; ./src/main.ts:30
|
000001E2 PushI32 U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:4
|
||||||
00000220 PushI32 U32(5) ; ./src/main.ts:30
|
000001E8 PushI32 U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:4
|
||||||
00000226 Shl ; ./src/main.ts:30
|
000001EE PushI32 U32(128) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:4
|
||||||
00000228 BitOr ; ./src/main.ts:30
|
000001F4 PushI32 U32(128) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:4
|
||||||
0000022A PushI32 U32(0) ; ./src/main.ts:30
|
000001FA PushI32 U32(65535) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:4
|
||||||
00000230 PushI32 U32(3) ; ./src/main.ts:30
|
00000200 Syscall U32(4099) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:4
|
||||||
00000236 Shr ; ./src/main.ts:30
|
00000206 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:4
|
||||||
00000238 BitOr ; ./src/main.ts:30
|
00000208 PushI32 U32(64) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:5
|
||||||
0000023A PushI32 U32(0) ; ./src/main.ts:31
|
0000020E PushI32 U32(64) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:5
|
||||||
00000240 PushI32 U32(0) ; ./src/main.ts:31
|
00000214 PushI32 U32(20) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:5
|
||||||
00000246 PushI32 U32(5) ; ./src/main.ts:31
|
0000021A PushI32 U32(31) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:5
|
||||||
0000024C PushI32 U32(5) ; ./src/main.ts:31
|
00000220 Syscall U32(4100) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:5
|
||||||
00000252 PushI32 U32(255) ; ./src/main.ts:31
|
00000226 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:5
|
||||||
00000258 PushI32 U32(3) ; ./src/main.ts:31
|
00000228 PushI32 U32(100) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:6
|
||||||
0000025E Shr ; ./src/main.ts:31
|
0000022E PushI32 U32(100) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:6
|
||||||
00000260 PushI32 U32(11) ; ./src/main.ts:31
|
00000234 PushI32 U32(10) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:6
|
||||||
00000266 Shl ; ./src/main.ts:31
|
0000023A PushI32 U32(2016) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:6
|
||||||
00000268 PushI32 U32(128) ; ./src/main.ts:31
|
00000240 PushI32 U32(65504) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:6
|
||||||
0000026E PushI32 U32(2) ; ./src/main.ts:31
|
00000246 Syscall U32(4101) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:6
|
||||||
00000274 Shr ; ./src/main.ts:31
|
0000024C Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:6
|
||||||
00000276 PushI32 U32(5) ; ./src/main.ts:31
|
0000024E PushI32 U32(20) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:7
|
||||||
0000027C Shl ; ./src/main.ts:31
|
00000254 PushI32 U32(100) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:7
|
||||||
0000027E BitOr ; ./src/main.ts:31
|
0000025A PushI32 U32(30) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:7
|
||||||
00000280 PushI32 U32(0) ; ./src/main.ts:31
|
00000260 PushI32 U32(30) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:7
|
||||||
00000286 PushI32 U32(3) ; ./src/main.ts:31
|
00000266 PushI32 U32(2047) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:7
|
||||||
0000028C Shr ; ./src/main.ts:31
|
0000026C PushI32 U32(63519) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:7
|
||||||
0000028E BitOr ; ./src/main.ts:31
|
00000272 Syscall U32(4102) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:7
|
||||||
00000290 Syscall U32(4098) ; ./src/main.ts:31
|
00000278 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:7
|
||||||
00000296 Pop ; ./src/main.ts:31
|
0000027A PopScope
|
||||||
00000298 PushConst U32(0)
|
0000027C PushConst U32(0)
|
||||||
0000029E Ret
|
00000282 Ret
|
||||||
|
00000284 PushScope ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:10
|
||||||
|
00000286 PushI32 U32(255) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
0000028C PushI32 U32(3) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
00000292 Shr ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
00000294 PushI32 U32(11) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
0000029A Shl ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
0000029C PushI32 U32(128) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002A2 PushI32 U32(2) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002A8 Shr ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002AA PushI32 U32(5) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002B0 Shl ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002B2 BitOr ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002B4 PushI32 U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002BA PushI32 U32(3) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002C0 Shr ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002C2 BitOr ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:11
|
||||||
|
000002C4 PushI32 U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:12
|
||||||
|
000002CA PushI32 U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:12
|
||||||
|
000002D0 PushI32 U32(5) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:12
|
||||||
|
000002D6 PushI32 U32(5) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:12
|
||||||
|
000002DC GetLocal U32(0) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:12
|
||||||
|
000002E2 Syscall U32(4098) ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:12
|
||||||
|
000002E8 Pop ; /Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/test-cartridges/color-square/src/my_gfx.ts:12
|
||||||
|
000002EA PopScope
|
||||||
|
000002EC PushConst U32(0)
|
||||||
|
000002F2 Ret
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,44 +1,11 @@
|
|||||||
function do_init_gfx(): void {
|
import {do_init_gfx, print_orange} from "./my_gfx";
|
||||||
gfx.clear(color.indigo);
|
import {do_pad, do_touch} from "./my_input";
|
||||||
gfx.fillRect(10, 10, 50, 50, color.red);
|
import {do_fs} from "./my_fs";
|
||||||
gfx.drawLine(0, 0, 128, 128, color.white);
|
|
||||||
gfx.drawCircle(64, 64, 20, color.blue);
|
|
||||||
gfx.drawDisc(100, 100, 10, color.green, color.yellow);
|
|
||||||
gfx.drawSquare(20, 100, 30, 30, color.cyan, color.color_key);
|
|
||||||
}
|
|
||||||
|
|
||||||
function do_pad(): void {
|
|
||||||
if (pad.up.down) {
|
|
||||||
log.write(2, "Up is down");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pad.a.pressed) {
|
|
||||||
audio.playSample(1, 0, 255, 128, 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function do_touch(): void {
|
|
||||||
if (touch.button.down) {
|
|
||||||
gfx.drawCircle(touch.x, touch.y, 5, color.white);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function do_fs(): void {
|
|
||||||
let h = fs.open("test.txt");
|
|
||||||
if (h >= 0) {
|
|
||||||
fs.write(h, "Hello Prometeu!");
|
|
||||||
let content = fs.read(h);
|
|
||||||
if (content) log.writeTag(2, 101, content);
|
|
||||||
fs.close(h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function tick(): void {
|
export function tick(): void {
|
||||||
do_init_gfx();
|
do_init_gfx();
|
||||||
do_pad();
|
do_pad();
|
||||||
do_touch();
|
do_touch();
|
||||||
do_fs();
|
do_fs();
|
||||||
|
print_orange();
|
||||||
let c = color.rgb(255, 128, 0);
|
|
||||||
gfx.fillRect(0, 0, 5, 5, c);
|
|
||||||
}
|
}
|
||||||
9
test-cartridges/color-square/src/my_fs.ts
Normal file
9
test-cartridges/color-square/src/my_fs.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export function do_fs(): void {
|
||||||
|
let h = fs.open("test.txt");
|
||||||
|
if (h >= 0) {
|
||||||
|
fs.write(h, "Hello Prometeu!");
|
||||||
|
let content = fs.read(h);
|
||||||
|
if (content) log.writeTag(2, 101, content);
|
||||||
|
fs.close(h);
|
||||||
|
}
|
||||||
|
}
|
||||||
13
test-cartridges/color-square/src/my_gfx.ts
Normal file
13
test-cartridges/color-square/src/my_gfx.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export function do_init_gfx(): void {
|
||||||
|
gfx.clear(color.indigo);
|
||||||
|
gfx.fillRect(10, 10, 50, 50, color.red);
|
||||||
|
gfx.drawLine(0, 0, 128, 128, color.white);
|
||||||
|
gfx.drawCircle(64, 64, 20, color.blue);
|
||||||
|
gfx.drawDisc(100, 100, 10, color.green, color.yellow);
|
||||||
|
gfx.drawSquare(20, 100, 30, 30, color.cyan, color.color_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function print_orange(): void {
|
||||||
|
let c = color.rgb(255, 128, 0);
|
||||||
|
gfx.fillRect(0, 0, 5, 5, c);
|
||||||
|
}
|
||||||
15
test-cartridges/color-square/src/my_input.ts
Normal file
15
test-cartridges/color-square/src/my_input.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
export function do_pad(): void {
|
||||||
|
if (pad.up.down) {
|
||||||
|
log.write(2, "Up is down");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pad.a.pressed) {
|
||||||
|
audio.playSample(1, 0, 255, 128, 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function do_touch(): void {
|
||||||
|
if (touch.button.down) {
|
||||||
|
gfx.drawCircle(touch.x, touch.y, 5, color.white);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user