Re: A89: Starting out assembly, need help


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

Re: A89: Starting out assembly, need help




The ROM calls take input from the stack (because they were written in C).
So, in order to use a ROM call that takes input, you must push the input
onto the stack before the call (a7 is the stack pointer) and restore the
stack to what it was after you make the call.

There are 16 forms of 68k addressing (read Jimmy Mardell's 68k tutorial,
even though it's best for people who already know z80).  In any assembly
language, direct addressing simply moves an immediate value or another
register into a register, something like: move.w #10,a0 will move 10 into
the lower word of a0.  On the other hand, indirect addressing moves an
immediate value or another register into the memory pointed to by one of the
address registers (those would be a0-a7): move.w #10,(a0) (the parethesis
indicate indirectness) will move the word 10 into the memory addressed by
a0; so, if a0 was $10000, then that instruction would move 10 into ($10000).
The 68k is particular in indirect addressing in that you can only indirect
address on even bytes of memory (otherwise you get the address error
exception)

The pre-decrement and post-increment features of the 68k will increment or
decrement the address register by a word or a longword.  Pre-decrement will
have this effect: move.w #10,-(a0) will decrement a0 (the pointer) by a word
and then move the word 10 into the new (a0).  Post-increment will have the
effect: move.w #10,(a0)+ will move the word 10 into new (a0) and then
increment a0 by a word.  These two addressing methods can be used to fill a
large space (post-increment's faster than <move.w #10,(a0) / add.l #2,a0>)
and are especially useful in pushing / popping.



>
>also, instead of that
>lea string(PC), a7
>or whatever isn't there a function in a library that l can use to display a
>string?