|
|
1.1 root 1: title "ET4000 ASM routines"
2: ;++
3: ;
4: ; Copyright (c) 1992 Microsoft Corporation
5: ;
6: ; Module Name:
7: ;
8: ; vgahard.asm
9: ;
10: ; Abstract:
11: ;
12: ; This module implements the baning code for the et4000.
13: ;
14: ; Environment:
15: ;
16: ; Kernel mode only.
17: ;
18: ; Revision History:
19: ;
20: ;
21: ;--
22:
23: .386p
24: .xlist
25: include callconv.inc
26: .list
27:
28: ;---------------------------------------
29: ;
30: ; ET4000 banking control port.
31: ;
32:
33: SEGMENT_SELECT_PORT equ 03cdh ;banking control here
34: SEQ_ADDRESS_PORT equ 03C4h ;Sequencer Address register
35: IND_MEMORY_MODE equ 04h ;Memory Mode register index in Sequencer
36: CHAIN4_MASK equ 08h ;Chain4 bit in Memory Mode register
37:
38: ;---------------------------------------
39:
40: _TEXT SEGMENT DWORD USE32 PUBLIC 'CODE'
41: ASSUME CS:FLAT, DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
42: ;
43: ; Bank switching code. This is a 1-64K-read/1-64K-write bank adapter
44: ; (VideoBanked1R1W).
45: ;
46: ; Input:
47: ; EAX = desired read bank mapping
48: ; EDX = desired write bank mapping
49: ;
50: ; Note: values must be correct, with no stray bits set; no error
51: ; checking is performed.
52: ;
53: public _BankSwitchStart, _BankSwitchEnd, _PlanarHCBankSwitchStart
54: public _EnablePlanarHCStart, _DisablePlanarHCStart
55: align 4
56:
57: _BankSwitchStart proc ;start of bank switch code
58: _PlanarHCBankSwitchStart: ;start of planar HC bank switch code,
59: ; which is the same code as normal
60: ; bank switching
61: shl eax,4 ;shift them to bits 7-4
62: or al,dl ;read bank in bits 7-4, write bank
63: ; in bits 3-0
64: mov dx,SEGMENT_SELECT_PORT ;banking control port
65: out dx,al ;select the banks
66:
67: ret
68:
69: align 4
70: _EnablePlanarHCStart:
71: mov dx,SEQ_ADDRESS_PORT
72: in al,dx
73: push eax ;preserve the state of the Seq Address
74: mov al,IND_MEMORY_MODE
75: out dx,al ;point to the Memory Mode register
76: inc edx
77: in al,dx ;get the state of the Memory Mode reg
78: and al,NOT CHAIN4_MASK ;turn off Chain4 to make memory planar
79: out dx,al
80: dec edx
81: pop eax
82: out dx,al ;restore the original Seq Address
83: ret
84:
85: align 4
86: _DisablePlanarHCStart:
87: mov dx,SEQ_ADDRESS_PORT
88: in al,dx
89: push eax ;preserve the state of the Seq Address
90: mov al,IND_MEMORY_MODE
91: out dx,al ;point to the Memory Mode register
92: inc edx
93: in al,dx ;get the state of the Memory Mode reg
94: or al,CHAIN4_MASK ;turn on Chain4 to make memory linear
95: out dx,al
96: dec edx
97: pop eax
98: out dx,al ;restore the original Seq Address
99: ret
100:
101: ;
102: ; Just here to generate end-of-bank-switch code label.
103: ;
104:
105: _BankSwitchEnd:
106:
107: _BankSwitchStart endp
108:
109:
110: _TEXT ends
111: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.