home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 162_01 / demo3.c < prev    next >
Text File  |  1985-08-21  |  896b  |  31 lines

  1. /*    file    demo3.c    */
  2. /*    Hex dump of float variables    */
  3. #include    fprintf.h
  4. extern    float    atof();
  5. extern    char    *ftoa();
  6. int    n;
  7. long    ln,*pl;
  8. float    fn,*pf = &fn;
  9. extern    int    portc,portd;
  10.  
  11. main() {
  12.     portd = 188; portc = 189;    /* must be YOUR hardware ports */
  13. #asm
  14.     .Z80
  15.     LD    HL,(pf)
  16.     LD    (pl),HL
  17.     .8080
  18. #endasm
  19.     for(n = -130; n < 130; ++n) {
  20.         fn = n;
  21.         printf("\n%.1f\t=",fn);
  22.         printf("\t0%lxH",*pl);
  23.     }
  24.     printf("\n\nEND\n\n");
  25. }
  26. /*    This program was originally created as a tool for the development
  27.     of several pieces of Mchip80.   With small changes, the program
  28.     can be used to disassemble any float value, revealing AM9511
  29.     format expressed as a string of hex characters.   It is useful
  30.     when output from this program is redirected to a disk file.    */
  31.