VIC-2000 Expander. Modern Power Using Retro Parts!

Modding and Technical Issues

Moderator: Moderators

User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Although I enjoy programming 6502 assembly more than anything, I must admit that the power of HDL is intoxicating!

The display shown in the above photos is basically generated by one line of code that unrolls the character ROM into a stream of pixels.

This entire block of test code executes in one 40MHz cycle...

Code: Select all

if (CHARS[CHARMEM[((HCOUNT-136)/32)+(((VCOUNT-24)/24)*22)]][(((HCOUNT-136)/4)&7)+(((VCOUNT-24)/3)*8)]==1) begin
VGARED <= VICPAL[COLRMEM[((HCOUNT-136)/32)+(((VCOUNT-24)/24)*22)]][3:0];
VGAGRN <= VICPAL[COLRMEM[((HCOUNT-136)/32)+(((VCOUNT-24)/24)*22)]][7:4];
VGABLU <= VICPAL[COLRMEM[((HCOUNT-136)/32)+(((VCOUNT-24)/24)*22)]][11:8];
end else begin
VGARED <= 15;
VGAGRN <= 15;
VGABLU <= 15;
end
Imagine how many cycles this would take even on a powerful micro like an ARM!
... makes me feel guilty!

Brad
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Mike »

You could inflate the display buffer though to contain the whole signal including the SYNC pulses and keep the complicated arithmetic out of the display loop. Heck, even a ZX81 managed to output video by just using the CPU and a parallel-to-serial-converter in the SCL ULA chip. ;)
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

The FPGA is just a test platform for me at this point, and will probably not use it anymore from here on the main project.
You are right about the "embedding" of sync and blanking in the buffer... I am doing this on the logic breadboard.
HSync, VSync, and Blanking all come from an independent SRAM.

Timing is tighter above 20MHz this way, and the CPU "Vic-20" will be able to create custom screen modes.
It's basically a programmable sync generator.
Multi screen resolutions like 400x600 and 400x300 can exist in the same frame.

I finally found an edge connector to get the entire expansion port to my breadboard!
From this point on, I am going back to 80's era logic to get this project back on track.
I will revisit the "6560 Clone" sub project again when I am held up by parts.

For my next test, I am stuffing a 32K SRAM with boot code so the VIC can start my OS.
Once I have that working, I will start wiring up the basic VGA generator logic.
The fist version will be a simple 400x600 dual buffer display system.
VIC-20 writes to one buffer while the other is being displayed.
Once graphics are ready, VIC tells the system to swap the buffers.

After that works, I will add the other 500+ logic ICs and make a powerful blitter system.
I also intend to add a 3rd buffer for dedicated text.
Will probably use a 44 x 46 text display, to simply double the VICs original y text display.

A lot will evolve during this build, but the end goal is the same as originally posted.
Hundreds of photos will be coming... I like taking photos of these hacks!

Cheers!
Radical Brad
sjgray
Vic 20 Hobbyist
Posts: 115
Joined: Thu May 03, 2007 6:46 pm
Location: Markham, ON, Canada

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by sjgray »

Radical Brad wrote:Had an hour free this evening, and decided to try my crazy "Remote 6560" idea.
I will admit that I only gave this a 75% chance of working.

Started by soldering a socket to the ZIF socked so I could attach 40 wires.
The idea was that the 6560 could live outside the VIC-20 and at the same time on a breadboard.
The other end of the 40 wires will be soldered to another socket that goes back to the VIC-20.
As part of another project, I made a little 40-pin dip breakout board, originally designed for the 6502/6510 but could also be useful for any 40-pin chip:

http://www.6502.org/users/sjgray/projec ... index.html

Steve
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Nice work, and certainly a lot neater than 40 wires hanging off the main-board!

I have buttoned my VIC-20 back up now, and will be working "externally" from this point.
Everything I do from here is going to connect only to the expansion port.
I will revisit the "6560 clone" sub project again one day, and start a new thread.

After some digging in one of many parts bins, I found a nice edge card...

Image

Unlike the cartridge blank also shown, this card has all the pins available.
The cartridge I dismembered is missing several address lines, and the VRW line.

My next step is to make a connector from this PCB to get all expansion port pins to my breadboard.
I have a test ROM ready to roll, and it should auto boot and cycle the screen colors.
Here is the code...

Code: Select all

; START ADDRESS = 40969 @ 40960 TO 40961
 .ORG 40960
 .BYTE 9,160

; RESET ADDRESS = 40969 @ 40962 TO 40963
 .ORG 40962
 .BYTE 9,160

; BOOT CODE = A0CBM @ 40964 TO 40968
 .ORG 40964
 .BYTE 65,48,195,194,205

; PROGRAM START @ 40969 TO 49151
 .ORG 40969

MAIN:
  ; CYCLE COLORS
  INC 36879
  
  JMP MAIN
 
And yes, I only work in decimal. I have no use for HEX.
... been doin' it that way since 1980!

I will report back when my VIC boots from the breadboard ROM.

Later!
Radical Brad
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Broke the original traces, and added wires where I need them...

Image

I am taking every expansion port line except for IRQ and NMI.

Soon I will find out if the VIC will boot a ROM at the end of 40 lengths of 16 inch wire!

Brad
cobracon
Vic 20 Dabbler
Posts: 74
Joined: Thu Nov 11, 2010 5:46 pm

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by cobracon »

Thanks for posting this project. I find myself always checking here for updates :) I love what you guys can do with the Vic 20.
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Thanks, hope this project is at least good for some entertainment value!
It has been fun at this end so far.

Time is very limited lately, but I found a few minutes to finish the expansion extender.
Cleaned up the wires and added them to a 40 pin DIP socket...

Image

After an electrical test, I plugged it in and turned on the VIC-20.

Image

Everything is working fine so far, and I can see the expected signals on my scope.
When I have a bit more time, I will wire up an SRAM and boot load it with the 6502 code.

If it all works as expected, the VIC should start cycling colors at warp speed.

Brad
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Ok, the first test has been successful.
This test circuit holds the VIC in reset, and then stuffs an SRAM with boot code.
The AVR that loads the SRAM then disappears and the VIC takes over.

When my system is done, the boot code (new Operating System) will come form an external source.

Here is the simple board that buffers the SRAM on the bus...

Image
This is an instantly loadable cartridge for the VIC-20!

I have the SRAM sitting as 8K in block 5, and this code is stuffed into the SRAM on power on...

Code: Select all

; START ADDRESS = 40969 @ 40960 TO 40961
 .ORG 40960
 .BYTE 9,160

; RESET ADDRESS = 40969 @ 40962 TO 40963
 .ORG 40962
 .BYTE 9,160

; BOOT CODE = A0CBM @ 40964 TO 40968
 .ORG 40964
 .BYTE 65,48,195,194,205

; PROGRAM START @ 40969 TO 49151
 .ORG 40969

MAIN:
 ; CYCLE COLORS
  INC 36879
  
  JMP MAIN
 
Once the Kernal finds the secret "A0CBM" string at location 40964, it runs the loop.
The loop just increments the screen colors as fast as possible.

The effect is kind of interesting, looking like a low res plasma effect...

Image
Color cycle code running from the fake cartridge.

This is just a sliver of a much larger journey, but it does feel good to see some progress.
My next step will be to extend the OS "ROM" to 32K in size.

Code: Select all

BLK-1 : 8K
BLK-2 : 8K
BLK-3 : 8K
BLK-5 : 8K
IO2/3 : External IO
I will map that 3K "hole" to become my external IO system.
As for register space, I will just use the original VIC internal memory.

The OS will eventually become many paged 24K segments, each with a different function.
The first page will be the IDE, which will be an assembler.
Other pages will include tools like graphic editors, a music tracker, and other utils.

Of course, things will evolve as I start plugging in the million or so wires on the giant breadboard!

Cheers, and thanks again for this amazing VIC resource!
Radical Brad
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Once I figured out why .PRG files had two bytes too many to work properly as cartridge images (thanks SROWE), everything came to life.
I adjusted my BIN2AVR program to strip the first two bytes and then output the data as assembly bytes.
This file is loaded into the AVR, which in turn loads it into the SRAM pretending to be a cartridge ROM on Block-5.

Image
Converting a cartridge ROM into AVR assembly bytes.

With a single mouse click, the AVR loads the SRAM and then reboots the VIC.
Look what the cat dragged in...

Image
One of the VIC-20 classics loaded via serial link.

Here is a quick vid showing how this Rube Goldberg machine works...

https://www.youtube.com/watch?v=jV9dHOOLs70

My next addition will be to map the other 24K into Blocks 1,2, and 3.
My new OS will live in the extended 32k ROM, and boot from Block 5.

Once I get sick of Omega Race, Rat Race, and Avenger, I will get back to the breadboard!

Cheers,
Radical Brad
norm8332
Vic 20 Nerd
Posts: 626
Joined: Sun Nov 13, 2016 11:04 am
Location: USA

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by norm8332 »

Radical Brad wrote:Thanks, hope this project is at least good for some entertainment value!
It has been fun at this end so far.
I for one am following this intently. Very interesting. Your skills are really up there.
“In religion and politics people’s beliefs and convictions are in almost every case gotten at second-hand, and without examination... whose opinions about them were not worth a brass farthing.”

-Autobiography of Mark Twain
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Thanks for the positive comments!

I had exactly 20 minutes of hackin' time tonight, so I decided to add a 74HC08 to my SRAM to enable the entire 32K on all 4 banks.
The logic is easy... each lo bank line enables a bit above 8K, and all low bank lines enable the CE on the SRAM.
One single AND gate is all that is required. Actually, there are several gate types that could do it in one chip.

Working with a 1MHz bus is like shooting a stationary target with a bazooka!... it's difficult to miss.
I bet my SRAM would function perfectly over 10 feet of wire!

Silly, I know, but it was super exciting to see the VIC start-up screen report this...

Image
I can take on the world now!

Back in the day, it would have been a dream to have that much memory.
I still remember the total disappointment after spending almost an entire day graphic out custom characters for a game I was coding, only to get that out of memory error. I tried all kinds of random poking for free memory, and think I found the tape buffer. Not sure, it was a LONG time ago!

Ok, that's it for tonight.
It's -18 out right now and blowing snow, so I get to haul firewood tonight instead of plugging wires.

My next step will be to fill the entire 32K with bytes (from an external source) and read them back on the VIC to verify that my boot loader is fully working. I will then begin laying out the new Video system on the giant breadboards.

...SYS 64802
Radical Brad
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Let the wiring begin!
Since I have now figured out how the VIC external port works, I can start building the VIC-2000 Expansion System.
I will start with one of the two large breadboards...

Image
This is the IO / Video half of the board.

This half of the board will do the following functions...

(0) 32K of auto-booting ROM that wil hold the new OS.
(1) IO mapping from the VIC to external hardware.
(2) Text display for the operating system and IDE.
(3) VGA sync and frame generation.
(4) Dual frame buffer with auto swapping.
(5) Memory Blitter system for graphics.

I am going to work on steps (0) and (1) before doing any of the video system.
Poking around in basic, I will be able to see the IO using LEDs on the board.

I expect to need at least 256 individual IO lines to control everything, so that 3K segment will do just fine.
My new OS will eat up the 32K of expansion ROM, leaving the VIC memory (and zero page) for variables.

Ok, now where is that bin full of 74HC138s and 74HC688s?

Later,
Radical Brad
User avatar
Radical Brad
Vic 20 Devotee
Posts: 256
Joined: Sat Jun 24, 2017 8:18 pm
Website: http://www.AtomicZombie.com
Location: Kakabeka Falls, ONT
Occupation: hACKER

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Radical Brad »

Ok, the first basic IO map test was a success.
I decided to use IO Block-3, which maps to locations 39936 to 40959.

Here is a basic test program that sends out a binary count to the data bus...

Image
Poking the VIC Data Bus out to the 8 LEDs.

This is a very basic test, taking the latch of the 74HC574 directly from the IO BLK-5 line.
When an address in the range is written to, the data is latched into the buffer.
There is one LED for each of the 8 lines on the data bus...

Image
Talking to 8 LEDs over the IO Block-5 expansion.

Here is a vide showing how this works...

https://youtu.be/ohuikMzer10

When I have a block of time, I will be expanding the IO mapping hardware.
The next step will be to register the Low Address Bus, and drive some demultiplexers.
By using 4 x 74HC138 demuxes, I can map out 256 individual IO pins.

I will show how this works next time I have a few minutes to plug more wires into the board.

Later,
Radical Brad
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: VIC-2000 Expander. Modern Power Using Retro Parts!

Post by Mike »

Please don't mix up BLKx and I/O x designators. The select signals BLK1, BLK2, BLK3 and BLK5 on the cartridge connector map to $2000..$3FFF, $4000..$5FFF, $6000..$7FFF and $A000..$BFFF respectively, and I/O 2 and I/O 3 map to $9800..$9BFF and $9C00..$9FFF. There's no such thing as "I/O Block-3" or "I/O BLK-5", both of which you mention (and really meant I/O 3).

BTW, your test program contains a classic example of a fencepost error. The value 255 is never actually written to the I/O latch. Line 12 should read 12 IF X=256 THEN X=0 instead. Or, for that matter you can fit the program in one line like thus:

Code: Select all

1 POKE40000,X:X=X+1AND255:GOTO1
... no parenthesis necessary around the sub-expression "X+1", as "+" binds more tightly than "AND".
Post Reply