Skip to content

Instantly share code, notes, and snippets.

View runer112's full-sized avatar

Zachary Wassall runer112

View GitHub Profile
@runer112
runer112 / memset_fast.asm
Last active September 2, 2016 16:02
Optimized memset_fast to 25 bytes
; (c) Copyright 2016 Matt Waltz
;-------------------------------------------------------------------------
; Faster memset variation
; Reasons faster:
; 1) uses ldir to memset
; 2) executes in RAM to avoid flash wait states
;-------------------------------------------------------------------------
.def _memset_fast
.assume adl=1
@runer112
runer112 / gist:aa317e6b8325e9292e9d9ed6f0e8a0f4
Last active November 8, 2020 09:01
*Really* fast GB sample playback through $FF1C writes
; Response to https://gist.github.com/nitro2k01/e45e47f8469009b8a43ad5e48d951442,
; which is nitro2k01's response to RGME about Pokemon Yellow sample playback.
; For this to make any sense, you'll definitely want to watch the video and
; then read nitro2k01's response.
; With the restriction that the sound data must end at the end of a page (which
; seems fine, you're probably not fitting multiple of these onto a page), 24
; cycles per sample is achievable:
; hl = data
@runer112
runer112 / roundf.src
Last active March 26, 2022 04:22
EZ80 implementation of roundf
assume adl=1
section .text
public _roundf
_roundf:
; exponent_biased >= 0 && exponent_biased < 256
; && exponent_biased = exponent + 127
; = exponent + 127 >= 0 && exponent + 127 < 256
; = exponent >= -127 && exponent < 129