.MODEL LARGE ;------------------------------------------------------------------------ ; DATA SEGMENT DECLARATIONS ;------------------------------------------------------------------------ DATASEG SEGMENT PARA PUBLIC 'DATA' public _wReentrancyCount _wReentrancyCount dw 0000h public _pOldInt1C _pOldInt1C dw 0000h dw 0000h public _FrameCount _FrameCount dw ? dw ? public _VSlice _VSlice dw ? public _HBytes _HBytes dw ? public _N2Move _N2Move dw ? public _BUFoff _BUFoff dw ? public _BUFseg _BUFseg dw ? public _VGAoff _VGAoff dw ? public _Buffer _Buffer dd ? public _wRow _wRow dw ? public _wColumn _wColumn dw ? Scanline dw 0000h BankNumber db 0000h DATASEG ENDS ;------------------------------------------------------------------------ ; CODE SEGMENT DECLARATIONS ;------------------------------------------------------------------------ ;.286 .386 PROGCODE SEGMENT PARA PUBLIC USE16 'CODE' assume cs:PROGCODE assume ds:nothing assume es:nothing ;------------------------------------------------------------------------ NewBank PROC pusha push es push ds push di push si mov ax, DATASEG mov ds, ax assume ds:DATASEG cli ; inc BankNumber ; mov dx,3bfh ;Enable access to extended registers ; mov al,3 ; out dx,al ; mov dl,0d8h ; mov al,0a0h ; out dx,al ; and ah,15 ; mov al,ah ; shl al,4 ; or al,ah ; mov dl,0cdh ; out dx,al ; set the bank mov al,BankNumber inc BankNumber and al, 00001111b ; and al,7 ; mov ah,al ; shl al,1 ; shl al,1 ; shl al,1 ; or al,ah ; or al,01000000b mov dx,3cdh out dx,al sti pop si pop di pop ds pop es popa assume ds:nothing ret NewBank endp public _VGAput _VGAput PROC pusha push ds push es push di push si mov ax, DATASEG mov ds, ax assume ds:DATASEG mov BankNumber, 0 ; bank Call NewBank mov bx, _HBytes ; Number of bytes in scan line shr bx, 2 ; Number of double words in scan line mov dx, 640 ; length of VGA space line sub dx, _HBytes ; offset to next VGA line from end scan mov cx, _N2Move ; number of lines to move mov di, _VGAoff ; VGA offset mov si, _BUFoff mov ax, _BUFseg mov ds, ax mov ax, 0A000h ; VGA segment mov es, ax Line_Loop: push cx ; push number of lines to move cld mov cx, bx ; get doubles to move rep movsd add di, dx jnc SameBank Call NewBank clc SameBank: pop cx dec cx cmp cx, 0 ja Line_Loop pop si pop di pop es pop ds assume ds:nothing popa ret _VGAput ENDP ;------------------------------------------------------------------------ CaptureFrame PROC pusha push ds push es push di push si mov ax, DATASEG mov ds, ax assume ds:DATASEG les di, _Buffer mov ax, [_VSlice] ; Number of scanlines mov Scanline, ax ; put total in ScanLine mov ax, [_HBytes] ; number of pixels per scanline shr ax, 1 ; number of 32 bit words ... mov [_N2Move],ax ; to move from FIFO buffer cld LoadLoop: xor si,si mov cx,100h mov dx, 250h ; pms port CopyLineLoop: in al,dx test al,40h ;Wait til FIFO 0 is filling (NewProMovie) loopnz CopyLineLoop mov cx, [_N2Move] ; number of double words to move mov bx, 0C800h ; address the PMS mov ds, bx ; PMS frame buffer address mov ds:[si],ax ; offset to scanline ? lodsd ; Reset FIFO and clear pipeline rep movsd ; move hbytes/2 dwords mov ax, DATASEG mov ds, ax dec Scanline ; done one scanline cmp Scanline, 0 ; at the end ? ja LoadLoop ; no, get another pop si pop di pop es pop ds assume ds:nothing popa ret CaptureFrame ENDP ;-------------------------------------------------------------------- public _DeviceISR _DeviceISR PROC far pusha push ds push es cld ; set up local DS mov ax, DATASEG mov ds, ax assume ds:DATASEG add word ptr _FrameCount ,1 adc word ptr _FrameCount+2,0 ; Set it up so other interrupts can come through. ; send EOI to PIC mov al, 20H ; non-specific EOI out 0A0h, al ; slave EOI out 020h, al ; master EOI inc [_wReentrancyCount] mov dx,250h mov cx,1000h clrnok: in ax,dx ; word from PMS port and ax,03h ; .and. with 03 cmp ax,03h ; compare with 03 loopne clrnok ; get another if not the same mov ax,1 shl ax,8 out dx,ax ; re-enable interrupts cmp [_wReentrancyCount],1 ja DeviceISRExit DeviceISRService: sti Call CaptureFrame DeviceISRExit: dec [_wReentrancyCount] pop es pop ds assume ds:nothing popa iret _DeviceISR endp ;------------------------------------------------------------------------ public _mode13 _mode13 PROC ; mov ax, 002dh ; 640 x 350 ; mov ax, 0013h ; 320 x 200 mov ax, 002eh ; 640 x 480 int 10h ret _mode13 ENDP public _txtmode _txtmode PROC mov ax,3 int 10h ret _txtmode endp public _SetCursorPos _SetCursorPos proc pusha push ds push es push di push si mov ax, DATASEG mov ds, ax assume ds:DATASEG mov ax,200h mov bh,00h mov dh, byte ptr _wRow mov dl, byte ptr _wColumn int 10h pop si pop di pop es pop ds assume ds:nothing popa ret _SetCursorPos endp ;------------------------------------------------------------------------ PROGCODE ENDS end