52

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 Integer BASIC, in turn derived from Apple I BASIC, which had been independently created by The Woz. Integer BASIC supported only 16-Bit signed integers as a ...


39

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 PC (including Microsoft BASIC), the use of LET was optional. Later standards in BASIC often required that the keyword be supported, but since there was no ...


33

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 / Extended RAM 8 / 8 kB $D000-DFFF - BASIC ROM / RAM bank 1 & 2 4 / 4 / 4 kB $C800-CFFF - Shared slot ROM memory 2 kB $C100-C7FF - Permanent ...


19

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 a character from the input buffer and moves the cursor left. The right arrow adds the character at the cursor position to the input buffer and moves the ...


18

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, so LET was needed in order to write a variable assignment (although there were unofficial patches to the ROM that eliminated that requirement). In fact, and ...


16

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 PET to see some of the problems that the tokeniser can cause. For example LET AFOR=ONER gets parsed as LET A FOR = ON ER Which is very difficult to see on a ...


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 ...


14

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 book has even more detail.) Apple II (1977) APPLESOFT I, based on Microsoft 6502 BASIC version 1.1 Documented in the November 1977 "Blue Book" Available on tape ...


12

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 straightforward, you can find Applesoft-ish line drawing in fdraw. Some commentary on how Applesoft's line drawing code sets bits on the hi-res screen can be found ...


12

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 — for Windows. Further to Thorbjørn Ravn Andersen's comment, I can confirm that Applesoft BASIC in JavaScript runs quite happily from a standalone local ...


11

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 value of zero. So when HPLOT is used in this manner, it draws on "graphics page zero" from $0000-1FFF, and writes a string of bytes across the zero page and ...


11

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 if you did a LIST command. In general, this gives you all the rules of AppleSoft formatting but in the form of a program :-) 0 REM ** DISASSEMBLE MYSELF 1 ...


10

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 of a particular frequency. There is no way to turn off this functionality using software. The easiest way is to pull the jumper connecting the speaker to the ...


9

The paddles and joysticks on the Apple work by charging a capacity through a variable resistance (potentiometer). For the first joystick, the X-axis corresponds to paddle 0, and the Y-axis to paddle 1, and similarly for the second joystick. Accessing address $C070 discharges all capacities, so they can now charge with a speed that is determined by the ...


8

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 with SP=-16336 outside the loop and PEEK SP in the loop, and note the effect that has...)


8

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 they start with a letter and do not contain any reserved words. Because the code for listing programs adds spaces before and after recognized tokens, typing a ...


8

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 this. Specifically, I was a big fan of GPLE from Beagle Bros. back in the day. The main problem that you run into with the screen editing method is that the ...


7

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-it.dk/coco/mc10/romlist.txt. It's 6800 assembly, and the whole commented routine (using the same constants) is: TBLF59B FCB $81,$38,$AA,$3B,$29 ;1.44269504 (...


7

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 89ABCDEF0123456789ABCDEF 0123456789ABCDEF 0 ... ... 6 +------------------------+----------------+--------------+ |Basic:::::::::::::::::::|::: HGR | | |Program::...


7

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 see this in Commodore 64 BASIC V2: X%=32767 READY X%=32768 ?ILLEGAL QUANTITY ERROR That said, the C64 SYS didn't actually take an integer parameter; it ...


6

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 an Error within the errorhandler will not cause any deadlock. So your Programm might look like this: 10 ONERR GOTO 100 20 POKE 0, 400 : REM INVALID VALUE ...


5

The AppleSoft BASIC Wikipedia page has quite a bit of info on this: Not really a feature, but the RAM footprint changed between the 1 & 2. AppleSoft I - 8.5 kb AppleSoft II - 10 kb AppleSoft I had these features over the "Integer BASIC" (which Woz had written): Atomic strings: A string is no longer an array of characters (as in Integer BASIC and ...


5

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 command (if any) Execute command "sagdgg" has no arguments so step 1 is skipped, then in step 2 AppleSoft discovers that there is no such command as "sagdgg" and ...


5

The routines are documented in the Programmers Aid #1 manual https://archive.org/details/programmers-aid-1/page/n81 These are basically the same as the ones in the Applesoft ROM. They might use different zero page locations and won't handle floating point numbers but they are the same algorithms.


5

10 input "some question?"; name$ Will be reformatted as: 10 INPUT "some question?" ; NAME$ That's not quite right (confirmed just now with an emulator). It will be reformatted as: 10 INPUT "some question?";NAME$ i.e. there are no spaces before and after the semicolon. You can see what the formatting algorithm looks like in C++ in this ...


4

Not a book but a (relatively) current website, with lesson plans, in AppleSoft BASIC: 20 lessons to teach your 12-year old how to start programming


4

What are the rules for Applesoft BASIC formatting for code? The most basic thein to know is that there is no source code in the sense of plain text files. Only the tokenized basic lines. When listing a programm. The tokens get converted back to their (uppercase) keywords with spaces being added after each. This even adds some quirks when using screen ...


4

The comma syntax does not work in Commodore BASIC, neither on the PET (Commodore BASIC V4.0), nor on C64 (Commodore BASIC V2.0), C16/116 (Commodore BASIC V3.5) or Commodore 128 (Commodore BASIC V7.0). Using a construction like INPUT "ENTER SOMETHING",A$ yields a SYNTAX ERROR. There are however other ways to suppress the question mark prompt on a C64, see the ...


3

(Warning, all from Memory without checking any manual) AFAI read the question, you're using an Apple II with highres graphics from BASIC and did run into memory problems - usually by interference of BASIC memory management with the graphics location. You 'solved' it (well, not rally) by moving to page two, but now you can't write any text. Problem #1 Text ...


3

It’s been a while but... MS BASIC used “ON ERROR GOTO” as opposed to “ONERR GOTO”, and using a line number of 0 outside of the error handling code reset it to the non-trapped default behavior. In AppleSoft BASIC, you had to POKE 216,0 to reset to the default handler.


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