Oric computers >> A help needed on machine coding.

by Pe@ceR » Sun, 17 Oct 2004 02:25:48 GMT

Can you please explain a bit about adressing in machine code? I have always
confusions about "absolute, indirect, immediate" concepts.

It will be so easy for me to understand if you give me machine code
counterparts of those basic entries. Especially it is a bit diffucult to
understand interactions with other registers,


Lets think that, A,X,Y are variables in Basic, representing registers
directly. Number in parantheses are memory adresses interested

I understand these..(From LDA command)
Immediate : A=#85 (#A9,#85)
Zero Page : A=PEEK(#85) (#A5,#85)
Absolute : A=PEEK(#8585) (#AD,#85,#85)

But, others are a bit complicated..
Zero Page,X : A=PEEK (#85+X) ?? (#B5,#85)
Absolute,X : A=PEEK (#8585+X) ?? (#BD,#85,#85)
Absolute,Y : A=PEEK (#8585+Y) ?? (#B9,#85,#85)
Indirect,X : A=PEEK (DEEK(#85+X)) OR A=PEEK(DEEK(#85)+X) : (#A1,#85)
Indirect,Y : A=PEEK (DEEK(#85+Y)) OR A=PEEK(DEEK(#85)+Y) : (#B1,#85)

And is there such commands ?
A=PEEK(DEEK(#8585)+Y)
A=PEEK(DEEK(#8585+Y))


Also regarding to ADC command, please fill in the blanks, If there are any
such commands. Please correct if X register is used in such syntaxes instead
of Y )
( ADC is good command to understand addressing with registers. I assume
Carry is zero of course here. If I understand ADC command well, I can apply
this information to other op codes )

A=A+#85 (Immediate) (#69,#85)
A=A+PEEK(#85) (ZeroPage) (#65,#85)
A=A+PEEK(#8585) (Absolute??) (#6D,#85,#85)
A=A+PEEK(#85)+Y
A=A+PEEK(#85+Y)
A=A+PEEK(#8585+Y)
A=A+PEEK(DEEK(#8585+Y))
A=A+PEEK(DEEK(#8585)+Y)
A=A+PEEK(DEEK(#85)+Y))
A=A+PEEK(DEEK(#85+Y))


Thank you from now !!

Sincerely

Oguz



Oric computers >> A help needed on machine coding.

by Andre Majorel » Sun, 17 Oct 2004 21:11:14 GMT



Correct.


Correct.


The former. LDA ($85,X) <=> A = PEEK(DEEK(#85+X)


The latter. LDA ($85),Y <=> A = PEEK(DEEK(#85)+Y

The "indirect,x" mode is pre-indexed, i.e. the index is added to
the operand before reading the 16-bit address from page zero.
The "indirect,y" mode is post-indexed, i.e. the index is added
_after_ reading the 16-bit address from the page zero location.

It's very important to understand the Y-indexed indirect mode,
because it's one you're bound to use very often.


No. There is a non-zero-page indirect mode, but it's not indexed
and only the JMP instruction uses it. You don't have to worry
about it for the moment, you probably won't ever use it.


A=A+PEEK(#85)+Y Are you sure this is what you want?
A=A+PEEK(#85+Y) ADC $85,Y
A=A+PEEK(#8585+Y) ADC $8585,Y
A=A+PEEK(DEEK(#8585+Y)) No such instruction
A=A+PEEK(DEEK(#8585)+Y) No such instruction
A=A+PEEK(DEEK(#85)+Y)) ADC ($85),Y
A=A+PEEK(DEEK(#85+Y)) No such instruction

--
Andr?Majorel <URL: http://www.teaser.fr/ ~amajorel/>
There are far more C programmers than there are copies of the
standard. -- Keith Thompson

Oric computers >> A help needed on machine coding.

by Pe@ceR » Sun, 17 Oct 2004 22:34:22 GMT

Thank you very much indeed.. It is very helpful..


"Andre Majorel" < XXXX@XXXXX.COM >, haber iletisinde sunlari
yazdi: XXXX@XXXXX.COM ...