27 lines
		
	
	
	
		
			470 B
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			470 B
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
.define	.strhp
 | 
						|
.sect .text
 | 
						|
.sect .rom
 | 
						|
.sect .data
 | 
						|
.sect .bss
 | 
						|
EHEAP=17
 | 
						|
 | 
						|
	.sect .text
 | 
						|
.strhp:
 | 
						|
	move.l	(sp)+, a0
 | 
						|
	move.l	(sp), d1	! new heap pointer
 | 
						|
	cmp.l	(.limhp), d1	! compare new heap pointer with limit
 | 
						|
	blt	1f
 | 
						|
	add.l	#0x400, d1
 | 
						|
	and.l	#~0x3ff, d1
 | 
						|
	move.l	d1, -(sp)
 | 
						|
	jsr	(__brk)		! allocate 1K bytes of extra storage
 | 
						|
	bcs	2f
 | 
						|
	move.l	(sp)+,(.limhp)
 | 
						|
1:
 | 
						|
	move.l	(sp)+, (.reghp)	! store new value
 | 
						|
	jmp	(a0)		! return
 | 
						|
2:
 | 
						|
	move.l	#EHEAP, -(sp)
 | 
						|
	jsr	(.trp)
 | 
						|
	jmp	(a0)
 | 
						|
.align 2
 |