Are there any good/elaborate ASM tutorials around?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
elusive
Very interested
Posts: 57
Joined: Fri Jan 27, 2012 12:03 am

Are there any good/elaborate ASM tutorials around?

Post by elusive » Tue Dec 29, 2015 9:41 pm

I've seen a few tutorials here and there that have been very helpful in learning some of the more basic op codes and working with data registers, but I haven't found much in terms of using the address registers. I guess what I'm asking for is almost a "hand held" (I really hate that term) tutorial that shows examples and breaks it down for someone who's used to higher level languages.

For example, one thing I'm not 100% sure on (and don't know the proper terminology to search google effectively) would be:

Code: Select all

    move.l d0,-(a2)
    move.l d2, (a4)+
I'm assuming the above snippet would be moving the longword from d0 and putting it in the address register a2, and decrements the address by a longword, and the 2nd line does the opposite and increments the address? Another question I have is how large are these address registers? Do they operate from a specific memory range?

But yea, these are the types of things I have questions on, and I really don't want to be that annoying member who constantly posts silly, newbie questions :P

Thanks!

ehaliewicz
Very interested
Posts: 50
Joined: Tue Dec 24, 2013 1:00 am

Re: Are there any good/elaborate ASM tutorials around?

Post by ehaliewicz » Wed Dec 30, 2015 12:15 am

The example code you have would do this

Code: Select all

move.l d0, -(a2)  // moves the 32-bit value in d0 to the address pointed to by a2, decrementing it by 4 before addressing
move.l d2,  (a4)+ // moves the 32-bit value in d2 to the address pointed to by a4, incrementing it by 4 after addressing

the increment/decrement amounts are scaled by the size of the instruction, longwords are 4, words are 2, bytes are 1.
This page explains the various addressing modes pretty well. http://physinfo.ulb.ac.be/cit_coursewar ... c68000.htm

elusive
Very interested
Posts: 57
Joined: Fri Jan 27, 2012 12:03 am

Re: Are there any good/elaborate ASM tutorials around?

Post by elusive » Wed Dec 30, 2015 12:25 am

ehaliewicz wrote:The example code you have would do this

Code: Select all

move.l d0, -(a2)  // moves the 32-bit value in d0 to the address pointed to by a2, decrementing it by 4 before addressing
move.l d2,  (a4)+ // moves the 32-bit value in d2 to the address pointed to by a4, incrementing it by 4 after addressing

the increment/decrement amounts are scaled by the size of the instruction, longwords are 4, words are 2, bytes are 1.
This page explains the various addressing modes pretty well. http://physinfo.ulb.ac.be/cit_coursewar ... c68000.htm
Thank you! This is exactly what I was looking for :D

ryanfaescotland
Very interested
Posts: 53
Joined: Mon Feb 09, 2015 10:46 pm
Contact:

Re: Are there any good/elaborate ASM tutorials around?

Post by ryanfaescotland » Wed Jan 06, 2016 8:57 am

The above link won't show for me so can't see exactly what you are looking for. However...

Have you read the blog by BigEvilCorporation? It is the most recent one I've stumbled across and really enjoyed. The start is here: http://bigevilcorporation.co.uk/2012/02 ... g-started/ but it is mostly about setting up your environment so the ASM related parts start in part 2: http://bigevilcorporation.co.uk/2012/03 ... uage-then/

It's geared towards developing on the Megadrive rather than 68K specifically but to be honest I prefer that rather than generic 68K stuff.

Of course there is the Easy68K website: http://www.easy68k.com/index.html it has a handful of examples and the simulator can be fun to play with and test the addressing modes yourself. It is really easy to get set up and running.

I know these are both fairly obvious ones you've probably already came across so here is a more obscure source: http://www.amazon.co.uk/Introduction-68 ... rogramming. I bought this on a whim and actually really liked it. It's short, lightweight but well presented and interesting and best of all you can read it on the bus (It's hard to find 68K reading material you can read on the go!). If you'd like a sneak peek I'm sure I could post up a couple of pages when I'm home (I'd actually like another read through it myself, it's been a while!)

Natsumi
Very interested
Posts: 82
Joined: Mon Oct 05, 2015 3:00 pm
Location: 0x0
Contact:

Re: Are there any good/elaborate ASM tutorials around?

Post by Natsumi » Wed Jan 06, 2016 11:35 am

here is also very basic tutorial for absolute newbies: http://mrjester.hapisan.com/04_MC68/

elusive
Very interested
Posts: 57
Joined: Fri Jan 27, 2012 12:03 am

Re: Are there any good/elaborate ASM tutorials around?

Post by elusive » Wed Jan 06, 2016 5:40 pm

ryanfaescotland,
Thank you for those links. I did look at BigEvilCorp's blog (very awesome, as well), but I couldn't find the stuff that I was getting confused on. His blog will definitely be referenced more as I learn ASM better.

Natsumi,
I've also used Marky Jester's tutorials a lot, which is why most of my questions are with address registers and the different modes, as I don't believe he went into too much detail (if any). Of course, I could've easily missed those sections, so forgive me if I did miss those :)


(edited to give proper thanks :P )
Last edited by elusive on Fri Jan 08, 2016 10:07 pm, edited 1 time in total.

ryanfaescotland
Very interested
Posts: 53
Joined: Mon Feb 09, 2015 10:46 pm
Contact:

Re: Are there any good/elaborate ASM tutorials around?

Post by ryanfaescotland » Thu Jan 07, 2016 8:59 am

elusive wrote:Natsumi,
Thank you for those links.
I did look at...
Yeah that's cool, give someone else all the credit, even though I did do a 5 paragraph reply with physical media and everything but no no, say thanks to the guy who gave a 1 line response. Anyone needs me I'll be over here eating worms. :P :lol:

elusive
Very interested
Posts: 57
Joined: Fri Jan 27, 2012 12:03 am

Re: Are there any good/elaborate ASM tutorials around?

Post by elusive » Fri Jan 08, 2016 6:47 pm

ryanfaescotland wrote:
elusive wrote:Natsumi,
Thank you for those links.
I did look at...
Yeah that's cool, give someone else all the credit, even though I did do a 5 paragraph reply with physical media and everything but no no, say thanks to the guy who gave a 1 line response. Anyone needs me I'll be over here eating worms. :P :lol:
D'oh! I'm sorry!! You deserve the credit as well, my apologies :) can I buy you a beer for the mistake? I'll also trade you a freshly cooked hotdog for that worm :p

greatkreator
Very interested
Posts: 158
Joined: Sat May 12, 2012 7:37 pm
Location: Ukraine

Re: Are there any good/elaborate ASM tutorials around?

Post by greatkreator » Fri Jan 08, 2016 11:19 pm

As ryanfaescotland said easy68k quite good for you purpose.
And of course don't forget about Motorola 68000 manual.

RetroGames
Interested
Posts: 34
Joined: Mon Oct 19, 2015 12:34 pm

Re: Are there any good/elaborate ASM tutorials around?

Post by RetroGames » Fri Jan 29, 2016 9:13 pm

I haven't seen links to this resource on spritesmind yet, so here you go:
Hugues Johnson's Programming Articles
Hugues is a veteran programmer who is new to Genesis dev. He only has a few tutorials up so far, but I think they are useful, and I hope he makes more. Scroll down the page to get to the Genesis stuff, or go here (though the tutorials won't be in order): Hugues Johnson Genesis Programming Articles index

I also endorse Easy68k. I love the 68000 simulator. 8)

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: Are there any good/elaborate ASM tutorials around?

Post by tryphon » Fri Jan 29, 2016 10:18 pm

I had some email exchange with him when I decoded Phantasy Star III ressources. I'm guessing his Aridia tool will have some new interesting functionnalities soon :)

elusive
Very interested
Posts: 57
Joined: Fri Jan 27, 2012 12:03 am

Re: Are there any good/elaborate ASM tutorials around?

Post by elusive » Sat Feb 27, 2016 4:15 pm

oooh, more links to check out :D Thanks!

I do have a couple of questions:

I've been rebuilding my BASIC compiler using BEX's ASM Library (devster gave me the go-ahead to use it :D) and there's a few things in BEX that I don't understand what's happening, or rather, I understand what's going on in theory/conceptually, but my ASM knowledge is still pretty limited. One of the functions I'm not finding a direct solution for is selecting the display type and another is setting interlace modes.

Looking at the VDP documentation by Charles MacDonald, Devsters VDP document, Marc's tutorial, and BigEvilCorps tutorial site, I see a few things on setting the VDP registers with these settings.

I'm actually going to just reference Devsters with these questions since his page is the easiest for me to read/understand at the moment :P

http://devster.monkeeh.com/sega/yavdp.html

On this link, section #12 - Mode Set Register No. 4 - [move.w #$8Cxx,($C00004)], it mentions what bits do what and what needs to be set for which feature to enable/configure. I figured out the shadow/highlight mode with some help from someone here or on the BEX forums, I forget which now, which was 2 lines of code : move.w #$8C89,($C00004) and move.w #$8C81,($C00004)

(I actually think I'm figuring this out as I ask these questions)

If I understand correctly, the 8C is the beginning address, and the 81 and 89 are the VDP settings (81 = 10000001 and 89 = 10001001). That would mean it's 40 cell mode with shadow disabled and 40 cell mode with shadowmode enabled, right? If so, setting the VDP to 32 cell mode would 8C08 and 8C00 and setting the interlace mode would be 8C01 for interlace, 8C00 for non-interlace (also 40 cell mode and shadow mode disabled), 8C01 for interlace, and 8C03 for double interlace, and would be done in the same manner as the enable shadow/highlight mode above: move.w #8Cxx, ($C00004).

Can anyone tell me if I'm understanding this right, and if not, help me with my confusion? :)

Post Reply