Re: [stella] preliminary `how to use DASM' doc

Subject: Re: [stella] preliminary `how to use DASM' doc
From: "B. Watson" <atari@xxxxxxxxxxxxxx>
Date: Mon, 8 Oct 2001 21:21:47 -0400 (EDT)
On Mon, 8 Oct 2001, Thomas Jentzsch wrote:

> B. Watson wrote:
> 
> > Hmmm. There's a simple reason for leaving out ALIGN: until just now, I didn't
> > know about it... I had been using:
> 
> > org [>.]*256+256
> 
> And I didn't know that :)
> 
> I have a problem of understanding, does . stand for "current address"?
> Where did you get this information, is it somewhere hidden in dasm.doc?
> 

Yes... however, looking at Bob's page, none of the downloads (ms-dos 16-bit,
ms-windows 32-bit, Amiga) have got the DASM.DOC for version 2.12. Only the
Windows 32-bit version is actually v1.12, and DASM.DOC is missing. So your
DASM.DOC might be the one from 2.02.

I got my DASM source from some web site that just lists a ton of cross-assembly
tools (not necessarily 6502 ones). Doing a diff between Bob's version and this
one, I think the one I'm using is what he started with, before modding it to
compile on DOS/Win (main difference is Bob's got a lot of (uword) casts)...

If you don't have the v2.12 dasm.doc, look at
http://www.urchlay.com/stelladoc/v2/dasm-doc.txt

> Your syntax might be to complex for simple aligning, but it's very
> useful when you have to align some data relative to the start of a page.
> 
> This syntax offers a simple way for positioning graphics data at the
> correct offset (as described in the latest Death Derby thread).
> 
> 1. my old solution, using ALIGN:
>   ALIGN 256
> StartPage
>   ...
>   ORG StartPage+90
> 
> 2: using the new syntax:
>   ORG [>.]*256+90
> 
> Cool!

Hmmm, what goes in the space you've marked with ... ? with the `new' syntax,
nothing.

Wait... those 2 don't quite do the same thing... suppose the PC is at $F9A0:

1.
	ALIGN 256 ; PC is now $FA00
StartPage
	ORG StartPage+90 ; PC is now $FA00 + 90 = $FA5A

2.
	; PC starts at $F9A0 again
	ORG [>.]*256+90 ; PC is now $F95A, *error*

...you still need the ALIGN 256 with the 2nd method:

3.
	; PC at $F9A0 again
	ALIGN 256 ; PC = $FA00
	ORG [>.]*256+90 ; PC is now $FA5A, same as 1. above

Of course, you could leave out the ALIGN if you did:

4.
	; PC at $F9A0
	ORG [>.]*256+256+90 ; PC now $FA5A

or:

5.
	; PC at $F9A0
	ORG [>.+1]*256+90 ; PC now $FA5A

Hmm, and playing around with DASM just now, it seems the precedence of > is
higher than multiplication... so 4. could be re-written as:

6.

	ORG >.*256+256+90 ; same as 4. without the []'s

And Yet Another Way To Do It:

7.
	ORG [. & $FF00] + 256 + 90 ; []'s required, spaces added for readability

or even:

8.
	ORG [[. >>8] <<8] + 256 + 90 ; []'s required again

9.
	ORG [./256+1]*256+90

Hrmmm. Obfuscated 6502 assembly anyone? It's amazing what you find entertaining
when you're procrastinating...

B.

---

If a trainstation is the place where trains stop, what is a workstation?



-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Current Thread