Compare commits
7 Commits
pseudoflut
...
GKNew
| Author | SHA1 | Date | |
|---|---|---|---|
| 5831117e36 | |||
| 420f2477fc | |||
| 727c265811 | |||
| 8de358d99f | |||
| 1ba813f068 | |||
| 13372307c2 | |||
| 63e8d5687b |
BIN
bin/linux/compress
Normal file
BIN
bin/linux/compress
Normal file
Binary file not shown.
BIN
bin/linux/decompress
Normal file
BIN
bin/linux/decompress
Normal file
Binary file not shown.
249
bin/src/compress.c
Normal file
249
bin/src/compress.c
Normal file
@@ -0,0 +1,249 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
const int MAXLENGTH = 0x300;
|
||||
|
||||
struct section {
|
||||
int mode;
|
||||
int length;
|
||||
unsigned char data[2];
|
||||
int datalength;
|
||||
};
|
||||
|
||||
int find_duplicate(off_t loc, off_t size, unsigned char buf[], struct section *out) {
|
||||
int i, j;
|
||||
struct section result;
|
||||
result.mode = 4;
|
||||
result.length = 0;
|
||||
for (i = 0; i < loc && i < 0x10000; i++) {
|
||||
if (buf[i] != buf[loc]) {
|
||||
continue;
|
||||
}
|
||||
for (j = 0; j < MAXLENGTH; j++) {
|
||||
if (buf[i + j] != buf[loc + j]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j > result.length) {
|
||||
result.length = j;
|
||||
result.data[0] = i & 0xFF;
|
||||
result.data[1] = (i >> 8) & 0xFF;
|
||||
result.datalength = 2;
|
||||
}
|
||||
}
|
||||
if (result.length < 4) {
|
||||
return -1;
|
||||
}
|
||||
*out = result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find_repeat_byte(off_t loc, off_t size, unsigned char buf[], struct section *out) {
|
||||
int i;
|
||||
for (i = 0; i < MAXLENGTH && loc + i < size; i++) {
|
||||
if (buf[loc + i] != buf[loc]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i > 2) {
|
||||
struct section result;
|
||||
result.mode = 1;
|
||||
result.length = i;
|
||||
result.data[0] = buf[loc];
|
||||
result.datalength = 1;
|
||||
*out = result;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int find_repeat_word(off_t loc, off_t size, unsigned char buf[], struct section *out) {
|
||||
int i;
|
||||
for (i = 0; i < MAXLENGTH && loc + i + 1 < size; i += 1) {
|
||||
if (buf[loc + i] != buf[loc + (i & 1)]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i > 3) {
|
||||
struct section result;
|
||||
result.mode = 2;
|
||||
result.length = i;
|
||||
result.data[0] = buf[loc];
|
||||
result.data[1] = buf[loc + 1];
|
||||
result.datalength = 2;
|
||||
*out = result;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int find_incrementing_byte(off_t loc, off_t size, unsigned char buf[], struct section *out) {
|
||||
int i;
|
||||
for (i = 0; i < MAXLENGTH && loc + i < size; i++) {
|
||||
if (buf[loc] + i < i) {
|
||||
break;
|
||||
}
|
||||
if (buf[loc + i] != buf[loc] + i) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i > 2) {
|
||||
struct section result;
|
||||
result.mode = 3;
|
||||
result.length = i;
|
||||
result.data[0] = buf[loc];
|
||||
result.datalength = 1;
|
||||
*out = result;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int get_section(off_t loc, off_t size, unsigned char buf[], struct section *out) {
|
||||
struct section best, current;
|
||||
best.length = 0;
|
||||
if (!find_repeat_byte(loc, size, buf, ¤t)) {
|
||||
if (current.length > best.length) {
|
||||
best = current;
|
||||
}
|
||||
}
|
||||
if (!find_repeat_word(loc, size, buf, ¤t)) {
|
||||
if (current.length > best.length) {
|
||||
best = current;
|
||||
}
|
||||
}
|
||||
if (!find_incrementing_byte(loc, size, buf, ¤t)) {
|
||||
if (current.length > best.length) {
|
||||
best = current;
|
||||
}
|
||||
}
|
||||
if (!find_duplicate(loc, size, buf, ¤t)) {
|
||||
if (current.length > best.length) {
|
||||
best = current;
|
||||
}
|
||||
}
|
||||
if (best.length > 0) {
|
||||
// printf("byte %06X: mode %d length %02X\n", loc, best.mode, best.length);
|
||||
*out = best;
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int write_section(struct section section, unsigned char data[], unsigned char buf[], int loc) {
|
||||
int nloc = loc;
|
||||
int len = section.length - 1;
|
||||
if (len > 0x1F) {
|
||||
buf[nloc++] = 0xE0 | (section.mode << 2) | (len >> 8);
|
||||
buf[nloc++] = len & 0xFF;
|
||||
} else {
|
||||
buf[nloc++] = (section.mode << 5) | len;
|
||||
}
|
||||
for (int i = 0; i < section.datalength; i++) {
|
||||
buf[nloc++] = data[i];
|
||||
}
|
||||
return nloc;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 3) {
|
||||
printf("Usage: %s infile outfile [start [length]]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
off_t seek = 0;
|
||||
if (argc > 3) {
|
||||
seek = strtol(argv[3], NULL, 0);
|
||||
}
|
||||
|
||||
FILE *inptr;
|
||||
if ((inptr = fopen(argv[1], "rb")) == NULL) {
|
||||
printf("%s does not exist.\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int fd = fileno(inptr);
|
||||
if (fd < 0) {
|
||||
printf("Error stating file: %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct stat buf;
|
||||
if (fstat(fd, &buf) != 0) {
|
||||
printf("Error stating file: %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
off_t size = buf.st_size - seek;
|
||||
|
||||
if (argc > 4) {
|
||||
size = strtol(argv[4], NULL, 0);
|
||||
}
|
||||
unsigned char inbuf[size];
|
||||
|
||||
fseek(inptr, seek, SEEK_SET);
|
||||
|
||||
if (fread(inbuf, 1, size, inptr) < size) {
|
||||
printf("Error reading file: %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(inptr);
|
||||
|
||||
unsigned char outbuf[size * 2];
|
||||
unsigned char m0data[MAXLENGTH];
|
||||
|
||||
int oloc = 0;
|
||||
struct section m0;
|
||||
m0.mode = 0;
|
||||
m0.length = 0;
|
||||
int i;
|
||||
|
||||
off_t loc = 0;
|
||||
while (loc < size) {
|
||||
struct section section;
|
||||
if (!get_section(loc, size, inbuf, §ion)) {
|
||||
if (m0.length > 0) {
|
||||
m0.datalength = m0.length;
|
||||
oloc = write_section(m0, m0data, outbuf, oloc);
|
||||
m0.length = 0;
|
||||
}
|
||||
oloc = write_section(section, section.data, outbuf, oloc);
|
||||
loc += section.length;
|
||||
} else {
|
||||
if (m0.length == MAXLENGTH) {
|
||||
m0.datalength = m0.length;
|
||||
oloc = write_section(m0, m0data, outbuf, oloc);
|
||||
m0.length = 0;
|
||||
}
|
||||
m0data[m0.length++] = inbuf[loc];
|
||||
loc += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (m0.length > 0) {
|
||||
m0.datalength = m0.length;
|
||||
oloc = write_section(m0, m0data, outbuf, oloc);
|
||||
m0.length = 0;
|
||||
}
|
||||
|
||||
outbuf[oloc++] = 0xFF;
|
||||
|
||||
FILE *outptr;
|
||||
if ((outptr = fopen(argv[2], "wb")) == NULL) {
|
||||
printf("Error opening file: %s\n", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fwrite(outbuf, 1, oloc, outptr) < oloc) {
|
||||
printf("Error writing to file: %s\n", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(outptr);
|
||||
printf("Input file: %lX bytes. Compressed: %X bytes.\n", size, oloc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
155
bin/src/decompress.c
Normal file
155
bin/src/decompress.c
Normal file
@@ -0,0 +1,155 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
struct section {
|
||||
int mode;
|
||||
int length;
|
||||
unsigned char data[2];
|
||||
int datalength;
|
||||
};
|
||||
|
||||
int read_section(unsigned char buf[], int loc, struct section *out) {
|
||||
int nloc = loc;
|
||||
unsigned char header = buf[nloc++];
|
||||
|
||||
if (header == 0xFF) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct section result;
|
||||
result.data[0] = buf[loc];
|
||||
result.datalength = 1;
|
||||
|
||||
if ((header & 0xE0) == 0xE0) {
|
||||
result.mode = (header & 0x1C) >> 2;
|
||||
result.length = (((header & 0x03) << 8) | buf[nloc++]) + 1;
|
||||
} else {
|
||||
result.mode = (header & 0xE0) >> 5;
|
||||
result.length = (header & 0x1F) + 1;
|
||||
}
|
||||
|
||||
switch (result.mode) {
|
||||
case 0:
|
||||
result.datalength = 0;
|
||||
break;
|
||||
case 1:
|
||||
result.datalength = 1;
|
||||
break;
|
||||
case 2:
|
||||
result.datalength = 2;
|
||||
break;
|
||||
case 3:
|
||||
result.datalength = 1;
|
||||
break;
|
||||
case 4:
|
||||
result.datalength = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < result.datalength; i++) {
|
||||
result.data[i] = buf[nloc++];
|
||||
}
|
||||
|
||||
*out = result;
|
||||
return nloc;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 3) {
|
||||
printf("Usage: %s infile outfile [start [length]]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
off_t seek = 0;
|
||||
if (argc > 3) {
|
||||
seek = strtol(argv[3], NULL, 0);
|
||||
}
|
||||
|
||||
FILE *inptr;
|
||||
if ((inptr = fopen(argv[1], "rb")) == NULL) {
|
||||
printf("%s does not exist.\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int fd = fileno(inptr);
|
||||
if (fd < 0) {
|
||||
printf("Error stating file: %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct stat buf;
|
||||
if (fstat(fd, &buf) != 0) {
|
||||
printf("Error stating file: %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
off_t size = buf.st_size - seek;
|
||||
|
||||
if (argc > 4) {
|
||||
size = strtol(argv[4], NULL, 0);
|
||||
}
|
||||
|
||||
fseek(inptr, seek, SEEK_SET);
|
||||
unsigned char inbuf[size];
|
||||
|
||||
if (fread(inbuf, 1, size, inptr) < size) {
|
||||
printf("Error reading file: %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(inptr);
|
||||
|
||||
unsigned char outbuf[size * 256];
|
||||
|
||||
int oloc = 0;
|
||||
struct section section;
|
||||
int i;
|
||||
|
||||
off_t loc = 0;
|
||||
|
||||
while ((loc = read_section(inbuf, loc, §ion)) >= 0) {
|
||||
if (section.mode == 0) {
|
||||
for (i = 0; i < section.length; i++) {
|
||||
outbuf[oloc++] = inbuf[loc++];
|
||||
}
|
||||
} else if (section.mode == 1) {
|
||||
for (i = 0; i < section.length; i++) {
|
||||
outbuf[oloc++] = section.data[0];
|
||||
}
|
||||
} else if (section.mode == 2) {
|
||||
for (i = 0; i < section.length; i++) {
|
||||
outbuf[oloc++] = section.data[0];
|
||||
if (++i < section.length) {
|
||||
outbuf[oloc++] = section.data[1];
|
||||
}
|
||||
}
|
||||
} else if (section.mode == 3) {
|
||||
for (i = 0; i < section.length; i++) {
|
||||
outbuf[oloc++] = (section.data[0] + i) & 0xff;
|
||||
}
|
||||
} else if (section.mode == 4) {
|
||||
int offset = section.data[0] | (section.data[1] << 8);
|
||||
for (i = 0; i < section.length; i++) {
|
||||
outbuf[oloc++] = outbuf[offset + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FILE *outptr;
|
||||
if ((outptr = fopen(argv[2], "wb")) == NULL) {
|
||||
printf("Error opening file: %s\n", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fwrite(outbuf, 1, oloc, outptr) < oloc) {
|
||||
printf("Error writing to file: %s\n", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(outptr);
|
||||
printf("Input file: %lX bytes. Decompressed: %X bytes.\n", size, oloc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
bin/windows/compress.exe
Normal file
BIN
bin/windows/compress.exe
Normal file
Binary file not shown.
BIN
bin/windows/decompress.exe
Normal file
BIN
bin/windows/decompress.exe
Normal file
Binary file not shown.
@@ -20,7 +20,12 @@ DoDungeonMapBossIcon:
|
||||
; get sprite pointer for room
|
||||
LDA.l UWSpritesPointers,X
|
||||
STA.b Scrap00 ; pointer in $00
|
||||
LDA.w #$0028 : STA.b Scrap02 ; set the bank to 28 for now
|
||||
if !FEATURE_FIX_BASEROM
|
||||
LDA.w #$0089
|
||||
else
|
||||
LDA.w #$0028 ; set the bank to 28 for now
|
||||
endif
|
||||
STA.b Scrap02
|
||||
LDY.w #$0001 ; to skip the "sort"
|
||||
|
||||
; get first byte to make sure it isn't an empty room
|
||||
|
||||
@@ -11,14 +11,16 @@ Sprite_ResetAll: ; Bank09.asm(1344)
|
||||
;================================================================================
|
||||
; On Room Transition -> Move Sprite depending on the room loaded
|
||||
;--------------------------------------------------------------------------------
|
||||
org $828979 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
|
||||
JSL boss_move
|
||||
org $828C16 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
|
||||
JSL boss_move
|
||||
org $829338 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
|
||||
JSL boss_move
|
||||
org $828256 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
|
||||
JSL boss_move
|
||||
if not(!FEATURE_FIX_BASEROM)
|
||||
org $828979 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
|
||||
JSL boss_move
|
||||
org $828C16 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
|
||||
JSL boss_move
|
||||
org $829338 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
|
||||
JSL boss_move
|
||||
org $828256 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
|
||||
JSL boss_move
|
||||
endif
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
@@ -248,7 +248,7 @@ DrawPlayerFileShared:
|
||||
|
||||
; Flute
|
||||
LDA.l InventoryTrackingSRAM : AND.w #$0003 : BEQ +
|
||||
LDA.l $7003C2 : AND.w #$00FF : CMP.w #$00FF : BNE .pseudo
|
||||
LDA.l $7003C2 : AND.w #$00FF : BNE .pseudo
|
||||
%fs_drawItem(7,16,FileSelectItems_flute)
|
||||
BRA ++
|
||||
.pseudo
|
||||
|
||||
@@ -115,7 +115,7 @@ InitInventoryTracking: skip 2 ; PC 0x18338C \ Need to set bits here fo
|
||||
InitBowTracking: skip 2 ; PC 0x18338E / boomerangs, powder/mushroom, etc
|
||||
InitItemLimitCounts: skip 16 ; PC 0x183390
|
||||
skip 34 ;
|
||||
InitFluteBitfield: db $FF ;
|
||||
InitFluteBitfield: db $00 ;
|
||||
InitSpecialWeaponLevel: db $00 ;
|
||||
InitItemOnB: db $00 ;
|
||||
InitProgressIndicator: db $02 ; PC 0x1833C5 - Set to $80 for instant post-aga with standard
|
||||
|
||||
@@ -34,16 +34,20 @@ RTL
|
||||
; Output: 0 locked, 1 open
|
||||
;--------------------------------------------------------------------------------
|
||||
CheckForZelda:
|
||||
LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling
|
||||
LDA.b #$01 ; pretend we have zelda anyway
|
||||
RTL
|
||||
+
|
||||
LDA.l FollowerIndicator
|
||||
LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling
|
||||
LDA.b #$01 ; pretend we have zelda anyway
|
||||
RTL
|
||||
+
|
||||
LDA.l FollowerIndicator
|
||||
RTL
|
||||
;================================================================================
|
||||
SetOverlayIfLamp:
|
||||
JSL LampCheck
|
||||
STA.b SUBDESQ ; write it directly to the overlay, this isn't a terrible idea at all
|
||||
JSL LampCheck
|
||||
CMP.b #$00
|
||||
BEQ +
|
||||
LDA.b #$01
|
||||
+
|
||||
STA.b SUBDESQ ; write it directly to the overlay, this isn't a terrible idea at all
|
||||
RTL
|
||||
;================================================================================
|
||||
; Mantle Object Changes
|
||||
|
||||
BIN
menu/drsheetdc.2bpp
Normal file
BIN
menu/drsheetdc.2bpp
Normal file
Binary file not shown.
@@ -188,12 +188,12 @@ ItemBehavior:
|
||||
BRA .store_inventory_tracking
|
||||
|
||||
.flute_inactive
|
||||
LDA.b #$FF : STA.l FluteBitfield
|
||||
LDA.b #$00 : STA.l FluteBitfield
|
||||
LDA.l InventoryTracking : ORA.b #$02
|
||||
BRA .store_inventory_tracking
|
||||
|
||||
.flute_active
|
||||
LDA.b #$FF : STA.l FluteBitfield
|
||||
LDA.b #$00 : STA.l FluteBitfield
|
||||
LDA.l InventoryTracking : ORA.b #$01
|
||||
BRA .store_inventory_tracking
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ OWLightWorldOrCrossed:
|
||||
|
||||
OWFluteCancel:
|
||||
{
|
||||
lda.l FluteBitfield : beq +
|
||||
lda.l FluteBitfield : cmp.b #$FF : beq +
|
||||
lda.l OWFlags+1 : and.b #$01 : bne +
|
||||
jsl FluteMenu_LoadTransport : rtl
|
||||
+ lda.w RandoOverworldTargetEdge : bne +
|
||||
@@ -332,7 +332,7 @@ OWFluteCancel2:
|
||||
lda.b Joy1B_All : ora.b Joy1A_All : and.b #$c0 : bne +
|
||||
jml FluteMenu_HandleSelection_NoSelection
|
||||
+ inc.w SubModuleInterface
|
||||
lda.l FluteBitfield : beq .cancel
|
||||
lda.l FluteBitfield : cmp.b #$FF : beq .cancel
|
||||
lda.l OWFlags+1 : and.b #$01 : beq +
|
||||
lda.b Joy1B_All : cmp.b #$40 : bne +
|
||||
.cancel
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
SelectFirstFluteSpot:
|
||||
LDA.l FluteBitfield
|
||||
CMP.b #$FF
|
||||
BNE +
|
||||
RTL
|
||||
+ LDA.b #$07
|
||||
STA.w $1AF0
|
||||
STA.w FluteSelection
|
||||
.try_next
|
||||
LDA.w $1AF0
|
||||
LDA.w FluteSelection
|
||||
INC A
|
||||
AND.b #$07
|
||||
STA.w $1AF0
|
||||
STA.w FluteSelection
|
||||
TAX
|
||||
|
||||
LDA.l FluteBitfield
|
||||
AND.l $8AB7A3, X
|
||||
BEQ .try_next
|
||||
AND.l FluteMenuNumbers_bits, X
|
||||
BNE .try_next
|
||||
RTL
|
||||
|
||||
SelectFluteNext:
|
||||
LDA.l FluteBitfield
|
||||
CMP.b #$FF
|
||||
BEQ InvalidBeep
|
||||
|
||||
.try_next
|
||||
LDA.w $1AF0
|
||||
LDA.w FluteSelection
|
||||
INC A
|
||||
AND.b #$07
|
||||
STA.w $1AF0
|
||||
STA.w FluteSelection
|
||||
TAX
|
||||
|
||||
LDA.l FluteBitfield
|
||||
AND.l $8AB7A3, X
|
||||
BEQ .try_next
|
||||
AND.l FluteMenuNumbers_bits, X
|
||||
BNE .try_next
|
||||
|
||||
LDA.b #$20
|
||||
STA.w $012F
|
||||
@@ -37,18 +39,19 @@ RTL
|
||||
|
||||
SelectFlutePrev:
|
||||
LDA.l FluteBitfield
|
||||
CMP.b #$FF
|
||||
BEQ InvalidBeep
|
||||
|
||||
.try_next
|
||||
LDA.w $1AF0
|
||||
LDA.w FluteSelection
|
||||
DEC A
|
||||
AND.b #$07
|
||||
STA.w $1AF0
|
||||
STA.w FluteSelection
|
||||
TAX
|
||||
|
||||
LDA.l FluteBitfield
|
||||
AND.l $8AB7A3, X
|
||||
BEQ .try_next
|
||||
AND.l FluteMenuNumbers_bits, X
|
||||
BNE .try_next
|
||||
|
||||
LDA.b #$20
|
||||
STA.w $012F
|
||||
@@ -62,8 +65,8 @@ RTL
|
||||
SetFluteSpotPalette:
|
||||
XBA
|
||||
LDA.l FluteBitfield
|
||||
AND.l $8AB7A3, X
|
||||
BEQ .disabled
|
||||
AND.l FluteMenuNumbers_bits, X
|
||||
BNE .disabled
|
||||
.enabled
|
||||
XBA
|
||||
STA.b $0C
|
||||
@@ -93,8 +96,9 @@ MaybeMarkFluteSpotVisited:
|
||||
TXA
|
||||
LSR A
|
||||
TAX
|
||||
LDA.l FluteBitfield
|
||||
ORA.l $8AB7A3, X
|
||||
LDA.l FluteMenuNumbers_bits, X
|
||||
EOR.b #$FF
|
||||
AND.l FluteBitfield
|
||||
STA.l FluteBitfield
|
||||
|
||||
.done
|
||||
@@ -113,33 +117,9 @@ CheckTransitionOverworld:
|
||||
STA.w $040A ; what we wrote over
|
||||
JML MaybeMarkFluteSpotVisited
|
||||
|
||||
DrawFluteIcon:
|
||||
AND.w #$00FF
|
||||
CMP.w #$0002
|
||||
BCC .write
|
||||
CheckFlute:
|
||||
LDA.l FluteBitfield
|
||||
AND.w #$00FF
|
||||
CMP.w #$00FF
|
||||
BNE .pseudo
|
||||
.real
|
||||
LDA.w #$0003
|
||||
BRA .write
|
||||
.pseudo
|
||||
LDA.w #$0002
|
||||
.write
|
||||
STA.b $02
|
||||
RTL
|
||||
|
||||
CheckFluteInHUD:
|
||||
LDA.l $7EF33F, X
|
||||
AND.w #$00FF ; what we wrote over
|
||||
CPX.w #$000D
|
||||
BNE .done
|
||||
CMP.w #$0002
|
||||
BCC .done
|
||||
LDA.l FluteBitfield
|
||||
AND.w #$00FF
|
||||
CMP.w #$00FF
|
||||
BNE .pseudo
|
||||
.real
|
||||
LDA.w #$0003
|
||||
@@ -147,4 +127,24 @@ CheckFluteInHUD:
|
||||
.pseudo
|
||||
LDA.w #$0002
|
||||
.done
|
||||
RTS
|
||||
|
||||
DrawFluteIcon:
|
||||
AND.w #$00FF
|
||||
CMP.w #$0002
|
||||
BCC +
|
||||
JSR CheckFlute
|
||||
+
|
||||
STA.b $02
|
||||
RTL
|
||||
|
||||
CheckFluteInHUD:
|
||||
LDA.l EquipmentWRAM-1, X
|
||||
AND.w #$00FF ; what we wrote over
|
||||
CPX.w #$000D
|
||||
BNE +
|
||||
CMP.w #$0002
|
||||
BCC +
|
||||
JSR CheckFlute
|
||||
+
|
||||
RTL
|
||||
|
||||
2
ram.asm
2
ram.asm
@@ -468,6 +468,8 @@ RoomStripes = $7E1100 ; Used for room drawing.
|
||||
;
|
||||
MirrorPortalPosXH = $7E1ACF ; Mirror portal position. (High byte of X coordinate)
|
||||
;
|
||||
FluteSelection = $7E1AF0 ; Currently selected flute spot (zero-indexed)
|
||||
;
|
||||
IrisPtr = $7E1B00 ; Spotlight pointers for HDMA. $1C0 bytes (?).
|
||||
;
|
||||
MessageSubModule = $7E1CD8 ;
|
||||
|
||||
@@ -790,7 +790,7 @@ HeartContainer_Vitreous:
|
||||
HeartContainer_Trinexx:
|
||||
db $3E
|
||||
;--------------------------------------------------------------------------------
|
||||
; 0x180159 - 0x18015F (unused) [encrypted]
|
||||
; 0x18015A - 0x18015F (unused) [encrypted]
|
||||
;================================================================================
|
||||
org $B08160 ; PC 0x180160 - 0x180162
|
||||
BonkKey_Desert:
|
||||
|
||||
32
timer.asm
32
timer.asm
@@ -7,25 +7,25 @@
|
||||
!FRAMES_PER_HOUR = 60*60*60
|
||||
;--------------------------------------------------------------------------------
|
||||
macro DecIncr(value)
|
||||
LDA.w <value> : INC
|
||||
LDA.l <value> : INC
|
||||
CMP.w #$000A : !BLT ?noIncr
|
||||
LDA.w <value>+2 : INC : STA.w <value>+2
|
||||
LDA.l <value>+2 : INC : STA.l <value>+2
|
||||
LDA.w #$0000
|
||||
?noIncr:
|
||||
STA.w <value>
|
||||
STA.l <value>
|
||||
endmacro
|
||||
;--------------------------------------------------------------------------------
|
||||
macro Sub32(minuend,subtrahend,result)
|
||||
LDA.l <minuend>
|
||||
!SUB.l <subtrahend> ; perform subtraction on the LSBs
|
||||
STA.w <result>
|
||||
STA.l <result>
|
||||
LDA.l <minuend>+2 ; do the same for the MSBs, with carry
|
||||
SBC.l <subtrahend>+2 ; set according to the previous result
|
||||
STA.w <result>+2
|
||||
STA.l <result>+2
|
||||
endmacro
|
||||
;--------------------------------------------------------------------------------
|
||||
macro Blt32(value1,value2)
|
||||
LDA.w <value1>+2
|
||||
LDA.l <value1>+2
|
||||
CMP.l <value2>+2
|
||||
!BLT ?done
|
||||
BNE ?done
|
||||
@@ -50,7 +50,7 @@ CalculateTimer:
|
||||
%Sub32(ChallengeTimer,NMIFrames,ClockBuffer)
|
||||
++
|
||||
|
||||
%Blt32(ClockBuffer,.halfCycle) : !BLT +
|
||||
%Blt32(ClockBuffer,.halfCycle) : !BGE +++ : JMP + : +++
|
||||
LDA.l TimeoutBehavior : AND.w #$00FF : BNE ++ ; DNF
|
||||
LDA.w #$0002 : STA.l ClockStatus ; Set DNF Mode
|
||||
LDA.l NMIFrames : STA.l ChallengeTimer
|
||||
@@ -66,6 +66,17 @@ CalculateTimer:
|
||||
LDA.l NMIFrames : STA.l ChallengeTimer
|
||||
LDA.l NMIFrames+2 : STA.l ChallengeTimer+2
|
||||
RTS
|
||||
++ CMP.w #$0004 : BNE ++ ; Drop Into Ganon
|
||||
LDA.w $048E
|
||||
BEQ .already_ganon
|
||||
LDA.w #$0002 : STA.l ClockStatus ; Set DNF Mode
|
||||
LDA.w #$0011 : STA.b GameMode
|
||||
SEP #$20
|
||||
LDA.b #$7B
|
||||
STA.w $010E
|
||||
REP #$20
|
||||
.already_ganon
|
||||
RTS
|
||||
++ ; End Game
|
||||
SEP #$30
|
||||
JSL ActivateGoal
|
||||
@@ -133,6 +144,13 @@ DrawChallengeTimer:
|
||||
LDA.w #$247F : STA.l HUDTileMapBuffer+$98
|
||||
STA.l HUDTileMapBuffer+$9A
|
||||
BRA +++
|
||||
++ CMP.w #$0004 : BNE ++ ; Ganon
|
||||
LDA.w #$247F : STA.l HUDTileMapBuffer+$92
|
||||
STA.l HUDTileMapBuffer+$94
|
||||
STA.l HUDTileMapBuffer+$96
|
||||
STA.l HUDTileMapBuffer+$98
|
||||
STA.l HUDTileMapBuffer+$9A
|
||||
BRA +++
|
||||
++ ; OHKO
|
||||
LDA.w #$280A : STA.l HUDTileMapBuffer+$94
|
||||
LDA.w #$280B : STA.l HUDTileMapBuffer+$96
|
||||
|
||||
@@ -283,6 +283,7 @@ EntranceData_song = $82D592
|
||||
SpawnPointData_room_id = $82D8D2
|
||||
Overworld_CheckForSpecialOverworldTrigger_Direction = $84E879
|
||||
Sprite_ShowSolicitedMessage_Direction = $85E1A3
|
||||
FluteMenuNumbers_bits = $8AB7A3
|
||||
WorldMap_RedXChars = $8ABF70
|
||||
WorldMap_CalculateOAMCoordinates = $8AC3B1
|
||||
WorldMap_HandleSpriteBlink = $8AC52E
|
||||
|
||||
Reference in New Issue
Block a user