
The Atari MC68000 Tutorials
Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team
Re: The Atari MC68000 Tutorials
Right, so, my formatting was the culprit ... i'll be tabbing around quite a bit more now 

-
- Disk Imager Supreme
- Posts: 2709
- Joined: Mon Aug 11, 2003 11:53 pm
- Location: just outside bristol
- Contact:
Re: The Atari MC68000 Tutorials
yeah, devpac is quite funny about having tabs everywheremembot wrote:Right, so, my formatting was the culprit ... i'll be tabbing around quite a bit more now

Re: The Atari MC68000 Tutorials
Glad I sorted that out quickly, Spiny. That's one of those things that can drive one mad by sheer frustration of unknown simplicity 

Re: The Atari MC68000 Tutorials
The normal way is to use a ';' for comments. AFAIK is Devpac to only assembler that also uses tabs. When you are planning to share code with non Devpac users please get used to place a ';' for your comments.membot wrote:Right, so, my formatting was the culprit ... i'll be tabbing around quite a bit more now
Code: Select all
clr.l -(a7) ; clear stack
move.w #32,-(a7) ; prepare for super mode
trap #1 ; call gemdos
addq.l #6,a7 ; clear up stack
move.l d0,old_stack ; backup old stack pointer
move.w #$700,$ffff8240 ; red background color
move.l old_stack,-(a7) ; restore old stack pointer
move.w #32,-(a7) ; back to user mode
trap #1 ; call gemdos
addq.l #6,a7 ; clear stack
clr.l -(a7) ; clean exit
trap #1 ; call gemdos
old_stack:
dc.l 0
- rocket-dog
- Atari Super Hero
- Posts: 779
- Joined: Wed Mar 05, 2008 3:13 pm
- Location: Great Britain - The Kingdom of Mercia
Re: The Atari MC68000 Tutorials
I am going to be lazy so apologies in advance. I know there is some discussion here about the virtues of the various marks of DevPac. Not qualified to know one from another. But if I download DevPac 2 can I still use this tutorial? Or is it only applicable to DevPac 3?
(PS: If anybody knows of a DevPac 3 download as separate files not an image I would be grateful.)
(PS: If anybody knows of a DevPac 3 download as separate files not an image I would be grateful.)
- rocket-dog
- Atari Super Hero
- Posts: 779
- Joined: Wed Mar 05, 2008 3:13 pm
- Location: Great Britain - The Kingdom of Mercia
Re: The Atari MC68000 Tutorials
Thank you. I have looked and looked and looked and looked and looked and looked and looked and looked and looked but to no avail.
I think I will just go with DevPac 3. You guys can carry discussing the merits of 3 vs 2 and 2 vs 3. I wouldn't understand what was being said anyway.

-
- Disk Imager Supreme
- Posts: 2709
- Joined: Mon Aug 11, 2003 11:53 pm
- Location: just outside bristol
- Contact:
Re: The Atari MC68000 Tutorials
I used v3 when I went through the tutorials and everything worked as it shouldrocket-dog wrote:Thank you. I have looked and looked and looked and looked and looked and looked and looked and looked and looked but to no avail.
I think I will just go with DevPac 3. You guys can carry discussing the merits of 3 vs 2 and 2 vs 3. I wouldn't understand what was being said anyway.

- rocket-dog
- Atari Super Hero
- Posts: 779
- Joined: Wed Mar 05, 2008 3:13 pm
- Location: Great Britain - The Kingdom of Mercia
Re: The Atari MC68000 Tutorials
It is a sign that I haven't been here much over the last 9 months or so that you have forgotten my infinite capacity to cock up the simplest of tasks and miss the blatantly obvious. All of which I achieve without the aid of a safety and with no skill whatsoever! 

Re: The Atari MC68000 Tutorials
a great read.Thanks! 

Re: The Atari MC68000 Tutorials
Hello everybody,
I thank the author of this tutorial for the excellent work.
I'm learning 68000 on Atari ST just for fun; this tutorial is essential for beginners and is better than most books.
I wish I had the book "Atari ST internals" but on the net I could not find a copy in electronic format.
Are there other books that explain how to use the various trap functions?
Thanks very much for you help.
I thank the author of this tutorial for the excellent work.
I'm learning 68000 on Atari ST just for fun; this tutorial is essential for beginners and is better than most books.
I wish I had the book "Atari ST internals" but on the net I could not find a copy in electronic format.
Are there other books that explain how to use the various trap functions?
Thanks very much for you help.
Re: The Atari MC68000 Tutorials
('< o o o o |''| STM,2xSTFM,2xSTE+HD,C-Lab Falcon MK2+HD,Satandisk,Ultrasatandisk,Ethernat.
Re: The Atari MC68000 Tutorials
Just wanted to also say thanks for these documents, I used to code 68k for old Macs really long ago but am excited to start working on the ST too 

- viking272
- Atari Super Hero
- Posts: 505
- Joined: Mon Oct 13, 2008 12:50 pm
- Location: west of London, UK
Re: The Atari MC68000 Tutorials
Yes they are good!zonky900 wrote:Just wanted to also say thanks for these documents, I used to code 68k for old Macs really long ago but am excited to start working on the ST too
These tutorials are in part a homage to Andreas Wahlin (aka Perihelion) who was sadly murdered in 2007.
http://www.atarilegend.com/contact/andreas.php
The comments at the bottom of the above webpage are very touching.
Re: The Atari MC68000 Tutorials
Just stumbled upon these tutorials after about a year of not giving my ST some data love, and wow! Thought I'd never be interested in programming (never been) but ASM on the ST is really fun, in a strange learning-how-computers-really-work way
And of course, the lot of it owes to the great way that it is written, learn-by-doing pedagogic and relaxed with a lot of humorous and casual reliefs. Really sad to hear about Perihelions death... Or rather, to hear that it was actually the guy who wrote this who was killed for his laptop that time in Bergsjön back in 2007 (I'm from the same town so i read those news).
About the tutorials though, which I've read the PDF version of to tutorial #5 now; Seems like there is a small error in the code which i managed to fix so that it works as intended (yay!). Either that, or I'm doing something wrong (but still getting the result right). Example code from the PDF:
I first thought that that was intended, in order to give you a little excercise, but the text doesn't say so - in fact, that part of the code is there just to make it work and not a part of the tutorial really... except for us "curious types" 
I first tried to run it but DevPac gave me an error at "section dss". Looking back some pages and changing it made it clear, it's "bss" and not "dss" (block storage segment) right? Seems to be a simple typo
Solved that problem, but it gave me another one at the next "old_screen" line ("BSS section cannot contain data"). Looking back again it was quite clear to me that the whole part of this code seems to be a bit wrong. "The DC area should be denoted by a “section data”, and the DS section should be denoted by a “section bss” (Block Storage Segment).". So, the old_palette which is a "define storage" is in the wrong section, and the same goes for the old_screen, a "define constant" which is placed in the storage section. At least that made sense to me, DevPac, and it assembled, executed and terminated back to the editor without any problems!
This is the new part of the code after i edited it (sorry for the indent-errors). Am I on track here? 

About the tutorials though, which I've read the PDF version of to tutorial #5 now; Seems like there is a small error in the code which i managed to fix so that it works as intended (yay!). Either that, or I'm doing something wrong (but still getting the result right). Example code from the PDF:
Code: Select all
section data
old_palette ds.l 8
old_resolution dc.w 0
old_stack dc.l 0
section dss
old_screen dc.l 0

I first tried to run it but DevPac gave me an error at "section dss". Looking back some pages and changing it made it clear, it's "bss" and not "dss" (block storage segment) right? Seems to be a simple typo

Solved that problem, but it gave me another one at the next "old_screen" line ("BSS section cannot contain data"). Looking back again it was quite clear to me that the whole part of this code seems to be a bit wrong. "The DC area should be denoted by a “section data”, and the DS section should be denoted by a “section bss” (Block Storage Segment).". So, the old_palette which is a "define storage" is in the wrong section, and the same goes for the old_screen, a "define constant" which is placed in the storage section. At least that made sense to me, DevPac, and it assembled, executed and terminated back to the editor without any problems!
Code: Select all
section data
old_screen dc.l 0
old_resolution dc.w 0
old_stack dc.l 0
section bss
old_palette ds.l 8

Re: The Atari MC68000 Tutorials
Hello Kriegor,Kriegor wrote:Am I on track here?
yes.

You have learned the hard way why it is sometimes really awkward to use assembly code between different assemblers. However, albeit some assemblers allow to have "ds.x" within the data section it seems that "section dss" is indeed a typo.
Some additional notes:
As any of these "memory variables" will be defined at the initialisation routine all of them can be moved to the BSS. So it would look like this:
Code: Select all
.data
.bss
old_palette: ds.w 16
old_resolution: ds.w 1
old_stack: ds.l 1
old_screen: ds.l 1
You may ask why I have chosen "ds.w 16" over "ds.l 8". Well, you should use the original size of the data even if it is the same result but later on it's easier to understand and easier to change the code.
Another example is declaring a two dimensional array:
Code: Select all
.bss
.align 4
screen_buffer: ds.w 320*240

It's better than having this:
Code: Select all
.bss
.align 4
screen_buffer: ds.l 38400
Sascha
Re: The Atari MC68000 Tutorials
Hi! Thanks for your input!Anima wrote:Hello Kriegor,Kriegor wrote:Am I on track here?
yes.
You have learned the hard way why it is sometimes really awkward to use assembly code between different assemblers. However, albeit some assemblers allow to have "ds.x" within the data section it seems that "section dss" is indeed a typo.
Some additional notes:
As any of these "memory variables" will be defined at the initialisation routine all of them can be moved to the BSS. So it would look like this:
Advantage: the memory space used to store the values will not add up to the program size.Code: Select all
.data .bss old_palette: ds.w 16 old_resolution: ds.w 1 old_stack: ds.l 1 old_screen: ds.l 1
You may ask why I have chosen "ds.w 16" over "ds.l 8". Well, you should use the original size of the data even if it is the same result but later on it's easier to understand and easier to change the code.
Another example is declaring a two dimensional array:
This example declares a true colour screen buffer for the Falcon030 which says: 320 pixels wide by 240 pixels height with a pixel size of 16 bits (one word). So if you want to change your resolution you can do it by changing the values.Code: Select all
.bss .align 4 screen_buffer: ds.w 320*240
It's better than having this:
CheersCode: Select all
.bss .align 4 screen_buffer: ds.l 38400
Sascha

Indeed, making the palette storage 16 words instead of 8 longwords naturally makes it more intuitive, did that to my code and it still works like a charm! I also tried to make the dc.N:s ds.N:s instead, and indeed as you say, it made the .PRG 10 bytes smaller compared to when using the dc:s. Kind of makes sense as 2*4 (longwords) and 1*2 (words) = 10 bytes!

I personally like those little errors (i think there are a few more, no biggies though) as it makes you need to dig deeper into the code than just copy it all, nice for repetition. Anyway i guess i should stop hijacking this thread and get on with the coding


-
- Captain Atari
- Posts: 247
- Joined: Sat Jul 02, 2011 7:18 pm
Re: The Atari MC68000 Tutorials
Great tutorials but packaged stupid, Single files buried five hundred feet deep
alltuts.zip/tut01.zip/tut01/tut01.pdf
Seems overkill?!
alltuts.zip/tut01.zip/tut01/tut01.pdf
Seems overkill?!
You do not have the required permissions to view the files attached to this post.
1040STe, 1040STf
Re: The Atari MC68000 Tutorials
Hi there,
I really enjoyed these tutorials, but I was a bit frustrated by the PDF format and the inability to fix minor typos and stuff, so I spent some time converting them to AsciiDoc, and rendering them in HTML.
The result is here: https://nguillaumin.github.io/perihelio ... tutorials/ , and the sources are on GitHub: https://github.com/nguillaumin/periheli ... -tutorials
I haven't changed much, it's mostly the original texts with a few fixes. I reformatted the source code to (hopefully) make them a bit more readable. I left all the credits where they were due, the idea was not to steal or take over but really to make them easier to share and contribute to.
I also setup a cross-assembly setup with VASM which can be used as a base for larger projects (See src/Makefile).
I hope that will make them a bit more accessible (especially when reading on mobile devices), and will allow more contributions via GitHub to fix issues or typos, and who knows maybe write additional tutorials?
Comments welcome, also feel free to raise issues on GitHub or submit pull requests!
edit: If people find this valuable, perhaps a mod could edit the first post of the thread to add a link to this HTML version?
I really enjoyed these tutorials, but I was a bit frustrated by the PDF format and the inability to fix minor typos and stuff, so I spent some time converting them to AsciiDoc, and rendering them in HTML.
The result is here: https://nguillaumin.github.io/perihelio ... tutorials/ , and the sources are on GitHub: https://github.com/nguillaumin/periheli ... -tutorials
I haven't changed much, it's mostly the original texts with a few fixes. I reformatted the source code to (hopefully) make them a bit more readable. I left all the credits where they were due, the idea was not to steal or take over but really to make them easier to share and contribute to.
I also setup a cross-assembly setup with VASM which can be used as a base for larger projects (See src/Makefile).
I hope that will make them a bit more accessible (especially when reading on mobile devices), and will allow more contributions via GitHub to fix issues or typos, and who knows maybe write additional tutorials?
Comments welcome, also feel free to raise issues on GitHub or submit pull requests!
edit: If people find this valuable, perhaps a mod could edit the first post of the thread to add a link to this HTML version?
-
- Hardware Guru
- Posts: 2313
- Joined: Sat Sep 10, 2005 11:11 am
- Location: Kosice, Slovakia
- Contact:
Re: The Atari MC68000 Tutorials
Man, this looks really awesome! Personally I came to the Perihelion tutorials way too late (when I already knew about m68k/TOS).
I'd advise to remove this line though:
I'd advise to remove this line though:
Unfortunately he does not, he was killed about 7 years ago, you can find info here on AF, too: http://atari-forum.com/viewtopic.php?t=11317. :-(He welcomes any and all feedback at <andreaswahlin@bredband.net>.
Re: The Atari MC68000 Tutorials
Yeah I new about this sad fact, but I was a bit reluctant to modify the original text too much... Perhaps it makes sense though, let's see what other people think?
- TheNameOfTheGame
- Atari God
- Posts: 1567
- Joined: Mon Jul 23, 2012 8:57 pm
- Location: Almost Heaven, West Virginia
Re: The Atari MC68000 Tutorials
I would think it's appropriate to remove that line or perhaps replace it with some sort of "in memory of" line.LynXX wrote:Yeah I new about this sad fact, but I was a bit reluctant to modify the original text too much... Perhaps it makes sense though, let's see what other people think?
Re: The Atari MC68000 Tutorials
Small update on this, the listings now have syntax highlighting. It's minor, but that make them a bit more readable.
It took me a while get all the pieces together, I had to start by contributing the m68k syntax to one of the syntax highlighter used by AsciiDoctor!
https://nguillaumin.github.io/perihelio ... tutorials/
It took me a while get all the pieces together, I had to start by contributing the m68k syntax to one of the syntax highlighter used by AsciiDoctor!
https://nguillaumin.github.io/perihelio ... tutorials/
You do not have the required permissions to view the files attached to this post.
- YQN
- Obsessive compulsive Atari behavior
- Posts: 146
- Joined: Sat Jul 22, 2017 6:01 pm
- Location: Meaux
- Contact:
Re: The Atari MC68000 Tutorials
Love this html version, merci !LynXX wrote:Small update on this, the listings now have syntax highlighting. It's minor, but that make them a bit more readable.
syntax.png
It took me a while get all the pieces together, I had to start by contributing the m68k syntax to one of the syntax highlighter used by AsciiDoctor!
https://nguillaumin.github.io/perihelio ... tutorials/
Re: The Atari MC68000 Tutorials
true, really great tutorial
thanks
one remark, would be cool to have a screenshot,to show how particular fx looks like. e.g. "Of Lighting A Candle (And Casting A Shadow)"
thanks
one remark, would be cool to have a screenshot,to show how particular fx looks like. e.g. "Of Lighting A Candle (And Casting A Shadow)"
Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net / AT Speed C16
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net / AT Speed C16
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/