home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pctech / pctj1188.arc / SPLITSCR.ASM < prev    next >
Assembly Source File  |  1988-09-06  |  4KB  |  101 lines

  1. ; Microsoft C: 
  2. ;       void SplitScreen( n ); 
  3. ;               int     n;      /* scan line at which */ 
  4. ;                               /*  to split screen */ 
  5.  
  6.  
  7. _TEXT           SEGMENT byte public 'CODE' 
  8.                 ASSUME  cs:_TEXT 
  9.  
  10.                 PUBLIC  _SplitScreen 
  11. _SplitScreen    PROC    near 
  12.  
  13.                 push    bp              ; preserve BP 
  14.                 mov     bp,sp 
  15.  
  16.                 mov     ax,40h 
  17.                 mov     es,ax           ; ES -> video BIOS data area 
  18.                 mov     dx,es:[63h]     ; DX = port for CRTC index reg 
  19.  
  20. ; wait for vertical retrace 
  21.  
  22.                 add     dl,6            ; DX = 3BAH or 3DAH (CRT status port) 
  23. L01:            in      al,dx           ; wait for end of vertical retrace 
  24.                 test    al,8 
  25.                 jnz     L01 
  26.  
  27. L02:            in      al,dx           ; wait for start of vertical retrace 
  28.                 test    al,8 
  29.                 jz      L02 
  30.                 sub     dl,6            ; DX = port for CRTC index reg 
  31.  
  32. ; isolate bits 0-7, bit 8, and bit 9 of the Line Compare value 
  33.  
  34.                 mov     ax,[bp+4]       ; AX = scan line value 
  35.                 mov     bh,ah           ; BH bits 0-1 = bits 8-9 of 
  36.                                         ;  Line Compare value 
  37.                  
  38.                 mov     bl,bh 
  39.                 and     bx,0201h        ; BH bit 1 = Line Compare bit 9 
  40.                                         ; BL bit 0 = Line Compare bit 0 
  41.  
  42.                 mov     cl,4 
  43.                 shl     bx,cl           ; BH bit 5 = Line Compare bit 9 
  44.                                         ; BL bit 4 = Line Compare bit 8 
  45.                 shl     bh,1            ; BH bit 6 = Line Compare bit 9 
  46.  
  47. ; update the CRTC registers 
  48.  
  49.                 mov     ah,al           ; AH = low-order 8 bits of value 
  50.                 mov     al,18h          ; AL = Line Compare register number 
  51.                 out     dx,ax           ; update Line Compare register 
  52.  
  53.                 mov     al,7            ; AL = Overflow register number 
  54.                 cli 
  55.                 out     dx,al 
  56.                 inc     dx 
  57.                 in      al,dx           ; AL = current Overflow reg value 
  58.                 sti 
  59.                 dec     dx 
  60.  
  61.                 mov     ah,al 
  62.                 and     ah,11101111b    ; AH bit 4 = 0 
  63.                 or      ah,bl           ; AH bit 4 = Line Compare bit 8 
  64.                 mov     al,7            ; AL = Overflow register number 
  65.                 out     dx,ax           ; update Overflow register 
  66.  
  67.                 mov     al,9            ; AL = Max Scan Line register number 
  68.                 cli 
  69.                 out     dx,al 
  70.                 inc     dx 
  71.                 in      al,dx           ; AL = current Max Scan Line reg value 
  72.                 sti 
  73.                 dec     dx 
  74.  
  75.                 mov     ah,al 
  76.                 and     ah,10111111b    ; AH bit 6 = 0 
  77.                 or      ah,bh           ; AH bit 6 = Line Compare bit 9 
  78.                 mov     al,9            ; AL = Max Scan Line reg number 
  79.                 out     dx,ax           ; update Max Scan Line register 
  80.  
  81. ; set bit 5 of the Attribute Controller Mode Control register 
  82.  
  83.                 mov     ax,1007h        ; AH = 10h (int 10H function number) 
  84.                                         ; AL = 7 (subfunction number) 
  85.                 mov     bl,10h          ; BL = Mode Control reg number 
  86.                 int     10h             ; BH = Mode Control reg value 
  87.                 or      bh,20h          ; set bit 5 
  88.  
  89.                 mov     ax,1000h        ; AH = 10h 
  90.                                         ; AL = 0 
  91.                 mov     bl,10h 
  92.                 int     10h             ; update Mode Control register 
  93.  
  94.                 pop     bp              ; restore BP and exit 
  95.                 ret 
  96.  
  97. _SplitScreen    ENDP 
  98.  
  99. _TEXT           ENDS 
  100.