From 25a9c167044442c93366e04eb2a58c9f2873544f Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sat, 6 Jul 2019 13:41:15 -0500 Subject: [PATCH] astrocade presets --- doc/notes.txt | 4 ++++ presets/astrocade/acfast.h | 2 ++ presets/astrocade/acfast.s | 17 +++++++++++++++-- presets/astrocade/aclib.h | 18 +++++++++++++++++- presets/astrocade/racing.c | 4 +--- 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/doc/notes.txt b/doc/notes.txt index bbf26b18..3e8f154f 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -159,6 +159,10 @@ TODO: - make sure to flatten subdirs - astrocade - ctrl+alt+l on ubuntu locks screen +- cookie + - list of stuff for policy + - popup + WEB WORKER FORMAT diff --git a/presets/astrocade/acfast.h b/presets/astrocade/acfast.h index f5273380..acd02034 100644 --- a/presets/astrocade/acfast.h +++ b/presets/astrocade/acfast.h @@ -3,4 +3,6 @@ extern void fast_sprite_8(const byte* pattern, byte* dst); extern void fast_sprite_16(const byte* pattern, byte* dst); +// clips off bottom +extern void fast_sprite_16_yclip(const byte* pattern, byte* dst, byte height); diff --git a/presets/astrocade/acfast.s b/presets/astrocade/acfast.s index c53f4484..bf46db66 100644 --- a/presets/astrocade/acfast.s +++ b/presets/astrocade/acfast.s @@ -44,14 +44,15 @@ _fast_sprite_16: add ix,sp ; IX = arg pointer ld l,4(ix) ; src (HL) ld h,5(ix) - ld e,6(ix) ; dst (DE) - ld d,7(ix) inc hl ; skip width ld c,(hl) ; load height -> C +fast_sprite_16_clip_entry: sla c sla c ; C *= 4 ld b,#0 ; B always 0 (BC < 256) inc hl ; move HL to pattern start + ld e,6(ix) ; dst (DE) + ld d,7(ix) 001$: ldi ldi @@ -69,3 +70,15 @@ _fast_sprite_16: 002$: pop ix ret + +;void fast_sprite_16_yclip(const byte* src, byte* dst, byte height) { +.globl _fast_sprite_16_yclip +_fast_sprite_16_yclip: + push ix + ld ix,#0 + add ix,sp ; IX = arg pointer + ld l,4(ix) ; src (HL) + ld h,5(ix) + ld c,8(ix) ; height (C) + inc hl ; skip width + jp fast_sprite_16_clip_entry diff --git a/presets/astrocade/aclib.h b/presets/astrocade/aclib.h index bc9e0b66..59c42c21 100644 --- a/presets/astrocade/aclib.h +++ b/presets/astrocade/aclib.h @@ -98,12 +98,28 @@ byte __at (0x0000) vmagic[VTOTAL][VBWIDTH]; // regular frame buffer RAM byte __at (0x4000) vidmem[VTOTAL][VBWIDTH]; +byte __at(0xfff) WASTER; // to soak up shifter residue + + /// GRAPHICS FUNCTIONS void set_palette(byte palette[8]) __z88dk_fastcall; // palette in reverse order + +#define SET_PALETTE(palette)\ +__asm__("ld hl,#"#palette);\ +__asm__("ld bc,#0x80b");\ +__asm__("otir");\ + +#define SET_RIGHT_PALETTE(palette)\ +__asm__("ld hl,#"#palette);\ +__asm__("ld bc,#0x40b");\ +__asm__("otir");\ + +/// SOUND FUNCTIONS + void set_sound_registers(byte regs[8]) __z88dk_fastcall; // in reverse too -// INTERRUPTS +/// INTERRUPTS typedef void (*t_interrupt_handler)(void) __interrupt; diff --git a/presets/astrocade/racing.c b/presets/astrocade/racing.c index 9f4d6a52..876bf28c 100644 --- a/presets/astrocade/racing.c +++ b/presets/astrocade/racing.c @@ -220,8 +220,6 @@ byte get1z(byte x) __z88dk_fastcall { #define PAT_SKY 0x55 #define PAT_GROUND 0xaa -byte __at(0xfff) WASTER; // to soak up shifter residue - byte road_width = 142; byte road_cenx = 80; int road_inc = 0; @@ -427,7 +425,7 @@ void position_cars() { void main(void) { // setup palette - set_palette(palette);` + set_palette(palette); // set screen height // set horizontal color split (position / 4) // set interrupt status