Page 2 of 3

Re: Assembler

Posted: Sat Mar 09, 2024 9:49 pm
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

Re: Assembler

Posted: Sun Mar 10, 2024 5:21 am
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.

Re: Assembler

Posted: Mon Mar 11, 2024 9:51 am
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)?

Re: Assembler

Posted: Mon Mar 11, 2024 12:42 pm
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:

Re: Assembler

Posted: Mon Mar 11, 2024 3:44 pm
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.

Re: Assembler

Posted: Mon Mar 11, 2024 7:02 pm
by Orangeman96
Wilson, thegg: THANKS MUCH! :D -OGM

Re: Assembler

Posted: Tue Mar 12, 2024 8:26 am
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. :-)

Re: Assembler

Posted: Tue Mar 12, 2024 5:16 pm
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

Re: Assembler

Posted: Thu Mar 14, 2024 3:58 am
by pixel
Is there a master plan? What's to be achieved?

Re: Assembler

Posted: Mon Mar 18, 2024 8:24 am
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.

Re: Assembler

Posted: Tue Mar 19, 2024 6:59 pm
by Orangeman96
Received this in my snail-mail box today VIC 20 Machine Code Bruce Smith, 1984; here goes nothing... -OGM

Re: Assembler

Posted: Mon Mar 25, 2024 9:31 pm
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

Re: Assembler

Posted: Tue Mar 26, 2024 2:59 am
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.

Re: Assembler

Posted: Tue Mar 26, 2024 6:24 am
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.

Re: Assembler

Posted: Tue Mar 26, 2024 11:40 am
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.