cleaning; optimize screen_bounce.csn

floats
Ondřej Hruška 4 years ago
parent 214d673643
commit dbc4454244
Signed by untrusted user: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 1
      crsn/src/asm/parse/arg_parser.rs
  2. 1
      crsn/src/builtin/parse.rs
  3. 25
      examples/screen_bounce.csn

@ -5,7 +5,6 @@ use crate::asm::error::CrsnError;
use crate::asm::parse::parse_data::{parse_rd, parse_wr};
use crate::asm::parse::ParserContext;
use crate::asm::parse::sexp_expect::expect_string_atom;
use crate::asm::patches::NextOrErr;
/// Utility for argument parsing
pub struct TokenParser<'a> {

@ -290,7 +290,6 @@ mod test {
use sexp::SourcePosition;
use crate::asm::instr::Flatten;
use crate::asm::parse::{parse_instructions, ParserContext};
use crate::asm::parse::sexp_expect::expect_list;
use crate::builtin::BuiltinOps;

@ -4,21 +4,20 @@
(sc-opt 1 1) ; auto blit
(sc-opt 2 25) ; frame rate
(ld r0 5) ; x
(ld r1 0) ; y
(sym x r0) (sym y r1) (sym dx r2) (sym dy r3) (sym color r5)
(ld r2 1) ; dx
(ld r3 1) ; dy
(ld r5 0x3300ff)
(ld x 5) (ld y 0)
(ld dx 1) (ld dy 1)
(ld color 0x3300ff)
(:loop)
(add r5 0x000001)
(sc-px r0 r1 r5)
(add r0 r2)
(add r1 r3)
(cmp r0 799 (eq? (ld r2 -1)) (ne? (cmp r0 0 (eq? (ld r2 1)))))
(cmp r1 599 (eq? (ld r3 -1)) (ne? (cmp r1 0 (eq? (ld r3 1)))))
(add color 0x000001)
(sc-px x y color)
(add x dx (z? (ld dx 1)))
(cmp x 799 (eq? (ld dx -1)))
(add y dy (z? (ld dy 1)))
(cmp y 599 (eq? (ld dy -1)))
(j :loop)
(fault "unreachable")
)

Loading…
Cancel
Save