User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 456,572 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,636 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 3021 | Replies: 2
Reply
Join Date: Aug 2004
Posts: 9
Reputation: The Beholder is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
The Beholder The Beholder is offline Offline
Newbie Poster

QB, access bytes from a register

  #1  
Aug 16th, 2004
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2004
Location: OK
Posts: 40
Reputation: Buff is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
Buff Buff is offline Offline
Light Poster

Re: QB, access bytes from a register

  #2  
Aug 16th, 2004
Originally Posted by The Beholder
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.
Reply With Quote  
Join Date: Aug 2004
Posts: 9
Reputation: The Beholder is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
The Beholder The Beholder is offline Offline
Newbie Poster

Re: QB, access bytes from a register

  #3  
Aug 17th, 2004
Originally Posted by Buff
&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?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 6:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC