home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_03_01 / 3n01014a < prev    next >
Text File  |  1991-12-02  |  2KB  |  62 lines

  1.  
  2. Listing 1
  3.  
  4. (1) Change CONFIG.SYS to this (assuming \dos is on drive C):
  5.  country=002,,c:\dos\country.sys
  6.  device=c:\dos\display.sys con=(ega,,2)
  7.  
  8. (2) Change AUTOEXEC.BAT to this:
  9.  nlsfunc
  10.  mode con codepage prepare=((863,850) c:\dos\ega.cpi)
  11.  chcp 850
  12.  
  13. (3) Reboot.
  14.  
  15. (4) Create, assemble and execute this program:
  16. ;Program:  Given a certain accented character, return the
  17. ;          plain equivalent via a code page collating table.
  18. ;Author:   P. Gulutzan, Ocelot Computer Services Inc.
  19. ;Note:     Requires MS-DOS 3.3 or later.
  20. ;          This program was originally prepared with MS-DOS 4.0.
  21. ;          One would probably want to do a few things differently
  22. ;          with MS-DOS 5.0 or DR-DOS 6.0.
  23.  
  24. d_cseg     segment byte public 'CODE'
  25. assume     cs:d_cseg
  26.  
  27. xx         db 6 (0)
  28.  
  29. start:
  30. ;MS-DOS 3.3 function: "Get pointer to collating sequence table"
  31. mov        ax,6506h
  32. mov        bx,-1                ;codepage of interest = default
  33. mov        cx,512               ;length of receiving buffer
  34. mov        di,offset d_cseg:xx  ;doubleword pointer to buffer
  35. mov        si,seg d_cseg
  36. mov        es,si
  37. mov        dx,-1                ;country of interest = default
  38. int        21h
  39. ;A failure here would probably indicate that CONFIG.SYS
  40. ;and/or AUTOEXEC.BAT were not set up properly, in which case:
  41. ;no display.
  42. jc         endit                        ;(failure)
  43. ;At this point xx has:
  44. ;  Byte    The subcode passed in AL for the function call: 06h
  45. ;  Dword   The address of the collating sequence table
  46. les        di,es:[di+1]                ;Point to the table
  47. ;Now es:di points to the collating sequence table, which has:
  48. ;  Word    Number of characters. Will be < 256 if truncated.
  49. ;  Byte(s) A lookup table for each character
  50. mov        bx,134               ;= the code for a + degree-sign
  51. mov        dl,es:[bx+di]        ;look it up in the collating table
  52. mov        ah,2                 ;display it
  53. int        21h
  54. endit:
  55. mov        ah,4ch               ;stop
  56. int        21h
  57. d_cseg ends
  58. end start
  59.  
  60. (5) Observe that the result is the letter "A" (ASCII code 65).
  61. (6) Restore the original CONFIG.SYS and AUTOEXEC.BAT files.
  62.