ZX Review #7-8-9-10
08 ноября 1997 |
|
Retro - 40 best procedures: Determination of the amount of free memory.
8. INSTRUMENTAL PROGRAM 8.1. Determining the size of free memory Length: 14 Number of variables: 0 Checksum: 1443 Purpose: gives the number of free space in RAM bytes. Calling the program: RANDOMIZE USR address Error Check: No Comment: This program must be called before using any routines that may increase the length of program, to be sure that the RAM is enough free space. LISTING machine code Assembly label number to VVODA147. LD HL, 0 33 0 0 ADD HL, SP 57 LD DE, (23653) 237 91 101 1992 AND A 167 SBC HL, DE 237 82 LD B, H 68 LD C, L 77 RET 2012 How it works: In a couple of registers loaded HL 0, and this value is summed address the end of the free area of memory (the address is stored in a SP). DE register pair is loaded address of the beginning of the free RAM and subtracted from the HL. HL copied to the BC and the program returns to BASIC.
Other articles:
Similar articles:
В этот день... 23 November