Overworld lost woods

View previous topic View next topic Go down

20131011

Post 

Overworld lost woods




This assembly is a guide only - you need to cater it for your own hack in terms of the movement combinations/exit areas. The meat of the code is all the increment/decrement of ram addresses in the different cases where the same area needs to be loaded.

PW uses a similar but little bit more inefficient version of this - so don't be surprised if the code doesn't match PW exactly.



.zram counter ; stores the combination # the player is up to.
.equ/= areaup=area-7
.equ/= areadown=area+7
.equ/= arealeft=area-1
.equ/= arearight=area+1

.equ/= areaout=arealeft ; which area can you exit?

.code
begin:
; Note at this stage the accumulator contains junk, and X contains the area you're moving to.

AND #$3F      ; NOTE: comment this line out for specified area only
             ;       this will make it affect dark and light world.
CMP area ; are we in the right area?
BEQ begincode
normalfinish:

LDA $02A5EC,x ; not right area so return.
STZ counter
RTL

begincode:
CPX areaout
BEQ normalfinish

; from here onwards, use the ram address to determine which combo you're up to
; this code is pretty repeatable
LDA counter

CMP #00
BNE combo1
CPX areadown ; did you get it right?
BEQ case down correct
BRA case down incorrect

combo1:
CMP #01
BNE combo2
CPX areaup ; did you get it right?
BEQ case up correct
BRA case up incorrect

combo2:
CMP #02
BNE combo3
CPX arearight ; did you get it right?
BEQ case right correct
BRA case right incorrect

combo3:
CPX areadown; did you get it right?
BEQ normalfinish ; we want to load the down area, since we complete the combos
BRA case down incorrect

case right incorrect:
STZ counter
BRA case right
case right correct:
INC counter
case right:
DEC $23
DEC $23
DEC $E1
DEC $E1
DEC $E3
DEC $E3
DEC $615
DEC $615
DEC $617
DEC $617
DEC $700
DEC $700
BRA all

case down incorrect:
STZ counter
BRA case down
case down correct:
INC counter
case down:
DEC $21
DEC $21
DEC $E7
DEC $E7
DEC $E9
DEC $E9
DEC $611
DEC $611
DEC $613
DEC $613
LDA $700
SEC
SBC #$10
STA $700
BRA all

case up incorrect:
STZ counter
BRA case up
case up correct:
INC counter
case up:
INC $21
INC $21
INC $E7
INC $E7
INC $E9
INC $E9
INC $611
INC $611
INC $613
INC $613
LDA $700
CLC
ADC #$10
STA $700
BRA all

case left incorrect:
STZ counter
BRA case left
case left correct:
INC counter
case left:
INC $23
INC $23
INC $E1
INC $E1
INC $E3
INC $E3
INC $615
INC $615
INC $617
INC $617
INC $700
INC $700

all:
LDA area ; load the same area.
RTL

.end


.ORG $02AA7D
JSL.l begin
.end


avatar
Euclid



Since : 2012-06-21

Back to top Go down

Share this post on: diggdeliciousredditstumbleuponslashdotyahoogooglelive

Overworld lost woods :: Comments

avatar

Post on Fri 11 Oct 2013 - 18:58 by SePH

Looks more complicated then I thought, I wonder how a 100 digit combination would look in coding lol

I'll probably need to save my coordinates somewhere or you include them in your patch in a text file so I know where to go! Do you need my latest rom to work this out or you can make an ips patch for it?

Back to top Go down

avatar

Post on Mon 21 Oct 2013 - 22:04 by SePH

I have a question regarding the lost woods asm Euclid! Is it working on big areas also?

Back to top Go down

avatar

Post on Tue 22 Oct 2013 - 9:19 by Euclid

That code up there won't work for big areas, however it can be done since we can control the area via performing extra maths on the scrolling and position variables.

Those memory addresses, take the case right example:
DEC $23
DEC $23
DEC $E1
DEC $E1
DEC $E3
DEC $E3
DEC $615
DEC $615
DEC $617
DEC $617
DEC $700
DEC $700

What i'm doing there is moving link so the game thinks link's on the screen to the left of the current area, thus the next area to load is the same area (thus lost woods).

Reposition link using theses addresses
$20-$21 Link’s Y-Coordinate (mirrored at $0FC4)
$22-$23 Link’s X-Coordinate (mirrored at $0FC2)

Reposition screen scrolling (so the right area loads)
$E0-$E1 BG0 horizontal scroll register ($210F)
$E2-$E3 BG1 horizontal scroll register ($210D)
$E6-$E7 BG0 vertical scroll register ($2110)
$E8-$E9 BG1 vertical scroll register ($210E)
$615-617 - also have to do with scrolling
$700 - i think (this is from memory) last area link's in * 2

Back to top Go down

Post  by Sponsored content

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum