COURS201.TXT
Jump to navigation
Jump to search
****************************************************************
* *
* 68000 ASSEMBLY COURSE ON ATARI ST *
* *
* by The Fierce Rabbit (from 44E) *
* *
* Second series *
* *
* Course number 1 *
****************************************************************
This is the second series of courses on 68000 assembly on Atari.
This course follows the first series. I hope for you that the
first series was perfectly understood, and that NOTHING was left
to chance. Based on this principle, we can say that your
foundations are solid, and that we are going to be able to go
much faster. The first series was designed to teach you the
mechanism of how the 68000 and the ST operates at the level of
its operating system, the second series will just be a bunch of
tricks, keys to access various things. If you have STUDIED
the first series PERFECTLY, you will be able to gently pull on
these strings to bring the information to you.
If, on the other hand, you 'think' you have understood the first
series but you are not 'sure' you have understood everything,
it is still time to read it again because in a few pages you
will start to feel lost, which would be a pity!!! To check
your knowledge a little bit, here are some simple questions:
1) MOVE.L #$12345678,A0 then MOVE.W #$1234,A0
What do we get in A0?
2) MOVE.L #$12345678,A0 then MOVE.B #$12,A0
What do we get in A0?
3) Can you explain concretely what happens when I
do MOVE.W #$2700,SR
4) MOVE.L #MESSAGE,-(SP) What does this function do?
MOVE.W #9,-(SP)
TRAP #1
ADDQ.L #4,SP
Before giving you the answers, here is the (non-definitive) list
of what will be covered in this second series of courses. The traps
(how to reprogram them), the Line A, the GEM, arrays, self-modifying
programs, macros, file inclusions, etc... Every time, the task
will consist in indicating how to do and provide a list of
articles, more or less precise works in this field. It seemed
ridiculous to me to spread for example 50 pages on GEM when this
is not likely to interest everyone. However, it seemed normal to
outline this subject and to provide all the necessary pieces
(or, at least, the pieces I know of) so that those of you who
want to create high-level applications can do so. They will
have to work hard, but in assembly, it's common to spend a lot
of time just looking for documentation. Thus, I provide you with
this list, it's up to you to see if you need it. As an indication,
the doc I use for GEM is called PRO GEM, is about 200 pages long,
and is all in English!!!! So, you can well understand that doing
a complete course on GEM would stupidly inflate this assembly
course!!!!
This same principle will be used for the various topics
addressed in this second series. You will find 2 booklets,
the first one including the courses themselves, the second one
containing short listings on the various subjects. Be careful,
most of these listings are unusable without having read the
corresponding course first. To conclude, I will give you the
same advice as for the first series: take your time, re-read
each chapter carefully, create small programs using what you have
just learned!
Contest result: If you got one thing wrong, I strongly
advise you to retake the first course!!!
1) We get #$00001234 in A0. Those who answered that we would
obtain #$12341234 are completely wrong! Indeed, we would have
obtained #$12341234 if the operation had taken place on a data
register. On an address register used as a destination operand,
there is an extension to the most significant bit. There, already
50% are going back to series 1......
2) We get nothing at all because we cannot assemble!!! You
can only work with an address register as a destination operand
on the word or long word format, not on the byte format.
3) $2700 gives in binary %0010011100000000. If we overlay this
number on the Status Register (those who believed that SR was
the stack and who therefore confused it with SP must absolutely
start series 1 over again, they are just ready to understand
nothing that follows!), we realize that the bits set to 1 in
this number correspond to bits S, I2, I1, and I0. Since we can
only access SR in supervisor mode, we deduce that such an
operation can only be done in this mode. Our MOVE thus keeps
the supervisor bit in state 1 and forces the bits describing the
interrupt level to 1. The minimal interrupt level taken into
account is therefore level 7, which is the highest level. In
summary, we have just blocked and forbidden interruptions.
4) This function does two things. First of all, it displays
the text located at the address MESSAGE. This is indeed the
Cconws() function of the gemdos. But this function also does
something else... a joyous error! Because by passing the address
and then the number of the function we have modified the stack
by 6 bytes (a long word for the address and a word for the
function number) but we only correct it by 4!!!!!
According to your answers, you may continue or else
start series 1 again with a little less haste. You must
understand EVERYTHING, that's the secret. If you have made
some mistakes and still want to directly attack the second series,
don't be surprised to abandon assembly in a few months, discouraged
by mountains of listings that you will not understand!
Good luck
Back to ASM_Tutorial