home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
HEXSTRS.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
3KB
|
49 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME HEXSTRS .DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "DAS-NB01.INC"
COLOR 7, 0
CLS
? "┌───────────────────────────────────────────────────────────────────┘
? "│ fHexFormat$ ( HexOrDec$ ) check/format the incoming string
? "│ fHex2ASCii$ ( HexOrDec$ ) convert HEX and DEC strings to ASCII
? "│ fASCii2Hex$ ( ASCii$ ) convert ASCII strings to HEX
? "│ fASCii2Dec$ ( ASCii$ ) convert ASCII strings to DECIMAL
? "├──────────────────────────────────────────────────────────────────────┘
? "│ These functions reappeared while I was doing a small program to keep an
? "│ unofficial petty cash ledger and the customer had a couple of different
? "│ printers. I had to have a printer set-up string input field in the pgm.
? "│ and it was easier/better to have the customer use HEX values. Their use
? "│ is pretty straight forward and their output is predictable.
? "│ The thing to keep in mind is that fHex2ASCii process both HEX and DEC
? "│ strings so they can be mixed. The HEX values have a trailing <h>.
? "└────────────────────────────────────────────────────────────────────────┘
?
V$ = ",2,65,1bH,34,," : PRINT " RAW: >>"; V$; "<<" ' user input
T$ = fHexFormat$( V$ ) : PRINT "FORMATED: >>"; T$; "<<" ' cleaned up
PRINT '
A$ = fHex2ASCii$( T$ ) : PRINT " ASCii: >>"; A$; "<<" ' ASCII values
H$ = fASCii2Hex$( A$ ) : PRINT " HEX: >>"; H$; "<<" ' HEX values
D$ = fASCii2Dec$( A$ ) : PRINT " DECIMAL: >>"; D$; "<<" ' DECIMAL values