Login
Back to forumReply to this topicGo to last reply

Posted By

Caruso, Fabrizio
on 2019-10-31
04:05:23
 cpu speed ntsc double clock blank

I am trying to figure out how and what sets the CPU speed.
Which code in BASIC is setting the CPU speed higher on the borders?
If I explode the kernal by changing the $FFFE pointer, do I still get this in my Assembly programs if I do nothing?

From the Ultimate Map 2.0 I see that 3 bits in $ff06, $ff07, $ff13 can be exploited.
I am doing this through raster interrupts on the border but I see no speed up:
https://github.com/Fabrizio-Caruso/C264_C_LIB/blob/master/src/double_turbo.s
where I do something like:

.IF .DEFINED(BLANK_SCREEN)
; Show screen
LDA TED_CTRL1
ORA #$10
STA TED_CTRL1
.ENDIF

.IF .DEFINED(NTSC_MODE_TRICK)
; Set PAL mode
LDA TED_MULTI1
AND #($FF - $40)
;LDA #$08
STA TED_MULTI1
.ENDIF

.IF .DEFINED(DOUBLE_CLOCK)
; Disable double clock
LDA TED_CLK
ORA #$02
;LDA #210
STA TED_CLK
.ENDIF

I am also trying to measure speed the raster interrupt screws the timer I use...

Which emulator should I use for these tests? Is Yape good enough? Does it emulate correctly double clock, blank and ntsc settings on pal models?

Posted By

gerliczer
on 2019-10-31
05:22:35
 Re: cpu speed ntsc double clock blank

If you have an NTSC machine then border is the fastest. You may gain speed with increasing the border in raster interrupts or turning off screen completely. No trickery will make it run any faster.

If you have a PAL machine then border is fastest. Speed gain can be achieved as above. Setting TED to run in NTSC mode will make it even faster but there will be no picture.

Posted By

Caruso, Fabrizio
on 2019-10-31
05:42:44
 Re: cpu speed ntsc double clock blank

@gerliczer, I see no speed up in my test:
https://github.com/Fabrizio-Caruso/C264_C_LIB/blob/master/demos/double_turbo_test.c
and I am not sure it is because of Yape inaccuracy or because maybe I am keeping the Kernal active and so the no speed-up case is sped up anyway by some Kernal routines.

@gerliczer BASIC already does some of this for me. Do I need set double clock on the border on any Assembly program or is the Kernal taking care of it?

Posted By

gerliczer
on 2019-10-31
08:31:22
 Re: cpu speed ntsc double clock blank

Unmodified KERNAL initializes TED in double clock mode. You don't have to do anything. Turning off double clock mode will slow down the machine.

Keep $FF13 bit 1 zero. Don't touch $FF07 bit 5 ever, keep it zero. If you need more speed turn off screen with setting bit 4 in $FF06 to zero.

YAPE is accurate enough. If you don't see what you expect you either have the wrong idea or your program needs debugging.

Posted By

Caruso, Fabrizio
on 2019-10-31
08:50:36
 Re: cpu speed ntsc double clock blank

What does the double clock bit do? Does it set double clock when on the borders? What switches the clock to double and when exactly? Is the kernal setting a raster interrupt that switches the double clock?
Is it used directly by the hardware or by the kernal?
If I do NOT use the kernal, will the double clock be used?
What I don't understand is what reads this bit. The hardware alone? Some portion of the kernal?

I do not use bit 5 of $FF07, instead I set bit 6 of $ff07 to set NTSC mode on PAL machines. This read that this can produce a 2,1mhz clock (see Ultimate Map 2.0).

Posted By

gerliczer
on 2019-10-31
11:11:09
 Re: cpu speed ntsc double clock blank

The double clock bit enables TED to run the CPU at high clock speed. If you turn double clock on TED automatically doubles the speed (~1.7 MHz) in the borders. If you turn it off TED is continuously slows down the processor with low clock (~0.9 Mhz), no matter if in the display area or in the border. Clock speed switching needs no intervention on the running program's part.

I do know what happens on a PAL machine when you switch it to NTSC standard.

This may help: http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/plus4/Plus_4_Technical_Docs.pdf



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024