Apple IIGS: Controlling speed mode from machine language

In the Configuration Register, CYAREG, at location $C036, the bit to control
is the high bit: setting it to 0 will set the normal mode and setting it to 1
will put the Apple IIGS in fast mode. The following machine language program
shows how to use the bit.

300: lda C036
303: jsr FDDA ;print the value of the memory location
306: jsr 0318 ;wait a little while
309: lda C036 ;now swap the speed mode
30C: eor #80
30E: sta C036
311: jsr FDDA ;and show how it changed
314: jsr 0318 ;wait again, to show the speed difference
317: rts

318: ldx #00 ;this is a wait routine that will pause for 8 seconds
31A: ldy #00 ;in fast mode, and 19 seconds in normal mode
31C: jsr 031F
31F: jsr 0322
322: jsr 0325
325: jsr 0328
328: jsr 032B
32B: jsr 032E
32E: dex
32F: bne 032E
331: dey
332: bne 032E
334: rts

This program will print the value of CYAREG, pause a while, flip the speed,
print the new value of CYAREG, and wait again. The speed difference is very
apparent.

Take note that speed control under AppleSoft may be very difficult, if not
impossible. Many firmware routines need the speed mode changed, so they often
save the previous mode on the stack and then set the required speed mode. In
this case, if you set the speed from AppleSoft or directly from the monitor,
the speed mode will get set back to its default value (as specified in the
Control Panel).

However, if you set the speed from a machine language program, the speed
should remain the same for as long as that program maintains control.

Published Date: Feb 18, 2012