This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INCLUDE "hardware.inc" | |
SECTION "Size-optimised", ROM0 | |
RotateTileClockwise: | |
ld hl, wTileBuf.bp0 | |
ld c, 8 | |
.loop | |
REPT 2 ; Once for each bitplane. | |
ld a, [de] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SECTION "VBlank vector", ROM0[$0040] ; (address as required by the hardware.) | |
push af ; Avoid overwriting registers, that would mess up the code being interrupted! | |
; Always restore registers from their shadows, to reset parameters even in the presence | |
; of raster effects. (This does imply that those registers should be written as late as | |
; possible during a frame's processing.) | |
ldh a, [hLCDC] | |
ldh [rLCDC], a | |
jr VBlankHandler | |
VBlankHandlerJump: | |
SECTION "VBlank handler", ROM0 ; See at the end of this section for its placement. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: requires Nightly Rust as of 2023-11-03. | |
use std::alloc::{Allocator, System}; | |
/// Object allowing access to the system allocator. | |
static SYSTEM: System = System; | |
fn main() { | |
let layout = Layout::from_size_align(2, 1).unwrap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# shellcheck disable=SC2016 # Dollar signs in single quotes are destined to Ninja, not Bash. | |
# Safety belt, even if not perfect. Combined with Shellcheck, we should be okay. | |
set -euo pipefail | |
cd "$(dirname "$0")" # Go to the script's directory. | |
BUILD_DIR="build" | |
CFLAGS="-D_GNU_SOURCE -pthread $(pkg-config --cflags sdl2)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
issotm@sheik-kitty ~% rgbasm - -Dm1=MACRO -Dm2= <<EOF | |
m1 duck{m2} | |
PRINTLN "Quack!" | |
ENDM | |
duck | |
EOF | |
Quack! | |
issotm@sheik-kitty ~% rgbasm - -Dm1= -Dm2=:MACRO <<EOF | |
m1 duck{m2} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
/^[^ \t]+[ \t]bank #([0-9]+):$/ { | |
bank = substr($3, 2) | |
sub(/:/, "", bank) | |
} | |
/^[ \t]*\$[0-9A-Fa-f]{4}[ \t]+=[ \t]+/ { | |
printf "%02x:%s %s\n", bank, substr($1, 2), $3 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start of main loop | |
loop: | |
# Wait until everything is settled before doing anything | |
A = 0x600 | |
D = A | |
wait_init: | |
A = 0x7FFF | |
# D has its bits get progressively cleared as exit conditions become true | |
# (since we're not instructing the robot to move, it won't suddenly start doing so) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MACRO nb_cels | |
REDEF NB_CELS equs "_NB_CELS\@" | |
db {NB_CELS} | |
DEF {NB_CELS} = 0 | |
ENDM | |
MACRO cel | |
db (\1) ; Amount of frames to display this cel during | |
REDEF {NB_CELS} = {NB_CELS} + (\1) | |
dw (\2) ; Ptr to cel | |
ENDM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt::{self, Display, Formatter}; | |
use std::ops::Add; | |
#[derive(Debug, Clone)] | |
struct u256 { | |
lo: u128, | |
hi: u128, | |
} | |
impl Add<u256> for u256 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def main(argv): | |
if len(argv) != 3: | |
print(f"Usage: {argv[0} -(0|1) file.csv", file=sys.stderr) | |
return 1 | |
if argv[1] == "-0": | |
bounds = (-128, 127) |
NewerOlder