Skip to content

Commit

Permalink
Revert "Split neslib and nesdoug components so they are linked condit…
Browse files Browse the repository at this point in the history
…ionally (#217)"

This reverts commit 55051dd.

I gave this a quick spin-through compiling
/~https://github.com/mysterymath/nesdoug/26_Full_Game, and this change
causes it to immediately present "You Died" after hitting Start. Not
sure exactly what changed, but it looks like this introduces some kind
of significant behavioral change.
  • Loading branch information
mysterymath committed Sep 24, 2023
1 parent 55051dd commit 2207d5a
Show file tree
Hide file tree
Showing 21 changed files with 860 additions and 967 deletions.
4 changes: 0 additions & 4 deletions mos-platform/nes/nesdoug/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ install(FILES
TYPE INCLUDE)

add_platform_library(nes-nesdoug
metatile.c
metatile.s
nesdoug.s
nesdoug.c
padlib.s
vram_buffer.c
vram_buffer.s
zaplib.s
)
target_include_directories(nes-nesdoug BEFORE PUBLIC ..)
Expand Down
15 changes: 0 additions & 15 deletions mos-platform/nes/nesdoug/metatile.c

This file was deleted.

270 changes: 0 additions & 270 deletions mos-platform/nes/nesdoug/metatile.s

This file was deleted.

20 changes: 20 additions & 0 deletions mos-platform/nes/nesdoug/nesdoug.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
// based on code by Groepaz/Hitmen <groepaz@gmx.net>, Ullrich von Bassewitz
// <uz@cc65.org>

// Keeping these functions in C LTOs them in, which informs LTO code generation
// that the ZP regions aren't available. This saves users of the library from
// having to manually reserve ZP space from LTO.
__attribute__((section(".zp.vram_index"))) char VRAM_INDEX;
__attribute__((section(".zp.meta_ptr"))) const char *META_PTR;
__attribute__((section(".zp.data_ptr"))) const char *DATA_PTR;

extern char VRAM_BUF[];
void set_vram_update(const void *buf);
void set_vram_buffer(void) {
VRAM_BUF[0] = 0xff;
VRAM_INDEX = 0;
set_vram_update(VRAM_BUF);
}

extern char PAD_STATET[];
char get_pad_new(char pad) { return PAD_STATET[pad]; }

Expand All @@ -29,6 +44,11 @@ void set_scroll_y(unsigned y) {
PPUCTRL_VAR = PPUCTRL_VAR & 0xfd | (y >> 8 & 0x01) << 1;
}

void set_data_pointer(const void *data) { DATA_PTR = (const char *)data; }
void set_mt_pointer(const void *metatiles) {
META_PTR = (const char *)metatiles;
}

extern volatile char PPUMASK_VAR;
void color_emphasis(char color) {
PPUMASK_VAR = PPUMASK_VAR & 0x1f | color & 0xe0;
Expand Down
Loading

0 comments on commit 2207d5a

Please sign in to comment.