Re: A89: Run Down on some Things


[Prev][Next][Index][Thread]

Re: A89: Run Down on some Things




At 08:25 1998-12-06 -0500, you wrote:
>>var: ds.w 10
>
>is this defining var as a word with value 10?  .w = word i guess, and dc.b =
>string or?  what's the 10 for, or is that the address or something? and if i
>wanted another one, i would do var2: ds.w 11 or something?

Actually, it should have been "var: dc.w 10" which would define
a word with value 10 (equal to "var: .dw 10" in TASM). The row
about ("ds.w 10") actually defines 10 words, set to 0:

 dc.b, dc.w, dc.l  => define byte, word, longword
 ds.b, ds.w, ds.l  => allocate empty space.

(note that "ds.b 16" is identical to "ds.w 8" and "ds.l 4")

>> move.w (var),d0
>
>this puts var into d0?  is this backwards in compared to the z80 where you
>do ld a,(var), and here you do ld (var),a ?

Right. The 68k processors uses a different order of the opcodes than
the Z80 and the x86 series. Most people think it's more logical
though, "move xx to yy". All instructions are this way, the source
is in the left operande and the destination in the right.

>> addq.w #1,d0
>
>is addq = inc a or is addq add the words in d0 and #1.. so if i changed the
>#1 to #2 it would add 2 to it or what?  and what's the number limit [65534
>like hl?]

addq = add quick = fast & short add instruction. Can add an immediate
value between 1 and 8 to a dataregister. Usually you always use
add.w, as the assembler often choose the addq instruction if possible.
Also, you usually don't need .w, as it is selected automatically.
In fact, IIRC, the addq instruction always uses the whole longword :-/

>> move.w d0,(var)
>
>i guess that just stores it back?

How smart you are :)

>>Note that in 68k, you usually always deal with words instead of bytes,
>>as the 68k is a 16-32 bit cpu.
>
>so there is no ".db", its all essentially ".dw", and whereas in z80 we have
>.dw for two bytes, there is a 32-bit thing or something?

Right. But of course you use dc.b sometimes if you want to define
a big map for instance...

>>So, any register A0-A6 could be called "equivelent of hl" if you're
>>intending to use it as an address.

Right.

>j would only be usable under main? 

Yeah.

>and what are macros used for?  everyone
>has some kinda text macro at the top of their source codes...

Macros are supported by practically all assemblers to make programming
easier... you could say that it's like a subroutine, but instead
of calling the routine, the routine is inserted in the code
where the calling is done (this is done by the assembler).

//Jimmy Mårdell

E-mail: yarin@acc.umu.se
Homepage: http://www.acc.umu.se/~yarin/


Follow-Ups: References: