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

  1. ;unsigned char  get_color(col,row);
  2. ;  unsigned char  col,row;
  3.  
  4.     EXTRN  _memory_model:byte
  5.     EXTRN  _video_page:byte
  6.  
  7. _TEXT    SEGMENT BYTE PUBLIC 'CODE'
  8.     ASSUME CS:_TEXT
  9.     PUBLIC _get_color
  10. _get_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        ;color now in AH
  26.     mov  al,ah        ;color to AL
  27.     sub  ah,ah        ;clear high byte
  28.     pop  bp            ;restore BP and quit
  29.     cmp  _memory_model,0    ;quit
  30.     jle  quit        ;
  31.     db   0CBh        ;RET far
  32. quit:    ret            ;RET near
  33. _get_color endp
  34. _TEXT    ENDS
  35.     END
  36.