Writing readable code

Programming, for all ages and all languages.
Post Reply
User avatar
matias_beretta
Member
Member
Posts: 101
Joined: Mon Feb 26, 2007 3:39 pm

Writing readable code

Post 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
Matías Beretta
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Post by Craze Frog »

ah first.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post 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.
C8H10N4O2 | #446691 | Trust the nodes.
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Post 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. :wink:

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.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post 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. :wink:

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.
:lol: I'm so slow today...Sorry, I thought you meant: "Ah, first" as in first post.
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
matias_beretta
Member
Member
Posts: 101
Joined: Mon Feb 26, 2007 3:39 pm

thanks

Post by matias_beretta »

thanks / gracias :) ;)
Matías Beretta
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post 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...
Post Reply