[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Applesoft commands
- Subject: Re: Applesoft commands
- From: dalloff@freenet.columbus.oh.us (Dave Althoff)
- Date: 1996/10/04
- Newsgroups: comp.sys.apple2
- Organization: The Greater Columbus FreeNet
- References: <52pfml$6m3@nonews.col.hp.com> <52sufa$bsu@darla.visi.com> <52u3cr$5no@nonews.col.hp.com> <52vdkg$mf4@login.freenet.columbus.oh.us> <52vek2$kee@darla.visi.com>
Nathan Mates (nathan@visi.com) wrote:
(first quoting me)
: >First of all, the formula for translating negative numbers under Applesoft
: >is n + 65536; for example, "PEEK (-16384)" is equal to "PEEK (49152)". I
: >think the inclusion of this little trick was originally related to a
: >problem with Integer BASIC:
(then responding...)
: That 'problem' didn't start with integer basic; it went a bit
: further back. Basically, this comes from trying to store positive and
: negative numbers in a n-bit value: how do you determine if something's
: negative? Solution: use the highest bit as sort of a sign bit. With
: the 2's-complement notation used by the 65xx series (and most other
: things), to negate something, you invert each bit, and then add 1.
Well, I should have been a little more specific...Integer BASIC was where
the problem showed up on our beloved Apples...I think the need for using
2's complement goes all the way back to the first time someone wanted to
do signed math in binary...and I don't know enough about computer history
to go back that far...!
--Dave Althoff, ][.
--
/-\ Celebrating the International Year of the Roller Coaster
/XXX\ /X\ /X\_ _ /XX\_ _ _ _____
/XXXXX\ /XXX\ _/XXXX\_ /X\ /XXXXX\ /X\ /X\ /XXXXX
_/XXXXXXX\__/XXXXX\/XXXXXXXX\_/XXX\_/XXXXXXX\__/XXX\_/XXX\_/\_/XXXXXX