RA USER 2/2

 BBS: Inland Empire Archive
Date: 01-19-93 (14:38)             Number: 325
From: CORIDON HENSHAW              Refer#: NONE
  To: JOHN GALLAS                   Recvd: NO  
Subj: RA USER               2/2      Conf: (2) Quik_Bas
Hello John!

In a msg of <15 Jan 93>, John Gallas writes to Mark Thomas:

 JG> FUNCTION ValToStr$ (WordValue!)
 JG> a! = WordValue!
 JG> Char2! = a! \ 256
 JG> c! = Char2! * 256
 JG> Char1! = a! - c!
 JG> ValToStr$ = CHR$(Char1!) + CHR$(Char2!)
 JG> END FUNCTION

You can avoid the use of floating point vars when dealing
with unsigned integers.  Just GET them as INTEGERs, and use
this little ASM FUNCTION on them:

===Chop===
'Hex2Bin 1.1
DEFINT A-Z:OPEN "B",#1,"CVTLONG.OBJ":OPEN "B",#2,"H"
DO:READ I$:IF I$="-1" THEN EXIT DO
PUT #2,,I$:LOOP:I$="  ":SEEK #2,1:DO UNTIL LOC(2)=LOF(2):GET #2,,I$
O$ = CHR$(VAL("&H"+I$)):PUT #1,, O$: LOOP:CLOSE:KILL "H"
DATA 800D000B6376746C6F6E672E61736DFC96260000064447524F55500C4356544C4F4E47
DATA 5F54455854044441544104434F4445055F44415441E5980700481400030501FC980700
DATA 4800000604010E9A040002FF025F900E000001074356544C4F4E470000003D88040000
DATA A201D1A01800010000558BEC57561E068B460633D2071F5E5F5DCA0200C28A02000074
DATA -1
===Chop=== The above 8 to 7 bit encoder is my own, and no-
one is getting the source.  This is to prevent abuse of
Hex2Bin.

Calling syntax is:

===Chop===
DECLARE FUNCTION CVTLong& (BYVAL SignedInteger%)

'SignedInteger% = QB/PDS INTEGER
'Returns: unsinged integer in form of a LONG
===Chop===

The above code is 100% ASM, and VERY fast.

\  Coridon Henshaw  \          ³
  \  Sirrus Software  \      \ ³ /
    \   Sysop,          \  ÄÄÄÄ*ÄÄÄÄ
      \  TCS Concordia    \  / ³ \
        \  34:3416/18       \  ³

...I say potato, you say potatoe...

--- GEcho 1.00
 * Origin: Politicly INcorrect and damn proud of it (1:250/820)
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