I'm stuck on retrieving bytes from a register using qbasic, specifically how do they get the Low byte and High byte from this:
'al%=lowbyte of ax, al%=highbyte of ax,

al%=outregs.ax and &hff
ah%=outregs.ax \ 256

I can understand that with call interrupt you can read or write to general registers but what i'm confused with is what are the '&HFF' and \ 256 for? aren't the registers already set, why the need to alter the value with these?

does outregs.ax equal one 16bit number and these two things seperate out the low byte and high byte, help i'm confused with this.

Recommended Answers

All 2 Replies

I'm stuck on retrieving bytes from a register using qbasic, specifically how do they get the Low byte and High byte from this:
'al%=lowbyte of ax, al%=highbyte of ax,

al%=outregs.ax and &hff
ah%=outregs.ax \ 256

I can understand that with call interrupt you can read or write to general registers but what i'm confused with is what are the '&HFF' and \ 256 for? aren't the registers already set, why the need to alter the value with these?

does outregs.ax equal one 16bit number and these two things seperate out the low byte and high byte, help i'm confused with this.

&hFF is 255 in hexadecimal (base 16)
I suggest you look up and in the help

outregs.ax does represent 1 16bit register (as with also bx,cx, etc)

You are not altering the registers but rather getting the high 8 bits and low
8 bits into separate variables. AH% and AL%

Others can probably explain some of this better than I can though I have used call interrupt a lot.

&hFF is 255 in hexadecimal (base 16)
I suggest you look up and in the help

outregs.ax does represent 1 16bit register (as with also bx,cx, etc)

You are not altering the registers but rather getting the high 8 bits and low
8 bits into separate variables. AH% and AL%

Others can probably explain some of this better than I can though I have used call interrupt a lot.

Okay so then I was right outregs.ax is represents a 16bit register although I can use al%=outregs.ax and &HFF to get the value i need I would like to understand the math, how do we get the highbyte simply by using the bitwise operator with &HFF?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.