New Girl Programmer.

Basic and Machine Language

Moderator: Moderators

SSmokingirl
Vic 20 Newbie
Posts: 1
Joined: Sun Sep 20, 2009 10:29 pm

New Girl Programmer.

Post by SSmokingirl »

Hi,
Just wanted to know.
I have been programming with a un-expanded Vic 20.
Well I just got a 16k memory expansion.
What are the peeks and pokes on this that have been changed?
Or I mean what changes with it pluged in.

Also I own a Machine Langugae Monitor Cartridge made by Commodore.
It is cart# 1213 or was it 1312 any way. What does this do?

If it only makes programs with just the Vic 20 unexpanded then how can I learn machine lang with 16k expansion and what asslembler do I use with the 16k expansion?

Plus if I do use a 16k expansion using a asslembler what are the basic commands. Can some one post a small bit of machine code and also explane the basic commands of a machine asslembler.

Also how to compile with asslembler so can be used with sys command to start programs or run command.

Thanks Guys
SSmokinGirl
P.S. I also have the asro-compiler can it be used with 16k and then progs run on 16k? with the adjusted peeks and pokes used for Graphics and screen cloors?
Bacon
for breakfast
Posts: 578
Joined: Mon Apr 19, 2004 8:07 am

Post by Bacon »

Welcome!

A post here with some machine language/assembler opcodes won't help you much if you want to learn machine languge programming. I suggest you start with Jim Butterfield's excellent book Machine Language for the Commodore 64 and other Commodore Computers (11 MB PDF file).
You'll get a good understanding of how the VIC works and all the important opcodes and programming techniques, and all you need is your VIC and your Machine Language Monitor Cartridge.

Later on, when you want move on to a symbolic assembler, the best way to go is probably to use a cross-assembler on a PC.
Bacon
-------------------------------------------------------
Das rubbernecken Sichtseeren keepen das cotton-pickenen Hands in die Pockets muss; relaxen und watschen die Blinkenlichten.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Re: New Girl Programmer.

Post by carlsson »

SSmokingirl wrote:What are the peeks and pokes on this that have been changed?
Someone made a very nice graphic about that before, but currently I'm not able to find it.

Roughly speaking, up to four things change when you add a memory expansion. Those are:

Start of Basic RAM
4096 ($1000) = Unexpanded
1024 ($0400) = +3K only
4608 ($1200) = +8K or more

End of Basic RAM
7679 ($1DFF) = Unexpanded or +3K
16383 ($3FFF) = +8K
24575 ($5FFF) = +16K

Position of screen matrix
7680 ($1E00) = Unexpanded or +3K
4096 ($1000) = +8K or more

Position of colour memory
38400 ($9600) = Unexpanded or +3K
37888 ($9400) = +8K or more

Actually the position of screen matrix and colour memory have rather little to do with the amount of memory. It is fully possible to move the screen matrix to a different address even on an unexpanded VIC-20. For practical purposes though, all this reshuffling happens because Basic needs continuous memory. As you can see, the unexpanded memory map places the screen matrix at the end of RAM, where an 8K expansion or more would extend the memory past the screen.

The colour memory is 1K nybbles, 4-bit memory. Whenever screen matrix begins on an even 1K, the colour memory starts at 37888. Whenever the screen begins on a 0.5K offset, the colour memory starts at 38400.

The VIC-1213 is a machine language monitor. If you have access to a multiple cartridge expander you can have it plugged in together with a 16K memory expansion and write programs for expanded VIC. Many people don't have a such cartridge expander which they are stuck with one cartridge at a time. Recent multi-carts however allow you to run a productivity cartridge together with a built-in memory expansion.
Also how to compile with asslembler so can be used with sys command to start programs or run command.
You would need to reserve space for a so-called Basic stub. It contains a line number, the SYS keyword, the decimal adress where your program begins and three zeroes to mark end of Basic program.
I also have the asro-compiler can it be used with 16k and then progs run on 16k? with the adjusted peeks and pokes used for Graphics and screen cloors?
Yes, the Austro Compiler generates executables that requite +8K or more to run.

I don't know what your previous experiences are, if you have done any machine code programming on e.g. the C64 or similar computer. Just as Bacon says though, the VIC-1213 today is mostly of academic interest or emergency tool if you're at a party with only your VIC to work with. For practical purposes I am a strong believer of cross assemblers. They both tend to be more user friendly once you got into it, and will allow you to write as large machine code programs as you can muster. Besides you won't have a problem with inserting two cartridges into the same slot...
Anders Carlsson

Image Image Image Image Image
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

You might find this interesting to read:
http://user.tninet.se/~pug510w/datormus ... vic20.html
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: New Girl Programmer.

Post by nbla000 »

SSmokingirl wrote:Hi,
Welcome to Denial, I think you are the first girl here :wink:
Also how to compile with asslembler so can be used with sys command to start programs or run command.
Some Examples:

Vic unexpanded programs, basic line is 2009 SYS4109, your code from $100d:

Code: Select all

org $1001
byte $0b,$10,$d9,$07,$9e,"4","1","0","9",0,0,0
Vic+3k programs, basic line is 2009 SYS1037, your code from $40d:

Code: Select all

org $401
byte $0b,$04,$d9,$07,$9e,"1","0","3","7",0,0,0
Vic+8/16/24k programs, basic line is 2009 SYS4621, your code from $120d:

Code: Select all

org $1201
byte $0b,$12,$d9,$07,$9e,"4","6","2","1",0,0,0
Mega-Cart: the cartridge you plug in once and for all.
gklinger
Vic 20 Elite
Posts: 2051
Joined: Tue Oct 03, 2006 1:39 am

Re: New Girl Programmer.

Post by gklinger »

carlsson wrote:Someone made a very nice graphic about that before, but currently I'm not able to find it.
Do you mean this one?
In the end it will be as if nothing ever happened.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: New Girl Programmer.

Post by nbla000 »

gklinger wrote:Do you mean this one?
Very helpful Schema's file for newbies and not, I've it on my archives but I forgot the link, many thanks Golan.
Mega-Cart: the cartridge you plug in once and for all.
Alan
Vic 20 Devotee
Posts: 280
Joined: Wed Mar 24, 2004 11:20 am

Post by Alan »

I put this page together some time ago that might also be helpful:

http://8bitcentral.com/vicram.htm
Alan
Centallica
Pinballer
Posts: 1090
Joined: Wed Feb 02, 2005 11:26 am

Post by Centallica »

Welcome!

Cough Cough....I'm single :D
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I've never seen you guys so helpful! hahaha
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

All that matters to me is if someone at least has tried to read up on the subject before posting questions. On the other end of the scale you have those who draw own, false conclusions and can't accept they got it wrong. As long as you try to do some of the groundwork and show interest in what you're asking without putting a lot of prestige into it, you are likely to get friendly and helpful replies.
Anders Carlsson

Image Image Image Image Image
User avatar
Ivanhoe76
Vic 20 Devotee
Posts: 200
Joined: Fri Sep 28, 2007 11:17 am
Location: Italy

Post by Ivanhoe76 »

Welcome to Denial... I couldn't be as helpful as the other members, but anyway nice to meet you!
No one should tolerate death and violence because tolerance will generate habit.
IsaacKuo
Vic 20 Hobbyist
Posts: 147
Joined: Tue Aug 04, 2009 5:45 am

Post by IsaacKuo »

Has anyone made a "generic" BASIC stub which will work regardless of the VIC20's memory expansions? I've coded one which works...the first time. But it needs something more to be able to work multiple times and I'm not sure exactly what.
TBCVIC
Vic 20 Hobbyist
Posts: 127
Joined: Thu Mar 05, 2009 3:38 am

Post by TBCVIC »

You've made a program that works once and then never again? That's amazing.
Ola Andersson
Image
IsaacKuo
Vic 20 Hobbyist
Posts: 147
Joined: Tue Aug 04, 2009 5:45 am

Post by IsaacKuo »

The first thing it does is copy the program to the desired location...I had a bug where it didn't quite work correctly. It works better now...I'm still not 100% sure of it.

So it would work the first time you typed in RUN, but not subsequent times. It seems to work properly now, but I'm not entirely confident of it.
Post Reply