Need help learning ASM

View previous topic View next topic Go down

Need help learning ASM

Post by KevinLD19191 on Wed 28 Dec 2016 - 1:24

Good evening I would need a little help I am new here and is the programming of the ASM difficult to understand? And I would have liked it to teach rain in the forest of the second world and is the intervention of the ASM obligatory for this kind of technique ?

Thanks You !

KevinLD19191
Newcomer

Since : 2016-12-18

Back to top Go down

Re: Need help learning ASM

Post by Puzzledude on Wed 28 Dec 2016 - 9:53

Good evening I would need a little help I am new here and is the programming of the ASM difficult to understand?
Yes. You need to learn the Opcodes and have full understanding of the debugger and how to trace code. Then be able to come up with new instructions. This is specific and not the usual way of romhacking, since playing a game usually means finishing levels, such as dungeons and traveling the overworld. ASM falls under completely different category, which is direct programing, ie telling the game "new things", which the original game could not do.

And I would have liked it to teach rain in the forest of the second world and is the intervention of the ASM obligatory for this kind of technique?
Yes, although a hex edit would probably by suficient here, but again not without tracing.

I wish I could help you, but ASM is the only thing which I never mastered and relied on others, that I collaborated with when making projects.
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: Need help learning ASM

Post by KevinLD19191 on Wed 28 Dec 2016 - 14:05

Hello if I understand the ASM can ask for an enormous amount of time and to understand this type of language and programming as we would like to show the 7th level turtle rock by replacing the Skull Woods in the forest of the second world but Without boggling the current GFX graphics I imagine it is possible? With the ASM and you also first have to trace the erroneous codes that have boggled the graphics like Overworld, dungeons or other things for the unknown reason ...... if I understood this well ! And that I do not say idiots!

KevinLD19191
Newcomer

Since : 2016-12-18

Back to top Go down

Re: Need help learning ASM

Post by Conn on Wed 28 Dec 2016 - 14:21

Here are several poeple floating around who know asm, that would be Euclid, qwertymodo, superskuj, XaserLE and me (I hope I didn't forget anybody).

However, I am retired and also some projects have started and left unfinished. Most asm requests require some time, and people who may want to help need some security whether their effort isn't wasted at a point.

If you want to learn it yourself, I once made a tutorial - this may give you a short overview what may come up on you:
https://www.zeldix.net/t134-coding-for-absolute-beginners
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Need help learning ASM

Post by KevinLD19191 on Wed 28 Dec 2016 - 14:49

Many thanks I know it will not be an easy thing to do but I would do my best to understand the Basic language and see may be towards a little later so more complex!

KevinLD19191
Newcomer

Since : 2016-12-18

Back to top Go down

Re: Need help learning ASM

Post by qwertymodo on Wed 28 Dec 2016 - 15:58

The most difficult part of asm is perspective or "big picture" thinking. Writing your own is quite simple, once you learn how to take the big picture ideas that you have and break them down into their absolute simplest steps. Things that might be 1 line of C code might take a dozen assembly instructions. That takes awhile to wrap your head around.

The much more difficult part is READING someone else's asm, especially without documentation or context. Going back to the big picture concept, it's difficult to make sense of why value A is being compared to value B is you don't know what either of those values are. Why are we adding to that value? Why are we reading that one? It's hard to say when you're looking at the microscope view of individual instructions.

It's kind of like a game of GeoGuesser, where they drop you into a random location on Earth in Google street view and you try to guess where you are. You need landmarks. Cheat codes can be a good place to start, as they often deal with relevant memory values like your health or items. Watching those memory values, or using breakpoints to see when the game accesses them, lets you see code that is related to those items. Then you can see how those items affect other memory locations like temporary location or speed values, or invincibility frames, and then you can watch those memory locations as well. You build out from your "landmarks" to try and get a bigger picture of your surroundings. If you need to find something new, start with what you know and branch out from there.

It takes time, but if you're willing to learn, it does get easier.
avatar
qwertymodo



Since : 2014-10-21

Back to top Go down

Re: Need help learning ASM

Post by XaserLE on Thu 26 Jan 2017 - 6:45

On this rainy thing: There is already an overlay patch to get rain on every area you want. Only needs to be modified a little bit. If you tell me exactly which areas should have rain, i can make this for you.

Code:

;this is for getting the overlays work in certain areas, i use bank 0x3C for the whole code
;WRITTEN:    by XaserLE
;THANKS TO: -MathOnNapkins
;         -wiiqwertyuiop for his Zelda Disassembly
;         -an unknown author of a rain activation code that helped a little
;TODO:
;         -missing: silent rain sound in dungeons. for that we need to save a rain indicator in free ram and hook into the dungeon load routine
;         -rain doesn't work with overworld warping (teleporter/mirror)

;header
lorom

;THIS IS FOR KEEPING AN OVERLAY APPEARED WHEN GOING FROM ONE AREA TO ANOTHER WITHOUT THE BLANK OUT
ORG $02AC18      ; go to the code that makes sure the overlay keeps appeared in transition from overworld area to overworld area
BRA $00         ; overwrites an "BCS $03" that won't keep the overlay appeared if we are not in the beginning mode
            ; only at the beginning an overlay keeps appeared when going from on area to another without a blank out

;THIS IS THE OVERLAY-CODE
            ; IMPORTANT: If the overlay is drawn correctly depends on the GFX# in this area (look at hyrule magic).
            ;       Rain seems to work various GFX#'s, but clouds for example on 33, 47 and maybe more.

ORG $02AFA3      ; go to beginning of the overlay code (command 293F00)

JSL $3C9180      ; overwrite this with a long jump to expanded space
BRA $62         ; after long jump we return and branch after the piece of code that loads the rain overlay (command A29F00)

ORG $3C9180      ; go to expanded space

LDA $7EF3C5    ; load game state
AND #$00FF      ;
CMP #$0002      ; test for beginning
BCS $04          ; if not beginning, jump to next test
LDX #$009F      ;
RTL            ;

LDA $8A        ; load actual area

;light world forest in original game, so test for master-sword-pulled is needed
CMP #$0000      ;
BNE $11         ;
LDA $7EF280,x  ; test if mastersword already pulled
AND #$0040      ;
BEQ $04          ; if not pulled, don't load the master-sword-pulled-overlay
LDX #$009E      ;
RTL
LDX #$009D      ;
RTL            ;

LDA $8A        ; load actual area again

;for paste©
;CMP #$0003      ;
;BNE $04         ;
;LDX #$0095      ;
;RTL            ;

CMP #$0003      ;
BNE $04         ;
LDX #$0095      ;
RTL            ;

CMP #$0005      ;
BNE $04         ;
LDX #$0095      ;
RTL            ;

CMP #$0007      ;
BNE $04         ;
LDX #$0095      ;
RTL            ;

CMP #$0040      ;
BNE $04         ;
LDX #$009D      ;
RTL            ;

CMP #$0043      ;
BNE $04         ;
LDX #$009C      ;
RTL            ;

CMP #$0045      ;
BNE $04         ;
LDX #$009C      ;
RTL            ;

CMP #$0047      ;
BNE $04         ;
LDX #$009C      ;
RTL            ;

;dark world evil swamp, so test for evil-swamp-dungeon-is-opened is needed
CMP #$0070      ;
BNE $0D         ;
LDA $7EF2F0    ; test if evil swamp dungeon already opened
AND #$0020      ;
BNE $03           ; if yes, don't load the rain overlay
LDX #$009F      ;
RTL            ;

LDA $8A        ; load actual area again

CMP #$005B      ;
BNE $04         ;
LDX #$0096      ;
RTL            ;

;no match
RTL            ;

;Between the above and the next code there should be enough space to test every area or to test for self-defined events
;in some areas. If you still need more, you need to move it more forward.

;THIS IS THE BLANK-OUT-CODE

ORG $02AADB      ; go to beginning of the overlay code (command 293F)

JSL $3C9700      ; overwrite this with a long jump to expanded space
CMP #$01      ; in the new routine i will set the accumulator to 0x01 to indicate that we used the blank out, otherwise 0x00
BEQ $02         ; so if we want to use the blank out, branch to this routine in the original code
BRA $0F         ; we don't want to use the blank out, jump to the routine after the RTS in the original code

ORG $3C9700      ; go to expanded space
            ; IMPORTANT: accumulator holds the area that we come from, NOT the actual, the game did this
            ; if want a blank out in an area, you need this when going in AND out

;test where we COME FROM

;for paste©
;CMP #$40      ;
;BNE $03         ;
;LDA #$01      ;
;RTL

CMP #$00      ; test if we come from this area
BNE $03         ; if not, jump to next area
LDA #$01      ; set blank out indicator
RTL

CMP #$40      ;
BNE $03         ;
LDA #$01      ;
RTL

;test where we GO TO
LDA $8A        ; load ACTUAL area

;for paste©
;CMP #$40      ;
;BNE $03         ;
;LDA #$01      ;
;RTL

CMP #$00      ; test if we go in this area
BNE $03         ; if not, jump to next area
LDA #$01      ; set blank out indicator
RTL

CMP #$40      ;
BNE $03         ;
LDA #$01      ;
RTL

;no match
LDA #$00      ; unset blank out indicator
RTL

;Between the above and the next code there should be enough space to test every area or to test for self-defined events
;in some areas. If you still need more, you need to move it more forward.

;THIS IS THE RAIN-ANIMATION-CODE

;-----------------------------------------------------------------------------------------------------------
;first of all a little helper: if you don't want this flash lights during the rain, uncomment the next lines
;ORG $02A4E7
;BEQ $14
;ORG $02A4F7
;BEQ $04
;ORG $02A506
;BRA $02
;if want to set back to normal, here is the original code, uncomment it and out-comment the modified above
;ORG $02A4E7
;BEQ $1D
;ORG $02A4F7
;BEQ $0D
;ORG $02A506
;LDA #$32
;-----------------------------------------------------------------------------------------------------------

ORG $02A4CD      ; go to beginning of the rain animation code (command A58A)

JSL $3C9C00      ; overwrite this with a long jump to expanded space
CMP #$01      ; in the new routine i will set the accumulator to 0x01 to indicate that we used the rain animation, otherwise 0x00
BEQ $0E         ; so if we want to use the rain animation, branch to this routine in the original code
BRA $55         ; we don't want to use the rain animation, jump to the RTL in the original code

ORG $3C9C00      ; go to expanded space

LDA $7EF3C5    ; load game state
CMP #$02       ; test for beginning
BCS $03          ; if not beginning, jump to next test
LDA #$01      ; set rain animation indicator
RTL   

LDA $8A        ; load ACTUAL area

;for paste©
;CMP #$00      ; test if we are in this area
;BNE $03         ; if not, jump to next area
;LDA #$01      ; set rain animation indicator
;RTL

;dark world evil swamp, so test for evil-swamp-dungeon-is-opened is needed
CMP #$70       
BNE $0E
LDA $7EF2F0      ; test if evil swamp dungeon already opened
AND #$20        ; if yes, don't animate the rain
BNE $03
LDA #$01      ; set rain animation indicator
RTL
LDA #$00      ; unset rain animation indicator
RTL

LDA $8A        ; load ACTUAL area again

;no match
LDA #$00      ; unset rain animation indicator
RTL

;Between the above and the next code there should be enough space to test every area or to test for self-defined events
;in some areas. If you still need more, you need to move it more forward.

;THIS IS THE MOUNTAIN-FLASHLIGHTS-CODE

ORG $0EF587      ; go to beginning of the flashlights code (command A58A)

JSL $3CA100      ; overwrite this with a long jump to expanded space
CMP #$01      ; in the new routine i will set the accumulator to 0x01 to indicate that we used the flashlights, otherwise 0x00
BEQ $06         ; so if we want to use the flashlights, branch to this routine in the original code
BRA $02         ; we don't want to use the flashlights, jump to the branch to the RTL in the original code

ORG $3CA100      ; go to expanded space

LDA $8A        ; load ACTUAL area

;for paste©
;CMP #$45      ;
;BNE $03         ;
;LDA #$01      ;
;RTL

CMP #$43      ; test if we are in this area
BNE $03         ; if not, jump to next area
LDA #$01      ; set flashlights indicator
RTL

CMP #$45      ;
BNE $03         ;
LDA #$01      ;
RTL

CMP #$47      ;
BNE $03         ;
LDA #$01      ;
RTL

;no match
LDA #$00      ; unset flashlights indicator
RTL

XaserLE



Since : 2013-01-22

Back to top Go down

Re: Need help learning ASM

Post by Sponsored content


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