Re: A82: saving hl


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

Re: A82: saving hl




>you could use this instead:
>.dw $0

Use self-modifying code.  It's pretty simple to do.  Change ONE of
the load HLs with (save) to save: ld hl,0.  Then change all the
(save)s to (save+1).  Example below.

Change this:

ld (save),hl
...
ld hl,(save)
...
ld hl,(save)
...
ld (save),hl

To this (note that changing ANY ld hl,(save) is alright):

ld (save+1),hl
...
save:
ld hl,0
...
ld hl,(save+1)
...
ld (save),hl


This only works with ld de,... ld hl,... and ld bc,...

-- Barubary


Follow-Ups: