Eeems

FreeThreadMem

Jul 1st, 2011
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Clears all memory accociated with a thread
  2. ; inputs    a  = Thread ID
  3. FreeThreadMem:
  4.     push af
  5.     push bc
  6.     push de
  7.     push hl
  8.     ld hl,UserRAM
  9.     ld d,a
  10. FTMLoop     ld a,(hl)
  11.         push hl
  12.         pop ix
  13.         cp d
  14.             call z,FreeMem
  15. _       inc hl
  16.         ld c,(hl)
  17.         inc hl
  18.         ld b,(hl)
  19. _           inc hl
  20.             djnz -_
  21.         inc hl
  22.         inc hl
  23.         ; compare hl with UserRAMEnd
  24.         ; if hl is smaller then jump back to FTMLoop
  25.         ; otherwise continue
  26.     pop hl
  27.     pop de
  28.     pop bc
  29.     pop af
  30.     ret
Add Comment
Please, Sign In to add comment