Overworld lost woods

Go down

20131011

Post 

Overworld lost woods Empty 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.



Code:
.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


Edit by Conn:
This code should be easier to use and implement:

Code:


;Lost Woods ASM, adapted from Euclid

;$1CF4 counter
; This example is for screen #$3f with exit screen left
; Correct Combo up, down, right, up

lorom


;----------------EDIT YOUR AREA
!area = #$3F              ;change this to your area
;----------------------------------

!left = !area-#$01;
!right = !area+#$01;
!up = !area-#$08;
!down = !area+#$08;

;----------------EDIT YOUR EXIT SCREEN and number of correct screens in your combination to pass
!leave = !left            ;exit screen
!screens = #$06 ; amount of combinations,
 ;eg.: !up,!down,!right,!up=04
 ;eg.: !up,!down,!right,!up,!right,!up=06
;-------------------------------------

org $82AA7D; hook to asm
JSL LWcode

org $A48000; some free space

;-------------EDIT YOUR COMBINATION
db !up,!down,!right,!up,!right,!up          ;your combination here
;----------------------------------


LWcode:
CMP.b !area ;check area
BEQ lostWoods
end:
LDA $82A5EC,x ; not right area so return.
STZ $1CF4
RTL

lostWoods:
CPX.b !leave ; want to leave by going left?
BEQ end
TXA
LDX $1CF4
CMP $A48000,x
BNE $06
INX
STX $1CF4
BRA $03
STZ $1CF4
CPX.b !screens ; number of correct screens to pass
BNE $03
JMP success
cmp.b !left ; left correct (area-1)
BNE $03
JMP left
cmp.b !right ; right correct (area+1)
BNE $03
JMP right
cmp.b !down ; down correct (area+8)
BNE $03
JMP down
cmp.b !up ; up correct (area-8)
BNE $03
JMP up
BRA end ;security

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
jmp all

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
jmp all

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
jmp all

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

all:
LDX #$3F
LDA $82A5EC,x
RTL

success:
LDA #$1B
STA $012f ;success SFX
LDX #$37
LDA $82A5EC,x
RTL






Euclid
Euclid

Overworld lost woods Image212

Since : 2012-06-21

Back to top Go down

Share this post on: reddit

Overworld lost woods :: Comments

avatar

Post Fri 11 Oct 2013 - 18:58 by Founder

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 Mon 21 Oct 2013 - 22:04 by Founder

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

Back to top Go down

Euclid

Post 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

Conn

Post Tue 15 Dec 2020 - 15:31 by Conn

Here's Euclid code adjusted for Lyra Island. I post it in addition to Euclid's initial asm, maybe it is for some people easier to adjust for use in their hacks

Code:


;Lost Woods ASM, adapted from Euclid

;$1CF4 counter
; This example is for screen #$3f with exit screen left
; Correct Combo up, down, right, up

lorom


;----------------EDIT YOUR AREA
!area = #$3F              ;change this to your area
;----------------------------------

!left = !area-#$01;
!right = !area+#$01;
!up = !area-#$08;
!down = !area+#$08;

;----------------EDIT YOUR EXIT SCREEN and number of correct screens in your combination to pass
!leave = !left            ;exit screen
!screens = #$06                  ; amount of combinations,
                                       ;eg.: !up,!down,!right,!up=04
                                       ;eg.: !up,!down,!right,!up,!right,!up=06
;-------------------------------------

org $82AA7D; hook to asm
JSL LWcode

org $A48000; some free space

;-------------EDIT YOUR COMBINATION
db !up,!down,!right,!up,!right,!up          ;your combination here
;----------------------------------


LWcode:
CMP.b !area ;check area
BEQ lostWoods
end:
LDA $82A5EC,x ; not right area so return.
STZ $1CF4
RTL

lostWoods:
CPX.b !leave ; want to leave by going left?
BEQ end
TXA
LDX $1CF4
CMP $A48000,x
BNE $06
INX
STX $1CF4
BRA $03
STZ $1CF4
CPX.b !screens ; number of correct screens to pass
BNE $03
JMP success
cmp.b !left ; left correct (area-1)
BNE $03
JMP left
cmp.b !right ; right correct (area+1)
BNE $03
JMP right
cmp.b !down ; down correct (area+8)
BNE $03
JMP down
cmp.b !up ; up correct (area-8)
BNE $03
JMP up
BRA end ;security

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
jmp all

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
jmp all

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
jmp all

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

all:
LDX #$3F
LDA $82A5EC,x
RTL

success:
LDA #$1B
STA $012f ;success SFX
LDX #$37
LDA $82A5EC,x
RTL






Back to top Go down

Back to top

- Similar topics

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