1/*
2 * BDM2: Banked dumb monochrome driver
3 * Pascal Haible 9/93, haible@izfm.uni-stuttgart.de
4 *
5 * bdm2/driver/sigma/sigmabank.s
6 *
7 * derived from:
8 * hga2/*
9 * Author:  Davor Matic, dmatic@athena.mit.edu
10 * and
11 * vga256/*
12 * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
13 *
14 * see bdm2/COPYRIGHT for copyright and disclaimers.
15 */
16
17/* $XFree86: mit/server/ddx/x386/bdm2/drivers/sigma/sigmabank.s,v 2.1 1993/09/10 08:11:47 dawes Exp $ */
18
19/*
20 * These are here the very lowlevel bankswitching routines.
21 * The segment to switch to is passed via %eax. Only %eax and %edx my be used
22 * without saving the original contents.
23 *
24 * WHY ASSEMBLY LANGUAGE ???
25 *
26 * These routines must be callable by other assembly routines. But I don't
27 * want to have the overhead of pushing and poping the normal stack-frame.
28 */
29
30/*
31 * Special hack for Sigma LaserView [PLUS]
32 * - logical bank size 16k
33 * - real bank size 16k
34 * To bank logical bank e.g n=1 [starting at 0]
35 *    (line 64 to 127, mem 16k to 32k-1) to e.g. (logical) BANK1:
36 * bank real bank n+13=14 to the first 16k window,
37 * bank real bank n+14=15 to the second 16k window.
38 * top and bottom are set to include last 12k of the first window and the
39 * first 4k of the second window.
40 */
41
42#include "assyntax.h"
43
44#include "sigmaPorts.h"
45
46        FILE("sigmabank.s")
47
48        AS_BEGIN
49
50        SEG_DATA
51
52        SEG_TEXT
53
54        ALIGNTEXT4
55        GLOBL   GLNAME(SIGMASetRead)
56GLNAME(SIGMASetRead):
57	/* Add 13 */
58	ADD_L	(CONST(13),EAX)
59	/* Set bit 7 */
60	AND_L	(CONST(0x80),EAX)
61	/* Out byte */
62	MOV_L	(SLV_BANK0,EDX)
63	OUT_B
64	/* Next bank */
65	MOV_L	(SLV_BANK1,EDX)
66	INC_L	(EAX)
67	OUT_B
68        RET
69
70        ALIGNTEXT4
71        GLOBL   GLNAME(SIGMASetWrite)
72        GLOBL   GLNAME(SIGMASetReadWrite)
73GLNAME(SIGMASetWrite):
74GLNAME(SIGMASetReadWrite):
75	/* Add 13 */
76	ADD_L	(CONST(13),EAX)
77	/* Set bit 7 */
78	AND_L	(CONST(0x80),EAX)
79	/* Out byte */
80	MOV_L	(SLV_BANK2,EDX)
81	OUT_B
82	/* Next bank */
83	MOV_L	(SLV_BANK3,EDX)
84	INC_L	(EAX)
85	OUT_B
86        RET
87