home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 150_01 / clink.asm < prev    next >
Assembly Source File  |  1985-03-10  |  4KB  |  96 lines

  1.          name      clink
  2.          page      55,132
  3.          title     'CLINK - Load and Link Graphics Characters'
  4.          assume    cs:cseg
  5. ;
  6. ; CLINK - Load and Link Graphics Character Table
  7. ;
  8. ; Original by Ray Duncan, published in DDJ #74
  9. ; Revised by Patrick Banchy, 1249 Park Ave. #5C, NYC
  10. ;
  11. ; The IBM PC allows the user to define the meanings of the
  12. ; characters in the range 80H-FFH in the graphics modes.
  13. ;
  14. ; This program when first called will allocate the 1 KB of
  15. ; memory needed for the table.  Subsequent calls will load
  16. ; the table specified in the invocation into memory.
  17. ;
  18. fcb      equ       05ch      ;default file control block
  19. ;
  20. eom      equ       '$'       ;literal ending of string
  21. cr       equ       13        ;ASCII carriage return
  22. lf       equ       10        ;ASCII line feed
  23. ;
  24. cseg     segment   para public 'CODE'
  25.          org       100h
  26.  
  27. clink:                       ;entry from PC-DOS
  28.          xor       ax,ax     ;see if table has been
  29.          mov       ds,ax     ;previously allocated
  30.          mov       bx,07ch   ;offset of vector
  31.                              ;pick up address of
  32.                              ;table in DS:DX
  33.          lds       dx,dword ptr [bx]
  34.          mov       ax,ds
  35.          or        ax,dx     ;have we been here before?
  36.          jnz       not_1st   ;yes,so read the table
  37.                              ;no,set up table
  38.          mov       ax,cs     ;address (restore proper
  39.          mov       ds,ax     ;contents of DS first)
  40.          xor       dx,dx
  41.          mov       ah,37     ;using DOS Set Interrupt
  42.          mov       al,1fh    ;call
  43.          int       21h
  44.                              ;tell the operator whats up
  45.          mov       dx,offset nxt_job
  46.          mov       ah,9
  47.          int       21h
  48.                              ;save 1 kbytes for the
  49.          mov       dx,400h   ;table, terminate but
  50.          int       27h       ;stay resident.
  51.  
  52. not_1st:                     ;read in graphics table
  53.          mov       ah,26     ;first set DTA address
  54.          int       21h
  55.          mov       ax,cs     ;restore DS
  56.          mov       ds,ax
  57.          mov       dx,offset fcb
  58.          mov       ah,15     ;try and open file
  59.          int       21h
  60.          or        al,al     ;does it exist?
  61.          jz        file_ok   ;yes,proceed
  62.                              ;no,warn operator
  63.          mov       dx,offset Boo_boo
  64.          mov       ah,9
  65.          int       21h
  66.          mov       ah,0      ;return to PC-DOS
  67.          int       21h
  68.  
  69. file_ok:                     ;file exists,read table
  70.          mov       bx,offset fcb
  71.                              ;set record size = 1024
  72.          mov       word ptr 14 [bx],400h
  73.                              ;set current rec=zero
  74.          mov       byte ptr 32 [bx],0
  75.          mov       dx,offset fcb
  76.          mov       ah,20     ;sequential read
  77.          int       21h
  78.          mov       dx,offset loaded
  79.          mov       ah,9      ;tell operator load
  80.          int       21h       ;was successful
  81.          mov       ah,0      ;and return to PC-DOS
  82.          int       21h
  83.  
  84. ;
  85. ; messages for console
  86. ;
  87. Boo_boo  db        cr,lf,'No such file',cr,lf,eom
  88. Loaded   db        cr,lf,'Character table loaded',cr,lf,eom
  89. Nxt_job  db        cr,lf,'Memory and Link for table initialized,'
  90.          db        cr,lf,'Rerun to load the table',cr,lf,lf,eom
  91.  
  92. cseg     ends
  93.  
  94.          end       clink
  95. 
  96. ├Ç>ñ,/t</t<\├è\Φ┤    Φù÷╖-u┤;═!rΦô²░?┐]╣ ≤¬2└├ï6¿-NèD Φ└ t ;≥t(èΦ╡ tNδ≥Ç|.t èD <:tΦá u∙├╞┤;═!