General Stuff(tm)

Blogs & guides and tales of woo by forum members.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7380
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Last night, after looking at the docs again I realised that (a) I needed to pass through to the Pico another address line, and (b) I'd confused myself by numbering the address lines differently on my RAM board to the main system (as it's a 16 bit system with only word access I made the system"A1" to be "A0" on the RAM board).

Schematic updated (and GAL code written).
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
rubber_jonnie
Site Admin
Site Admin
Posts: 14905
Joined: 17 Aug 2017 19:40
Location: Essex

Re: General Stuff(tm)

Post by rubber_jonnie »

stephen_usher wrote: 08 Dec 2022 11:14 Last night, after looking at the docs again I realised that (a) I needed to pass through to the Pico another address line, and (b) I'd confused myself by numbering the address lines differently on my RAM board to the main system (as it's a 16 bit system with only word access I made the system"A1" to be "A0" on the RAM board).

Schematic updated (and GAL code written).

Sounds like good progress so far :)
Collector of many retro things!
800XL and 65XE both with Ultimate1MB,VBXL/XE & PokeyMax, SIDE3, SDrive Max, 2x 1010 cassette, 2x 1050 one with Happy mod, 3x 2600 Jr, 7800 and Lynx II
Approx 20 STs, including a 520 STM, 520 STFMs, 3x Mega ST, MSTE & 2x 32 Mhz boosted STEs
Plus the rest, totalling around 50 machines including a QL, 3x BBC Model B, Electron, Spectrums, ZX81 etc...
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7380
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

rubber_jonnie wrote: 08 Dec 2022 11:16
stephen_usher wrote: 08 Dec 2022 11:14 Last night, after looking at the docs again I realised that (a) I needed to pass through to the Pico another address line, and (b) I'd confused myself by numbering the address lines differently on my RAM board to the main system (as it's a 16 bit system with only word access I made the system"A1" to be "A0" on the RAM board).

Schematic updated (and GAL code written).

Sounds like good progress so far :)
This evening's task is to install the headers onto the RAM expansion, then I can start wiring things up on the breadboard fully.

Once this is done I can start properly on the RP Pico software. Initially I plan to just monitor the inputs and printout the values as they're presented. No need to do any real logic other than say it's a read/write and what address etc.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
rubber_jonnie
Site Admin
Site Admin
Posts: 14905
Joined: 17 Aug 2017 19:40
Location: Essex

Re: General Stuff(tm)

Post by rubber_jonnie »

stephen_usher wrote: 08 Dec 2022 15:15
rubber_jonnie wrote: 08 Dec 2022 11:16


Sounds like good progress so far :)
This evening's task is to install the headers onto the RAM expansion, then I can start wiring things up on the breadboard fully.

Once this is done I can start properly on the RP Pico software. Initially I plan to just monitor the inputs and printout the values as they're presented. No need to do any real logic other than say it's a read/write and what address etc.
Nice one, I'd be interested to see a more in depth view of how you've done this all from a learning perspective :)
Collector of many retro things!
800XL and 65XE both with Ultimate1MB,VBXL/XE & PokeyMax, SIDE3, SDrive Max, 2x 1010 cassette, 2x 1050 one with Happy mod, 3x 2600 Jr, 7800 and Lynx II
Approx 20 STs, including a 520 STM, 520 STFMs, 3x Mega ST, MSTE & 2x 32 Mhz boosted STEs
Plus the rest, totalling around 50 machines including a QL, 3x BBC Model B, Electron, Spectrums, ZX81 etc...
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7380
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Getting ready to do the wiring up. I really could have done with longer header pins. I can tell that this is going to be an issue whilst testing as the DuPont connectors only just hold and are too easily dislodged.

IMG_2863.jpeg

I'm too tired to do any more tonight and I'm out tomorrow night, so it'll have to wait until the weekend.
You do not have the required permissions to view the files attached to this post.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7380
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

GAL programmed, all wired up... Doesn't work.

Although the Pico is supposed to be pulling up certain pins it seems that it isn't, so the interrupt pin is constantly low, causing the host to halt if it's connected. Checking other pins they seem to have the same issue. A bit of a problem.

Here's my current Pico MicroPython code...

Code: Select all

import machine
import os
import time

from sd_setup import *

#
# Pin definitions
#

SPI1_MISO=12
SPI1_MOSI=11
SPI1_CLK=10
SPI1_CS=13

D0=0
D1=1
D2=2
D3=3
D4=4
D5=5
D6=6
D7=7

SELECTED=16
READ_WRITE=17

A1=18
A2=19
A3=20
A4=21
A8=22

IOWAIT=28
INT2=27

# Data buffer and WD1010 registers

buffer = [0] * 8192

wd_head = 0

wd_rd_status = 0
wd_wr_status = 0

#
# Mount the SD Card
#

setup_sd()

#
# Set up the pins.
#

d0 = machine.Pin(D0, machine.Pin.IN, machine.Pin.PULL_UP)
d1 = machine.Pin(D1, machine.Pin.IN, machine.Pin.PULL_UP)
d2 = machine.Pin(D2, machine.Pin.IN, machine.Pin.PULL_UP)
d3 = machine.Pin(D3, machine.Pin.IN, machine.Pin.PULL_UP)
d4 = machine.Pin(D4, machine.Pin.IN, machine.Pin.PULL_UP)
d5 = machine.Pin(D5, machine.Pin.IN, machine.Pin.PULL_UP)
d6 = machine.Pin(D6, machine.Pin.IN, machine.Pin.PULL_UP)
d7 = machine.Pin(D7, machine.Pin.IN, machine.Pin.PULL_UP)

selected = machine.Pin(SELECTED, machine.Pin.IN, machine.Pin.PULL_UP)
read_write = machine.Pin(READ_WRITE, machine.Pin.IN, machine.Pin.PULL_UP)

# A1 - A3 address the registers
# A4 selects the buffer memory if set
# A8 switches between the WD1010 (0) and the control latch (1)

a1 = machine.Pin(A1, machine.Pin.IN, machine.Pin.PULL_UP)
a2 = machine.Pin(A2, machine.Pin.IN, machine.Pin.PULL_UP)
a3 = machine.Pin(A3, machine.Pin.IN, machine.Pin.PULL_UP)
a4 = machine.Pin(A4, machine.Pin.IN, machine.Pin.PULL_UP)
a8 = machine.Pin(A8, machine.Pin.IN, machine.Pin.PULL_UP)

iowait = machine.Pin(IOWAIT, machine.Pin.OUT, machine.Pin.PULL_UP)
int2 = machine.Pin(INT2, machine.Pin.OUT, machine.Pin.PULL_UP)

#
# Make sure that the INT2 and IO_WAIT outputs are disasserted.
#

int2.value(1)

iowait.value(1)

#
# Main loop
#

while(1):
#
# Wait until the /SELECTED line is low
#
    while(selected.value() == 0):
        pass
#
# Asset the /IO_WAIT line to halt the system processor while we process the request.
#
    iowait.value(0)
#
# Is the request a read or a write cycle?
#
    is_write = read_write.value()
#
# Evaluate the lower address bus values. We'll need these is it's a latch or a WD1010 register operation.
#
    addr = a1.value() + (a2.value() << 1) + (a3.value() << 2)
    
    if ((a8.value() == 1) and (is_write)):
        print("Latch operation.")
        print("Latch address: ", addr, "Value: ", d0.value())
    elif (a4.value()):
        print("Buffer operation.")
        if (is_write()):
            data_value = d0.value() + (d1.value() << 1) + (d2.value() << 1) + (d3.value() << 2) + (d4.value() << 3) + (d5.value() << 4) + (d6.value() << 5) + (d7.value() << 6) + (d8.value() << 7)
            print("Write: ", data_value)
        else:
            print("Read")
    else:
        print("WD1010 register operation.")
        if (addr == 1):
            if (is_write):
                print("Write Precomp Cylinder")
            else:
                print("Read Error Flags")
        elif (addr == 2):
            if (is_write):
                print("Write Sector Count")
            else:
                print("Read Sector Count")
        elif (addr == 3):
            if (is_write):
                print("Write Sector Number")
            else:
                print("Read Sector Number")
        elif (addr == 4):
            if (is_write):
                print("Write Cylinder Low")
            else:
                print("Read Cylinder Low")
        elif (addr == 5):
            if (is_write):
                print("Write Cylinder High")
            else:
                print("Read Cylinder High")
        elif (addr == 6):
            if (is_write):
                print("Write SDH")
            else:
                print("Read SDH")
        elif (addr == 7):
            if (is_write):
                print("Write Command Register")
            else:
                print("Read Status Register")
        else:
            print("NULL operation.")
    
    iowait.value(1)
    print("IO_WAIT deasserted")
    while(selected.value() == 1):
        pass
    
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7380
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

Well, it would help if I connected the right output pin from the GAL to the /OE lines on the 244 and 245 wouldn't it?

Still, the 74LVC244 at 3.3V seems to be too slow to react to the output enable lines. The /G1 and /G2 levels drop for 400ns but the low input doesn't get translated to the output. If I manually pull the /G lines low then it works. I've some 74AHCT244 chips which I can try instead of the LVC one.

Anyway, it also seems that the Pico with micropython is also too slow to see the signal that gets. I'll probably have to move into the realms of programmed I/O on that one!

However, until I can get the system halting via pulling the IRDY (I/O Ready) line low via the 244 I'll not be able to do much.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7380
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

I think that I also need to download a newer version of micropython as it's not reliably reading or writing values to the GPIO pins when run in a program. (The command line is fine.)
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7380
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

I'm finally getting somewhere.

I've now got data flowing and it seemingly it's sane.

I had to correct some GAL code for the memory board for the I/O read-write control line for a start. Secondly I discovered that I'd wired up the address bus slightly incorrectly... oh and forgot to hook up the selection line to the memory board so I was always getting 255 on the data bus.

I also discovered that address line A8 is actually a red herring.

I can now see the system attempting to reset the transfer buffer address counter, writing the value 85 (01010101) to the buffer, resetting the counter again and attempting to read it back. This is the first part of the hard disk interface test code. It then resets the disk head latch port.

So, now I have got this far I can start writing the logic in the Python for actually doing things!

It's a pity that Thonny, the micropython IDE and Pico interface program doesn't allow you to capture the output from the Pico to a file. It would be far easier to diagnose off-line with a decent text editor rather thanonly being able to PgUp and PgDn.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7380
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: General Stuff(tm)

Post by stephen_usher »

I've done enough of the logic that the machine *thinks* that it has a 10MB hard drive, most of the time, if I start the Pico code from scratch every time.

Still, progress.

The system can't actually read or write anything yet other than the WD1010-05 virtual registers and the data buffer, but still. And... it's very slow because it's printing a whole load of debugging info.


IMG_2869.jpeg
You do not have the required permissions to view the files attached to this post.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.

Return to “MEMBER BLOGS”

Who is online

Users browsing this forum: ClaudeBot, rubber_jonnie, semrush [bot], xyzzy76 and 8 guests