shp.s 477 B

12345678910111213141516171819202122232425262728293031
  1. .define .strhp
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. .strhp:
  8. move.l 4(sp), d1 ! new heap pointer
  9. cmp.l .limhp, d1
  10. blt 1f
  11. add.l #0x400, d1
  12. and.l #~0x3ff, d1
  13. move.l d1, -(sp)
  14. move.l d1,.limhp
  15. jsr BRK ! allocate 1K bytes of extra storage
  16. add.l #4, sp
  17. tst.l d0
  18. bne 2f
  19. 1:
  20. move.l 4(sp), .reghp ! store new value of heap pointer
  21. move.l (sp)+,a0
  22. move.l a0,(sp)
  23. rts
  24. 2:
  25. move.l #EHEAP, -(sp)
  26. jsr .trp
  27. move.l (sp)+,a0
  28. move.l a0,(sp)
  29. rts
  30. .align 2