Skip to content

Instantly share code, notes, and snippets.

@jacobly0
jacobly0 / Makefile
Last active February 1, 2016 19:03
ez80 Makefile template for linux
CEDEV ?= ..
BIN = $(CEDEV)\bin
INCLUDE = $(CEDEV)\include
WORKDIR ?= src
OUTDIR ?= src
TARGET ?= template
CC = @wine "$(BIN)\eZ80cc"
LD = @wine "$(BIN)\eZ80link"
@jacobly0
jacobly0 / disp168.ez80
Last active January 18, 2019 16:25
Displays a 16.8 fixed point number.
call AbsDE
ld hl, OP1
jp m, Positive
ld (hl), $1a
inc hl
Positive:
ex de, hl
push hl
push af
inc sp
@jacobly0
jacobly0 / Makefile
Last active February 1, 2016 20:09
ez80 Makefile template for wine/windows
CEDEV ?= ..
BIN = $(CEDEV)\bin
INCLUDE = $(CEDEV)\include
WORKDIR ?= src
OUTDIR ?= src
TARGET ?= template
CC = "$(BIN)\eZ80cc"
LD = "$(BIN)\eZ80link"
#Change 'template' to the name of your program
TARGET ?= template
#Change ICONC to "ICON" to include a custom icon, and "NICON" to not use an icon
ICONC ?= NICON
DESCRIPTION ?= "Template C Program"
empty :=
space := $(empty) $(empty)
comma := ,
@jacobly0
jacobly0 / ez80.asm
Last active February 28, 2016 09:45
Every ez80 instruction.
NOP ; 00
LD BC,$0000 ; 01 $0000
LD (BC),A ; 02
INC BC ; 03
INC B ; 04
DEC B ; 05
LD B,$00 ; 06 $00
RLCA ; 07
EX AF,AF' ; 08
ADD HL,BC ; 09
@jacobly0
jacobly0 / ucline.ez80
Last active November 5, 2016 02:05
Unclipped Line in ez80
Line:
ld iy,-1
add iy,sp
ld hl,(iy+4) ; hl = x1
ld c,(iy+7) ; c = y1
ld de,(iy+10) ; de = x2
ld b,(iy+13) ; b = y2
ex.s de,hl ; de = x1, hl = x2
ld a,c
sbc a,b
@jacobly0
jacobly0 / shift.c
Last active August 25, 2016 18:39
Screen Shift
void ShiftUp(unsigned amt) {
char *dst = currDrawingBuff + xmin + ymin * lcdWidth;
char *src = dst + amt * lcdWidth;
unsigned times = ymax - ymin - amt;
do {
ldir(dst, src, xmax - xmin);
dst += lcdWidth;
src += lcdWidth;
} while (--times);
}
@jacobly0
jacobly0 / shift.asm
Last active September 1, 2016 22:47
Shifts
;-------------------------------------------------------------------------------
_ShiftLeft:
; Shifts whatever is in the clip left by some pixels
; Arguments:
; arg0 : Amount to shift by
; Returns:
; None
.db $F6
;-------------------------------------------------------------------------------
@jacobly0
jacobly0 / key.md
Created September 2, 2016 08:26
How to find a key code for a token

How to find a key code for a token

  1. Open CEmu
  2. Go to desired token in the catalog
  3. [Stop] and set a breakpoint at the destination of 020ED8
  4. [Run] and press Enter
  5. [Step Over] until BC changes
  6. BC contains the token code
  7. To repeat just
    1. Remove the old breakpoint
@jacobly0
jacobly0 / getsprite.asm
Last active September 7, 2016 02:06
GetSprite
;-------------------------------------------------------------------------------
_GetSprite:
; Grabs the data from the current draw buffer and stores it in another buffer
; Arguments:
; arg0 : Pointer to storage buffer
; arg1 : X Coord
; arg2 : Y Coord
; Returns:
; Pointer to resultant sprite
ld iy,0