cleaning; optimize screen_bounce.csn

pull/21/head
Ondřej Hruška 4 years ago
parent 214d673643
commit dbc4454244
Signed by: 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::parse_data::{parse_rd, parse_wr};
use crate::asm::parse::ParserContext; use crate::asm::parse::ParserContext;
use crate::asm::parse::sexp_expect::expect_string_atom; use crate::asm::parse::sexp_expect::expect_string_atom;
use crate::asm::patches::NextOrErr;
/// Utility for argument parsing /// Utility for argument parsing
pub struct TokenParser<'a> { pub struct TokenParser<'a> {

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

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

Loading…
Cancel
Save