home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / screen / colorize.arc / COLORIZE.ASM next >
Encoding:
Assembly Source File  |  1989-02-22  |  1.5 KB  |  63 lines

  1. title    colorize.asm
  2. page    62,132
  3.  
  4. ; fake color for games by wedging into BIOS video interrupt
  5. ; mode must be co80
  6.  
  7. code        segment
  8.         assume    cs:code,ds:nothing,es:nothing
  9.         org    100H
  10.  
  11. ; .com entry point
  12. start:        jmp short install
  13.  
  14. ; program variables
  15. vector$10    dd    4*010h
  16. old$10        dd    ?        ; save original intr entry addr
  17.  
  18. ;;;;;;;;;;;;;;;;;;;;;;  interrupt entry point  ;;;;;;;;;;;;;;;;;;;;;;;;
  19.  
  20. wedge$10    proc    far
  21.  
  22.         cmp    ah,09h        ; write char & attr func call ?
  23.         je    L1
  24.         cmp    ah,0ah        ; write char func call ?
  25.         jne    exitwedge    ; neither, go exec BIOS intr
  26.         mov    ah,09h        ; always write attr with char
  27.         mov    bl,07h
  28.  
  29. ; fiddle attributes for character graphics
  30. L1:        cmp    bl,07h        ; white ?
  31.         jnz    L2
  32.         mov    bl,02h        ; then make green
  33.  
  34. L2:        cmp    al,'@'        ; player symbol ?
  35.         jnz    L3
  36.         mov    bl,03h        ; then make cyan
  37.  
  38. L3:        test    al,80h        ; hi bit char ?
  39.         jz    exitwedge
  40.         mov    bl,04h        ; then make red
  41.  
  42. exitwedge:    jmp    [old$10]    ; exec BIOS intr
  43. wedge$10    endp
  44.  
  45. ;;;;;;;;;;;;;;;;;;;;;;;;;  installation code  ;;;;;;;;;;;;;;;;;;;;;;;;;
  46.  
  47. install        proc     near
  48.         cli
  49.         lds    si,vector$10        ; load addr of vector table entry
  50.         les    di,dword ptr [si]    ; read entry from vector table
  51.         mov    word ptr old$10,di
  52.         mov    word ptr old$10+2,es    ; save original vector
  53.         mov    word ptr [si],offset wedge$10
  54.         mov    word ptr [si+2],cs    ; set new vector
  55.         sti
  56.  
  57.         mov    dx,offset install
  58.         int    27h            ; terminate & remain resident
  59. install        endp
  60.  
  61. code        ends
  62.         end    start
  63.