Jump to content

Difference Between ADDRESS and OFFSET


Goran

3 posts in this topic

Recommended Posts

Difference Between ADDRESS and OFFSET

 

In the initial days when I started writing assembly programs on my own I used to get confused as to when to use ADDRESS and when to use OFFSET in the program. This article is an attempt to clear the doubts of assembly programmers regarding the meaning and usage of ADDRESS and OFFSET.

First and foremost, the purpose of using either ADDRESS or OFFSET is to get the memory address of variables during program execution.

Now, we know that variables in any assembly program are of two types, i.e. local and global variables.

While global variables remain in the memory throughout the execution of the program, local variables exist only during the execution of the functions in which they are declared and will be removed from the stack memory once the function in which they are declared completes is execution.

Since the global variables  exist in memory throughout the lifetime of a program's execution, their memory address is allocated during assembly time by the assembler. The assembler knows the exact location of the global variable's memory address during assembly time.

In case of local variables, the assembler has no idea about the address of the variable as it's address is allocated during runtime in the stack as and when the function in which it is declared is executed.

now coming back to our assembler instructions, OFFSET will get the address of a variable which already has it's address allocated. This in turn means, OFFSET could be used to get the address of global variables only. We cannot receive the address of a local variable by using OFFSET as the address of a local variable is not decided during assembly time.

To overcome this difficulty we have ADDRESS instruction. This instruction should be used if we want to retrieve the address of a local variable. 

Now naturally a question arises as to how does ADDRESS know the address of a local variable while OFFSET cannot. Well, even ADDRESS will not know the actual address of a local variable as it is referred during assembly time. What ADDRESS actually does is a simple substitution in the code as follows, just before the function is executed.

lea eax, localvar 
push eax

What really this means is that ADDRESS causes the address of the local variable which is generated during runtime to be returned. lea is used to refer to the stack memory. LEA means Load Effective Address! It is used to load variables from the stack.

If you still did not get it, then imagine a situation as follows.

I am standing somewhere on the street there and you come to meet me there in search of the address of a beautiful girl which you feel I know. So, now your asking me of the address could be considered as the assembly time of the program, you are the assembly program in search of the (girl's) address and I am the assembler.

Now if I know her exact address I'll give it to you: with perfect street address, door number, etc. This is what OFFSET does.

Now if I don't know where she lives, but I know somebody who I know knows the address of that girl, then I'll give you the address of that somebody and ask you to checkout there for the address of the girl you are searching for. That's what ADDRESS does. So it's clear that even ADDRESS doesn't have the exact address of the variable.

Now that we clearly know when to use ADDRESS and OFFSET, another question arises. Can we use ADDRESS to load global variables????

Yes, of course! If you are referring to global variables using ADDRESS, then ADDRESS simply substitutes is as following.

mov eax, 3000h

where 3000h is the actual address of the global variable. Remember, the actual address of a global variable is known during assemble and link time.

But then, why does ADDRESS use LEA instead of MOV in case of local variables. Well, for the simple reason that 

mov eax,ebp+2

is an invalid CPU instruction. Note that EBP also known as base address is the register used to access stack, and it is in stack where the local variables are stored.

Hence, LEA is used by ADDRESS in case of local variables.

So it is clear that OFFSET is to be used to global variables and ADDRESS for local variables. ADDRESS could ALSO be used while referring to global variables, BUT OFFSET cannot be used while referring to local variables.

 

Credits to author: http://www.hitxp.com/comp/pro/asm/120403.htm

Link to comment
https://iosgods.com/topic/56690-difference-between-address-and-offset/
Share on other sites

Forgot the "Still any doubts? Feel free to mail me to the address on the RHS below. But please do not ask the address of any beautiful girl :-) I won't give it even if I get one ever."

Credit the author http://www.hitxp.com/comp/pro/asm/120403.htm

1 minute ago, Joka said:

Forgot the "Still any doubts? Feel free to mail me to the address on the RHS below. But please do not ask the address of any beautiful girl :-) I won't give it even if I get one ever."

Credit the author http://www.hitxp.com/comp/pro/asm/120403.htm

Done... <3

Archived

This topic is now archived and is closed to further replies.

  • Our picks

    • Avalar: Hardcore ARPG v04.60.07 +2 Jailed Cheats [ Damage & Defence ]
      Modded/Hacked App: Avalar: Hardcore ARPG By Enigma Publishing Limited
      Bundle ID: com.avalar.atwo.epl.as
      iTunes Store Link: https://apps.apple.com/us/app/avalar-hardcore-arpg/id6504173866?uo=4


      Hack Features:
      - Damage Multiplier
      - Defence Multiplier


      Jailbreak required hack(s): [Mod Menu Hack] Avalar: Tag Team ARPG v04.52.30 +2 Cheats [ Damage & Defence ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Like
      • 34 replies
    • Avalar: Hardcore ARPG v04.60.07 +2 Cheats [ Damage & Defence ]
      Modded/Hacked App: Avalar: Hardcore ARPG By Enigma Publishing Limited
      Bundle ID: com.avalar.atwo.epl.as
      iTunes Store Link: https://apps.apple.com/us/app/avalar-hardcore-arpg/id6504173866?uo=4


      Hack Features:
      - Damage Multiplier
      - Defence Multiplier


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] Avalar: Tag Team ARPG v04.52.30 +2 Jailed Cheats [ Damage & Defence ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Like
      • 54 replies
    • Nightfall: Kingdom Frontier TD v1.0.162 +8 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Nightfall: Kingdom Frontier TD By Fansipan Limited
      Bundle ID: com.fansipan.nightfall.tower.simulation.strategy.td.game
      iTunes Store Link: https://apps.apple.com/us/app/nightfall-kingdom-frontier-td/id6621272416?uo=4


      Hack Features:
      - God Mode
      - Unlimited In-Game Coins -> Will increase instead of decrease.
      - Unlimited Currencies -> Will increase instead of decrease.
      - No Ads
      - Add 1K Currency -> Head over to Settings and toggle the Discord button. [ VIP ]
      - Unlock All Features -> Head over to Settings and toggle the Discord button. [ VIP ]
      - Unlock All / Everything ->  Head over to Settings and toggle the Discord button. [ VIP ]
      - Complete Tutorial -> Head over to Settings and toggle the Discord button. [ VIP ]


      Jailbreak required hack(s): [Mod Menu Hack] Nightfall: Kingdom Frontier TD v1.0.41 +8 Cheats [ Unlimited Currencies ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Haha
      • 47 replies
    • Nightfall: Kingdom Frontier TD v1.0.162 +8 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Nightfall: Kingdom Frontier TD By Fansipan Limited
      Bundle ID: com.fansipan.nightfall.tower.simulation.strategy.td.game
      iTunes Store Link: https://apps.apple.com/us/app/nightfall-kingdom-frontier-td/id6621272416?uo=4


      Hack Features:
      - God Mode
      - Unlimited In-Game Coins -> Will increase instead of decrease.
      - Unlimited Currencies -> Will increase instead of decrease.
      - No Ads
      - Add 1K Currency -> Head over to Settings and toggle the Discord button. [ VIP ]
      - Unlock All Features -> Head over to Settings and toggle the Discord button. [ VIP ]
      - Unlock All / Everything ->  Head over to Settings and toggle the Discord button. [ VIP ]
      - Complete Tutorial -> Head over to Settings and toggle the Discord button. [ VIP ]


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] Nightfall: Kingdom Frontier TD v1.0.41 +8 Jailed Cheats [ Unlimited Currencies ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 60 replies
    • Glow Fashion Idol v0.4.1 +2 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Glow Fashion Idol By CRAZY LABS BY TABTALE , G.P.
      Bundle ID: com.crazylabs.fashionsquad
      iTunes Store Link: https://apps.apple.com/us/app/glow-fashion-idol/id6446197181?uo=4


      Hack Features:
      - Unlimited Coins
      - Unlimited Gems


      Jailbreak required hack(s): [Mod Menu Hack] Glow Fashion Idol v0.3.3 +2 Cheats [ Unlimited Currencies ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Haha
      • 18 replies
    • Glow Fashion Idol v0.4.1 +2 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Glow Fashion Idol By CRAZY LABS BY TABTALE , G.P.
      Bundle ID: com.crazylabs.fashionsquad
      iTunes Store Link: https://apps.apple.com/us/app/glow-fashion-idol/id6446197181?uo=4


      Hack Features:
      - Unlimited Coins
      - Unlimited Gems


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] Glow Fashion Idol v0.3.3 +2 Jailed Cheats [ Unlimited Currencies ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Like
      • 10 replies
    • Toram Online v4.0.53 - [ Custom Move Speed & More ]
      Modded/Hacked App: Toram Online By ASOBIMO,Inc.
      Bundle ID: com.asobimo.toramonline
      iTunes Store Link: https://itunes.apple.com/us/app/toram-online/id988683886?mt=8&uo=4&at=1010lce4
       

      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iFile / Filza / iFunBox / iTools or any other file managers for iOS.
      - Cydia Substrate or Substitute.
      - PreferenceLoader (from Cydia or Sileo).


      Hack Features:
      - Custom Move Speed
      - God Mode 
      - Fast Attack Speed
      - Fast Cast Speed
      - Always Critical Chance
      - Never Miss Hit 
      - Mobs/Bosses Can't Avoid & Guard 
      - Quick Draw
      - Armor Break
      - Magic Wall - Stun + Full Map Hack 
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 2,515 replies
    • DungeonDrop! v1.02.51 +2 Jailed Cheats
      Modded/Hacked App: DungeonDrop! By Eternal Games Inc.
      Bundle ID: com.eternalgames.dungeonboom
      iTunes Store Link: https://apps.apple.com/us/app/dungeondrop/id6596731031?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Damage Multiplier
      - Defense Multiplier


      Jailbreak required hack(s): 


      iOS Hack Download IPA Link:

      Hidden Content

      Download via the iOSGods App








      PC Installation Instructions:
      STEP 1: If necessary, uninstall the app if you have it installed on your iDevice. Some hacked IPAs will install as a duplicate app. Make sure to back it up so you don't lose your progress.
      STEP 2: Download the pre-hacked .IPA file from the link above to your computer. To download from the iOSGods App, see this tutorial topic.
      STEP 3: Download Sideloadly and install it on your PC.
      STEP 4: Open/Run Sideloadly on your computer, connect your iOS Device, and wait until your device name shows up.
      STEP 5: Once your iDevice appears, drag the modded .IPA file you downloaded and drop it inside the Sideloadly application.
      STEP 6: You will now have to enter your iTunes/Apple ID email login, press "Start" & then you will be asked to enter your password. Go ahead and enter the required information.
      STEP 7: Wait for Sideloadly to finish sideloading/installing the hacked IPA. If there are issues during installation, please read the note below.
      STEP 8: Once the installation is complete and you see the app on your Home Screen, you will need to go to Settings -> General -> Profiles/VPN & Device Management. Once there, tap on the email you entered from step 6, and then tap on 'Trust [email protected]'.
      STEP 9: Now go to your Home Screen and open the newly installed app and everything should work fine. You may need to follow further per app instructions inside the hack's popup in-game.

      NOTE: iOS/iPadOS 16 and later, you must enable Developer Mode. For free Apple Developer accounts, you will need to repeat this process every 7 days. Jailbroken iDevices can also use Sideloadly/Filza/IPA Installer to normally install the IPA with AppSync. If you have any questions or problems, read our Sideloadly FAQ section of the topic and if you don't find a solution, please post your issue down below and we'll do our best to help! If the hack does work for you, post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - AlyssaX64


      Cheat Video/Screenshots:

      N/A
        • Thanks
      • 29 replies
    • DungeonDrop! v1.02.51 +2 Cheats
      Modded/Hacked App: DungeonDrop! By Eternal Games Inc.
      Bundle ID: com.eternalgames.dungeonboom
      iTunes Store Link: https://apps.apple.com/us/app/dungeondrop/id6596731031?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Damage Multiplier
      - Defense Multiplier


      Non-Jailbroken & No Jailbreak required hack(s): 


      iOS Hack Download Link:

      Hidden Content

      Download Hack








      Installation Instructions:
      STEP 1: Download the .deb Cydia hack file from the link above. Use Safari/Google Chrome or other iOS browsers to download.
      STEP 2: Once the file has downloaded, tap on it and then you will be prompted on whether you want to open the deb with iGameGod or copy it to Filza.
      STEP 3: If necessary, tap on the downloaded file, and then, you will need to press 'Install' from the options on your screen.
      STEP 4: Let iGameGod/Filza finish the cheat installation. Make sure it successfully installs, otherwise see the note below.
      STEP 5: If the hack is a Mod Menu — which is usually the case nowadays — the cheat features can be toggled in-game. Some cheats have options that can be enabled from your iDevice settings.
      STEP 6: Turn on the features you want and play the game. You may need to follow further instructions inside the hack's popup in-game.

       

      NOTE: If you have any questions or problems, read our Troubleshooting topic & Frequently Asked Questions & Answers topic. If you still haven't found a solution, post your issue down below and we'll do our best to help! If the hack does work for you, please post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - AlyssaX64


      Cheat Video/Screenshots:

      N/A
        • Like
      • 37 replies
    • Shadow Hunter: Premium v11.118.2 +9 Cheats
      Modded/Hacked App: Shadow Hunter: Premium By ENIGMA SOFTWARE JOINT STOCK COMPANY
      Bundle ID: com.enigma.shadowhunter.paid
      iTunes Store Link: https://apps.apple.com/us/app/shadow-hunter-premium/id1588843797?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia or Sileo).


      Hack Features:
      - Free Equipment Level Up*
      - Free Merchant Shop*
      - Free Mystic Store*
      - Free Fragment Shop*
      - Free Video Shop*
      - No Awaken Dust Cost
      - No Ascend Requirements
      - No Evolve Requirements
      - 1 Item = 100 Items

      Notes:
      * under one switch. Do not purchase stuff that cost diamond, or your game becomes invalid. So, save from time to time to revert back if anything happens.
        • Agree
        • Winner
        • Like
      • 599 replies
    • Shadow Hunter: Lost Worlds v10.118.2 +9 Cheats
      Modded/Hacked App: Shadow Hunter: Lost Worlds By ENIGMA SOFTWARE JOINT STOCK COMPANY
      Bundle ID: com.enigma.shadowhunter.free
      iTunes Store Link: https://apps.apple.com/us/app/shadow-hunter-lost-worlds/id1559150590?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia or Sileo).


      Hack Features:
      - Free Equipment Level Up*
      - Free Merchant Shop*
      - Free Mystic Store*
      - Free Fragment Shop*
      - Free Video Shop*
      - No Awaken Dust Cost
      - No Ascend Requirements
      - No Evolve Requirements
      - 1 Item = 100 Items

      Notes:
      * under one switch. Do not purchase stuff that cost diamond, or your game becomes invalid. So, save from time to time to revert back if anything happens.
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 752 replies
    • (Otherworld: Three Kingdoms) 이세계 삼국지 v1.0.154 +3 Jailed Cheats
      Modded/Hacked App: 이세계 삼국지 By CodeDragon Co., LTD.
      Bundle ID: com.codedragongame.threekingdoms
      iTunes Store Link: https://apps.apple.com/kr/app/%EC%9D%B4%EC%84%B8%EA%B3%84-%EC%82%BC%EA%B5%AD%EC%A7%80/id6526477945?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Damage Multiplier
      - Defense Multiplier
      - Loot Multiplier → Only Few Currenices Work (Turn Off When Use)


      Jailbreak required hack(s): 


      iOS Hack Download IPA Link:

      Hidden Content

      Download via the iOSGods App








      PC Installation Instructions:
      STEP 1: If necessary, uninstall the app if you have it installed on your iDevice. Some hacked IPAs will install as a duplicate app. Make sure to back it up so you don't lose your progress.
      STEP 2: Download the pre-hacked .IPA file from the link above to your computer. To download from the iOSGods App, see this tutorial topic.
      STEP 3: Download Sideloadly and install it on your PC.
      STEP 4: Open/Run Sideloadly on your computer, connect your iOS Device, and wait until your device name shows up.
      STEP 5: Once your iDevice appears, drag the modded .IPA file you downloaded and drop it inside the Sideloadly application.
      STEP 6: You will now have to enter your iTunes/Apple ID email login, press "Start" & then you will be asked to enter your password. Go ahead and enter the required information.
      STEP 7: Wait for Sideloadly to finish sideloading/installing the hacked IPA. If there are issues during installation, please read the note below.
      STEP 8: Once the installation is complete and you see the app on your Home Screen, you will need to go to Settings -> General -> Profiles/VPN & Device Management. Once there, tap on the email you entered from step 6, and then tap on 'Trust [email protected]'.
      STEP 9: Now go to your Home Screen and open the newly installed app and everything should work fine. You may need to follow further per app instructions inside the hack's popup in-game.

      NOTE: iOS/iPadOS 16 and later, you must enable Developer Mode. For free Apple Developer accounts, you will need to repeat this process every 7 days. Jailbroken iDevices can also use Sideloadly/Filza/IPA Installer to normally install the IPA with AppSync. If you have any questions or problems, read our Sideloadly FAQ section of the topic and if you don't find a solution, please post your issue down below and we'll do our best to help! If the hack does work for you, post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - AlyssaX64


      Cheat Video/Screenshots:

      N/A
        • Like
      • 79 replies
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines