While I was writing a program on an Apple IIe, I set up access the graphics page using softswitches, and then tried to draw on it, but the system crashed so hard I had to do a Control - Open Apple - Reset reboot to get out of it. What happened?

Boot DOS 3.3

10 POKE -16304,0: POKE -16301,0: POKE -16297,0: POKE -16300,0
20 HCOLOR = 3
30 HPLOT 0,0 TO 279,159

** CRASH to monitor **
Control-C to return to BASIC

Each time RETURN is pressed, it says ?SYNTAX ERROR

Press Control-Reset
Doesn't help, still says ?SYNTAX ERROR when RETURN is pressed

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 the stack, which then totally corrupts the system state.

If you use HPLOT like this without showing the hi-res graphics page 1, you will also see a slanted line of characters appear across the text screen, as it proceeds to corrupt everything in the first 8 kilobytes of memory.

If you want to draw on Hi-Res page 1 without clearing it first, use POKE 230, 32

To draw on Hi-Res page 2 without clearing it first, use POKE 230, 64

It is possible to use a hidden Hi-Res page 3 to store an image, at $6000-7FFF using POKE 230,96 ... any higher than this is not usable since DOS 3.3 normally starts at $9600.

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.