Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; rst 08h, macros kld, kcall, kjp
- ; Loads the correct address into
- ; executing programs at runtime
- rmacro:
- push hl ; Save HL
- inc sp
- inc sp
- pop hl ; Get the return address
- dec hl
- ld (hl), 0 ; Remove the rst
- inc hl ; Move to the load
- dec sp
- dec sp
- push hl
- inc hl ; Move to the address
- push de
- push bc
- push af
- push hl ; push the original value to the stack
- ld c, (hl) ; Load the address to bc
- inc hl
- ld b, (hl)
- dec hl
- push hl ; store it for later
- ld a,(CurrentThreadID)
- call GetThreadEntry ; get the thread entry
- inc hl ; move to the executable address entry
- ld e,(hl) ; load
- inc hl ; it
- ld d,(hl) ; into de
- ex de,hl ; swap it into hl
- add hl,bc ; add it to the address in bc
- ex de,hl ; put it back into de
- pop hl ; get the address back
- ld (hl), e ; store the new adress
- inc hl ; into the old location
- ld (hl), d
- pop af
- pop bc
- pop de
- pop hl ; restore values
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement