PCW 8256 in colour, cheap and easy

Started by czarnikjak, 14:46, 02 January 25

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

squelch41

#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)






With the scart connected to a monitor, I get



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:




fuzzweed

Silly question. Is it rgb capable monitor? Scart =/= rgb

squelch41

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 

eto

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.

fuzzweed

You can bluff that with a battery. Put 1.5v on pin 16 should do it

squelch41

#30
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 

fuzzweed

Could that be over voltage? Just googling / guessing here, but rgb select says 1-3v

Sebastian Blanco

This is super cool  :o
Don't get how you get that python code flashed on the pico ?

czarnikjak

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

czarnikjak

#34

Sebastian Blanco

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 ?.



czarnikjak

Quote from: Sebastian Blanco on Yesterday at 15:31Thanks ! 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 ?.





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)

Sebastian Blanco

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.
  


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.



czarnikjak

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. 

Sebastian Blanco

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
 


But last mission and mythos are also out of center and cut at the bottom

Token

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.

Sebastian Blanco

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.


Sebastian Blanco

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.

Powered by SMFPacks Menu Editor Mod