home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol110 / dbdir.lbr / ASCIIDEC.CMD next >
Encoding:
Text File  |  1985-02-10  |  1.8 KB  |  62 lines

  1. *
  2. *               asciidec.cmd
  3. *
  4. *               This command module will convert an ascii string to 
  5. *               a string of decimal numbers seperated by commas which
  6. *               can then be used in a poke command.
  7. *               
  8. *               ie. if the input string is 'DIR'
  9. *                   the output string will be '68,73,82'
  10. *     
  11. *               To use this routine:   
  12. *                   1) put string to be converted in a memory variable
  13. *                      called "stringin"
  14. *                   2) call this routined by using the dBASEII 
  15. *                      command "DO asciidec"
  16. *                   3) the converted string will be returned in
  17. *                      a memory variable called "stringout"
  18. *                        - Mike Kelly
  19. *                 
  20. *              written  v1.0    08-23-82
  21. *              updated  v1.0    08-23-82
  22. *
  23. *
  24. set echo off
  25. set talk off
  26. *
  27. *       translate table 
  28. *         from hex 20 thru hex 7E
  29. *
  30. *
  31. store ' !"#$%&' +;
  32.       chr(39) +;
  33.       '()' +;
  34.       '*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`' +;
  35.       'abcdefghijklmnopqrstuvwxyz{|}~' to asciitbl
  36. *
  37. *
  38. *        convert ascii to decimal
  39. *
  40. *
  41. store stringin to param
  42. store 31   to base
  43. store ' '  to dstring
  44. store 0    to pointer
  45. *
  46. do  while pointer<len(param)
  47.     store $(param,pointer+1,1)               to srchchar
  48.     store @(srchchar,asciitbl)               to position
  49.     store dstring+str(position+base,3) + ',' to dstring
  50.     store pointer + 1                        to pointer
  51. *  ? 'srchchar=',srchchar
  52. *  ? 'position=',position
  53. *   wait
  54. enddo  pointer
  55. *
  56. *        take off last comma
  57. *
  58. store len(dstring)        to leng
  59. store $(dstring,1,leng-1) to dstring
  60. store dstring             to stringout
  61. return
  62.