Neotron-Compute / Neotron-Pico-BIOS

BIOS for the Neotron Pico
GNU General Public License v3.0
15 stars 5 forks source link

Fix the colours in 4bpp mode. #112

Closed thejpster closed 3 months ago

thejpster commented 3 months ago

The interpolator was pulling out the wrong palette values - but now it's fixed.

thejpster commented 3 months ago

Although on the RP2040, it's not quite fast enough to keep up and the display flickers. The hot loop looks like this:

// Write eight pixels (32-bits) to interpolator Lane 0
str r3, [r6, #0]
// Write eight pixels (32-bits) to interpolator Lane 1
str r3, [r6, #4]
// Read palette address from Lane 0
ldr r4, [r0, #0]
// Read palette address from Lane 1
ldr r5, [r0, #4]
// Load 16-bit palette entry for left pixel
ldrh    r4, [r4, #0]
// Load 16-bit palette entry for right pixel
ldrh    r5, [r5, #0]
// Mix two pixels together
lsls    r5, r5, #16
adds    r4, r5, r4
// Write 32-bit pixel pair to scanline buffer
str r4, [r1, #0]