Jump to content

Photo

Assembly Language programming books


28 replies to this topic

#1 morelenmir OFFLINE  

morelenmir

    Moonsweeper

  • 354 posts
  • Location:West Yorkshire, Great Britain

Posted Sun Feb 5, 2012 5:27 PM

I have started to make some - a little! - progress in Atari Assembler.

Most books which purport to teach ASM for Atari beginners usually focus exclusively on X=USR(...) routines in BASIC. The single title I have found that doesn't, instead required you to type in their own assembly language editor and debugger - in BASIC!

I was wondering if anyone knew of any titles other than 'The Atari Assembler - Don Inman & Kurt Inman' that focus primarily on programming with the Atari Assembler/Editor cart? I would ideally like something with a lot of listings that I can type-in and learn from - but again I would really like to find something with raw ASM and not just poking and peeking from BASIC. A screen-friendly PDF would be the icing on the cake!

Alternately I wonder if there are any internet-archived magazine that offer plenty of ASM code?

#2 David_P OFFLINE  

David_P

    Moonsweeper

  • 480 posts
  • Location:Canada

Posted Sun Feb 5, 2012 7:11 PM

Old ANALOG magazines had a fair number of assembly programs with source code. They also had a colun called "Boot Camp" that was intended to teach assembly lanaguage programming.

You'll want access to Mapping the Atari as well, once you get deeper into things.

#3 morelenmir OFFLINE  

morelenmir

    Moonsweeper

  • Topic Starter
  • 354 posts
  • Location:West Yorkshire, Great Britain

Posted Sun Feb 5, 2012 7:26 PM

I shall go on a trawl for Analog then David!

'Mapping The Atari' I did actually get hold of the other day - along with 96 other atari books!!!

#4 Ransom ONLINE  

Ransom

    River Patroller

  • 3,909 posts
  • Cartridge Gaming Enthusiast
  • Location:Just south of the Wisconsin border.

Posted Sun Feb 5, 2012 8:24 PM

"Atari Roots" is the one I found most useful.

#5 Allan OFFLINE  

Allan

    Quadrunner

  • 5,329 posts
  • Location:Wallingford, CT

Posted Sun Feb 5, 2012 9:36 PM

Try these:

http://www.atariarchives.org/alp/

http://www.atariarchives.org/mlb/

http://www.atariarchives.org/roots/

http://www.atariarchives.org/

Allan

#6 morelenmir OFFLINE  

morelenmir

    Moonsweeper

  • Topic Starter
  • 354 posts
  • Location:West Yorkshire, Great Britain

Posted Sun Feb 5, 2012 10:38 PM

MANY thanks again guys!!! I do actually have all those titles you recommend. Now I know they focus in the right area I shall go through them carefully.

I think the difficulty of ASM has been greatly over-emphasized. If it were as easy to find material on the Assembler/Editor cartridge as it is for BASIC then I am sure more people would be comfortable programming there. I really don't get the 'learn machine language through basic' angle. It is far easier to use a proper assembler working from mnemonics than it is to poke in hex op-codes. It is also far more of a struggle to correctly find free memory to use when the BASIC cartridge is in residence.

Edited by morelenmir, Sun Feb 5, 2012 10:39 PM.


#7 David_P OFFLINE  

David_P

    Moonsweeper

  • 480 posts
  • Location:Canada

Posted Sun Feb 5, 2012 11:01 PM

With BASIC, I tend toward small, relocatable routines for specific purposes, rather than trying to find some consistently free block of memory (well, there's always page 6, but everyone uses page 6).

#8 tschak909 ONLINE  

tschak909

    Dragonstomper

  • 601 posts
  • Location:USA

Posted Fri Feb 10, 2012 7:13 PM

I can't stress enough, on more than a few sites there is the Atari 400/800 Hardware manual that was published by Atari. It is well formatted, and has an exhaustive reference of every single chip, its registers, and their functions.

This was superceded by a newer internal document (The Bob Duhamel written System Reference Manual) that I would use ALONGSIDE the original Atari hardware reference manual, which describes the various bits that have been added by the XL and XE series machines (i.e. bank switching using PORTB, how to access the RAM underlying the OS to get access to the full 64K, etc.)

Atarimania has these manuals, as does a few other sites, google for it.

-Thom

#9 SIO99 OFFLINE  

SIO99

    Chopper Commander

  • 157 posts
  • Location:London, UK

Posted Sat May 12, 2012 12:56 PM

I have started to make some - a little! - progress in Atari Assembler.

Most books which purport to teach ASM for Atari beginners usually focus exclusively on X=USR(...) routines in BASIC. The single title I have found that doesn't, instead required you to type in their own assembly language editor and debugger - in BASIC!

I was wondering if anyone knew of any titles other than 'The Atari Assembler - Don Inman & Kurt Inman' that focus primarily on programming with the Atari Assembler/Editor cart? I would ideally like something with a lot of listings that I can type-in and learn from - but again I would really like to find something with raw ASM and not just poking and peeking from BASIC. A screen-friendly PDF would be the icing on the cake!

Alternately I wonder if there are any internet-archived magazine that offer plenty of ASM code?


Can you tell me which book you're talking about that requires you to type in their own Assembler/Debugger BASIC listing? That may be the only one I can use, due to lots of bills, not enough money, and a lack of Assembler carts at more reasonable prices. I've just been reading a listing of PD disks by ABBUC, but I haven't got a disk drive.I hope to get an SIO2SD soon. One of the PD Assemblers is called BIBO. Their list is all in German, which I speak.

I may try Assembling by hand, then converting it into decimal and typing it into a BASIC loader program. I recently dissassembled a short section of code from a BASIC listing.

BTW, I only recently bought an Atari 8 bitter (65XE), which I'm using to study simple games programming. Earlier today, I converted some short Sinclair BASIC listings from a certain programming magazine. I don't know when I might move on to Assembly programming.

#10 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,046 posts
  • Location:The land of Gorch

Posted Sat May 12, 2012 2:40 PM

Why use Atari's Assembler/Editor at all? There's much better options available (even natively)...cross-programming using a modern computer probably being the easiest method.

If you really want to make the experience more-painful, tho...just cross-program with your feet in a bucket of live piranha fish.

#11 morelenmir OFFLINE  

morelenmir

    Moonsweeper

  • Topic Starter
  • 354 posts
  • Location:West Yorkshire, Great Britain

Posted Sat May 12, 2012 6:36 PM

You've probably got the right of it Nukey!!! I do use EditPad Pro though and then copy/paste into Altirra when I have the source code typed into a text file.

My take on it is that for years and years I have wanted to learn how to program in assembler, but have always been scared away from PC ASM by the sheer complexity of doing so on the x86. Also there is the dos/windows issue where, yes you CAN use ASM for windows - but you inevitably end up just using it to make API calls. And I can do that fairly well in C already! For me at least this has always to an attempt at using MASM in native DOS - which leads back to the complexity of 8086 code and near/far pointers and all that malarkey. So... I thought I would give it a serious push by learning ASM on something nice and simple like the a8 with its pretty small number of mnemonics and small memory pool. To be fair I was doing pretty well, but then ran into a bloody irritating problem with DOS XE and a weird sound issue - a constant high-pitched whistle that drove me nuts and started whenever anything was written to disk from the assembler/editor cart. SpartaDOS didn't work with the examples from "atari roots", causing a crash whenever I tried to load object files into memory. ANYWAY that was a couple of months back now and I haven't found the impetus to knuckle down again, which is a shame as I was just getting to grips with the idea of the carry flag and doing register shifts! I might grit my teeth and start again with the blissfully quiet (I hope!) dos 2.5.

And SIO99 - the book with the basic assembler you typed in yourself called 'alpa' was "Atari 130XE Machine Language for the Absolute Beginner" by 'Kevin Bergin'. I really would recommend "Atari Roots" though - and perhaps through your learning stage give the PC Emulator 'Alitrra' a try, it is just about perfect and best of all FREE!!! I do understand some of us prefer to stick with nuts and bolts hardware though. I probably would too if I had a working A8!

Edited by morelenmir, Sat May 12, 2012 6:42 PM.


#12 SIO99 OFFLINE  

SIO99

    Chopper Commander

  • 157 posts
  • Location:London, UK

Posted Sun May 13, 2012 7:48 AM

You've probably got the right of it Nukey!!! I do use EditPad Pro though and then copy/paste into Altirra when I have the source code typed into a text file.

My take on it is that for years and years I have wanted to learn how to program in assembler, but have always been scared away from PC ASM by the sheer complexity of doing so on the x86. Also there is the dos/windows issue where, yes you CAN use ASM for windows - but you inevitably end up just using it to make API calls. And I can do that fairly well in C already! For me at least this has always to an attempt at using MASM in native DOS - which leads back to the complexity of 8086 code and near/far pointers and all that malarkey. So... I thought I would give it a serious push by learning ASM on something nice and simple like the a8 with its pretty small number of mnemonics and small memory pool. To be fair I was doing pretty well, but then ran into a bloody irritating problem with DOS XE and a weird sound issue - a constant high-pitched whistle that drove me nuts and started whenever anything was written to disk from the assembler/editor cart. SpartaDOS didn't work with the examples from "atari roots", causing a crash whenever I tried to load object files into memory. ANYWAY that was a couple of months back now and I haven't found the impetus to knuckle down again, which is a shame as I was just getting to grips with the idea of the carry flag and doing register shifts! I might grit my teeth and start again with the blissfully quiet (I hope!) dos 2.5.

And SIO99 - the book with the basic assembler you typed in yourself called 'alpa' was "Atari 130XE Machine Language for the Absolute Beginner" by 'Kevin Bergin'. I really would recommend "Atari Roots" though - and perhaps through your learning stage give the PC Emulator 'Alitrra' a try, it is just about perfect and best of all FREE!!! I do understand some of us prefer to stick with nuts and bolts hardware though. I probably would too if I had a working A8!


Thanks sooo much, for telling me about "Atari 130XE Machine Language for the Absolute Beginner"! It was one book I was considering anyway, so now I know which one to get. Atari Roots is available on www.atariarchives.org , anyway, but I haven't looked at it yet, because the title didn't give me any idea of what it was about. There are various A8 computers for sale on eBay, where I recently got my Atari 65XE complete with XC12, joystick, 3 games carts, and two TI game controllers which don't seem to work, for the sum of £22.01!

BTW, since my last post I've been working on a missile base/Space Invaders type program, which looks about as advanced as the original Pong, but I now understand how to program it and how it works!

Finally, here's a question for all you budding Assembly Language programmers out there. Here's a routine for the BBC Micro, as well as for the Commodore 64, which prints lots of text on the screen really quickly. I can't see much similarity between these routines. Can you modify them to work on the A8?

BBC

DATA 162,96,160,0,185,0,128,153,0,96,200,208,247,232,138,24,105,32,141,6,16,142,9,16,224,128,208,230,96

CBM64

DATA 162,0,169,46,157,40,4,157,0,5,157,0,6,157,232,6,232,208,241,96

#13 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 8,428 posts
  • Location:United Kingdom

Posted Sun May 13, 2012 10:10 AM

First thing to do is go and convert those numbers into their equivalent Assembly language instructions. You can do this easily with the hex converter in Windows' calculator and any website which lists the 6502's instructions. That will be an education in itself, and then you can post the resulting source code here for discussion. This is the kind of excercise I did two decades ago when I was first learning 6502 assembler, with no internet: just a 6502 guidebook and a pen and paper.

Regarding an A8 version: better to start from scratch, but comparisons with other systems will be much more meaningful with source code instead of data statements.

#14 SIO99 OFFLINE  

SIO99

    Chopper Commander

  • 157 posts
  • Location:London, UK

Posted Sun May 13, 2012 4:35 PM

First thing to do is go and convert those numbers into their equivalent Assembly language instructions. You can do this easily with the hex converter in Windows' calculator and any website which lists the 6502's instructions. That will be an education in itself, and then you can post the resulting source code here for discussion. This is the kind of excercise I did two decades ago when I was first learning 6502 assembler, with no internet: just a 6502 guidebook and a pen and paper.

Regarding an A8 version: better to start from scratch, but comparisons with other systems will be much more meaningful with source code instead of data statements.


I have disassembled a routine by hand before but it didn't make much sense. I wouldn't be able to write this kind of routine at all by myself at the moment.

#15 Stephen OFFLINE  

Stephen

    River Patroller

  • 4,724 posts
  • A8 Gear Head
  • Location:Akron, Ohio

Posted Sun May 13, 2012 5:26 PM

I have disassembled a routine by hand before but it didn't make much sense. I wouldn't be able to write this kind of routine at all by myself at the moment.

But that is the only way you will start to understand this. It may seem confusing at first, but there are plenty of people here who will help. Trust me - it will make much more sense looking at the mnemonics, than it will staring at decimal numbers. At most, the CBM64 routine will have 10 instructions, and that is assuming everything is a two-byte. There are no "complex" instructions on the 6502. Everything is either a load, store, compare, or some kind of bit-twiddling operation. So disassemble the routine, use an online 6502 op-code resource, and trace out by hand what each instruction is doing.

#16 ProWizard OFFLINE  

ProWizard

    River Patroller

  • 3,257 posts
  • MyIDE 2 Conversions in Progress!
  • Location:$d500-$d57f

Posted Sun May 20, 2012 1:14 PM

Why use Atari's Assembler/Editor at all? There's much better options available (even natively)...cross-programming using a modern computer probably being the easiest method.


Well... I agree on the first part of your comment. Atari Assembler Editor is terrible slow and not really a good option to learn assembler. The slowness of this assembler will not encourage anyone.

But I really do not share the idea of cross-assembling/programming at all.

I do a lot of coding on my little atari, and I do it all on the real thing itself. I have two assembler carts which I like both equal, and a lot. I have Synassembler on cart, and Mac/65. Both lightning fast, and very versatile.

The last few months I used the Synassembler some more than Mac/65. Synassembler is a drop faster, and has a few very handy options.

Although I see the benefits of cross-assembling, I do not think they are so great that they would discourage anyone of coding on the real thing.

And for me is the hobby: Spending time on the Atari... not spending more time on PC or Mac.

#17 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 8,428 posts
  • Location:United Kingdom

Posted Mon May 21, 2012 5:11 AM


Why use Atari's Assembler/Editor at all? There's much better options available (even natively)...cross-programming using a modern computer probably being the easiest method.


Well... I agree on the first part of your comment. Atari Assembler Editor is terrible slow and not really a good option to learn assembler. The slowness of this assembler will not encourage anyone.

But I really do not share the idea of cross-assembling/programming at all.


It's entirely dependent on the size of the project. SpartaDOS X was (AFAIK) written using a cross-assembler in the 1980s because it was a massive cartridge based project. Because of cross-platform development tools, we're now able to undertake huge, commercial-sized projects like these with barely a second thought. Without such tools, I doubt such projects would be undertaken (certainly not by me). It's hard enough to manage a dozen 2,500 line assembly source files in Eclipse on a 1080p monitor, let alone on a tiny 40x24 display and a text editor that maybe handles 16K files. A previous project I started on the A8 simply grew so big that cross-development became a necessity.

One the other hand, I still love using the Atari for small projects, and I do miss the days of compiling 200KB of source code using a floppy drive and a RAMdisk. Unfortunately times change, and for large projects, one simply does not have the time to code "in situ". But I do long to do some development on real hardware again, especially with a fast hard drive and bags of RAM. Where's that copy of MAE??? :)

#18 SIO99 OFFLINE  

SIO99

    Chopper Commander

  • 157 posts
  • Location:London, UK

Posted Tue Jul 31, 2012 5:30 AM

I've since typed in the ALPA disassembler from the book "Atari 130XE Machine Language for the Absolute Beginner". Unfortunately it doesn't work, so I'm checking and debugging the version I've typed in. I wonder if someone can save me any time? I keep getting the errors "UNKNOWN OPERATION CODE" within ALPA, then the program exits with the Atari BASIC message "ERROR 5 AT LINE 4015". So far, I've debugged up to line 7020. Errors I've found included graphics characters instead of spaces (originally printed in the book as small, squat triangles" and some missing spaces, next to some of these triangles. It seems the errors may all be to do with different parts of each line (i.e. label, opcode, and operand), not being the required length.

I tried assembling some examples by hand, but found they didn't work.

BTW, it seems that the Atari Assembler/Editor requires a disk drive (or SIO2SD?), so I can't use that at the moment, because I've only got the XC12 tape deck.

#19 Carl_R ONLINE  

Carl_R

    Space Invader

  • 40 posts

Posted Wed Aug 1, 2012 3:08 AM

I've typed it in as well and spent an entire evening debugging it. Right now it seems to work, at least it runs without exiting and the examples I've tried so far works. I have it in an ATR file which I could share but I suppose you really need a SIO2SD or similar to get it into your Atari.

#20 SIO99 OFFLINE  

SIO99

    Chopper Commander

  • 157 posts
  • Location:London, UK

Posted Wed Aug 1, 2012 11:27 AM

I've typed it in as well and spent an entire evening debugging it. Right now it seems to work, at least it runs without exiting and the examples I've tried so far works. I have it in an ATR file which I could share but I suppose you really need a SIO2SD or similar to get it into your Atari.


It's good to know that the listing actually works! I have no way of loading an ATR file into my Atari 65XE at the moment. I think some of the problems have been caused by the dot matrix printer listing printing squat triangles for spaces. Where spaces actually appear next to the squat triangles, what character are they supposed to represent? Also, according to the instructions given, I've started each line of Assembly Language with a TAB character, because the first spaces are supposed to be where a label would go. If there was actually a label there, then the "operation codes" or opcodes would probably have started at another TAB position to the right of where they actually start. Going over the listing, it looks like the way they're positioned may actually matter. How have you been using TAB characters when typing in the first two examples?

#21 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 8,428 posts
  • Location:United Kingdom

Posted Wed Aug 1, 2012 11:42 AM

A "squat triangle" denotes a single space. A triangle enclosed in quotes is a single space enclosed in quotes. Apart from arbitrary spaces between BASIC keywords, ignore them all. Just do a 1:1 substitution for space : triangle.

#22 Carl_R ONLINE  

Carl_R

    Space Invader

  • 40 posts

Posted Wed Aug 1, 2012 11:46 AM

Yes, the triangles puzzled me at first as well but I concluded they represented spaces. I then mistook the TAB character (a triangle pointing right) for a space which messed up the input totally. Found it during the debugging. All errors were related to mistypings of course. I spent some late evenings typing it in so that's why I wasn't too precise all the time. For example, the variable "INFOS$" I mistyped as "INFO$" in several places. While debugging I basically had to read the listing and run the program in my mind by jumping back and forth at every Gosub. I suppose it was a good exercise...

There was one line in the listing that was over the max line length, line 3715. How did they get that into the listing? Anyway, I just put the last RETURN statement on a new line.

When you enter a program line in ALPA there are three columns after the line number. First is for the label, second is for the mnemonic, third for the operand. If you don't want to enter a label, just press TAB to move to the next column. Type the mnemonic and then TAB again for the third column. Press Return when you want to go to the next line. Just press return again on an empty line when you want to leave program enter mode and go back to command mode. ASM to assemble. It's wonderfully slow, retro computing at its best.

Edited by Carl_R, Wed Aug 1, 2012 11:49 AM.


#23 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 8,428 posts
  • Location:United Kingdom

Posted Wed Aug 1, 2012 12:16 PM

To enter very long lines, you can always set the margin to 0 (POKE 82,0) to gain an extra six characters. Take a few spaces out of the line elsewhere and you'll have plenty of room for a colon and "RETURN". I suppose a lot of the grunt-work could be taken out of typing these things in by simply pasting the listing into Altirra. The listing could be pre-processed using a text editor on the PC to tidy things up (replace the odd set of characters the triangles produce in Notepad with spaces, for instance).

#24 Carl_R ONLINE  

Carl_R

    Space Invader

  • 40 posts

Posted Wed Aug 1, 2012 12:23 PM

How to cut and paste from a physical book? ;) Maybe it works from the pdf. For sio99 I suppose it wouldn't help since he can't transfer the file anyway. But your tip is of course a good one.

#25 SIO99 OFFLINE  

SIO99

    Chopper Commander

  • 157 posts
  • Location:London, UK

Posted Wed Aug 1, 2012 12:46 PM

Yes, the triangles puzzled me at first as well but I concluded they represented spaces. I then mistook the TAB character (a triangle pointing right) for a space which messed up the input totally. Found it during the debugging. All errors were related to mistypings of course. I spent some late evenings typing it in so that's why I wasn't too precise all the time. For example, the variable "INFOS$" I mistyped as "INFO$" in several places. While debugging I basically had to read the listing and run the program in my mind by jumping back and forth at every Gosub. I suppose it was a good exercise...

There was one line in the listing that was over the max line length, line 3715. How did they get that into the listing? Anyway, I just put the last RETURN statement on a new line.

When you enter a program line in ALPA there are three columns after the line number. First is for the label, second is for the mnemonic, third for the operand. If you don't want to enter a label, just press TAB to move to the next column. Type the mnemonic and then TAB again for the third column. Press Return when you want to go to the next line. Just press return again on an empty line when you want to leave program enter mode and go back to command mode. ASM to assemble. It's wonderfully slow, retro computing at its best.


Thanks for the tip about the triangle pointing right being the TAB character. I'll have to go back and look for that one. It would probably affect the length of each line of code.

How to input line 3715, as far as I remember, you not only use POKE 82,0 , but also abbreviated Atari BASIC commands. You don't have to memorise them all, because they're usually the first two characters followed by a . , as in POS. (POSITION), sometimes only one character followed by a . , such as G. (GOTO) or LO. (LOAD) or sometimes the first three characters followed by a . , as in RET. (RETURN), but ? for PRINT. Whenever two commands start with the same first two characters, then you either look up the shortened form or guess by using the first three characters, followed by a . character.

Or course, I can't help wondering how learning 6502 Assembly Language could enable me to write A8 demos , which remind me of Amiga demos and sometimes are even versions of Amiga demos! I think it may be that you need to think about creating your own routines for absolutely everything, forgetting about the Atari ROM, or even disable the ROM before your demo starts. Can anyone tell me how or where to learn about writing demos?

Edited by SIO99, Wed Aug 1, 2012 1:03 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users