The Atari MC68000 Tutorials

All 680x0 related coding posts in this section please.

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
membot
Captain Atari
Captain Atari
Posts: 198
Joined: Tue Jul 27, 2004 8:57 am

Re: The Atari MC68000 Tutorials

Postby membot » Sun May 29, 2011 9:11 am

Right, so, my formatting was the culprit ... i'll be tabbing around quite a bit more now :wink:

User avatar
spiny
Disk Imager Supreme
Disk Imager Supreme
Posts: 2340
Joined: Mon Aug 11, 2003 11:53 pm
Location: just outside bristol
Contact:

Re: The Atari MC68000 Tutorials

Postby spiny » Sun May 29, 2011 1:08 pm

membot wrote:Right, so, my formatting was the culprit ... i'll be tabbing around quite a bit more now :wink:


yeah, devpac is quite funny about having tabs everywhere :)

User avatar
membot
Captain Atari
Captain Atari
Posts: 198
Joined: Tue Jul 27, 2004 8:57 am

Re: The Atari MC68000 Tutorials

Postby membot » Sun May 29, 2011 1:22 pm

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

User avatar
Nyh
Atari God
Atari God
Posts: 1496
Joined: Tue Oct 12, 2004 2:25 pm
Location: Netherlands

Re: The Atari MC68000 Tutorials

Postby Nyh » Mon May 30, 2011 9:05 am

membot wrote:Right, so, my formatting was the culprit ... i'll be tabbing around quite a bit more now :wink:

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.

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


Hans Wessels

User avatar
rocket-dog
Atari Super Hero
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

Postby rocket-dog » Sun Feb 05, 2012 8:41 pm

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.)

User avatar
spiny
Disk Imager Supreme
Disk Imager Supreme
Posts: 2340
Joined: Mon Aug 11, 2003 11:53 pm
Location: just outside bristol
Contact:

Re: The Atari MC68000 Tutorials

Postby spiny » Mon Feb 06, 2012 6:17 pm


User avatar
rocket-dog
Atari Super Hero
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

Postby rocket-dog » Mon Feb 06, 2012 6:31 pm

spiny wrote:devpac 3 here:

http://dhs.nu/files.php?t=single&ID=5

:)


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. :mrgreen:

User avatar
spiny
Disk Imager Supreme
Disk Imager Supreme
Posts: 2340
Joined: Mon Aug 11, 2003 11:53 pm
Location: just outside bristol
Contact:

Re: The Atari MC68000 Tutorials

Postby spiny » Mon Feb 06, 2012 8:08 pm

rocket-dog wrote:
spiny wrote:devpac 3 here:

http://dhs.nu/files.php?t=single&ID=5

:)


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. :mrgreen:


I used v3 when I went through the tutorials and everything worked as it should :)

User avatar
rocket-dog
Atari Super Hero
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

Postby rocket-dog » Mon Feb 06, 2012 9:35 pm

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! :D

xdy0d3x
Atarian
Atarian
Posts: 4
Joined: Tue Jul 03, 2012 12:57 pm

Re: The Atari MC68000 Tutorials

Postby xdy0d3x » Tue Jul 03, 2012 1:09 pm

a great read.Thanks! :wink:

qwe
Atari User
Atari User
Posts: 40
Joined: Mon Oct 29, 2012 10:06 pm

Re: The Atari MC68000 Tutorials

Postby qwe » Wed Oct 31, 2012 9:34 am

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.

User avatar
MiggyMog
Atari Super Hero
Atari Super Hero
Posts: 802
Joined: Sun Oct 30, 2005 4:43 pm
Location: Scotland

Re: The Atari MC68000 Tutorials

Postby MiggyMog » Thu Nov 08, 2012 12:13 am

('< o o o o |''| STM,2xSTFM,2xSTE+HD,C-Lab Falcon MK2+HD,Satandisk,Ultrasatandisk,Ethernat.

zonky900
Atari User
Atari User
Posts: 34
Joined: Mon Jan 21, 2013 4:24 am

Re: The Atari MC68000 Tutorials

Postby zonky900 » Mon Jan 21, 2013 11:39 pm

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 :lol:

User avatar
viking272
Captain Atari
Captain Atari
Posts: 242
Joined: Mon Oct 13, 2008 12:50 pm
Location: west of London, UK

Re: The Atari MC68000 Tutorials

Postby viking272 » Tue Jan 22, 2013 11:19 pm

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 :lol:


Yes they are good!
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.

Kriegor
Atariator
Atariator
Posts: 21
Joined: Tue Apr 03, 2012 7:23 pm

Re: The Atari MC68000 Tutorials

Postby Kriegor » Thu Feb 07, 2013 4:30 pm

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:

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 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!

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


This is the new part of the code after i edited it (sorry for the indent-errors). Am I on track here? :)

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 655
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The Atari MC68000 Tutorials

Postby Anima » Fri Feb 08, 2013 10:53 am

Kriegor wrote:Am I on track here? :)


Hello Kriegor,

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


Advantage: the memory space used to store the values will not add up to the program size.

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


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. ;)

It's better than having this:

Code: Select all

.bss
.align 4
screen_buffer:    ds.l 38400


Cheers
Sascha

Kriegor
Atariator
Atariator
Posts: 21
Joined: Tue Apr 03, 2012 7:23 pm

Re: The Atari MC68000 Tutorials

Postby Kriegor » Fri Feb 08, 2013 2:46 pm

Anima wrote:
Kriegor wrote:Am I on track here? :)


Hello Kriegor,

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


Advantage: the memory space used to store the values will not add up to the program size.

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


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. ;)

It's better than having this:

Code: Select all

.bss
.align 4
screen_buffer:    ds.l 38400


Cheers
Sascha


Hi! Thanks for your input! :)

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! :cool: Even though i haven't really gotten to that part of the tutorials it's good to have it in mind for the future!

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 :) I'll get back in a more relevant thread if i get stuck at something and can't find any info on it. Let's just conclude that the tutorials have some small "accidential challenges"/errors/typos, but nothing you shouldn't be able to handle at that point anyway. Thanks for the hint on memory-saving!

:cheers:

Silly_Pony
Captain Atari
Captain Atari
Posts: 216
Joined: Sat Jul 02, 2011 7:18 pm

Re: The Atari MC68000 Tutorials

Postby Silly_Pony » Sun Jun 16, 2013 4:32 pm

Great tutorials but packaged stupid, Single files buried five hundred feet deep

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

User avatar
LynXX
Atariator
Atariator
Posts: 20
Joined: Wed Jul 19, 2017 3:15 am
Location: Seattle, WA, USA

Re: The Atari MC68000 Tutorials

Postby LynXX » Sat Sep 16, 2017 10:58 pm

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?

mikro
Atari God
Atari God
Posts: 1305
Joined: Sat Sep 10, 2005 11:11 am
Location: Brisbane, Queensland, Australia
Contact:

Re: The Atari MC68000 Tutorials

Postby mikro » Sat Sep 16, 2017 11:59 pm

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:

He welcomes any and all feedback at <andreaswahlin@bredband.net>.

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. :-(

User avatar
LynXX
Atariator
Atariator
Posts: 20
Joined: Wed Jul 19, 2017 3:15 am
Location: Seattle, WA, USA

Re: The Atari MC68000 Tutorials

Postby LynXX » Sun Sep 17, 2017 12:02 am

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?

User avatar
TheNameOfTheGame
Atari God
Atari God
Posts: 1055
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: The Atari MC68000 Tutorials

Postby TheNameOfTheGame » Sun Sep 17, 2017 12:06 am

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?


I would think it's appropriate to remove that line or perhaps replace it with some sort of "in memory of" line.


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 2 guests