Matchbox sized 6502 / Z80 / 6809 Co Pro

discussion of games, software, hardware & emulators relating to the Acorn Atom and Acorn System machines.
User avatar
BigEd
Posts: 2781
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by BigEd » Sun Jan 18, 2015 9:40 pm

Great stuff Dave. I think I'd missed the existence of Alan's 65C02 core. Do you know if it passes Klaus' recently extended test suite, or could you perhaps try to run it?
https://github.com/Klaus2m5/6502_65C02_functional_tests

Cheers
Ed

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Sun Jan 18, 2015 10:27 pm

Ed,
BigEd wrote:Great stuff Dave. I think I'd missed the existence of Alan's 65C02 core. Do you know if it passes Klaus' recently extended test suite, or could you perhaps try to run it?
https://github.com/Klaus2m5/6502_65C02_functional_tests
It doesn't pass the DORMANN tests.

Attached is my build:
dormann.zip
(64.82 KiB) Downloaded 37 times
It is failing at address 3876, because Y has an incorrect value (43 rather than 42).

This is testing an undefined OpCode ($02) and the test is failing because the length of the opcode is 1, and it should be 2.

Looking at the code, I think this should be easy to fix:

Code: Select all

	-- +------- Update register A
	-- |+------ Update register X
	-- ||+----- Update register Y
	-- |||+---- Update register S
	-- ||||       +-- Update Flags
	-- ||||       |   
	-- ||||      _|__ 
	-- ||||     /    \
	-- AXYS     NVDIZC    addressing  aluInput  aluMode
	-- AXYS     NVDIZC    addressing  aluInput  aluMode  
	  "0000" & "001100" & brk       & aluInBrk & aluP,   -- 00 BRK
	  "1000" & "100010" & readIndX  & aluInT   & aluOra, -- 01 ORA (zp,x)
	  "0000" & "000000" & implied   & aluInXXX & aluXXX, -- 02 NOP ------- 65C02
	  "0000" & "000000" & implied   & aluInXXX & aluXXX, -- 03 NOP ------- 65C02
I think changing the addressing mode to immediate might do it.

Dave

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Sun Jan 18, 2015 10:48 pm

Ed,

I've got all the NOP tests passing now.

Next failure is at 5E09, which is the BCD Arithmetic tests,

Code: Select all

                        ; core subroutine of the decimal add/subtract test
                        ; *** WARNING - tests documented behavior only! ***
                        ;   only valid BCD operands are tested, V flag is ignored
                        ; iterates through all valid combinations of operands and carry input
                        ; uses increments/decrements to predict result & carry flag
5df3 :                  chkdad
                        ; decimal ADC / SBC zp
5df3 : 08                       php             ;save carry for subtract
5df4 : a551                     lda ad1
5df6 : 6552                     adc ad2         ;perform add
5df8 : 08                       php          
5df9 : c553                     cmp adrl        ;check result
                                trap_ne         ;bad result
5dfb : f003            >        beq skip2783
                       >        trap            ;failed not equal (non zero)
5dfd : 20d560          >        jsr report_error
                       >
5e00 :                 >skip2783
                        
5e00 : 68                       pla             ;check flags
5e01 : 2983                     and #$83        ;mask N-----ZC
5e03 : c555                     cmp adrf
                                trap_ne         ;bad flags
5e05 : f003            >        beq skip2785
                       >        trap            ;failed not equal (non zero)
5e07 : 20d560          >        jsr report_error
                       >
5e0a :                 >skip2785
The flags are 01 when they should be 81, so the N flag is getting not getting set when it should be.

Dave

User avatar
BigEd
Posts: 2781
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by BigEd » Mon Jan 19, 2015 6:36 am

Aargh BCD mode - trips everyone up (including Commodore themselves...) - but thanks for testing and patching so quickly.

For BCD fails it might be easier to run Bruce's tests. Fixing BCD is another matter: Bruce explains the mechanics, but I think the idea is that N and Z now match the final A value. See
http://www.6502.org/tutorials/decimal_mode.html
which includes explanation and test code.

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by flynnjs » Mon Jan 19, 2015 8:28 am

The Rockwell datasheet I have covers 65C02, 65C102 and 65C112
and shows that the instruction set is the same on each. I take it
therefore that we shouldn't see any difference on a Tube between
C02 and C102?

I'll do some builds on Daves latest code and post the binaries.
I might put both C02 and C102 in the build so if future bugs
crop up we can compare and narrow down.

I'm also looking at modifiying some cheap FTDI boards rather than
spin my own as an alternative to a £20-something unit.

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by RobC » Mon Jan 19, 2015 9:18 am

hoglet wrote:Does anyone with an LX9 Co Pro have the kit to do an update?
I've got a cheap JTAG programmer somewhere that came with a small FPGA module. I'm happy to have a go if someone can post instructions on how to wire it up to the board. (Or are programmers sufficiently different that they have to be wired individually?)

Thanks for the continued work on this too!

User avatar
daveejhitchins
Posts: 5302
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 » Mon Jan 19, 2015 9:43 am

OK, it's January . . . So let's have a sale :D

Price slashed for these! There are 4 - I'll keep one so I can program my own CoPro, so three available. And, I'll need guidance with the procedure* Please.

* If they're even suitable for this project?? See 'More information', below.

New price £6 including P&P. PM me.

Dave H :D

More information:
(1) There's a switch to select (a) Altera Quartus (b) Xilinx ISE
(2) Someone asked the question "does it have a USB port" - a reply came back affirmative, however, IT'S PARALLEL ONLY - no USB port!

If someone would like to Try-Before-Buy I'll post one on to them.
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
danielj
Posts: 7792
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by danielj » Mon Jan 19, 2015 10:28 am

Alas I don't have anything with a parallel port... Happy to bodge something but not quite sure where to start bodging... Additionally, what's the preferred method of attaching to the jtag pads on the copro?

d.

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Mon Jan 19, 2015 1:03 pm

I might be completely wrong here, but I think the Xilinx Impact programming software has a very limited set of cable drivers.

So if people are expecting that Impact will "just work" with generic USB JTAG cable, you may be disappointed.

The programmer I use is a £20 clone of the £200 official Xilinx USB programmer:
http://www.stardot.org.uk/forums/viewto ... 59#p100220
This is indistinguishable from the real thing, and works very well with Impact.

If you do want to use a generic JTAG cable, them you would need to find some third-party software that is able to use it, and that supports programming of Xilinx devices. Earlier Jason mentioned these guys:
http://www.mlab.cz/Modules/CPLD_FPGA/XI ... st.en.html
Does anyone have any experience of this, or any other alternative programming software?

Dave

firthmj
Posts: 235
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 19, 2015 7:20 pm

Some of Xilinx's evaluation boards have ISE compatible programming hardware built into them.

For example, the Spartan 3AN board does:

http://www.xilinx.com/support/documenta ... /ug334.pdf

As the schematics and firmware are available for download from Xilinx, it should be possible to clone the programming part of the design.

Not sure what the cost of the components they used relative to the ~£30 Chinese clone cable is though.

As a word of warning though, the Avnet "Zedboard" eval board for the Xilinx Zynq chip claims to have something similar included, but I could never find drivers for the circuitry that would work correctly on Linux - it required Digilent drivers, which seemed to be available as a Windows based add on to ISE, but the Linux version that was supposed to exist never worked for me - after several kernel panics etc, I gave up.

There are other Xilinx clone cables available, but most of them cost more like £100 - still a big saving over the official one for commercial use, where a Chinese clone from eBay might not be acceptable.

Regards

Michael
Had fun at the
Image
Meeting 21st September 2019

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by flynnjs » Mon Jan 19, 2015 7:33 pm

The VXC (Virtual Xilinx cable) guys are using an FTDI chip.
It is the same chip as on this module:

http://uk.farnell.com/ftdi/umft220xb-01 ... dp/2081335

However, the pins the VXC guys are using are not the ones brought out onto the header of this dev board. I do have one of these dev boards and I'm just about to go to the workshop to see if it can be modded with a few jumper wires. If so it would be a cheap way forward.

User avatar
TheCorfiot
Posts: 671
Joined: Mon Jan 08, 2007 5:22 pm
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by TheCorfiot » Mon Jan 19, 2015 7:55 pm

Just ordered a clone programmer like Daves from ebay

Better safe than sorry :)

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by flynnjs » Mon Jan 19, 2015 8:25 pm

You can either solder on a bit of pin header to the underside of the board (right angle helps) or get some "pogo pins" which is what I used to program up 50-odd boards.

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by flynnjs » Mon Jan 19, 2015 8:27 pm

I just remembered that Hoglet told me that his LX9Co fouled the keyboard screw next to the Tube socket on the Beeb. I never noticed that as I've not had any screws in my B for years.

Might be worth people checking their installations or popping a bit of tape over the top to avoid any short circuits occuring!

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by sirmorris » Mon Jan 19, 2015 8:59 pm

Screws? In a Beeb??

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Mon Jan 19, 2015 10:09 pm

Hi all,
BigEd wrote:Aargh BCD mode - trips everyone up (including Commodore themselves...) - but thanks for testing and patching so quickly.

For BCD fails it might be easier to run Bruce's tests. Fixing BCD is another matter: Bruce explains the mechanics, but I think the idea is that N and Z now match the final A value.
I now have AlanD's core passing all the DORMANN tests and Bruce Clark's BCD tests. :D

In the end, there were three separate issues:
  • Several of the undocumented NOP op codes had the wrong instruction length - some should be 2 or 3 bytes long.
  • In BCD mode, Z and N were being calculated incorrectly (i.e. on an intermediate value rather the final accumulator value)
  • In BCD mode, with some operands SBC gave the wrong value in the accumulator (this one was a bit subtle!)
I'm really pleased with this, as I think of all the cores Alan's (which is based on Peter Wendrich's FPGA64 core) has the cleanest code and is actually understandable.

Latest code is now on Githib.

Dave
Last edited by hoglet on Mon Jan 19, 2015 10:29 pm, edited 2 times in total.

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by flynnjs » Mon Jan 19, 2015 10:13 pm

Awesome work. It synthsises a heck of a lot quicker than the 65C102 one
that I was using.

User avatar
berendvosmer
Posts: 18
Joined: Mon Jan 12, 2015 9:52 pm
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by berendvosmer » Mon Jan 19, 2015 11:27 pm

I now have an Eagle schematic and pcb design for the Papilio One. It contains the RAM and level shifters.

Have a look at the attached files.

I'll leave it for a moment and do a final check later ... quite challenging as a first project :wink:

Would anyone be interested in one?

Greetings,

Berend
Attachments
CoPro Wing v0.1.zip
(87.6 KiB) Downloaded 56 times

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by hoglet » Tue Jan 20, 2015 8:12 am

Hi Berend,
berendvosmer wrote: I'll leave it for a moment and do a final check later ... quite challenging as a first project :wink:
Wow is all I can say!

Did you manage to auto route this?

A couple of questions/suggestions:

- Include a jumper in the H_IRQ_B signal - none of the current co processors use this, and a jumper would avoid the chance of accidental interrupts.

- If you look at the schematic on page 24 of the GOP manual:
http://www.oho-elektronik.de/pics/UM_XC3S200.pdf
you see they provide the option of pull ups on the 5V side of the level shifers, to make up for their limited ability to source current. This is a 1.2K resistor in series with a BAT54 Schottky diode.

Given the data bus on the Beeb is heavily loaded (especially if the 1MHz bus is also used), this *might* be worth considering. (I know these will be a pain to add....)

That said, on my GOP I don't have these enabled, and it works fine on a Master and a Model B.
berendvosmer wrote: Would anyone be interested in one?
I'd give it a go? How much do you think the boards would be?

Dave

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by sirmorris » Tue Jan 20, 2015 10:09 am

Tempted but moving house will see my retro budget nixed.

:(

Besides - my Papilio is too happy being an Atom ;)

C

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by flynnjs » Tue Jan 20, 2015 11:40 pm

OK, here's the latest build from Hoglet's git repo, plus the
new BIST routine (which runs continuously).

Switch positions (0 means towards the FPGA or according the marking, ON).

1 2 3 4
0 0 0 0 65C02 (AlanD core)
0 0 0 1 Z80
0 0 1 0 6809 (with build 0.25 Tube ROM)
0 0 1 1 x86 (currently broken)
0 1 0 0 BIST

You'll need Xilinx iMPACT (not the whole of ISE) and a Xilinx compatible JTAG pod.
1) Power CoPro and attach pod
2) Do boundary scan and initialise chain
3) When prompted for a .bit file press [bypass]
4) Right click on the Xilinx chip icon and click add SPI/BPI flash
5) Choose the .mcs file from this zip ->
lx9multiboot.zip
6) Choose S25FL032P from the drop down list
7) Now right click the Flash chip icon and choose program
8) Wait nearly four minutes (with a 6MHz programming cable.... YMMV)

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by sirmorris » Wed Jan 21, 2015 10:16 am

I think I'll be soldering a header - there's no way I can pogo for that long ;)

User avatar
sydney
Posts: 2468
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by sydney » Wed Jan 21, 2015 10:40 am

Jason, would you be able to reprogram mine at Halifax for me please?
Thanks,
Simon

User avatar
leenew
Posts: 4022
Joined: Wed Jul 04, 2012 3:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by leenew » Wed Jan 21, 2015 10:47 am

Yep, I hope it isn't too much to ask but I was going to bring Lurkio 's to Halifax for capping and updating as well as collecting mine (that was already arranged though :D )
Lee.

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

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by danielj » Wed Jan 21, 2015 11:01 am

I'm going to have to ask the same :D I'll be getting the Xilinx kit next month though...

d.

User avatar
TheCorfiot
Posts: 671
Joined: Mon Jan 08, 2007 5:22 pm
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by TheCorfiot » Wed Jan 21, 2015 6:07 pm

Thanks Jason

My programmer should be here in a week, if i can help take the pressure of Jaon by programming some of these pls let me know..

I tried downloading impact (part of lab tools) via the xilinx website but it insists on a corporate email to register, my email addy isnt accepted.
Does anyone kniw a way around this or a different download link.

Thanks
:)

User avatar
roland
Posts: 3584
Joined: Thu Aug 29, 2013 8:29 pm
Location: Born (NL)
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by roland » Wed Jan 21, 2015 6:14 pm

You also need to register for a free license key. I can make you a "corparate" address like <edit: removed address> and let the mail be forwarded to your personal address. I registered with an address <edit: removed address>.
Last edited by roland on Wed Jan 21, 2015 6:34 pm, edited 2 times in total.
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN :shock:

User avatar
TheCorfiot
Posts: 671
Joined: Mon Jan 08, 2007 5:22 pm
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by TheCorfiot » Wed Jan 21, 2015 6:24 pm

Can i send you an email address roland, thank you so much.

:)

User avatar
roland
Posts: 3584
Joined: Thu Aug 29, 2013 8:29 pm
Location: Born (NL)
Contact:

Re: Matchbox sized 6502 / Z80 / 6809 Co Pro

Post by roland » Wed Jan 21, 2015 6:29 pm

Sure, just PM me the address to forward to....

Edit: PM received, mail address created.
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN :shock:

User avatar
jgharston
Posts: 3806
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 21, 2015 7:22 pm

jgharston wrote:
hoglet wrote:Do you keep past versions? It would be good to be able to compare 0.24 and 0.25 to see exactly what changed.
Yes, but I'm away from my computer at the moment, with only 25 minutes' WiFi left. When I get back I'll add public access to the earlier versions.
If interested in earlier versions, diffs of them are at Tube/6809/Versions. In general, any earlier versions of my software is usually in a Versions subdirectory of the main directory. You can probably find lots of hidden bits of old stuff on my website that way. ;)

Code: Select all

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

Post Reply