Index

Function Name: MEMTOP

Purpose: Set/read top of system RAM
Call address: $FF99 (hex) 65433 (decimal)
Preparation:

	Registers:	.X = lsb of MEMSIZE
			.Y = msb of MEMSIZE
	Memory:		system map
	Flags:		.C = 0 -> set top of memory
			.C = 1 -> read top of memory
	Calls:		none
Results:
	Registers:	.X = lsb of MEMSIZE
			.Y = msb of MEMSIZE
	Memory:		MEMSIZE ($A07)
	Flags:		none

Description: MEMTOP is used to read or set the top of system RAM, pointed to by MEMSIZE ($A07). This call is included in the C128 for completeness, but neither the Kernal nor BASIC utilizes MEMTOP since it has little meaning in the banked memory environment of the C128 (even the RS-232 buffers are permanently allocated). Nonetheless, set the carry status to load MEMSIZE into .X and .Y, and clear it to update the pointer from .X and .Y. Note that MEMSIZE references only system RAM (RAM0). The Kernal initially sets MEMSIZE to $FF00 (MMU and Kernal RAM code start here).

EXAMPLE:

	SEC
	JSR	$FF99	;get top of user RAM0
	DEY
	CLC
	JSR	$FF99	;lower it 1 block