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

  1. ; TEST6.ASM by Warren A. Ring
  2. ;
  3. ; This program shows how you can convert an integer from ASCII string to
  4. ; integer form and back again.  It also shows you how to display a
  5. ; binary integer as 8 hex ASCII digits.
  6.  
  7.    section code
  8.  
  9.    include "macros.asm"
  10.  
  11.    Start               ;Perform startup
  12.                        ; housekeeping
  13. X1 Display <'Enter a decimal number: '>
  14.    ReadCon #Word       ;Get a line from the console
  15.    StrLen  #Word       ;If no characters were entered,
  16.    BEQ     X99         ; then jump to X99
  17.    Display <'The hexadecimal equivalent is: '>
  18.    AtoI    #Word,Value ;Convert the string from ASCII to an integer
  19.    ItoHA8  Value,#HexCode;Convert the integer to 8-character hex ASCII
  20.    WritCon #HexCode    ;Display the hex ASCII string
  21.    Crlf                ;Display a CR/LF
  22.    Display <'Enter a hexadecimal number: '>
  23.    ReadCon #Word       ;Get a line from the console
  24.    StrLen  #Word       ;If no characters were entered,
  25.    BEQ     X99         ; then jump to X99
  26.    Display <'The decimal equivalent is: '>
  27.    HAtoI   #Word,Value ;Convert the string from hex ASCII to integer
  28.    ItoA    Value,#Word ;Convert the integer to an ASCII string
  29.    WritCon #Word       ;Display the ASCII string
  30.    Crlf                ;Display a CR/LF
  31.    BRA     X1          ;Jump to X1
  32.  
  33. X99
  34.    Exit                ;Perform ending housekeeping, and exit
  35.  
  36.    include "warlib.asm"
  37.  
  38.    section data
  39.  
  40.    StrBuf  Word,16
  41.    StrBuf  HexCode,8
  42.  
  43. Value  DS.L    1
  44.  
  45.    end
  46.