Page 1 of 1
Writing readable code
Posted: Fri Sep 28, 2007 7:02 am
by matias_beretta
Hello, I'm making a 16bit os and i'm messing with my code...
I'm trying to make it more readable and to comment it...
i have a stupid question, but it is useful to make my code more readable:
What goes first: AH or AL?
mov ah, [Y]
mov al, 160
or
mov al, [Y]
mov ah, 160
thanks
Posted: Fri Sep 28, 2007 7:11 am
by Craze Frog
ah first.
Posted: Fri Sep 28, 2007 2:18 pm
by Alboin
Craze Frog wrote:ah first.
Uhh.....No? Please refrain from posting unless you have something to say.
Thank you.
As for the question, I don't understand. In your case, it doesn't matter which goes first. AL and AH have to relation no each other except through AX, which you're not manipulating at the moment.
Posted: Fri Sep 28, 2007 2:47 pm
by Craze Frog
As for the question, I don't understand.
But I did, and I answered. Please don't answer if you don't have any answer.
Ah should be set first because it's always drawn leftmost in the visual representation. Going from left to right is more natural than going from right to left. There is of course no technical difference.
Posted: Fri Sep 28, 2007 3:07 pm
by Alboin
Craze Frog wrote:As for the question, I don't understand.
But I did, and I answered. Please don't answer if you don't have any answer.
Ah should be set first because it's always drawn leftmost in the visual representation. Going from left to right is more natural than going from right to left. There is of course no technical difference.
I'm so slow today...Sorry, I thought you meant: "Ah, first" as in first post.
thanks
Posted: Fri Sep 28, 2007 3:18 pm
by matias_beretta
thanks / gracias
Posted: Fri Sep 28, 2007 4:50 pm
by JAAman
just me, but i would do AL first, since it comes first numerically (AL = 000, AH = 100)
so i usually do it in order:
AL
CL
DL
BL
AH
CH
DH
BH
etc...