strhp.s 334 B

123456789101112131415161718192021222324252627
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .sect .text
  3. .define .strhp
  4. .extern .reghp, .limhp, EHEAP, .trp
  5. .strhp:
  6. pop bx
  7. pop ax
  8. mov (.reghp),ax
  9. cmp ax,(.limhp)
  10. jb 1f
  11. add ax,02000
  12. and ax,~0777
  13. push bx
  14. push ax
  15. call __brk
  16. pop cx
  17. pop bx
  18. cmp ax,-1
  19. je 2f
  20. 1:
  21. mov (.limhp),cx
  22. jmp bx
  23. 2:
  24. mov ax,EHEAP
  25. push bx
  26. jmp .trp