<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Thu, 08 Jan 2009 23:26:25 +0000
From   : jgh@... (Jonathan Graham Harston)
Subject: OSHWM / HIMEM question

Phill Harvey-Smith wrote:
> Am I correct in asuming that OSHWM and HIMEM will only ever be on a page
> boundry ? If this is the case then the amount of free memory will always
> be an exact number of pages which will make things simpler for me.
 
No. OSBYTE &83 (OSHWM, bottom of user memory) and OSBYTE &84 (top
of user memory) return 16-bit values. Many implementations just
happen to return &xx00, but you must not rely on that. For
instance, I have an 40x4 LCD screen driver that returns &7F60 as
the top of user memory.
 
To simplify programming you can always force the low byte to zero
for top of memory and round up to next page is bottom of memory is
not page aligned. BASIC ignores the bottom byte of OSBYTE &83, and
only allows PAGE to be set to a page-aligned value.
 
As an aside, if b7 of A is clear, then a 23-bit value has been
returned in A:Y:X, as with the 65Turbo emulator that returns
&010000 - &040000.
 
-- 
J.G.Harston - jgh@...                - mdfs.net/User/JGH
Youth has now fled. Their best years have been passed in the service
of the party. They are ageing and their ideals have also passed,
dispersed by the contrarities of daily struggles.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>