;*************************************************************************** ; ; Copyright (c) 1997, 1998 Timpanogas Research Group, Inc. All Rights ; Reserved. ; ; This program is an unpublished work of TRG, Inc. and contains ; trade secrets and other proprietary information. Unauthorized ; use, copying, disclosure, or distribution of this file without the ; consent of TRG, Inc. can subject the offender to severe criminal ; and/or civil penalities. ; ; ; AUTHOR : Jeff V. Merkey ; FILE : SCREENA.386 ; DESCRIP : Screen Code for MANOS v1.0 ; DATE : December 11, 1997 ; ; ;*************************************************************************** ; .486P ; select the processor MODEL FLAT CGROUP GROUP _TEXT DGROUP GROUP _DATA ASSUME cs:_TEXT, ds:_DATA, es:_DATA, fs:_DATA _DATA SEGMENT PUBLIC USE32 'DATA' ; ; Video Equates and Types ; CRTCPort1 EQU 03D4h ; Index port for CRTC CRTCPort2 EQU 03D5h ; Data port for CRTC CRTCAddHi EQU 0Ch ; Register for lo byte of Video address CRTCAddLo EQU 0Dh ; Register for lo byte of Video address CRTCCurHi EQU 0Eh ; Register for lo byte of Cursor address CRTCCurLo EQU 0Fh ; Register for lo byte of Cursor address CRTC0C db 0 ; CRT Reg 0C HiByte address value CRTC0D db 0 ; CRT Reg 0D LoByte address value _DATA ENDS _TEXT SEGMENT PUBLIC USE32 'CODE' ; ; InitVideo makes Video Screen 0 the default screen. That ; makes the VGATextBase address 0B8000h ; public InitVideo InitVideo: cld mov al, CRTCAddHi ;Index of hi byte mov dx, CRTCPort1 ;Index Port out dx, AL mov al, CRTC0C ;hi byte value to send mov dx, CRTCPort2 ;Data Port out dx, al ; mov al, CRTCAddLo ;Index of lo byte mov dx, CRTCPort1 ;Index Port out dx, al mov al, CRTC0D ;lo byte value to send mov dx, CRTCPort2 ;Data Port out dx, al ret public HardXY HardXY: push ebx mov ebx, dword ptr [esp + 8] ; X mov eax, dword ptr [esp + 12] ; Y mov ecx, 80 mul ecx ; Line * 80 add eax, ebx ; Line plus column mov dx, CRTCPort1 ; Index register push eax mov al, CRTCCurLo out dx, al ; Index 0Fh for low byte pop eax mov dx, CRTCPort2 ; Data register out dx, al ; Send Low byte out shr eax, 08 ; shift hi byte into al push eax mov dx, CRTCPort1 mov al, CRTCCurHi out dx, al ; Index for High byte pop eax mov dx, CRTCPort2 out dx, al ; Send High byte out pop ebx ret public ClrScn ClrScn: push edi mov edi, [esp + 8] ; edi points to his video memory mov eax, [esp + 12] ; Attr shl eax, 8 ; mov al, 20h ; mov dx, ax shl eax, 16 mov ax, dx ; Fill Char & Attr mov ecx, 0400h cld rep stosd pop edi ret public CopyData CopyData: push esi push edi cld mov esi, [esp + 12] mov edi, [esp + 16] mov ecx, [esp + 20] add ecx, 3 shr ecx, 2 ; round to dwords rep movsd pop edi pop esi ret public CopyDataB CopyDataB: push esi push edi cld mov esi, [esp + 12] mov edi, [esp + 16] mov ecx, [esp + 20] rep movsb pop edi pop esi ret public SetData SetData: push edi cld mov edi, [esp + 8] mov eax, [esp + 12] mov ecx, [esp + 16] add ecx, 3 shr ecx, 2 ; round to dwords rep stosd pop edi ret public SetDataB SetDataB: push edi cld mov edi, [esp + 8] mov eax, [esp + 12] mov ecx, [esp + 16] rep stosb pop edi ret public SetDataD SetDataD: push edi cld mov edi, [esp + 8] mov eax, [esp + 12] mov ecx, [esp + 16] rep stosd pop edi ret _TEXT ENDS END