TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: WAYNE ZIMMERLE
from: RODERICK RIENSCHE
date: 1995-09-08 19:59:00
subject: Regs Ax Ah Al

WZ>MSGID: 1:232/30 2617a594
WZ>TID: InterEcho 1.10 9-01-95
WZ>Can someone explain to me how to load AH and AL?  And then how to read 
hem
WZ>back out? I've deduced that I have to load them by loading AX like 0302 
with
WZ>hex values and then 03 is AH and 02 is AL    I'm doing this with the REG
WZ>command.  But then when I read the register I have to split them back 
part
WZ>from AH and I'm doing it by converting to a string and using right$ or 
left$
WZ>and then doing a VAL and this seems awfully awkward to me.  I'm using 
PB3.1c
WZ>with the original PB3.0 manuals and I must be missing something.
Try this:
type Register       'Define type Register with high and low bytes
  Low as byte
  High as byte
end type
union WordRegister  'Define a union to join Register type with
  byte as Register  'a word variable
  word as word
end union
dim RegAX as WordRegister 'Create your variable
asm mov ax, &h0ff0  'Load AX with &h0ff0
asm mov RegAX, ax   'Load Your variable with contents of AX
cls
print hex$(RegAX.word), hex$(RegAX.byte.High), hex$(RegAX.byte.Low)
'Voila!
---
 * SLMR 2.1a * This tagline stolen by Silly Little Mail Reader!
--- QScan v1.131b / 01-0080
---------------
* Origin: BECSS COMPUTER PARADISE (1:3407/2)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.