lundi 26 octobre 2015

If Statement Conversion From C to Assembly(Motorola 68k)

I'm given a IF statement like this:

if( (Ch > ‘g’) && (Ch < ‘m’)) || ((A>=0) && (A<=100))
    condition = 1;
else
    condition = 0;

Where Ch is a char, A is a int, and condition is a short int.

I'm trying to put this into assembly language as such:

Org $8000
CLR.W DO
CLR.W D1
CMPI.B #$67,ch
BGT ;something here...

Org   $9000
ch    DC.B  'a'
A     DC.L   0
condition  DS.W  1

I believe I've gotten the first if condition, where 67 is the hex value for the ascii code, for the letter 'g'. But I have no idea how to implement the AND statement here, I guess the or statement could be treated like an else? Since either one part of the if executes or the other does. Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire