Skip to content
Permalink
Browse files

Fix #83

The problem was that the internal data pointers didn't get overwritten when an icon + description was present, thus resulting in code being treated as strings
  • Loading branch information...
PeterTillema committed Jul 28, 2018
1 parent 5a602bd commit 368d82083b51dfebe6a2c4c823ac2f3c3f632554
Showing with 10 additions and 3 deletions.
  1. +1 −1 src/asm/cheader.asm
  2. +9 −2 src/prescan.c
@@ -4,7 +4,7 @@ segment data
.def _GraphxHeader

_CheaderData:
ld hl, LibLoadAppVar - $ + 0D1A882h
ld hl, LibLoadAppVar - _CheaderData + 0D1A882h
call 0020320h
ld a, 015h
ld (0D005F8h), a
@@ -218,11 +218,19 @@ uint8_t getNameIconDescription(void) {
}

uint8_t parsePrescan(void) {
uint8_t *programPtr = ice.programPtr;
uint24_t offset = ice.programPtr - ice.programData;

// Copy C header to program and write the pointers to the LibLoad data string correctly
memcpy(ice.programPtr, CheaderData, SIZEOF_CHEADER);
w24(programPtr + 1, r24(programPtr + 1) + offset);
w24(programPtr + 52, r24(programPtr + 52) + offset);
w24(programPtr + 65, r24(programPtr + 65) + offset);

// Insert C functions
if (prescan.hasGraphxFunctions) {
uint8_t a;

memcpy(ice.programPtr, CheaderData, SIZEOF_CHEADER);
ice.programPtr += SIZEOF_CHEADER;
for (a = 0; a < AMOUNT_OF_GRAPHX_FUNCTIONS; a++) {
if (prescan.GraphxRoutinesStack[a]) {
@@ -231,7 +239,6 @@ uint8_t parsePrescan(void) {
}
}
} else if (prescan.hasFileiocFunctions) {
memcpy(ice.programPtr, CheaderData, SIZEOF_CHEADER - 9);
ice.programPtr += SIZEOF_CHEADER - 9;
}

0 comments on commit 368d820

Please sign in to comment.
You can’t perform that action at this time.