InsomniaDMX just recently posted a bit of code that made Air: Fool X-ray blocks with a BTS of 03 hurt you like lava does. I've read a few articles on ASM, and I know Java, so I figured I would try to use my knowledge decipher it. I've looked for some simple asm examples, and I think this is just what I am looking for. I am just looking for some clarification to see if I am on the right track. I didn't see any other topics were like this, so hopefully this is in the right spot. I wrote my comments in red.
Any help is appreciated.
lorom //Not sure what this does, but I think I've heard something about loroms and hiroms? Maybe header, no header?
;Lava style damage block hack
;by Insom
;
;ONCE AGAIN... USE XKAS V.06 TO COMPILE...
;
;Not a whole lot to say about this one...
;To use, set the tiles you want to have this effect
;to block type $02 ("Air. Fool X-RAY.")
;with a BTS value of $03. There are PLENTY of blank
;spaces in the lookup table that I mention, so take
;advantage if you want to add other blocks. Just add
;another DW $xxxx after the first one to point to new
;code. For example, $94:98B2's pointer corresponds to
;the BTS value of $03, and $94:98B4's pointer would
;correspond to the BTS value of $04.
;
;Good luck!
;
;__________________________________________________
;
;Defines:
!value = #$7000 //Defining a variable named value with the value of 7000 in hex? I think the "#" means the number is a number and not an address, but how is 7000 a very small number (or fractional number), since the comment below says a whole number would be way too much damage.
;Fractional damage per frame. I didn't include whole
;number damages, because even a whole number damage
;of $0001 would seem ridiculous. Feel free to experiment
;with this value.
!damage = $0A4E //Defines a new variable named damage, and according to the comment this variable holds the address in the rom that the damage(or "value" variable) value should be stored at.
;The address to store the damage value to.
;__________________________________________________
;Change the entry for this block type in the appropiate
;lookup table to point to where our code will be.
org $9498B2 //Not really sure about this one, but it must the code to the right position in the rom or something.
DW $B300 //Same as above.
;Now that we've got our entry point, write the code.
org $94B300 //Don't know.
LDA !value //Okay, this must load the variable "value" into the processor.
STA !damage //This must store what is in the processor (in this case the "value" variable) at the location of the "damage" variable.
RTS //This piece returns the flow of the code back to wherever it branched off at. I don't see any JMP, or BRK command, so it must have something to do with those ORG commands.
;Lava style damage block hack
;by Insom
;
;ONCE AGAIN... USE XKAS V.06 TO COMPILE...
;
;Not a whole lot to say about this one...
;To use, set the tiles you want to have this effect
;to block type $02 ("Air. Fool X-RAY.")
;with a BTS value of $03. There are PLENTY of blank
;spaces in the lookup table that I mention, so take
;advantage if you want to add other blocks. Just add
;another DW $xxxx after the first one to point to new
;code. For example, $94:98B2's pointer corresponds to
;the BTS value of $03, and $94:98B4's pointer would
;correspond to the BTS value of $04.
;
;Good luck!
;
;__________________________________________________
;
;Defines:
!value = #$7000 //Defining a variable named value with the value of 7000 in hex? I think the "#" means the number is a number and not an address, but how is 7000 a very small number (or fractional number), since the comment below says a whole number would be way too much damage.
;Fractional damage per frame. I didn't include whole
;number damages, because even a whole number damage
;of $0001 would seem ridiculous. Feel free to experiment
;with this value.
!damage = $0A4E //Defines a new variable named damage, and according to the comment this variable holds the address in the rom that the damage(or "value" variable) value should be stored at.
;The address to store the damage value to.
;__________________________________________________
;Change the entry for this block type in the appropiate
;lookup table to point to where our code will be.
org $9498B2 //Not really sure about this one, but it must the code to the right position in the rom or something.
DW $B300 //Same as above.
;Now that we've got our entry point, write the code.
org $94B300 //Don't know.
LDA !value //Okay, this must load the variable "value" into the processor.
STA !damage //This must store what is in the processor (in this case the "value" variable) at the location of the "damage" variable.
RTS //This piece returns the flow of the code back to wherever it branched off at. I don't see any JMP, or BRK command, so it must have something to do with those ORG commands.
Any help is appreciated.
Thread title: