home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CEXPRESS.ZIP / SCREEN.ASM / SETCOLOR.ASM < prev    next >
Assembly Source File  |  1989-05-03  |  951b  |  38 lines

  1. ;void  set_color(col,row,color);
  2. ;  unsigned char  col,row,color;
  3.  
  4.     EXTRN  _memory_model:byte
  5.     EXTRN  _video_page:byte
  6.  
  7. _TEXT    SEGMENT BYTE PUBLIC 'CODE'
  8.     ASSUME CS:_TEXT
  9.     PUBLIC _set_color
  10. _set_color proc near
  11.     push bp            ;save BP
  12.     mov  bp,sp        ;set stack frame
  13.     cmp  _memory_model,0    ;near or far?
  14.     jle  begin        ;jump if near
  15.     inc  bp            ;else add 2 to BP
  16.     inc  bp            ;
  17. begin:    mov  bh,_video_page    ;set the page
  18.     mov  dh,[bp+6]        ;row to DH
  19.     dec  dh            ;count from 0
  20.     mov  dl,[bp+4]        ;col to DL
  21.     dec  dl            ;count from 0
  22.     mov  ah,2        ;function to set cursor
  23.     int  10h        ;set the cursor
  24.     mov  ah,8        ;func to read attribute
  25.     int  10h        ;char now in AL
  26.     mov  ah,9        ;function to write char
  27.     mov  cx,1        ;write at 1 pos only
  28.     mov  bl,[bp+8]        ;new attribute
  29.     int  10h        ;set the new attribute
  30.     pop  bp            ;restore BP
  31.     cmp  _memory_model,0    ;quit
  32.     jle  quit        ;
  33.     db   0CBh        ;RET far
  34. quit:    ret            ;RET near
  35. _set_color endp
  36. _TEXT    ENDS
  37.     END
  38.