4 POKE Addresses I Found

Basic and Machine Language

Moderator: Moderators

Post Reply
JRBasic
Vic 20 Newbie
Posts: 17
Joined: Thu Dec 20, 2018 10:31 am
Occupation: Programmer

4 POKE Addresses I Found

Post by JRBasic »

Now, you've all heard of the POKE command! It lets you edit the memory inside the VIC-20!
Well, I've discovered 4 POKE addresses that actually affect the screen!
36880 - When changed, this sets the screen horizontal position, you can tell because the area inside the border moves on the X axis!
36881 - When changed, this sets the screen vertical position, Again, you can tell because the area inside the border moves on the Y axis!
36882 - This...uhh, I have no idea what this address is! All I know is that it screws the screen up when modified.
36883 - How much of the screen is visible on the Y axis, For some reason, odd numbers will do something weird after a certain quantity!

Anyways, that was about 4 POKE addresses I found that were.....rather interesting! You can send me some more POKE addresses through replies!
Last edited by JRBasic on Thu Jul 11, 2019 10:06 pm, edited 1 time in total.
User avatar
srowe
Vic 20 Scientist
Posts: 1341
Joined: Mon Jun 16, 2014 3:19 pm

Re: 4 POKE Addresses I Found

Post by srowe »

These are 'mirrors' of the VIC registers that are usually addressed from $9000 (36864). An explanation of what each register does can be found in https://en.wikipedia.org/wiki/MOS_Techn ... #Registers, with more details in books like the Programmers Reference.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: 4 POKE Addresses I Found

Post by orion70 »

Nice! This post reminds me of the (in)famous Peeks and Pokes section of several mags back in the Eighties :)
Kakemoms
Vic 20 Nerd
Posts: 740
Joined: Sun Feb 15, 2015 8:45 am

Re: 4 POKE Addresses I Found

Post by Kakemoms »

Oh, yea these are somewhat confusing as "mirrors". There are 16 registers in the VIC chip that controls screen functions. They normally start at $9000 (hex) which equals 36864. The last register is at 36864+15=36879. Now if you go to 36880, the VIC chip will receive data because of the internal logic (=address decoding scheme) that the chip uses. The book "Compute! Mapping the VIC" (you can find a pdf of this online), is a good reference. It says that subtracting 16 on the values from 36880 and above will tell you what VIC register you access.

Now, if you look at the Schematics of the VIC-20, all address lines from A0 to A13 are connected on the VIC chip, but most of the time, these are used by the VIC chip to access the RAM in order to build the screen contents. E.g. the VIC chip and the 6502 CPU of the VIC-20 shares the address lines with each getting half the time to access the RAM. Now, if you poke into a VIC register, the CPU will try to store data into one of the addresses (36864-36879), but this only gets to the VIC chip if the RW line is set to write (see datasheet). In that case, the address lines A0-A3 are used to point to the correct register.

Not all addresses hit the the chip registers since the chip has another limiter (in addition to RW) which is a "chip select". The VIC chip does not have a separate "chip select" pin, but uses address lines A13-A8 to decide if it has been selected (see datasheet). This corresponds to using an address $1000 on the A13-A8 lines. The internal logic of the VIC-20 uses the output of the cpu's address lines A15-A13 to make certain block signals called BLK0, BLK1, BLK2, .. up to BLK7 (this comes from the 74LS138 in the UC5 socket). BLK1-3 and BLK5 can be seen on the expansion port. For the VIC chip, the BLK4 signal is fed into A13 (on the VIC chip, so that the VIC chip is only selected if A12-A8 correspond to address $1000 and A15 is high, A14 low and CPU A13 loow (which sets VIC A13 low), which translates into address $9000.

So as you see, address lines A7, A6, A5 and A4 are not used to neither select the chip register or decode the address, meaning their content is not used. Thus any address within 36864-36879, but with A4 high (=+16), with A5 high (=+32), with A6 high (=+64) or with A7 high (=+128) will activate the VIC registers. POKE'ing or PEEK'ing these registers (up to 36879+16+32+64+128=37119) will access the same registers and work exactly the same way. You just need to figure out the register you are accessing (by setting A7-A4 bits to zero).
JRBasic
Vic 20 Newbie
Posts: 17
Joined: Thu Dec 20, 2018 10:31 am
Occupation: Programmer

Re: 4 POKE Addresses I Found

Post by JRBasic »

What are you talking about? :/
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Re: 4 POKE Addresses I Found

Post by Victragic »

... and with that, another newbie is scared away. :shock:

Fascinating though, I had no idea these locations did anything.
3^4 is 81.0000001
User avatar
Mike
Herr VC
Posts: 4842
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 4 POKE Addresses I Found

Post by Mike »

Victragic wrote:... and with that, another newbie is scared away. :shock:
Maybe it wasn't that easy to strive the right balance formulating a reply between "sorry, but this isn't exactly news", "yes, indeed this is, because [... followed by an over-length, but really unneccessary technical explanation ...]", and "whoa, what's this? tell us more!".

IMO, a good idea for a newcomer to a forum is possibly - first to read quite some postings, to get a feel what's being talked about. Chances are when you're coming up with a first post that announces something spectacular in your opinion, it really isn't. But if you frame it in the form of a question, "I've found out [something]. Does anyone here know (more) about this?", then the subject is more likely to be handled on a adequate 'level'.

In case of the thread topic here, a *very* similar question was raised not to far ago, in the thread "Writing to $9010..$901F". Something JRBasic could have possibly found out beforehand with a little research here in Denial. There, it was not only cleared up, that these addresses merely act as "mirrors" of the standard VIC registers, but that there are also extra complications, which means it is not a good idea to use these mirrors at all.


(mod: thread was split and OT posts moved to here)
JRBasic
Vic 20 Newbie
Posts: 17
Joined: Thu Dec 20, 2018 10:31 am
Occupation: Programmer

Re: 4 POKE Addresses I Found

Post by JRBasic »

I know this topic is old, but I started this topic!
Turns out you can manipulate the registers and the speed of assembly to create a wave effect.
bdk6
Vic 20 Amateur
Posts: 47
Joined: Fri Sep 29, 2017 7:40 pm
Website: http://www.smalltimeelectronics.com
Location: TN, USA
Occupation: Embedded engineer

Re: 4 POKE Addresses I Found

Post by bdk6 »

Can you post a short program that demonstrates that? I would be interested in trying it out.
Post Reply