This tutorial will show you how to create a RAM checking program. This program will make good use of the _Memchk(_Memchk = 42E5h) and _Disphl(Disphl = 4507h) ROM calls.
#define equ .equ
#define EQU .equ
#define END .end
ld hl,Mem ;Load Text
B_CALL(_Memchk) ;Check RAM
B_CALL(_DispHL) ;Display contents of HL
.db "RAM free (bytes)"
How the Program Worked
This is a fairly simple program. The _Memchk ROM call checks the amont of memory available in RAM. It hen stores that value to the HL register. _DispHL then displays the contents of HL on the screen.
_MemChk - Checks amount of memory in RAM, outputs value to hl.
_Disphl - Displays contents of HL
This wasn't hard. =) Amount of Free RAM may vary due to hidden system variables not marked dirty. This may alter the Free RAM returned by a few bytes.
Click to return to the site's menu... or here to get back to the tutorial's menu.