RosettaCodeData/Task/Memory-allocation/360-Assembly/memory-allocation-1.360

23 lines
1.2 KiB
Plaintext

* Request to Get Storage Managed by "GETMAIN" Supervisor Call (SVC 4)
LA 1,PLIST Point Reg 1 to GETMAIN/FREEMAIN Parm List
SVC 4 Issue GETMAIN SVC
LTR 15,15 Register 15 = 0?
BZ GOTSTG Yes: Got Storage
* [...] No: Handle GETMAIN Failure
GOTSTG L 2,STG@ Load Reg (any Reg) with Addr of Aquired Stg
* [...] Continue
* Request to Free Storage Managed by "FREEMAIN" Supervisor Call (SVC 5)
LA 1,PLIST Point Reg 1 to GETMAIN/FREEMAIN Parm List
SVC 5 Issue FREEMAIN SVC
LTR 15,15 Register 15 = 0?
BZ STGFRE Yes: Storage Freed
* [...] No: Handle FREEMAIN Failure
STGFRE EQU * Storage Freed
* [...] Continue
*
STG@ DS A Address of Stg Area (Aquired or to be Freed)
PLIST EQU * 10-Byte GETMAIN/FREEMAIN Parameter List
DC A(256) Number of Bytes; Max=16777208 ((2**24)-8)
DC A(STG@) Pointer to Address of Storage Area
DC X'0000' (Unconditional Request; Subpool 0)