Sequence | Results in |
---|---|
\[ |
[ |
\] |
] |
\\ |
\ |
Format characters
ident: | |
/[A-Za-z_.][A-Za-z0-9_.]*/ | |
expr: | |
ident | | |
expr '+' expr | | |
etc. | |
nl: | |
'\' | '\r' | '\n' | EOF |
fn main() { | |
let mut ram = [0u16; 0x2000]; | |
let mut rom = [0xffffu16; 0xc000]; | |
{ | |
let mut ptr = 0x0000; | |
let mut mov = |dst, src| { | |
rom[ptr+0] = src; | |
rom[ptr+1] = dst; | |
ptr += 2; |
tsx ; transfer stack pointer to X register | |
stx scratch ; store X in RAM | |
ldx #$01 ; load 0x01 into X | |
stx scratch+1 ; store X in RAM | |
ldx offset ; load offset into X | |
lda (scratch,x) ; perform an indirect load from *(scratch + X) into A | |
1+2+2+2+2+2 bytes = 11 bytes | |
2+3+2+3+3+6 cycles = 19 cycles |
bankswitch(bank, address) { | |
push old bank to stack ; in old bank | |
switch code bank register to new bank ; in old bank | |
call bank:address ; in old bank | |
; function in new bank returns here | |
pop old bank from stack ; in new bank | |
switch code bank register to old bank ; in new bank | |
jump to label in old bank ; in new bank |
trait ControllerPins { | |
// inputs: | |
// latch pin (normally low) | |
fn latch_rising(&mut self); | |
fn latch_falling(&mut self); | |
// clock pin (normally high) | |
fn clock_rising(&mut self); | |
fn clock_falling(&mut self); | |
// output: |
; Goal: to turn controller button samples, incoming on the x register each | |
; frame, into three variables: | |
; - cur, which represents the current state of the controller buttons | |
; - prs, which represents the buttons pressed this frame | |
; - rls, which represents the buttons released this frame | |
; | |
; Example: | |
; x cur prs rls | |
; ................ ................ ................ <- initial values | |
; ...........1.... ...........1.... ...........1.... ................ |
extern crate sdl2; | |
use sdl2::pixels::Color; | |
use sdl2::event::Event; | |
use sdl2::keyboard::Keycode; | |
use std::sync::mpsc::{Receiver, Sender}; | |
enum Command { | |
SetBG(u8, u8, u8), |
[ '[' | |
x exchange bg/fg colors | |
krygbcmwn dark colors | |
KRYGBCMW light colors | |
h00 256-color | |
i italics | |
u underline | |
c clear all formatting | |
|[bxWu]Test|c |
I hereby claim:
To claim this, I am signing this object: