CPCWiki forum

General Category => NC100, NC200, PCW, PDA600 - the rest of the Family! => Topic started by: czarnikjak on 14:46, 02 January 25

Title: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 14:46, 02 January 25
This project was inspired by Habi and his work on getting a colour video output from the original PCW machines.

The only issue with his approach was that he used FPGA which i dont have and dont really want to spend the money on...

Anyway, what you will need to get this to work:


This is how it all connects:

pico.png


NSYNC, VIDEO and GND inputs come from your PCW (either from the expansion port or from the Video connector on the system board). You can also get the 5V from PCW itself.
Outputs go to your RGB monitor (I use a SCART cable breakout). The resistor values don't have to be exact to make it work...it should also work with 220 or 330 Ohms, only the intensity of the colours will vary. In this implementation I am using a CGA 4 colour palette Black/Red/Greed/Yellow hence there is no need for RGB Blue output. Personally i cant stand the Cyan/Magenta CGA palette, hence i went for the Red/Greed one, but it shouldn't be difficult to adapt it to it.

Some photos of it in action on my old Technika TV, connected via SCART:

Screenshot 2025-01-02 145150.png

Screenshot 2025-01-02 145218.png

Screenshot 2025-01-02 145125.png

Screenshot 2025-01-02 140303.png

I also added an option to switch back and forth between 4 colour and standard green on black mode with a press of the button on Pi Pico.

It does look very nice and bright, for such a chip and easy solution.

The software side on the Pi Pico is just few lines of Micropython as below (heavily relying on the outstanding PIO feature of Pi Pico):

import rp2
from machine import Pin,freq
import time

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW, rp2.PIO.OUT_LOW,rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW,rp2.PIO.IN_LOW))
def video4colour():
    wrap_target()
    wait(1,gpio,20) # wait for end of Sync pulse
    label("loop")
    out(pins,3).delay(10) # output red,green and Sync to the monitor
    in_(pins,2).delay(15) # sample 1st bit and Sync pulse then wait for 2nd pixel
    in_(pins,1) # sample 2nd bit
    mov(osr,isr).delay(2)
    jmp(pin, "loop") # jump back to Loop if still in active drawing area
    mov(osr,x)
    out(pins,3) # output all zeroes to the monitor as we are in the blanking area
    wrap()

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW,rp2.PIO.IN_LOW))
def video2colour():
    wrap_target()
    wait(1,gpio,20) # wait for end of Sync pulse
    label("loop")
    in_(pins,2) # sample video and Sync pulse
    mov(osr,isr)
    out(pins,2) # output video and Sync to the monitor
    jmp(pin, "loop") # jump back to Loop if still in active drawing area
    mov(osr,x)
    out(pins,2) # output all zeroes to the monitor as we are in the blanking area
    wrap()

freq(256000000)
colourSM = rp2.StateMachine(6, video4colour, freq=256000000,in_base=Pin(19),out_base=Pin(16),jmp_pin=Pin(20))
monoSM = rp2.StateMachine(5, video2colour, freq=128000000,in_base=Pin(19),out_base=Pin(17),jmp_pin=Pin(20))
monoSM.active(1) # start the 2 colour video initially

while True:
    if rp2.bootsel_button() ==1:  #if Bootsel button pressed then switch between colour and mono video
        colourSM.active(not colourSM.active())
        monoSM.active(not monoSM.active())
        time.sleep(1)






Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 15:42, 02 January 25
EDIT: Above post fixed with pictures now displaying correctly

Title: Re: PCW 8256 in colour, cheap and easy
Post by: 00WReX on 23:36, 02 January 25
That is really nice. Excellent work.
Thanks for sharing 👍 
Title: Re: PCW 8256 in colour, cheap and easy
Post by: luisbarna on 12:18, 10 January 25
Very interesting!!!
It would be great to be able to take advantage of this along with @Habi's board (https://www.habisoft.com/pcwwiki/doku.php?id=es:hardware:perifericos:pcw-io) to take advantage of the PCW boards that are loose.
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Sykobee (Briggsy) on 14:12, 10 January 25
That's pretty cool.

It would be nice if the button switched between different palettes (if blue is wired up eventually).

I imagine Locoscript looks a mess!
Title: Re: PCW 8256 in colour, cheap and easy
Post by: GUNHED on 16:29, 10 January 25
Cool expansion!!!  :) :) :) Just awesome!!!  :) :) :)

Can it be bought somewhere?
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 17:45, 10 January 25
Quote from: GUNHED on 16:29, 10 January 25Cool expansion!!!  :) :) :) Just awesome!!!  :) :) :)

Can it be bought somewhere?

I have no plans to create and sell a board out of it. 

Anyone is free to use this design to create their own board, i dont claim any rights for it or anything like that, and the components are all very cheap.
Title: Re: PCW 8256 in colour, cheap and easy
Post by: GUNHED on 17:11, 12 January 25
Well, if somebody is going to create this awesome expansion, please let me know. I would be interested in 2 units. Sadly I'm in time-troubles, so I can't do a batch by myself.
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 11:44, 17 January 25
Quote from: Sykobee (Briggsy) on 14:12, 10 January 25That's pretty cool.

It would be nice if the button switched between different palettes (if blue is wired up eventually).

I imagine Locoscript looks a mess!

I have wired up Blue to create 8 colour mode (optionally 16 colour with the extra diodes and resistors as shown on the additional diagram). I dont seem to be able to modify the original post, so let me put the details in here:

3 different modes are selectable by pressing the Button on Pi Pico:

1. Standard Green on Black 720x256
2. 4 colour 360x256 (Black, Red, Green, Yellow - although you can get different colours if you connect the outputs to different RGB channels of your monitor)
3. 8 colour (optionally 16) 180x256

Schematic:

rgb.png

This is the option for 16 colour wiring i found online where the Intensity pin (Y0) is also connected. I don't have space on my breadboard to test it, but its fully implemented in software, should work as expected but  the resistor values will need tweaking most likely:

16colours.png

Pi Pico code modified to support 2,4,8 and 16 colour modes:

import rp2
from machine import Pin,freq
import time

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.OUT_LOW, rp2.PIO.OUT_LOW,rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW))
def video8colour():
    wrap_target()
    wait(1,gpio,22) # wait for end of Sync pulse
    label("loop") 
    in_(pins,1).delay(15) # sample 1st bit then wait for 2nd bit
    in_(pins,1).delay(15) # sample 2nd bit
    in_(pins,1).delay(15) # sample 3rd bit
    in_(pins,1) # sample 4th bit
    mov(osr,isr).delay(0)
    out(pins,4).delay(12)
    jmp(pin, "loop") # jump back to Loop if still in active drawing area
    mov(osr,x)
    out(pins,4) # output all zeroes to the monitor as we are in the blanking area
    wrap()

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW))
def video4colour():
    wrap_target()
    wait(1,gpio,22) # wait for end of Sync pulse
    label("loop")
    in_(pins,1).delay(15) # sample 1st bit for 2nd bit
    in_(pins,1) # sample 2nd bit
    mov(osr,isr)
    out(pins,2).delay(12)
    jmp(pin, "loop") # jump back to Loop if still in active drawing area
    mov(osr,x)
    out(pins,2) # output all zeroes to the monitor as we are in the blanking area
    wrap()

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW))
def video2colour():
    wrap_target()
    wait(1,gpio,22) # wait for end of Sync pulse
    label("loop")
    in_(pins,1) # sample video
    mov(osr,isr)
    out(pins,1).delay(4) # output video
    jmp(pin, "loop") # jump back to Loop if still in active drawing area
    mov(osr,x)
    out(pins,1) # output
    wrap()

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW))
def sync():
    wrap_target()
    in_(pins,1) # sample Sync pulse
    mov(osr,isr)
    out(pins,1) # output Sync to the monitor
    wrap()

freq(256000000)

colourSM = rp2.StateMachine(7, video4colour, freq=256000000,in_base=Pin(21),out_base=Pin(17),jmp_pin=Pin(22))
monoSM = rp2.StateMachine(5, video2colour, freq=128000000,in_base=Pin(21),out_base=Pin(17),jmp_pin=Pin(22))
fullcolourSM = rp2.StateMachine(6, video8colour, freq=256000000,in_base=Pin(21),out_base=Pin(16),jmp_pin=Pin(22))
syncSM = rp2.StateMachine(4, sync, freq=256000000,in_base=Pin(22),out_base=Pin(20))
syncSM.active(1) # start the Sync video initially
monoSM.active(1) # start the 2 colour video initially

current_mode = 0

while True:
    if rp2.bootsel_button() == 1:  # if Bootsel button pressed then switch between video modes
        current_mode = (current_mode + 1) % 3
       
        if current_mode == 0:
            fullcolourSM.active(1)
            colourSM.active(0)
            monoSM.active(0)
        elif current_mode == 1:
            fullcolourSM.active(0)
            colourSM.active(1)
            monoSM.active(0)
        elif current_mode == 2:
            fullcolourSM.active(0)
            colourSM.active(0)
            monoSM.active(1)
       
        time.sleep(1)



Finally, as screenshot from 16 colour game Astro Marine Corps (https://www.habisoft.com/pcwwiki/doku.php?id=es:nuevos:amc (https://www.habisoft.com/pcwwiki/doku.php?id=es:nuevos:amc)) displayed using 8 colour mode:

amc8colour.png 
Title: Re: PCW 8256 in colour, cheap and easy
Post by: GUNHED on 00:00, 18 January 25
This is so cool!  :) :) :)
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Gryzor on 09:09, 24 January 25
Who'd have thought!...
Title: Re: PCW 8256 in colour, cheap and easy
Post by: dodogildo on 18:05, 24 January 25
This is amazing..
Title: Re: PCW 8256 in colour, cheap and easy
Post by: squelch41 on 23:34, 05 April 25
I'm havign real problems getting this to work with micropython - for some reason my pi pico (usb-c) board wont work with micropython after 1.14 and it seems this is too old to have the required libraries.

Does anyone have it as a compiled .uf2 to just upload to a pico?
Title: Re: PCW 8256 in colour, cheap and easy
Post by: squelch41 on 14:52, 06 April 25
Quote from: squelch41 on 23:34, 05 April 25I'm havign real problems getting this to work with micropython - for some reason my pi pico (usb-c) board wont work with micropython after 1.14 and it seems this is too old to have the required libraries.

Does anyone have it as a compiled .uf2 to just upload to a pico?
Solved it - had to compile with 1.22 - the 1.24 kept saying memory alignment error.

Here it is if anyone needs it:
(I dont think this forum supports direct attachments?)

https://www.dropbox.com/scl/fi/86331yoizp6q1qmx2vh5f/pcw-colour.uf2?rlkey=xqkybd9teew6hlflufr2pfw7u&st=f9mg85kv&dl=0

Title: Re: PCW 8256 in colour, cheap and easy
Post by: Amagni on 01:40, 07 April 25
I'm not too familiar with the PCW video output, does it have 4 brightness levels like the Gameboy, or is it taking in pairs of adjacent pixels and treating them as a 2-bit number?

Does it work with regular PCW software or are you modifying those games in some way?
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 08:40, 07 April 25
Quote from: Amagni on 01:40, 07 April 25I'm not too familiar with the PCW video output, does it have 4 brightness levels like the Gameboy, or is it taking in pairs of adjacent pixels and treating them as a 2-bit number?

Does it work with regular PCW software or are you modifying those games in some way?
The system here treats 2 pixels as 2 bit number.

Most games just work unmodified as graphics were ported from cga or cpc.
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Amagni on 10:43, 07 April 25
Quote from: czarnikjak on 08:40, 07 April 25
Quote from: Amagni on 01:40, 07 April 25I'm not too familiar with the PCW video output, does it have 4 brightness levels like the Gameboy, or is it taking in pairs of adjacent pixels and treating them as a 2-bit number?

Does it work with regular PCW software or are you modifying those games in some way?
The system here treats 2 pixels as 2 bit number.

Most games just work unmodified as graphics were ported from cga or cpc.
That's awesome!
I need to order a Rpi Pico, then I'm definitely trying it out!
Title: Re: PCW 8256 in colour, cheap and easy
Post by: squelch41 on 18:12, 08 April 25
turns out using an alie
Quote from: squelch41 on 23:34, 05 April 25I'm havign real problems getting this to work with micropython - for some reason my pi pico (usb-c) board wont work with micropython after 1.14 and it seems this is too old to have the required libraries.

Does anyone have it as a compiled .uf2 to just upload to a pico?
Turns out using an aliexpress pi pico was the issue! used a pimoroni one and fine!

Title: Re: PCW 8256 in colour, cheap and easy
Post by: fuzzweed on 07:32, 04 May 25
Quote from: czarnikjak on 11:44, 17 January 25I have wired up Blue to create 8 colour mode (optionally 16 colour with the extra diodes and resistors as shown on the additional diagram). I dont seem to be able to modify the original post, so let me put the details in here:

3 different modes are selectable by pressing the Button on Pi Pico:

Schematic:

rgb.png

This is the option for 16 colour wiring i found online where the Intensity pin (Y0) is also connected. I don't have space on my breadboard to test it, but its fully implemented in software, should work as expected but  the resistor values will need tweaking most likely:

16colours.png


Hi just checking: is this schematic/ code working for scart or VGA or both?
Title: Re: PCW 8256 in colour, cheap and easy
Post by: squelch41 on 13:30, 29 May 25
Quote from: fuzzweed on 07:32, 04 May 25
Quote from: czarnikjak on 11:44, 17 January 25I have wired up Blue to create 8 colour mode (optionally 16 colour with the extra diodes and resistors as shown on the additional diagram). I dont seem to be able to modify the original post, so let me put the details in here:

3 different modes are selectable by pressing the Button on Pi Pico:

Schematic:

rgb.png

This is the option for 16 colour wiring i found online where the Intensity pin (Y0) is also connected. I don't have space on my breadboard to test it, but its fully implemented in software, should work as expected but  the resistor values will need tweaking most likely:

16colours.png


Hi just checking: is this schematic/ code working for scart or VGA or both?
It's 15kHz output - works for SCART. 
I'd imagine would also work if you have a 15kHz capable vga monitor, but obviously, most don't support that scan rate
Title: Re: PCW 8256 in colour, cheap and easy
Post by: fuzzweed on 13:45, 29 May 25
Ah OK. It was just the different pin labelling on the two schematics that confused me. Could a pico not manage 30k?
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 14:02, 29 May 25
Quote from: fuzzweed on 13:45, 29 May 25Ah OK. It was just the different pin labelling on the two schematics that confused me. Could a pico not manage 30k?
Pico could. But the signal coming from PCW is not. I'm doing minimal processing here, for example the Sync signal is just passed through.

For VGA you would need to create your own SYNC timing and fit the pixel data coming from PCW into it. All Doable, but more complicated than this simple example.
Title: Re: PCW 8256 in colour, cheap and easy
Post by: fuzzweed on 14:12, 29 May 25
Great stuff. Thanks for the info 
Title: Re: PCW 8256 in colour, cheap and easy
Post by: squelch41 on 21:59, 01 June 25
I'm struggling to get this working properly - 

I get video fine from the pico but if I run anything with grey scales eg head over heels, I cant see anything other than the bright white text. In the game, I can see the play character but not the lives or the pattern on the floor.

This is the same for any of the colour modes.

I've use 270ohm resistors on RGB, 1k on sync and 100ohm on RGB blanking.

Even if I bypass the resistors, the problem remains.

What am I doing wrong?
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 09:53, 03 June 25
Quote from: squelch41 on 21:59, 01 June 25I'm struggling to get this working properly -

I get video fine from the pico but if I run anything with grey scales eg head over heels, I cant see anything other than the bright white text. In the game, I can see the play character but not the lives or the pattern on the floor.

This is the same for any of the colour modes.

I've use 270ohm resistors on RGB, 1k on sync and 100ohm on RGB blanking.

Even if I bypass the resistors, the problem remains.

What am I doing wrong?
Hard to diagnose remotely, I would check first if you are getting voltages from all R G B pins on the pico. Display something with all white pixels on the screen and check voltages on the pico output pins. But if you are getting white text I would expect it to work.

Also in normal 2 colour mode boot to cpm and see if text is green, then and try connecting G output from pico to R input on your RGB lead, see if you are getting red text, and try the same with B input as well to see if the text is blue. This should test all 3 channels.
Title: Re: PCW 8256 in colour, cheap and easy
Post by: squelch41 on 16:04, 03 June 25
Quote from: czarnikjak on 09:53, 03 June 25
Quote from: squelch41 on 21:59, 01 June 25I'm struggling to get this working properly -

I get video fine from the pico but if I run anything with grey scales eg head over heels, I cant see anything other than the bright white text. In the game, I can see the play character but not the lives or the pattern on the floor.

This is the same for any of the colour modes.

I've use 270ohm resistors on RGB, 1k on sync and 100ohm on RGB blanking.

Even if I bypass the resistors, the problem remains.

What am I doing wrong?
Hard to diagnose remotely, I would check first if you are getting voltages from all R G B pins on the pico. Display something with all white pixels on the screen and check voltages on the pico output pins. But if you are getting white text I would expect it to work.

Also in normal 2 colour mode boot to cpm and see if text is green, then and try connecting G output from pico to R input on your RGB lead, see if you are getting red text, and try the same with B input as well to see if the text is blue. This should test all 3 channels.


Thanks - I'm getting red, green and blue output and the mode switch works.
When I 'scope the pins I get quite low voltages -
This is without anything connected to the pico, just the values after the resistors:

(Yellow is the green channel, blue is the sync pin - all taken on the head over heels start screen)


(https://www.cpcwiki.eu/forum/index.php?action=dlattach;attach=45355;image)



With the scart connected to a monitor, I get
(https://www.cpcwiki.eu/forum/index.php?action=dlattach;attach=45357;image)


I thought that if I bypassed the resistors, that might help but it doesnt make any difference.

This is the Head over Heels start screen as a photo of the monitor:
(https://www.cpcwiki.eu/forum/index.php?action=dlattach;attach=45359;image)


Title: Re: PCW 8256 in colour, cheap and easy
Post by: fuzzweed on 18:25, 03 June 25
Silly question. Is it rgb capable monitor? Scart =/= rgb
Title: Re: PCW 8256 in colour, cheap and easy
Post by: squelch41 on 18:38, 03 June 25
Quote from: fuzzweed on 18:25, 03 June 25Silly question. Is it rgb capable monitor? Scart =/= rgb
Hehe, yes :) 
Tried on my SCART scaler that I use for megadrive, snes etc with RGB scart cables and a Sony LCD TV which has a couple of other rgb scarted consoles 
Title: Re: PCW 8256 in colour, cheap and easy
Post by: eto on 18:46, 03 June 25
Quote from: squelch41 on 18:38, 03 June 25
Quote from: fuzzweed on 18:25, 03 June 25Silly question. Is it rgb capable monitor? Scart =/= rgb
Hehe, yes :)
Tried on my SCART scaler that I use for megadrive, snes etc with RGB scart cables and a Sony LCD TV which has a couple of other rgb scarted consoles

Does the cable you use with the PCW have a voltage on the RGB detect pin? 

That's a common issue on the CPC that the TVs don't switch to RGB mode.
Title: Re: PCW 8256 in colour, cheap and easy
Post by: fuzzweed on 19:03, 03 June 25
You can bluff that with a battery. Put 1.5v on pin 16 should do it
Title: Re: PCW 8256 in colour, cheap and easy
Post by: squelch41 on 19:35, 03 June 25
Quote from: eto on 18:46, 03 June 25
Quote from: squelch41 on 18:38, 03 June 25
Quote from: fuzzweed on 18:25, 03 June 25Silly question. Is it rgb capable monitor? Scart =/= rgb
Hehe, yes :)
Tried on my SCART scaler that I use for megadrive, snes etc with RGB scart cables and a Sony LCD TV which has a couple of other rgb scarted consoles

Does the cable you use with the PCW have a voltage on the RGB detect pin?

That's a common issue on the CPC that the TVs don't switch to RGB mode.
Yes, it's in the schematic - 3.3v taken from the pico at pin 36.

I'm getting RGB as all the colours are visible - it just seems to either not be sampling the pcw signal correctly (so detecting the grays as black) or not outputting a strong enough signal to the scart (so essentially it is compressing down the levels) but I'm not sure which. 

Or, it's something else that I am missing as a novice with analog video 
Title: Re: PCW 8256 in colour, cheap and easy
Post by: fuzzweed on 19:39, 03 June 25
Could that be over voltage? Just googling / guessing here, but rgb select says 1-3v
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Sebastian Blanco on 03:06, 03 August 25
This is super cool  :o
Don't get how you get that python code flashed on the pico ?
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 11:02, 03 August 25
Quote from: Sebastian Blanco on 03:06, 03 August 25This is super cool  :o
Don't get how you get that python code flashed on the pico ?
You flash Micropython. And just copy the code into your main.py
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 11:14, 03 August 25
Some talented people created a pcb for it, Gerber files are available.

https://www.va-de-retro.com/foros/viewtopic.php?style=7&t=13722&start=20

https://www.va-de-retro.com/foros/viewtopic.php?p=212819#p212819
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Sebastian Blanco on 15:31, 04 August 25
Thanks ! this was so easy and works great the 4 color mode is amazing :D
Is possible to solder a button so the palete switch could be activated and don't have to open the computer case ?.


(https://i.ibb.co/cSdVV9Nf/Whats-App-Image-2025-08-04-at-02-01-03-80c68166.jpg) (https://ibb.co/tT5FF6bj)
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 17:31, 04 August 25
Quote from: Sebastian Blanco on 15:31, 04 August 25Thanks ! this was so easy and works great the 4 color mode is amazing :D
Is possible to solder a button so the palete switch could be activated and don't have to open the computer case ?.


(https://i.ibb.co/cSdVV9Nf/Whats-App-Image-2025-08-04-at-02-01-03-80c68166.jpg) (https://ibb.co/tT5FF6bj)


Yes, this is not a problem. If you follow this link for the PCB, https://www.va-de-retro.com/foros/viewtopic.php?p=212819#p212819 there is also slightly modified version of the code where GPIO28 is also checked to switch the mode (grounding GPIO28 switches the mode)
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Sebastian Blanco on 19:46, 04 August 25
Thanks, ended up finding about the pint TP6 can be used to solder a switch that work like the top one.

Now after some game testing find an issue in how the picture is display.

For example on CP/M and astromarine corps the screen is centered and looks fine.
(https://i.ibb.co/QF89sPn3/IMG-20250804-WA0013.jpg) (https://ibb.co/QF89sPn3)   (https://i.ibb.co/C3HLHr5z/IMG-20250804-WA0016.jpg) (https://ibb.co/C3HLHr5z)


But in other games like soviet last ninja 2,the screen is cut at the bottom and the image starts much 
lower.
Using composite they look fine.

(https://i.ibb.co/Fbp6Zf5D/IMG-20250804-WA0014.jpg) (https://ibb.co/Fbp6Zf5D)(https://i.ibb.co/Psb87CfK/IMG-20250804-WA0015.jpg) (https://ibb.co/Psb87CfK)(https://i.ibb.co/FbkKzMQx/Whats-App-Image-2025-08-04-at-15-43-26-53a2a5b7.jpg) (https://ibb.co/FbkKzMQx)
Title: Re: PCW 8256 in colour, cheap and easy
Post by: czarnikjak on 20:01, 04 August 25
Oh, that's weird. I've tested many games and didn't see this behaviour (not tested this particular games mind you).

Can't think of top of my head what could be the problem. 
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Sebastian Blanco on 20:35, 04 August 25
Is kinda weird just in case change from the Sony TV to a monitor but results are the same.
Sested some more games.

sabrewolf, madmix,pacmania all work fine centered image no parts cut
(https://i.ibb.co/dwGDf2gc/IMG-20250804-WA0021.jpg) (https://ibb.co/dwGDf2gc) (https://i.ibb.co/TDsqrgRD/IMG-20250804-WA0022.jpg) (https://ibb.co/TDsqrgRD) (https://i.ibb.co/Jw0ySbWb/IMG-20250804-WA0023.jpg) (https://ibb.co/Jw0ySbWb) (https://i.ibb.co/LDttcwCm/IMG-20250804-WA0028.jpg) (https://ibb.co/LDttcwCm)


But last mission and mythos are also out of center and cut at the bottom
(https://i.ibb.co/KpMsBjkb/IMG-20250804-WA0024.jpg) (https://ibb.co/KpMsBjkb) (https://i.ibb.co/wN5zZ2hZ/IMG-20250804-WA0025.jpg) (https://ibb.co/wN5zZ2hZ) (https://i.ibb.co/yFvkLcpw/IMG-20250804-WA0026.jpg) (https://ibb.co/yFvkLcpw) (https://i.ibb.co/Q75LggHD/IMG-20250804-WA0027.jpg) (https://ibb.co/Q75LggHD)
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Token on 21:16, 04 August 25
Different cause, but I had a similar screen issue during the last mission when I connected the mainboard to a GT64. I had to add a resistor somewhere because the signal was too strong. I don't remember if it was on the sync or RGB lines.
Title: Re: PCW 8256 in colour, cheap and easy
Post by: Sebastian Blanco on 02:46, 05 August 25
Seems to be some kind of issue on the Pico, if the computer is turn on or reset and the input (pin 29 NSYNC) signal is not connected. And is connected a couple of seconds later after reset or power on, the display looks ok in all games.

Title: Re: PCW 8256 in colour, cheap and easy
Post by: Sebastian Blanco on 04:34, 05 August 25
Managed to fix this issue by adding a 2 second delay that keep the (pin 29 nsync) high at the beggining.  
# main.py
import rp2
from machine import Pin,freq
import time
#
# Set up GPIO 22 (pin 29) as output
pin22 = Pin(22, Pin.OUT)

# Set GPIO 22 high
pin22.value(1)
print("GPIO 22 is HIGH")

# Wait 2 seconds
time.sleep(2)

# Set GPIO 22 low
pin22.value(0)
print("GPIO 22 is LOW — done.")
pin22.init(Pin.IN)  # Release control of the pin
#

fDebouncingDelay = 0.18
led = Pin(25, Pin.OUT)
mode_button = Pin(28, Pin.IN, Pin.PULL_UP)

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.OUT_LOW, rp2.PIO.OUT_LOW,rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW))
def video8colour():
  wrap_target()

  # wait for end of Sync pulse
  wait(1,gpio,22)
  label("loop")

  # sample 1st bit then wait for 2nd bit
  in_(pins,1).delay(15)
  in_(pins,1).delay(15) # sample 2nd bit

  # sample 3rd bit
  in_(pins,1).delay(15)
  in_(pins,1) # sample 4th bit
  mov(osr,isr).delay(0)
  out(pins,4).delay(12)

  # jump back to Loop if still in active drawing area
  jmp(pin, "loop")
  mov(osr,x)

  # output all zeroes to the monitor as we are in the blanking area
  out(pins,4)
  wrap()

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW))
def video4colour():
  wrap_target()

  # wait for end of Sync pulse
  wait(1,gpio,22)
  label("loop")

  # sample 1st bit for 2nd bit
  in_(pins,1).delay(15)
  in_(pins,1) # sample 2nd bit
  mov(osr,isr)
  out(pins,2).delay(12)

  # jump back to Loop if still in active drawing area
  jmp(pin, "loop")
  mov(osr,x)

  # output all zeroes to the monitor as we are in the blanking area
  out(pins,2)
  wrap()

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW))
def video2colour():
  wrap_target()

  # wait for end of Sync pulse
  wait(1,gpio,22)
  label("loop")

  # sample video
  in_(pins,1)
  mov(osr,isr)

  # output video
  out(pins,1).delay(4)
  jmp(pin, "loop") # jump back to Loop if still in active drawing area
  mov(osr,x)

  # output
  out(pins,1)
  wrap()

@rp2.asm_pio(out_shiftdir=1,out_init=(rp2.PIO.OUT_LOW,rp2.PIO.IN_LOW))
def sync():
  wrap_target()

  # sample Sync pulse
  in_(pins,1)
  mov(osr,isr)

  # output Sync to the monitor
  out(pins,1)
  wrap()

freq(256000000)

colourSM = rp2.StateMachine(7, video4colour, freq=256000000,in_base=Pin(21),out_base=Pin(17),jmp_pin=Pin(22))
monoSM = rp2.StateMachine(5, video2colour, freq=128000000,in_base=Pin(21),out_base=Pin(17),jmp_pin=Pin(22))
fullcolourSM = rp2.StateMachine(6, video8colour, freq=256000000,in_base=Pin(21),out_base=Pin(16),jmp_pin=Pin(22))
syncSM = rp2.StateMachine(4, sync, freq=256000000,in_base=Pin(22),out_base=Pin(20))

# start the Sync video initially
syncSM.active(1)

# start the 2 colour video initially
monoSM.active(1)

current_mode = 0

while True:

  # if BOOTSEL or GPIO#28 button is pressed then switch between video modes
  if rp2.bootsel_button() or not mode_button.value():

    current_mode = (current_mode + 1) % 3

    if current_mode == 0:
      fullcolourSM.active(1)
      colourSM.active(0)
      monoSM.active(0)
    elif current_mode == 1:
      fullcolourSM.active(0)
      colourSM.active(1)
      monoSM.active(0)
    elif current_mode == 2:
      fullcolourSM.active(0)
      colourSM.active(0)
      monoSM.active(1)

    for i in range(current_mode+1):

      # switch on Pico LED
      led.on()

      # delay
      time.sleep(fDebouncingDelay)

      # switch off Pico LED
      led.off()

      # delay
      time.sleep(fDebouncingDelay)

Of course this works if the computer is power off and on that do the same to the pico.

But if i reset using a button hardwired to the z80 it will not activate, have to finde something for that.
(https://i.ibb.co/mV9cKFfM/IMG-20250805-WA0001.jpg) (https://ibb.co/mV9cKFfM) (https://i.ibb.co/cc7P8tpK/IMG-20250805-WA0002.jpg) (https://ibb.co/cc7P8tpK) (https://i.ibb.co/Q3qqqXCn/IMG-20250805-WA0003.jpg) (https://ibb.co/Q3qqqXCn) (https://i.ibb.co/ZzgpX03h/IMG-20250805-WA0004.jpg) (https://ibb.co/ZzgpX03h) (https://i.ibb.co/2Yg4xBVV/IMG-20250805-WA0005.jpg) (https://ibb.co/2Yg4xBVV) (https://i.ibb.co/FLdHnMrs/IMG-20250805-WA0006.jpg) (https://ibb.co/FLdHnMrs)
Title: Re: PCW 8256 in colour, cheap and easy
Post by: ZorrO on 19:47, 05 August 25
Is there an emulator that can show PCW in color?
Title: Re: PCW 8256 in colour, cheap and easy
Post by: robcfg on 22:14, 05 August 25
But, of course!  ;D
https://habisoft.com/pcw/en.htm
Powered by SMFPacks Menu Editor Mod