home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d136 / asmtoolbox.lha / AsmToolBox / test5.asm < prev    next >
Assembly Source File  |  1988-03-19  |  1KB  |  42 lines

  1. ; TEST5.ASM by Warren A. Ring
  2. ;
  3. ; This program shows examples of character conversion from ASCII to hex
  4. ; ASCII.  It allows you to enter a phrase, then it displays the individual
  5. ; ASCII characters and their hexadecimal equivalents for each character
  6. ; you entered.
  7.  
  8.    section code
  9.  
  10.    include "macros.asm"
  11.  
  12.    Start               ;Perform startup
  13.                        ; housekeeping
  14. X1 Display <'Enter a phrase: '>
  15.    ReadCon #Word       ;Get a line from the console
  16.    StrLen  #Word       ;If no characters were entered,
  17.    BEQ     X99         ; then jump to X99
  18.    SetScan #Word       ;Set to scan the console line
  19.    Display <'Characters are:',LF>
  20. X2 Scanc   #Char       ;Scan the console line for the next character
  21.    StrLen  #Char       ;If no character is available,
  22.    BEQ     X1          ; then jump to X1
  23.    WritCon #Char       ;Display the character
  24.    Space               ;Display a space
  25.    ItoHA2  Char+8,#HexCode;Convert the character from ASCII to hex ASCII
  26.    WritCon #HexCode    ;Display the hex ASCII code
  27.    Crlf                ;Display a CR/LF
  28.    BRA     X2          ;Jump to X2
  29.  
  30. X99
  31.    Exit                ;Perform ending housekeeping, and exit
  32.  
  33.    include "warlib.asm"
  34.  
  35.    section data
  36.  
  37.    StrBuf  Word,16
  38.    StrBuf  Char,1
  39.    StrBuf  HexCode,2
  40.  
  41.    end
  42.