Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Returns the amount of Free RAM
- ; output hl = Free RAM
- ReturnFreeRAM:
- push af
- push bc
- push de
- push ix
- ld hl,UserRAM
- ld bc,0
- ld a,$FF
- _ cp (hl)
- jr nz,_
- inc hl
- ld e,(hl)
- inc hl
- ld d,(hl)
- push hl
- ld h,b
- ld l,c
- add hl,de
- ld b,h
- ld c,l
- pop hl
- jr ++_
- _ inc hl
- ld e,(hl)
- inc hl
- ld d,(hl)
- _ add hl,de ; jump to next section
- ld de,UserRAMEnd ; get the end of UserRAM
- sbc hl,de ; compare
- add hl,de
- jr c,---_ ; loop again if hl < UserRAMEnd
- pop ix
- pop de
- pop bc
- pop af
- ld h,b
- ld l,c
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement