Assembler

You need an actual VIC.

Moderator: Moderators

User avatar
Orangeman96
Vic 20 Amateur
Posts: 45
Joined: Tue Jan 16, 2024 3:42 pm
Location: U.S.A.

Re: Assembler

Post by Orangeman96 »

I could use the help from all of you! :lol:

I have been wanting to learn how to program in 6502 Assembly/ML for nearly four decades! (I am fairly proficient in BASIC, UCSD PASCAL, FORTRAN 77, PERL/awk, and IBM mainframe NQL.)

I have been trying to learn via CBM prg Studio, but don't feel the proverbial "light bulb" coming on such that I could design, code, build, and execute something with utility and (hopefully) longevity.

OGM
User avatar
thegg
Vic 20 Amateur
Posts: 69
Joined: Mon Aug 30, 2021 4:49 am
Location: England
Occupation: retired

Re: Assembler

Post by thegg »

Orangeman96 wrote: Sat Mar 09, 2024 9:49 pmI have been trying to learn via CBM prg Studio, but don't feel the proverbial "light bulb" coming on such that I could design, code, build, and execute something with utility and (hopefully) longevity.
I'm afraid design needs to be done elsewhere using whatever method you are happy with. However, you will find the rest of program development is well supported: especially if you use VICE as your test environment.
User avatar
Orangeman96
Vic 20 Amateur
Posts: 45
Joined: Tue Jan 16, 2024 3:42 pm
Location: U.S.A.

Re: Assembler

Post by Orangeman96 »

If I could only choose one book to learn how to program in Assembly/Machine Language on the VIC-20, what would it be (and perhaps, why)?
User avatar
Wilson
Vic 20 Enthusiast
Posts: 190
Joined: Mon Sep 28, 2009 7:19 am
Location: Brooklyn, NY

Re: Assembler

Post by Wilson »

Most concepts of assembly transfer from computer-to-computer. If you understand the fundamentals, it's easy to apply them to any given system. But the 6502 is as good a place to start as any, and Jim Butterfield's "Machine Language for the Commodore 64 and other Commodore Computers" is probably the most common recommendation. I used it myself and it was a great introduction.

link

Before that, I learned the asm basics from Jeff Dunham's "Assembly Language Step by Step", which covers real-mode DOS 16-bit x86 assembly. It was good but maybe spent too much time on obsolete concepts like MASM/TASM features. Although, you might find those interesting! :mrgreen:
User avatar
thegg
Vic 20 Amateur
Posts: 69
Joined: Mon Aug 30, 2021 4:49 am
Location: England
Occupation: retired

Re: Assembler

Post by thegg »

Orangeman96 wrote: Mon Mar 11, 2024 9:51 am If I could only choose one book to learn how to program in Assembly/Machine Language on the VIC-20, what would it be (and perhaps, why)?
If you want a good beginner's book, take a look at VIC-20 Machine Code by Bruce Smith. You will find it in the Internet Archive. I stumbled on it by accident and wished I had it when I was starting out with assembly. For me, it gives good coverage of 6502 assembly in the context of the VIC-20 using simple examples. It won't help with how to design and implement a VIC-20 masterpiece, but it does provide a lot of the building blocks.
User avatar
Orangeman96
Vic 20 Amateur
Posts: 45
Joined: Tue Jan 16, 2024 3:42 pm
Location: U.S.A.

Re: Assembler

Post by Orangeman96 »

Wilson, thegg: THANKS MUCH! :D -OGM
Merytsetesh
Vic 20 Amateur
Posts: 40
Joined: Sat Mar 02, 2024 8:57 pm
Location: Canada

Re: Assembler

Post by Merytsetesh »

Mastering the VIC-20 has been mentioned elsewhere as a very good source. It, together with a lot of other books, are available here. To be honest, I'm going back to these for my current mega-project, for which I find I have to relearn a load that I've apparently forgotten.

I have another suggestion.

As a student of spoken, human, languages, one thing that I've done in the past is to find a book I know well -- often The Adventures of Sherlock Holmes -- and read them in translation. I can get enough of a gist to follow the story and I can write down new words and things I don't understand as I go. And I keep going back to them, re-reading, and I get better. It takes a while but it can be done. I learned very elementary read Swedish like that.

Where am I going with this? Bear with me.

Some type-in games use short machine code routines stored (normally) as lines of numeric DATA statements, which are read and then poked. )Often into the cassette buffer.) One such example in my mind is in Owen Bishop's book The VIC-20 Games Book, "Bombing Run" on page 47. (I think of this as it was one of my favourite books growing up: it broke down each block of BASIC lines into sections and explained what each was doing.) So what you might try is to disassemble -- by hand! -- some of these short routines, and annotate them by line (LDA #$9 -> 'load 9 into A') and, once you have more of an overview, you could start to see what each little section of code is doing, and how it's doing it. I recommend doing it by hand as I've found, personally and as an educator, it really helps with learning and understanding what's going on.

I'm nowhere near any kind of 6502 expert these days: I willingly defer to many others here on this site. And I'm going to take my own advice, I think, and go back to (re-)learning. :-)
User avatar
Orangeman96
Vic 20 Amateur
Posts: 45
Joined: Tue Jan 16, 2024 3:42 pm
Location: U.S.A.

Re: Assembler

Post by Orangeman96 »

All good stuff...

I actually have a copy of Bruce Smith's VIC 20 Machine Code heading this way; I'll keep you posted as to how that goes

OGM
Last edited by Orangeman96 on Sat Mar 23, 2024 11:24 am, edited 1 time in total.
User avatar
pixel
Vic 20 Scientist
Posts: 1358
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Assembler

Post by pixel »

Is there a master plan? What's to be achieved?
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
AndyH
Vic 20 Afficionado
Posts: 364
Joined: Thu Jun 17, 2004 5:51 am
Website: https://www.hewco.uk
Location: UK
Occupation: Developer

Re: Assembler

Post by AndyH »

Big questions, lots of answers. Here's a couple of things to consider, if they line up to what you want to be able to achieve...

This book https://www.amazon.co.uk/Retro-Game-Dev ... 66276a05f7 might be useful. It is focused on the 64, not the Vic, but demonstrates an aspect missing from books on assembly... Ie: how to make something and in that case this is a game.

It's not perfect, you will need another source of information, but it's where I started along with a book on 6502 assembler mnemonics and what they do, and a hardware manual such as the Vic programmers guide or mapping the Vic.

It uses CBM PRG Studio so that could be relevant here.

Where I ended up going was Turbo Rascal. It doesn't suit everyone, but for me the sort of mix between high level Pascal and low level assembler clicked perfectly. I relearnt a lot about the Vic I'd forgotten and a whole lot more I never knew was there. I learnt assembler and how to bring that together with a form of "C" - like Pascal designed for 8 bit development. I have fun doing this and coupled with a goal that made learning easier.
--
AndyH
HEWCO | Vic 20 blog
User avatar
Orangeman96
Vic 20 Amateur
Posts: 45
Joined: Tue Jan 16, 2024 3:42 pm
Location: U.S.A.

Re: Assembler

Post by Orangeman96 »

Received this in my snail-mail box today VIC 20 Machine Code Bruce Smith, 1984; here goes nothing... -OGM
User avatar
Orangeman96
Vic 20 Amateur
Posts: 45
Joined: Tue Jan 16, 2024 3:42 pm
Location: U.S.A.

Re: Assembler

Post by Orangeman96 »

Orangeman96 wrote: Tue Mar 19, 2024 6:59 pm Received this in my snail-mail box today VIC 20 Machine Code Bruce Smith, 1984; here goes nothing... -OGM
Well, I am a little less than halfway through, and slowly reading/studying the text, but I have yet to have an "a-ha" moment. Wish me luck as I plow forward! :) -OGM
User avatar
pixel
Vic 20 Scientist
Posts: 1358
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: Assembler

Post by pixel »

Any summary of this adventure? Somebody once asked me if I could teach him to programme. I asked "Do you know how a computer works?" "Yes! You grab the mouse *grab* and then you click here and here and…" It takes Harvard experience to teach adults like that.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Assembler

Post by beamrider »

I would suggest separating the problem into two parts..

1) Learning 6502
2) Learning to program the VIc hardware in 6502.

I would use the many web based resources (google 6502 assembler online) for part 1 then you will find part 2 much easier.
User avatar
darkatx
Vic 20 Afficionado
Posts: 471
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Re: Assembler

Post by darkatx »

Let's touch on what you are familiar with as you have programming experience.

So you know higher level languages that means you understand basic concepts of loops and variables and subroutines, etc...

Assembly is lower so a lot of what you know can translate well just think of it as programming in a language you know but even more crude.

Jim Butterfield's book is probably the best one out there as posted earlier. He makes great use of analogies and guides you through the basics giving you the confidence to take on more and more.
Learning all the time... :)
Post Reply