;------------------------------------------------------------------------------- ;@doc:file ; ; === Speed.asm === ; ; Provides methods for manipulating the speed of the calculator's CPU. ; ;@doc:end ;------------------------------------------------------------------------------- .module Speed ;------------------------------------------------------------------------------- ;@doc:routine ; ; === Speed.Reset === ; ; Reset the slow speed to 6MHz, the fast speed to 15MHz and disables the ; throttle. ; ; DESTROYED: ; REGISTERS ; * AF ; ;@doc:end ;------------------------------------------------------------------------------- Reset xor a ld (Speed.Slow),a ld (Speed.Throttler),a inc a ld (Speed.Fast),a xor a push bc jr Set ;------------------------------------------------------------------------------- ;@doc:routine ; ; === Speed.SlowDown === ; ; Throttles the CPU to its "slow" speed. ; ; DESTROYED: ; REGISTERS ; * AF. ; ;@doc:end ;------------------------------------------------------------------------------- SlowDown push bc ld a,(Speed.Throttler) inc a jr Set ;------------------------------------------------------------------------------- ;@doc:routine ; ; === Speed.SpeedUp === ; ; Allows the CPU to run at its "fast" speed. ; ; DESTROYED: ; REGISTERS ; * AF. ; ;@doc:end ;------------------------------------------------------------------------------- SpeedUp push bc ld a,(Speed.Throttler) dec a ;------------------------------------------------------------------------------- ;@doc:routine ; ; === Speed.Set === ; ; Updates the CPU speed. ; ; INPUTS: ; REGISTERS ; * A - New Speed.Throttler value. ; * F - Z set if A=0, reset otherwise. ; ; DESTROYED: ; REGISTERS ; * AF. ; ;@doc:end ;------------------------------------------------------------------------------- Set ld (Speed.Throttler),a ld a,(Speed.Slow) jr nz,+ ld a,(Speed.Fast) + ld b,a in a,(2) or a ld a,b pop bc ret p out ($20),a ret .endmodule