Automap Without The Map

I’ve been asked if there was a version of the Automap Plus patch without the automap. In other words, just the partial heart pieces in the HUD and faster life refilling with potions and fairies. Easy enough: just chop all of the map-related stuffs from the code, and voila.

Download the IPS patch with source included (Automap NoMap.zip), or, for your convenience, the code is available below.

; Zelda auto-map Patch 
; 0.2
; NO MAP EDITION
;
; By snarfblam
; ----------------------------
; Includes:
;   -1/8 heart increments
;   -Faster potion/fairy refill
;   -Changed magic key count from "A" to "infinity" symbol

; Note that most of these are unused in the no-map version
;========================================================
; Variable declarations
;========================================================

; Game variables
; --------------
LevelNumber         := $10
SaveSlot            := $16
PendingPpuMacro     := $14
CurrentMapLocation  := $EB
NewMapLocation      := $EC
OAM_MapBlipY        := $0254

; Game routines
; -------------
BankSwap        := $FFAC
SendPpuMacro    := $A0F6

; Our addresses
;----------------------
MapTiles    = $AD00 ; 06:AD00
VRAM_MapTiles = $1300

; Our variables
; -----------------
.enum $6C00
    tileFlag:   .dsb 1  ; Used to indicate that there is a pending PPU macro for the map
    mapVar:     .dsb 1  ; Temporary storage variable
    mapVar_X:   .dsb 1  
    mapVar_Y:   .dsb 1
    mapLoop_X:  .dsb 1
    mapLoop_Y:  .dsb 1
.endenum
.enum $7F10
    SecondPpuStringIndex: .DSB 1    ;

    MapBits_Left:   .DSB 1      ; Stores flags for whether the two screens in the left/right side
    MapBits_Right:  .DSB 1      ; of the current map tile have been visited, in lower 2 bits

    MapFilter_Top:    .DSB 1    ; Stores a value to be ANDed with the bytes of a map tile to black out unvisited screens
    MapFilter_Bottom: .DSB 1

    MapTileMacro:   .DSB $14    ; 10 bytes of tile data, 2 byte pointer, 1 byte len specifier, 1 byte FF terminator

;    TempAddress:    .DW 1

    MapBlipY:       .DSB $1     ; Stores the y-coordinate of the map blip
.ende
.enum $7F50
    MapRam:     .DSB $10
    MapSaveRam: .DSB $30
.ende

; Registers
; ---------
PpuControl1     := $2000
PpuControl2     := $2001
PpuStatus       := $2002
OamAddress      := $2003
OamData         := $2004
PpuScroll       := $2005
PpuAddress      := $2006
PpuData         := $2007

; ===========================================================
;  "AUTOMAP BY SNARF"
; ===========================================================
; Adds by-line to title screen

.PATCH $1A8C5
.db $24, $24, $17, $18, $16, $0A, $19, $24, $00, $2C, $02, $24, $0B, $22, $24, $1C, $17, $0A, $1B, $0F
;              N    O    M    A    P         0    .    1         B    Y         S    N    A    R    F 

; ===========================================================
;  New heart data
; ===========================================================

; New heart PPU macros
; --------------------
; The PPU addresses of these macros have been swapped so that the hearts fill the top row before the bottom row.

.PATCH $6517
; First row of hearts
.db $20, $D6
.db $08
.db $24, $24, $24, $24, $24, $24, $24, $24

; Second row of hearts
.db $20, $B6
.db $08
.db $24, $24, $24, $24, $24, $24, $24, $24

; "-LIFE-" (unchanged)
.PATCH $1bF1E
.db $62, $15, $12, $0F, $0E, $62

; New heart tiles
; ---------------
.PATCH $8C8F
.HEX 6c ee ee ee fe 7c 38 10 6c 9e de fe fe 7c 38 10 ; Partial hearts
.HEX 6c ee ee ee fe 7c 38 10 6c 9e 9e 9e fe 7c 38 10 
.HEX 6c ee ee ee ee 5c 38 10 6c 9e 9e 9e 9e 7c 38 10 
.HEX 6c ee ee ee ee 6c 38 10 6c 9e 9e 9e 9e 5c 28 10 
.HEX 6c fe ee ee f6 7c 38 10 6c 9e 9e 9e 8e 44 28 10 
.HEX 6c fe ee fe fe 7c 38 10 6c 9e 9e 82 82 44 28 10 
.HEX 6c fa e6 fe fe 7c 38 10 6c 9e 9a 82 82 44 28 10 
.HEX 6c fa e6 fe fe 7c 38 10 6c 9e 9a 82 82 44 28 10 
.HEX 6c 9e 9a b2 f2 6c 00 00 00 00 00 00 00 00 00 00 

.PATCH $8E8F
.HEX 6c fe fe fe fe 7c 38 10 6c 92 82 82 82 44 28 10 ; Whole heart

; Magic key tile index
; --------------------
; This byte specifies the tile index to use for the key count when player has the magic key
.PATCH $65b2
.db $58

; ===========================================================
;  Partial heart routine
; ===========================================================  

; Partial heart routine
; ---------------------
.PATCH 05:BC30

PartialHeartRoutine:
;   Returns appropriate tile index in A

    LDA $0F     ; Load partial-heart value
    LSR         ; Divide by $20 (into a range of 0-7)
    LSR
    LSR
    LSR
    LSR

    CLC
    ADC #$50    ; Partial-heart tiles are # 50-57

    JMP $6ED7   ; Return from hijack

; Hijack
; ------

; Original code
; (1):6EC8:C9 80     CMP #$80          ; If partial-heart-value >= #$80, load full-heart-tile
;    :6ECA:B0 F4     BCS $6EC0         
;    :6ECC:A9 00     LDA #$00          ; ??????????????
;    :6ECE:8D 29 05  STA $0529    
; (2):6ED1:A9 65     LDA #$65          ; Load half-full heart tile
;    :6ED3:D0 02     BNE $6ED7         ; Branch always   
;
; (1) - Update value of CMP #$80 to run our partial heart routine for smaller increments
; (2) - Hijack goes here

.PATCH $6748
.BASE  $6EC8    ; This code is run from RAM

    CMP #$E0
    BCS $6EC0

*   LDA #$00
    STA $0529

    JMP PartialHeartRoutine

; ===========================================================
;  Fast life fill
; ===========================================================
; Causes life to fill faster with potion/fairy

; ORIGINAL CODE
;   05:B1EF   LDA $0670             ; If current heart > #$F8 (out of #$100):
;   05:B1F2   CMP #$F8              ; 
;   05:B1F4   BCS $B1FD             ;   Jump to routine to set current heart to 0 and increment full-heart count
;
;   05:B1F6   CLC                   ; Add #$06 to current heart value (out of #$100), and return
;   05:B1F7   ADC #$06              ;
;   05:B1F9   STA $0670             ;
;   05:B1FC   RTS                   ;

;.ORG $B1EF
;.PATCH $171FF
.PATCH 05:B1EF
    LDA $0670
    CMP #$D7              ; 
    BCS $B1FD             ;   Jump to routine to set current heart to 0 and increment full-heart count

    CLC                   ; Add #$06 to current heart value (out of #$100), and return
    ADC #$18              ;
    STA $0670             ;
    RTS                   ;

Leave a Reply

Your email address will not be published. Required fields are marked *