53 votes
Accepted

Why was it common to reference memory locations using negative numbers on some BASICs?

The difference between Applesoft BASIC and the other Microsoft 6502 BASIC derivatives can be explained by the fact that Applesoft BASIC was not the first BASIC for the Apple II; the first was Apple II ...
user avatar
  • 1,055
40 votes
Accepted

Did the LET statement actually do anything in 8-bit Microsoft BASICs?

Except for the very earliest versions of basic, LET was rarely used, but the LET keyword was not always optional. Early BASIC interpreters required it; however, for most versions that came out for the ...
user avatar
33 votes
Accepted

Apple II: Applesoft BASIC memory management

Managing memory on an Apple II using Applesoft BASIC can be quite complicated, especially for large programs. A general map of Apple II memory at power-up looks like this: $E000-FFFF - Monitor ROM / ...
user avatar
  • 3,341
31 votes

What does this line: `T=C/2=INT(C/2)` do? Why is it valid syntax?

Explaining what this line does is easy enough: it checks if C is even by dividing it by 2 and comparing the result to its floor, then stores the result of the comparison in the variable T. Comparisons ...
user avatar
  • 16.4k
19 votes

Did the LET statement actually do anything in 8-bit Microsoft BASICs?

I can only answer to the first question: the LET statement was actually used in 48K Sinclair BASIC, in which due to the way commands are entered, a keyword is needed before an identifier can be typed, ...
user avatar
19 votes
Accepted

Apple // screen editing

The Apple II has an input buffer separate from the screen, with a maximum capacity of 256 characters. Typing a printable character adds it to the buffer and the screen. The left-arrow button removes ...
user avatar
  • 26.1k
17 votes
Accepted

What are the rules for Applesoft BASIC formatting for code?

This is an AppleSoft issue where it puts spaces either side of a token. PET/CBM BASIC (based off the same code base) doesn't do this. Tokenising ignores spaces, this means it can be difficult on the ...
user avatar
  • 5,135
16 votes

Can you read the character definitions (font) in an Apple II using PEEK in Applesoft BASIC?

No, it's not possible to read the built-in text mode font data from "inside" the machine. (Update: Except perhaps in the Apple IIgs - see below.) In all Apple II models the font data is in a ...
user avatar
15 votes
Accepted

What are the differences between the versions of AppleSoft BASIC?

The Wikipedia entry is a bit jumbled, ambiguous, and in some cases wrong. Perhaps it makes more sense to list changes by Apple II model, as documented by the fantastic Apple II History site. (The ...
user avatar
15 votes
Accepted

At what address do Apple II Applesoft programs get stored?

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 ...
user avatar
13 votes
Accepted

Are there standalone emulators of Applesoft Basic?

Yes, there are at least a couple: LinApple - for Linux/Raspberry Pi. This fork of LinApple is current and maintained, and fixes annoying configuration bugs that others hadn't addressed. AppleWin — ...
user avatar
  • 17.1k
13 votes
Accepted

Why does the Applesoft BASIC have shapes?

Why did Apple include shapes in Applesoft BASIC? Because they were introduced with the 'Programmers Aid #1 ROM' for Integer BASIC, so it was rather natural for Applesoft to support it as well. ...
user avatar
  • 166k
13 votes

What does this line: `T=C/2=INT(C/2)` do? Why is it valid syntax?

The line in question is T=C/2=INT(C/2) The first '=' is a variable assignment. The second '=' is part of the expression and is an equality test. The expression returns a boolean result, which is ...
user avatar
  • 1,589
12 votes
Accepted

Where can I find the Applesoft line-drawing algorithm?

You can find the hi-res drawing code in an Applesoft disassembly. HPLOT starts at $F6FE. The ROM code is optimized for size, and parts are tricky to sort out. If you want something a bit more ...
user avatar
  • 7,411
12 votes

What are the rules for Applesoft BASIC formatting for code?

Here is a program I wrote several years ago in AppleSoft for the fun of it. What it simply does is disassemble itself from the tokenized storage into a listing. If you run it, it will look the same as ...
user avatar
  • 14.1k
12 votes
Accepted

Apple II: HPLOT crashes system. Why?

In order for the drawing commands to work, they need to know what graphics page to use. Since HGR or HGR2 was not used, this setting (address $00E6) is left undefined, and is at the default boot-time ...
user avatar
  • 3,341
11 votes
Accepted

Testing/using a joystick in AppleSoft?

The paddles and joysticks on the Apple work by charging a capacitor through a variable resistance (potentiometer). For the first joystick, the X-axis corresponds to paddle 0, and the Y-axis to paddle ...
user avatar
  • 1,048
10 votes
Accepted

Turn off Apple IIe sound

In this case, to "toggle" the speaker means to move it from one position to the other. To make a sound, you repeatedly toggle the speaker (by poking that address) at a particular speed to make a sound ...
user avatar
  • 5,509
10 votes

How to use HGR2 (or HGR) on an Apple II

Problem Here is a picture (to scale) of how memory is being used in units of "pages" (256 bytes) on the Apple 2. 000000001111111111111111 2222222222222222 3 ... ... 9 ...
user avatar
10 votes

Why does Applesoft get confused by a nonzero value at $0800?

The Applesoft RUN command ($d912) begins by calling SETPTRS ($d665), which calls STXTPT ($d697) to initialize TXTPTR ($b8-b9) to the value in TEXTTAB ($67-68) minus one. In simple terms, parsing of ...
user avatar
  • 7,411
10 votes
Accepted

Extensions to Apple BASIC with ampersands

After a bit of research, it turns out it was Applesoft. The interpreter had a feature where, if it encountered an ampersand during execution of the program, it would unconditionally jump to a ...
user avatar
  • 2,386
9 votes

Apple II: Applesoft variable syntax error weirdness

In Applesoft BASIC, the parser recognizes reserved words greedily, but spaces outside tokens or reserved words are ignored. Variable names may consist of any sequence of letters or numbers provided ...
user avatar
  • 26.1k
9 votes

Applesoft (pseudo) Random Numbers - alternatives?

I found an example that plotted on the hi-res screen to evaluate a replacement RNG. The code is based on a Call-A.P.P.L.E. article from 1989, available here. It appears to be a linear congruential ...
user avatar
  • 7,411
8 votes

Apple // screen editing

Though supercat points out the built-in way of editing BASIC programs on the screen (well, machine language as well if you were doing it via the monitor and mini-assembler), there are better tools for ...
user avatar
  • 14.1k
8 votes

In Applesoft BASIC, does combining statements into a single line speed up execution?

Yes. Replacing NEXT I with NEXT will also help. One way to evaluate this is to throw a speaker click (PEEK -16336) into the loop and listen. The faster the loop, the higher the pitch. (Then try it ...
user avatar
  • 7,411
7 votes
Accepted

How can you reset the behavior of ONERR in AppleSoft BASIC?

ZP Location 216 ($D8) holds the ONERR Flag(s) it is non-zero whenever an ONERR target is set. To reset just poke zero here. This is by the way also the recomended method to start any error handling so ...
user avatar
  • 166k
7 votes

1980's ROM used which exp(n) algorithm?

Monte Davidoff's floating point routines for early Microsoft BASIC used Chebyshev Modified Taylor series for EXP(x). There's a very helpful disassembly of the TRS-80 MC-10 ROM here: http://www.roust-...
user avatar
  • 17.1k
7 votes

Why was it common to reference memory locations using negative numbers on some BASICs?

In some BASICs integers were signed 16-bit values, so there was no integer higher than 32767. Thus, if you wanted a 16-bit value of $FFFF in an integer variable,you'd have to specify it as -1. You can ...
user avatar
  • 20k
6 votes

Apple II: Applesoft variable syntax error weirdness

This is the result of the way AppleSoft "parses" programs. From the behavior you described, I can infer that at a high level, AppleSoft executes commands in two steps: Evaluate arguments to the ...
user avatar
  • 11.3k
6 votes

Extensions to Apple BASIC with ampersands

While paxdiablo answered the question confirming that it was AppleSoft, I can point out three things related to it as an extension: When you load your extension, it should attempt to relocate itself ...
user avatar
  • 14.1k

Only top scored, non community-wiki answers of a minimum length are eligible