Skip to content

Instantly share code, notes, and snippets.

@jacobly0
jacobly0 / memset_fast.asm
Last active September 2, 2016 16:11 — forked from runer112/memset_fast.asm
Optimized memset_fast to 23 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
@jacobly0
jacobly0 / scroll.ez80
Created October 3, 2016 12:14
Instant Scroll
include '../fasmg-ez80/ez80.inc'
include '../fasmg-ez80/tiformat.inc'
include '../ti84pceg.inc'
format ti executable protected program 'SCROLL'
ld hl,v_PrgmName+1
ld de,ti.progToEdit
ld bc,8
ldir
xor a,a
target triple = "i386"
define i64 @test() #0 {
call i64 asm "", "=v"()
ret i64 %1
}
attributes #0 = { "target-features"="+sse" }
define time
namespace time
macro init
ld de, 48000000/100
ld hl, ti.mpTmr1Counter
ld (hl), de
ld l, ti.tmr1Counter + 3
ld (hl), e
inc l; ti.tmr1Load
define i1 @bittest(i4096* %i, i32 %n) {
%1 = lshr i32 %n, 3
%2 = bitcast i4096* %i to i8*
%3 = getelementptr i8, i8* %2, i32 %1
%4 = load i8, i8* %3
%5 = trunc i32 %n to i8
%6 = and i8 %5, 7
%7 = lshr i8 %4, %6
%8 = and i8 %7, 1
%9 = icmp ne i8 %7, 0
@jacobly0
jacobly0 / display.z80
Last active February 15, 2017 17:30
AoCE Display Optimizations
;out off, size
;320* 0-0*2, 2
;320* 1-1*2, 6
;320* 2-2*2, 10
;320* 3-3*2, 14
;320* 4-4*2, 18
;320* 5-5*2, 22
;320* 6-6*2, 26
;320* 7-7*2, 30
;320* 8- 15, 32
@jacobly0
jacobly0 / lolwut.txt
Created February 26, 2017 12:06
Weird Ports
006 002
001 030
000 013
004 013
005 000
010 014
011 001
030 210
030 102
030 021
@jacobly0
jacobly0 / GNUmakefile
Last active April 6, 2017 14:28
Quick Makefile
vpath %.c src
vpath %.asm src obj
vpath %.obj obj
CC = /home/jacob/Programming/llvm/build/Debug/bin/clang -O3 -Dreentrant= -Dinterrupt='__attribute__((__interrupt__))' -Dnested_interrupt='__attribute__((__interrupt__("nested")))' -Dnmi_interrupt='__attribute__((__interrupt__("nmi")))' -target ez80 -I/opt/CEdev/include/{,lib/{ce,std}} -mllvm -verify-machineinstrs
AS = wine /opt/CEdev/bin/ez80asm.exe -NOigcase -cpu:EZ80F91
CSOURCES = $(wildcard src/*.c)
ASMSOURCES = $(wildcard src/*.asm)
OBJECTS = $(patsubst src/%,obj/%,$(CSOURCES:.c=.obj) $(ASMSOURCES:.asm=.obj))
@jacobly0
jacobly0 / makefile
Last active March 25, 2017 02:01
Dynamic makefile dependencies
all: create $(patsubst %.src,%.obj,$(wildcard *.src))
clean:
rm -f create *.src *.obj
%.obj: %.src
cp $< $@
create:
touch create {a,b,c}.src
test -e create # make sure it fails if the file wasn't created (to prevent infinite recursion)!
$(MAKE)
.PHONY: all clean
@jacobly0
jacobly0 / Makefile
Created March 25, 2017 10:24
CE Library Makefile
#----------------------------
# Makefile
#----------------------------
# set NAME to the name of the library
# set SRC to the assembly source of the library
NAME := fileioc
SRC := fileioc.asm
# defult locations