6561 Initialisation

Modding and Technical Issues

Moderator: Moderators

FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

6561 Initialisation

Post by FD22 »

For reasons best left unsaid at this point (too geeky, and needing a long post to go into the detail) I need to get a clear understanding of the behaviour of the 6561 (VIC) at power-on-reset. My hardware is boxed at the moment, and emulation (e.g. VICE) can't give me an accurate model.

Specifically:

1. During RESET, as the 6502 executes the VIC-20 initialisation code at $FD22, has the 6561 register block been hardware initialised to a known state - i.e. are the 16 registers at $9000-$900F pulled to zero? I know there is VIC initialisation code resident in the RESET path at $E5C3, but what about before this executes, such as during RAMTAS?

2. During RESET the VIC appears to display no picture - is this absence of image merely a result of all registers being zero (if the answer to the first question above is 'YES') resulting in just 'border' colour being drawn, or a lack of coherent signal from the chip due to the fact that it requires specific values (e.g. from $EDE4) across certain registers before it can begin to generate sensible video timing signals?

My intent is to alter the 'border' colour very early in RESET so that the user sees a full green screen image as soon as power is on, and this would then be replaced by the regular VIC-20 screen layout as usual once RAMTAS etc. are complete - or a red screen if some part of initialisation failed. I'm writing space-and-time-critical code, so if I can avoid initialising 15 VIC registers for no reason, or if necessary just initialise a few with specific values to enable signal generation, then it'll save me around 10 bytes and 100+ cycles.
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

Well this works in VICE, but I'd really like to know how a real 6561 behaves during POST. No-one here got any ideas?
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

I read this with interest and curiosity, and admit I have not the faintest idea.
However, it sounds like you're doing a modern-day application of the VIC20 and hope it will succeed and that you can share your invention with us.
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

I wasn't sure whether what I'm doing would be of particular interest here, because it's something to do with the VIC-20, but only in the sense that the VIC is the basis for it.

Have a look, if you fancy it - I won't be upset if you don't think much of it. :)

http://vicpp.blogspot.com/
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

The idea of a "new os rom" is fascinating. I've always thought about making small changes to BASIC, but a whole new rom is breathtaking.
High Scores, Links, and Jeff's Basic Games page.
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

Could do a Fortran Vic-20, I hear Fortran is pretty fast vs Basic.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

BTW, has anyone ever tried the VIC (simplified version of?) Fortran on cartridge?
User avatar
Mike
Herr VC
Posts: 4849
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

matsondawson wrote:Could do a Fortran Vic-20, I hear Fortran is pretty fast vs Basic.
I'm pretty sure you meant FORTH.
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

There's a FORTRAN cartridge?

Lee.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

:oops: Oops. Nope, there's a FORTH cartridge, but definitely not a FORTRAN one.
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

I'm not sure why you didn't think we'd be interested!
Fascinating stuff.
I'll be watching this one!
User avatar
TLovskog
Vic 20 Enthusiast
Posts: 194
Joined: Fri Mar 25, 2011 3:16 pm
Location: Kävlinge, Sweden

Post by TLovskog »

I concur, this was a very interesting project. One of the few blogs that is interesting to follow. Very well and cool written.

Keep up the good work!

I also 100% can recognize me in your unconditional fondness of the VIC20 and 6502. I also grew up with that.

A question. Since you are rewriting the whole KERNAL and BASIC and also need to swap the ROMs physically. Have you considered swapping the CPU to the 65C02 and make use of it's improved instruction set.
BR
Thomas Lövskog
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

orion70 wrote::oops: Oops. Nope, there's a FORTH cartridge, but definitely not a FORTRAN one.
I had the Audiogenic FORTH cart back in the day. It was great - it came with a set of A5 pages stapled together containing an indecipherably cryptic set of instructions on how to use 'pages' (which I think referred to the editor), no FORTH instructions, and no guide to the keyboard controls it used to switch between functions. I gave up after about 3 days of trying to figure out how to work it, and it gathered dust forever after.

Thanks for the kind and encouraging words, everyone. To answer your questions, I'm going to be creating a hybrid BASIC/C-style language, which will actually convert the high-level code to raw 6502 on the fly (and back again when you type LIST). The idea is that programs will run fairly close to pure machine-code speeds, as they'll effectively be dynamically compiled.

And no, I'm not swapping the CPU for a 65C02 - it's a cool idea, but I really want to find out how hard I can push a stock 6502; plus, my homebrew project will be using a pair of them when I finally get the opportunity to build the hardware, so I have to stay within the original 6502 instruction set (including undocumented opcodes, natch :) ).
User avatar
Mike
Herr VC
Posts: 4849
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

FD22 wrote:a hybrid BASIC/C-style language, which will actually convert the high-level code to raw 6502 on the fly (and back again when you type LIST).
Yet another Quetzalcoatl or Tiny Basic Compiler? This time even proposed to be hosted on the VIC-20 itself and also doing compiles-on-the-fly?

In any case, such a language would have to provide good support for modern control flow structures, 32-bit values, strings and float values. Otherwise this isn't going to gain an edge over hybrid BASIC + ML programs.
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

Mike wrote:Yet another Quetzalcoatl or Tiny Basic Compiler? This time even proposed to be hosted on the VIC-20 itself and also doing compiles-on-the-fly?

In any case, such a language would have to provide good support for modern control flow structures, 32-bit values, strings and float values. Otherwise this isn't going to gain an edge over hybrid BASIC + ML programs.
I'd say it was more akin to TBC than Quetzalcoatl, since it's not intended to do cross-compilation - it is, as you affirm from my earlier post, a native VIC-20-hosted dynamic compiler. And my intention isn't to create 'yet another' VIC-20 product - my opening post in the blog explains clearly that this is actually a project intended for a custom homebrew machine, but using the VIC as a software/concept design host. Which is why I didn't post about it here, except to ask the 656x question, until an interest was expressed - it's VIC Jim, but not as we know it.

And yes, the language design is already far enough along to support modern control flow structures (without, incidentally, any risk of stack-overflow), 8/16/32/64-bit integer and float, signed and unsigned numerics, strings limited only by memory size, arrays, jagged arrays, associative sets, hash tables, indexed and keyed dictionary structures, and strongly-typed primitives including Bit/Byte/Word/Long/Double, String, Array, Char, Float, Pointer, and Boolean. There is also an aggressive garbage-collector, optimiser, and what I call SAVE FINAL, which turns the dynamically-generated assembly into a fully dereferenced non-editable 'cooked' version of the code.

Whether anyone aside from me ever chooses to use it, I do not predict - indeed, I'm designing it for use in a different computer and I'd be surprised if anyone else ever used it. But it'll work on the VIC-20, and if nothing else it's giving me an opportunity to write some nice 6502 and talk about it in a blog. And thus, it suffices.
Post Reply