strhp.s 615 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ! $Source$
  2. ! $State$
  3. ! $Revision$
  4. .sect .text; .sect .rom; .sect .data; .sect .bss
  5. .sect .text
  6. .define .strhp
  7. .extern .reghp, .limhp, EHEAP, .trp
  8. ! Updates the heap pointer:
  9. !
  10. ! int .strhp(void* newpointer)
  11. !
  12. ! .reghp is the current heap pointer;
  13. ! .limhp is the current top of memory.
  14. !
  15. ! If the desired new heap pointer is above the top of memory, then BRK is
  16. ! called to extend the memory.
  17. .strhp:
  18. pop bx
  19. pop ax
  20. mov (.reghp),ax
  21. cmp ax,(.limhp)
  22. jb 1f
  23. add ax,02000
  24. and ax,~0777
  25. push bx
  26. push ax
  27. call BRK
  28. pop cx
  29. pop bx
  30. cmp ax,-1
  31. je 2f
  32. 1:
  33. mov (.limhp),cx
  34. jmp bx
  35. 2:
  36. mov ax,EHEAP
  37. push bx
  38. jmp .trp