Re: LZ: How to do self-modifying code?


[Prev][Next][Index][Thread]

Re: LZ: How to do self-modifying code?



To store data, you have to have a label.
stuff:
            .db $00,$00,$0F


to access that data, use this:
            ld hl,PROGRAM_ADDR              ;gets start of program, stored by
ZS
            ld de,stuff                                  ;takes the label
offset
            add hl,de                                   ;hl now contains the
address of the first byte 
            
to load numbers to that location:
           ld (hl),a                                      ;would load a into
the first byte after stuff:


Again, use this somewhere in your code:
           ld hl,ZS_BITS
           set 0,(hl)


Enjoy,
Alan B.


References: