Page 1 of 1

Second scanline disable for double the performance:

Posted: 14 May 2018, 13:10
by at67
Disabling scanlines on the Gigatron is not just a retro feature, it's also a method to allow the vCPU interpreter and SYS function calls access to more CPU cycles.

From my initial testing disabling one extra scan line allows for 100% more vCPU and SYS cycles, (i.e. double the speed as tested by Mandlebrot taking only 10minutes to render instead of 20).

What's the catch?
1: I have only tested this in my emulator so far, but it passes with flying colours with respect to meeting video timing and compatibility with the inbuilt applications and all of the applications I have written so far.
2: You have to modify your ROM if you want to try this on real hardware, (why haven't I done it yet you ask? I'm waiting on some Ebay bits and pieces and I will update this post with my results when they arrive).

How do I modify my ROM? Well if you have an EPROM programmer and know what you are doing, you can try the following, *NOTE* I'm not responsible for anything good or bad that manifests itself as an outcome.

Code: Select all

                    .ld     $01,y       ; new $01c2 $1401
sound2a             .ld     $3f         ; old $01c3
sound2b             .adda   [$03]       ; old $01c4
                    .st     [$03]       ; old $01c5
                    .ld     [$13]       ; old $01c6
                    .bra    [$0c]       ; old $01c7
                    .ld     $c0,out     ; old $01c8
videoB              .ld     [$09]       ; new $01c9 $0109
                    .adda   $01,x       ; new $01ca $9001
                    .ld     [$0a]       ; new $01cb $010a
                    .adda   [y,x]       ; new $01cc $8d00
                    .st     [$0a]       ; new $01cd $c20a
                    .ld     videoC      ; new $01ce $00d4
                    .bra    join + 2    ; new $01cf $fcfd
                    .st     [$0c]       ; new $01d0 $c20c
                    .nop                ; new $01d1 $0200
                    .nop                ; new $01d2 $0200
                    .nop                ; new $01d3 $0200
The bytes you need to modify are all marked as new, followed by the ROM address and then the 16bit data.

Here's a video of it in action in emulation, (this video shows the old videoC disable code, the code I posted above is for disabling videoB, the performance between the two is exactly the same, videoB just looks better).
https://www.youtube.com/watch?v=TVM69DfP9CQ

Re: Second scanline disable for double the performance:

Posted: 16 May 2018, 20:03
by HGMuller
Indeed, this is a useful trick. I am working on a Chess program, and my plan was to skip 3 out of 4 lines while the program is thinking. That would still leave a recognizable chess board, and have the advantage that it would become immediately obvious when the program is done thinking, and it is your turn again.

Re: Second scanline disable for double the performance:

Posted: 17 May 2018, 01:15
by at67
Here's the code for videoC, (5 new instructions, old means unchanged), combined with the videoB code above and the fact that videoD is disabled by default; you have 3 blank scanlines. https://youtu.be/rt34cNLT-E8

Code: Select all

videoC          .ld     [$03]       ; old $01d4 $0103              
                .ora    $0f         ; old $01d5 $400f
                .anda   [$14]       ; old $01d6 $2114
                .st     [$13]       ; old $01d7 $c213
                .st     $03,[$03]   ; old $01d8 $c003
                .ld     [$0d]       ; old $01d9 $010d
                .bra    join + 2    ; new $01da $fcfd
                .st     [$0c]       ; new $01db $c20c
                .nop                ; new $01dc $0200
                .nop                ; new $01dd $0200
                .nop                ; new $01de $0200

Re: Second scanline disable for double the performance:

Posted: 17 May 2018, 10:20
by marcelk
What's the catch?
You borrowed an instruction from the sound generation that it wants back :-) The wiped out instruction helps with creating different harmonics, duty cycle etc: the 'wavA' channel modifier. Maybe also needed for making better noise waveforms (although 'wavX' could be enough for that one). After Belgrade I will dive into it deeper, there must be some way to squeeze it back in.

Re: Second scanline disable for double the performance:

Posted: 17 May 2018, 14:11
by at67
marcelk wrote: 17 May 2018, 10:20
What's the catch?
You borrowed an instruction from the sound generation that it wants back :-) The wiped out instruction helps with creating different harmonics, duty cycle etc: the 'wavA' channel modifier. Maybe also needed for making better noise waveforms (although 'wavX' could be enough for that one). After Belgrade I will dive into it deeper, there must be some way to squeeze it back in.
Haha yes for videoB I did ninja an instruction, but the videoC changes should pass inspection ;P