Matchbox sized 6502 / Z80 / 6809 Co Pro

discussion of games, software, hardware & emulators relating to the Acorn Atom and Acorn System machines.
User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Mon Jan 26, 2015 9:05 pm

firthmj wrote:So I now have:
1) An LX9 CoPro
2) A JTAG cable
3) A PC with Xilinx ISE installed.
Is it a Xilinx compatible cable?

If not, I doubt it will work with ISE.

Dave

User avatar
DutchAcorn
Posts: 2094
Joined: Fri Mar 21, 2014 9:56 am
Location: Maarn, Netherlands
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by DutchAcorn » Mon Jan 26, 2015 9:14 pm

^^^
Would this one be fit for the job?

Paul
Paul

Image

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Mon Jan 26, 2015 9:17 pm

DutchAcorn wrote:^^^
Would this one be fit for the job?

Paul
It looks pretty much identical to the one I bought:
http://www.ebay.co.uk/itm/Xilinx-Platfo ... 5afe127968
But it's just a different supplier.

Dave

firthmj
Posts: 230
Joined: Tue May 26, 2009 8:37 am
Location: Ipswich, UK
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by firthmj » Mon Jan 26, 2015 10:00 pm

hoglet wrote: Is it a Xilinx compatible cable?

If not, I doubt it will work with ISE.

Dave
Yes, it's one of the Chinese Xilinx eBay clones.

After a lot of pain getting the drivers working on Ubuntu 14, I've already managed to see the Spartan 3 on my previous board from Impact.

Regards

Michael
Had fun at the
Image
Meeting 13th May 2017

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Mon Jan 26, 2015 10:07 pm

And just when I thought we were close to done :lol: :lol: :lol:
IMG_0788.JPG
The disc was created by formating a 720K disk on a PC:
- FORMAT A: /T:80 /N:9

Then on the PC copying all the files from:
http://mdfs.net/Software/BBCBasic/M512.zip

Anyone know how to determine the offending instruction? (I really doubt it will be that straight forward.....)

Dave

User avatar
flynnjs
Posts: 809
Joined: Tue Jul 06, 2010 9:33 pm
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by flynnjs » Mon Jan 26, 2015 10:17 pm

Erm, the CS and the IP ?

User avatar
danielj
Posts: 7309
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by danielj » Mon Jan 26, 2015 10:23 pm

Ooh, I seem to remember there's a bug to do with pc formatted floppies..? Try formatting it on the beeb first?

It could be the other way around though :?

D.

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Mon Jan 26, 2015 10:25 pm

flynnjs wrote:Erm, the CS and the IP ?
I've hit break to get back to the supervisor prompt, and done:

Code: Select all

D 4e5c: 1a00
It's clearly not code! Lots of 00's and a few FF's.

Dave

User avatar
paulv
Posts: 3854
Joined: Tue Jan 25, 2011 6:37 pm
Location: Leicestershire
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by paulv » Mon Jan 26, 2015 10:35 pm

Doesn't CS:IP point to the segment/offset address of the NEXT instruction to be executed? I seem to recall that's the case from my x86 assembler tutorials BITD at Uni although I've not done any x86 16-bit memory addressing since those tutorials so I could well be wrong...

That being said, if the CS:IP is pointing at junk data and the CPU tries to execute that junk data as code, an "Invalid Opcode" error would be an expected result. The question is, what's updating the address to point to the middle of nowhere? I guess it could be some segment:offset calculation error in the core depending on what the other processor flags are set to. Is BBCBASIC doing anything funky with the processor registers directly?

Paul

User avatar
jgharston
Posts: 3569
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by jgharston » Mon Jan 26, 2015 10:59 pm

paulv wrote:Is BBCBASIC doing anything funky with the processor registers directly?
No, DOS BBC BASIC is very "clean" code, it doesn't try to do anything funky. Just well-written hand-optimised assembler. You could try the generic DOS version, that also runs on the M512, just without BBC-specific I/O stuff (eg SOUND, graphics, etc.) and the free version only gives you 4K of workspace.

Sigh. Do you want another disassembly file? ;)

I don't think I ever got around to disassembling the tailored M512 version, just the generic DOS version. I'll have a rummage.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
jgharston
Posts: 3569
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by jgharston » Mon Jan 26, 2015 11:06 pm

jgharston wrote:Sigh. Do you want another disassembly file? ;)
I don't think I ever got around to disassembling the tailored M512 version, just the generic DOS version. I'll have a rummage.
Got it the wrong way around, I'd disassembled the free tailored M512 version. Completely uncommented, here it is. I don't want to leave it lying around as there is still a commercial product based on most of the code (the generic DOS version, and even the Windows version), so grab it now before I delete it in a couple of days.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Tue Jan 27, 2015 8:09 pm

jgharston wrote:You could try the generic DOS version, that also runs on the M512, just without BBC-specific I/O stuff (eg SOUND, graphics, etc.) and the free version only gives you 4K of workspace.
This generic version actually works, so whatever is tripping the Co Pro up is something used only in the BBC-specific version.

Again, I strongly suspect one of the 80186 specific instructions, that is either buggy, or not implemented at all in Zet. The list of these is highlighted in the datasheet (pages 27-32):
http://www.ti99.com/exelvision/website/ ... /80188.pdf

The only gaps I am aware of are:
- ENTER is incompletely implemented
- BOUND is not implemented at all
but neither of these seem to be used.

Dave

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Tue Jan 27, 2015 8:27 pm

Hi Berend,
berendvosmer wrote:By the look of the other posts you must be very busy, but if you could manage to have another look at the final board before I send it off, that would be much appreciated.
I've just had a quick look at the updated schematics, and it all looks fine to me.

Dave

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Tue Jan 27, 2015 8:33 pm

jgharston wrote:Got it the wrong way around, I'd disassembled the free tailored M512 version. Completely uncommented, here it is. I don't want to leave it lying around as there is still a commercial product based on most of the code (the generic DOS version, and even the Windows version), so grab it now before I delete it in a couple of days.
Brill, thanks.

Any chance you could persuade your disassembler to disassemble more of the file? Most of it is still just hex.

Dave

User avatar
richardtoohey
Posts: 3712
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by richardtoohey » Tue Jan 27, 2015 8:45 pm

hoglet wrote:Any chance you could persuade your disassembler to disassemble more of the file? Most of it is still just hex.
:shock: We thought you enjoyed disassembling from hex in your head, just for fun! :wink:

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Tue Jan 27, 2015 9:02 pm

richardtoohey wrote:
hoglet wrote:Any chance you could persuade your disassembler to disassemble more of the file? Most of it is still just hex.
:shock: We thought you enjoyed disassembling from hex in your head, just for fun! :wink:
That's only true for 6502 - I haven't learnt the full set of 80x86 opcodes yet :wink: :wink:

Dave

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Tue Jan 27, 2015 10:09 pm

hoglet wrote:
jgharston wrote:You could try the generic DOS version, that also runs on the M512, just without BBC-specific I/O stuff (eg SOUND, graphics, etc.) and the free version only gives you 4K of workspace.
This generic version actually works, so whatever is tripping the Co Pro up is something used only in the BBC-specific version.
After a bit more testing, I need to qualify this statement. :(

Even the generic version does not reliably run BASIC programs. I've tried some of the benchmarks from the other BBC disc, and BM7 seems to randomly generate BASIC errors, usually "No Such Variable", but sometimes others.

So there are definitely some remaining problems to be sorted.

Random failures are interesting, because they are not simple instruction bugs. Generally in my experience they are interrupt related, e.g. an interrupt routine not preserving all state.

I've also tried slowing the clock from 16MHz to 10MHz, in case the memory timing was marginal, but that made no difference at all.

Dave

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Wed Jan 28, 2015 6:13 pm

hoglet wrote:Even the generic version does not reliably run BASIC programs. I've tried some of the benchmarks from the other BBC disc, and BM7 seems to randomly generate BASIC errors, usually "No Such Variable", but sometimes others.
The failure mode with the generic DOS version of BBC Basic is quite curious.

Consider the following program:

Code: Select all

10 REM TEST PROGRAM
20 GOTO 10
30 PRINT "WEIRD!!"
40 GOTO 10
This will run continuously, and every few seconds will print WEIRD!!

I'm trying to imagine possible bugs that might be responsible for this. It's like 99.9% of the time the GOTO on line 20 functions correctly, but 0.1% of the time it is either skipped, or jumps to the wrong place.

An x86 instruction used by BBC BASIC that was incorrectly implemented would give a more constant failure pattern.

A hardware timing problem would cause a less consistent type of failure, and would also be less choosy about what it impacts. Yet I can boot DOSPLUS and GEM 100% reliably.

My current hunch is that this is somehow interrupt related - the interrupt being the 20ms Vertical refresh event. I'm wondering if somehow this interrupt is not preserving the state of all registers, but the one being trashed is rarely used.

Can anyone suggest other possible failure mechanisms that might be this selective?

Also, if anyone else has the latest x86 Co Pro designs running, and could also try the above program in the Vanilla DOS version of BBC Basic, that would be most helpful:
http://mdfs.net/Software/BBCBasic/M512/

Dave

User avatar
jgharston
Posts: 3569
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by jgharston » Wed Jan 28, 2015 9:51 pm

hoglet wrote:
jgharston wrote:Got it the wrong way around, I'd disassembled the free tailored M512 version. Completely uncommented, here it is.
Any chance you could persuade your disassembler to disassemble more of the file? Most of it is still just hex.
Yes, that's the bit I hadn't got around to. It follows CALLs and JUMPs to disassemble what it thinks it code, but obviously doesn't know code if it's pointed to by a jump table without being told about the jump table. I haven't worked out how to override this and just plough through the whole file and just treat every byte as data and the morass that is the 80x86 opcode set stopped me getting my own disassembler finished several times.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

harrowm
Posts: 121
Joined: Sun Nov 30, 2014 11:07 pm
Location: Singapore
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by harrowm » Thu Jan 29, 2015 2:06 pm

Mmm .. So it's not random just intermittent.
Why does gem work but bbc basic not?
Was bbc basic written especially for the 80186. Does it use instructions, addressing modes or interrupts that gem doesn't ?

RobC
Posts: 2626
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by RobC » Thu Jan 29, 2015 3:55 pm

flynnjs wrote:You'll need Xilinx iMPACT (not the whole of ISE) and a Xilinx compatible JTAG pod.
1) Power CoPro and attach pod
My programmer arrived today - can I power the CoPro from the Beeb or do I have to power it separately?

I'm assuming I just solder some header pins to the board and attach the appropriate cable?

Thanks,

Rob

User avatar
jgharston
Posts: 3569
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by jgharston » Thu Jan 29, 2015 5:58 pm

hoglet wrote:Any chance you could persuade your disassembler to disassemble more of the file? Most of it is still just hex.
Here we are, "force all instructions" turned on. I've done an initial bit of commenting to identify text strings, but things like the command/function dispatch tables aren't identified.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

RobC
Posts: 2626
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by RobC » Thu Jan 29, 2015 9:00 pm

Decided to have a go with the programmer following Jason's instructions - upgrade was successful: 6809 co-pro banner now says v0.25.

Even better, it booted Flex! :D

I'm getting a disk error but that may be because I don't have a Flex formatted disk in the drive (or an error in my disk drivers!). I'm off to bed now as a sick child meant I had very little sleep last night - hopefully I can spend some time sorting this out over the weekend.

Just want to say a big thank you to everyone involved in this - I'm sure this little board is going to give me many hours of fun :)

Cheers,

Rob

User avatar
danielj
Posts: 7309
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by danielj » Thu Jan 29, 2015 9:47 pm

Again, excellent :D - well done Rob!

d.

User avatar
flynnjs
Posts: 809
Joined: Tue Jul 06, 2010 9:33 pm
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by flynnjs » Thu Jan 29, 2015 10:41 pm

I use pogo pins rather.than solder header on the bottom.

User avatar
hoglet
Posts: 8279
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Thu Jan 29, 2015 11:05 pm

Hi all,

I've eventually managed to get the 80x86 Co Pro booting a DataCentre CF Card in my Model B, using Daniel's CF Card Image.

The bad news, it seems a more temperamental in the Model B than in the Master. This improves significantly when it's plugged directly into the socket, instead of being attached via a 30cm extension cable. But there are still occasional glitches.

I'll try to investigate a bit more over the weekend, both on the Model B and the Master. I just checked the schematics:

On the Master, the tube data bus:
- has 2 other loads on the databus
- is buffered by the PBC (peripheral bus controller)
- has 2K2 pull-downs to 0V
- has 2K2 pull-ups to 5V
- is shared with the 1MHz bus

On the Model B, the tube data bus:
- has 18 other loads on the databus
- is driven directly by the 6502
- has 6K8 pull-downs to 0V
- is isolated from the 1MHz bus (with an LS245)

But my gut feeling is the Model B represents a more challenging electrical environment, especially with 18 loads. :shock:

Is actually surprising the Model B works at all. :lol:

In addition, an extension cable on the Model B will affect the whole system, where as on the Master it's affect is just the Tube and 1MHz bus.

Dave

User avatar
daveejhitchins
Posts: 4967
Joined: Wed Jun 13, 2012 5:23 pm
Location: Newton Aycliffe, County Durham
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by daveejhitchins » Fri Jan 30, 2015 8:17 am

Dave:

As the extension cable was, I believe, for the Master, so you didn't have to 'modify' the Tube socket . . . Wouldn't it be wise to recommend that the CoPro be used ONLY in the Beebs Tube socket? This would remove/reduce that particular isssue!

Dave H :D
Parts: UM6502CE, GAL22V10D, GAL16V8D, AS6C62256A, TC514400AZ, WD1772, R6522, TMS27C512, AT28C256
Products: ARA II, ARA III, ABR, ATI, AP6, MGC, AP5 . . .
For a price list, contact me at: Retro Hardware AT dave ej hitchins DOT plus DOT com

User avatar
sirmorris
Posts: 771
Joined: Wed Feb 11, 2009 12:18 pm
Location: oxfordshire uk
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by sirmorris » Fri Jan 30, 2015 11:18 am

Is there a way to make an adapter board to mount the copro inside a master?

User avatar
danielj
Posts: 7309
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by danielj » Fri Jan 30, 2015 11:30 am

All the signals are there on the internal tube port, so it shouldn't be an issue to do that? Unless you've got one stuck in there already!

:D

d.

firthmj
Posts: 230
Joined: Tue May 26, 2009 8:37 am
Location: Ipswich, UK
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by firthmj » Sat Jan 31, 2015 3:33 pm

flynnjs wrote:Currently, I've been opening each ISE project file and building the .bit file.
Then once all the CPUs are built I open the ICAP project and ensure
that the offsets in the verilog are still correct for the .bit files (not had
time to investigate why some are a different size, I'm not using compression).
Build the ICAP and then use iMPACT to generate the .mcs file.

I'm sure it's possible to script the whole lot.

If you want to just tinker with one version you can JTAG it into the FPGA
from a .bit file without overwriting the flash, which is a lot quicker. Once
your changes are final you can create a .mcs file and burn it to flash.
Hi,

I've managed to update my board with the MCS file you posted earlier, and have managed to build several of the ISE projects on my Linux laptop.

One thing that's not obvious so far is how to combine the various .bit files into a .mcs file. In particular, presumably the order and address for the .bit files in the .mcs is important - is there a note for which one goes where?

In terms of the .bit files being different sizes, I've generally found that they are a fixed size once you remove the "textish" headers, which contain the design name and a few other details, which can make the size change by +/- a few bytes.

Sounds like one thing I should be able to contribute fairly easily is a script to automate building all the ISE projects, and combining the outputs into an .mcs file - done similar things a few times in the past ;-)
Had fun at the
Image
Meeting 13th May 2017

Post Reply