Files
Digital-Research-Source-Code/CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/SALLOC.S
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

37 lines
1.1 KiB
ArmAsm
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*
* _salloc function.
*
* This function allocates a data area on the stack.
*
* Calling Sequence:
*
* adr = _salloc(size);
*
* Returns the address of the area allocated.
*
* Pulled out of 'w.s' 1/84 whf
* Fixed 2/84 sw
*
.globl __salloc
__salloc:
move.l (sp)+,a0 * Save return address
clr.l d0 * Zap d0 high word
move.w (sp)+,d0 * Get arg (word size)
addq.l #1+4,d0 * Round
bclr.l #0,d0 * up to word
move.l __break,a1 * a1 -> break area
lea $100(a1),a1 * Add chicken factor
lea 0(a1,d0.l),a1 * And size
cmpa.l a1,sp * OK?
bhi ok *sw Overflow, die
jmp __sovf *sw Jump to error in s.o
ok: sub.l d0,sp * allocate
lea 4(sp),a1 * a1 -> area start
move.l a1,d0 * set return code
jmp (a0) * and "return"
*
 * and "return"
*
 * and "return"
*