Advertisement
Zeda

RAMcall

Jun 4th, 2016
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define scrap $8000
  2. RAMcall:
  3. ;IX points to where the code that needs to be copied.
  4. ;Preceded by 2-byte size field, followed by the actual routine
  5. ;Example:
  6. ;  myroutine:
  7. ;      .dw myroutine_end-$-2
  8. ;      <<code>>
  9. ;  myroutine_end:
  10.     push hl
  11.     push de
  12.     push bc
  13.     push af
  14.     push ix
  15.     pop ix
  16.     ld c,(hl)
  17.     inc hl
  18.     ld b,(hl)
  19.     inc hl
  20.     ld de,scrap
  21.     ldir
  22.     pop af
  23.     pop bc
  24.     pop de
  25.     ld hl,scrap
  26.     ex (sp),hl
  27.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement