12

Online references disagree on whether Applesoft programs were stored at 0x801 (2049) or 0x3001 (12289). A quick test on my OpenEmulator install with an Apple II Plus definitely puts it at 0x801. However, Applesoft II Pointers & Tokens says otherwise:

Programs store startirlg [sic] at decimal location 12289 upward...

Is that article incorrect? I know you can change the address at $67/$68, but I'm interested in the default: Applesoft programs on disk do not store their starting memory address, but do refer to absolute memory locations to point to the following line, so there must be an agreed-upon default.

  • I've never heard of 0x3001 as startig address before. It also doesn't make particular sense, as it's right in the middle of Hires page 1. 0x4001 actually would make sense, if you had a long program and wanted to use hires graphics as well. The only starting address I've known so far is 0x801, but of course that doesn't explain where the conflicting information comes from. – dirkt Oct 24 '16 at 7:11
15

The answers can be found in Apple's early "Blue Books". For more info see my answer here.

Applesoft I on tape used $2A00

  • APPLESOFT I, based on Microsoft 6502 BASIC version 1.1
  • Documented in the November 1977 "Blue Book"
  • Available on tape
  • Loaded into memory at $800-$29FF (8.5k)
  • Program and variables at $2A00 up (* See note below)

Applesoft II used $3000 for the tape version and $800 for all ROM versions

  • APPLESOFT II, based on Microsoft 6502 BASIC version 2
  • Documented in the August 1978 "Blue Book"
  • In mainboard ROM (also available on tape, disk, firware card ROM)
  • Tape version loaded into memory at $800-$2FFF (10k)
  • Tape version programs and variables at $3000 up
  • ROM version in memory at $D000-$F7FF (10k) (* See note below)
  • ROM version program and variables at $800 up (* See note below)

* Note: Some sources say the program starts at $801 (etc) not $800 (etc), but the interpreter actually accesses $800 (etc) first. Try setting $800 (etc) to a non-zero value and you'll see some strange behaviour when trying to RUN the program.

2

You can infer/prove/verify the start of Applesoft program memory by doing the following experiment...

First we can look at the memory beginning at $0800

] NEW
] CALL -151
* 0800L
0800- 00 BRK
0801- 00 BRK
0802- 00 BRK
0803 etc...

Then we can enter a line of BASIC code and re-examine the same memory:

RESET
] 10 PRINT "NEAT"
] CALL -151
* 0800L
0800- 00 
0801- 0D 08 0A
0804- etc...

This seems to indicate $0801 is indeed the start of Applesoft Basic program memory (although I always thought it was $0800) :-)

Interesting, the first 2 bytes of each "line of basic" always point to the memory address of the next encoded line. In the example above, our line of code lives at $0801 with a pointer to the next line at $080D (in little-endian) which contains $0000 terminating the line listing..

  • 2
    Yep, it's a linked list. GOTO and GOSUB work faster for lines near the beginning of the program. – Nick Westgate Oct 25 '16 at 2:07
  • Or just look at what's in $67-$68, which is the pointer to the start of a BASIC program. – Fred Larson Jul 26 at 18:17
2

While you didn't explicitly mention the IIe, the following memory map information was taken directly from Inside the Apple IIe (1985) by Gary B. Little ISBN 0-89303-551-3:

Page 47/48

  • $0000-$00FF. This is the 6502 zero page and it is used extensively by all parts of the lie's operating system, including the system monitor (see Chapter 3), the Applesoft interpreter (see Chapter 4), and the disk operating system (see Chapter 5). Those locations available for use by your own programs are set out in Table 2-5.

  • $0100-$01FF. This is the 6502 stack area and is also used for temporary data storage by the Applesoft interpreter (see Chapter 4).

  • $0200-$02FF. This area of memory is normally used as an input buffer whenever character information is entered from the keyboard or from diskette (see Chapter 6).

  • $0300-$03CF. This area of memory is not used by any of the built-irt programs in the lie and so is available for use by your own programs. It is an ideal location for storing small assembly-language programs that are called from Applesoft and most of the examples presented in this book are to be loaded here.

  • $03D0-$03FF. This area of memory is used by the disk operating system, Applesoft, and the system monitor for the purpose of storing position-independent vectors to important subroutines that can be located anywhere in memory (such as interrupt-handling subroutines). See Appendix IV for a complete description of how this area is used.

  • $0400-$07FF. This is pagel of video memory that is used for displaying both the primary text screen and the primary lowresolution graphics screen (see Chapter 7). It is also used for displaying one-half of the text screen when in 80-column mode.

  • $0800-$0BFF. This is page2 of video memory that is used for displaying both the secondary text screen and the secondary low-resolution graphics screen (see Chapter 7). Since page2 is rarely used, this area of memory is normally used for program storage; in fact, the default starting position for an Applesoft program is $801.

  • $0C00-$1FFF. This area of memory is free for use.

  • $2000-$3FFF. This is pagel of video memory that is used for displaying the primary high-resolution graphics screen (see Chapter 7).

  • $4000-$5FFF. This is page2 of video memory that is used for displaying the secondary high-resolution graphics screen (see Chapter 7).

  • $6000-$BFFF. This area of memory is normally free for use. However, the upper part of it (above $9600) will be used if a disk operating system is installed (see Chapter 5).

Highlighted section added by me.

0

Reading the linked article I think this is when AppleSoft (particularly as it talks about Versions 1 & 2) is loaded into main memory rather than into a language card on an original Apple ][. I'm guessing this is the "tape" version of AppleSoft.

In practice $801 is normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.