Re: Error checking in QB

 BBS: Inland Empire Archive
Date: 10-16-92 (17:01)             Number: 296
From: TONY ELLIOTT                 Refer#: NONE
  To: VICTOR YIU                    Recvd: NO  
Subj: Re: Error checking in QB       Conf: (2) Quik_Bas
Victor,

 VY> If you're talking about getting AX and separating AL and AH, do
 VY> this... X = Register.ax
 VY>
 VY> AL = X AND 255
 VY> AH = X \ 256    ' I believe this will work...

Doing an integer divide will work fine as long as AX is positive. BASIC
views 16 bit integers as signed. Here's another approach that's faster
and not vulernable to signed integer problems:

    DEF SEG
    AL% = PEEK(VARPTR(Reg.AX))      'Peek the low byte and put it AL%
    AH% = PEEK(VARPTR(Reg.AX) + 1)  'Peek the high byte and put it in AH%

Tony

... Back up my hard disk? I can't find the reverse switch!
--- Blue Wave/Max v2.10 [NR]
 * Origin: Oakland BBS - McDonough, GA - (404) 954-0071 (1:133/706.0)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET