First post, by lucky7456969
- Rank
- Oldbie
If I naively plug the vga bios into dosbox, and then install the avance logic driver for windows 3.1,
the image will be seriously skewed and deformed, how do I get started to write a vga part of dosbox in
'order for the avance logic device driver to understand it. In dos mode, it is okay without problems.
How should I start?
Avance Logic ALG Graphics AcceleratorThe ALG chips are VGA controllers with built in graphics coprocessor (COP).The ALG chips only works in AT and better systems as they uses 16 bit I/Oaddresses.ALG2101 160pin 2Mb, 1280x1024x256c, 800x600x64kALG2201 160pin As 2101, but supports 24bit color ---- maybebecause 1994 and is 1MB expandable to 2MBAvance Logic (ALI ALG2201) ALVGA GUI2 VLB, 1MB, Vesa Local Bus <----- thisALG2228 160pin 2MB, 1280x1024x256c, 1024x768x32k/64k, 800x600x16mALG2301 160pin PCI version of ALG2228ALG2302ALG2064 64bit memory bus, integrates 24bit DAC & dual clock generator andon-chip 32K ROMSupport chips:ALG1101 16bit DAC, controlled via I/O pinALG1201 15/16/24bit DACALG1301 As 1201, but with video functionsALG3102 Clock chip. Supplies 50.35, 56.6, 44.6, 72.2, 74.9, 65.1, 84.7,79.4, 25.175, 28.3, 44.6, 36.1, 57.1, 63.3, 49.9, 39.73C0h index 15h (R/W): Cursor Foregroundbit 0-7 The HW cursor foreground color3C0h index 16h (R/W): Cursor Backgroundbit 0-7 The HW cursor background colorNote: When updating index 15h and 16h it may be necessary to explicitlypreserve index 11h and 12h.3CEh index 09h (R/W): Planar Pixel Index Registerbit 0-2 Planar Pixel Index. Selects the pixel within the CPU Latch to beread at 3CEh index 0Ah.3CEh index 0Ah (R/W): Planar Pixel Registerbit 0-3 Planar Pixel Data. A planar pixel can be read by:Reading the video memory address containing the pixel, thusloading the CPU latches.Setting index 9 to the pixel number (0-7) within the byte.Reading this register.3CEh index 0Bh (R/W): Extended Function Register 1bit 0-1 Video Clock Division Control. Divides the video clock by:(2101) 0: pass through, 1: 1.5, 2: 2, 3: 4(2228) 0: pass through, 1: 2, 2: 4, 3: 42 DRAM Clock Select. If set the DRAM clock is selected from the videoclocks, if clear from SCLK. Only valid if 3CEh index 0Ch bit 6 isset.3-5 ??6-7 DRAM Clock Division Control. Divides the DRAM clock by:0: pass through, 1: 1.5, 2: 2, 3: 43CEh index 0Ch (R/W): Extended Function Register 2
bit 0 Vertical Retrace Interrupt Polarity Control. If set the VerticalRetrace Interrupt is active low, if clear active high.1 16-bit Video Memory Access Enable. Set if access to video memory is8bit, clear if 16bit.2 16-bit BIOS ROM Access Enable. Set if access to the BIOS ROM is8bit, clear if 16bit.3 Building Character. If set enables patterned writes where the CPUdata is interpreted as a pattern (Color Expansion). 8 pixels arewritten at a time. '1' bits in the pattern cause the pixel to be setto the foreground color (3CEh index 0Dh) and '0' bits the backgroundcolor (3CEh index 0Eh).4 8Maps Enable. (Packed modes only) If set 8maps are chained togetherrather than the normal 4 (Chain4). If set the Display Start Address(3d4h index Ch-Dh + 20h) and the Offset (3D4h index 13h) are inunits of 8 bytes. If clear in units of 4 bytes and the pixels aredoubled on the screen (Mode 13h).5 Clock Select 2. Bits 0-1 are in 3C2h/3CCh bits 2-36 SCLK Selection Enable. If set enables 3CEh index 0Bh bit 27 If set turns display off ?3CEh index 0Dh (R/W): Foreground Color Registerbit 0-7 Used as foreground color in Color Expansion and fill color by theCoprocessor. In planar modes only bits 0-3 are used.3CEh index 0Eh (R(W): Background Color Registerbit 0-7 Used as foreground color in Color Expansion and by the Coprocessor.In planar modes only bits 0-3 are used.3CEh index 0Fh (R/W): Extended Function Register 3bit 0 Polarity Control of CPU Latch Output to Function Block. If set theoutput from the CPU Latch is inverted.1 Polarity Control of Function Block output to Bit Mask Block. If setthe output from the Function Block is inverted2 Set to enable the Read bank.3 Address Mapping Control. If set 1MB of video memory can be mapped toany 1MB bank in the first 16MB ?4 ??5 (2201 +)6-7 ??3CEh index 10h (R/W): (2201+)bit 0-7 ??3CEh index 11h (R/W): (2201+)bit 0-7 ??3CEh index 1Fh (R/W): Character ROM Extended Address Register (2101)bit 0-1 ??2 (2101 only) Clock Select 3. Bits 0-1 are in 3C2h/3CCh bits 2-3 andbit 2 in 3CEh index 0Ch bit 63-7 ??CRTC = 3d4h===========================3d4h index 19h (R/W): CRTC Extended Registers 1bit 0 Interlace Control. Set in interlaced modes. In interlaced modes theCRTC offset (3d4h index 13h) is for two scan lines.1 High Resolution Address Support in Chain 4 Mode. If set MA14 andMA15 wraps around, if clear MA12 and MA13 wraps around.Should be set enables access to video memory above 256K.2 Clock Lock. If set disables writes to 3C2h bits 2,3,6,7.3 CRTC Timing Lock. If set disables writes to the CRTC timingregisters.4 New Address Scheme. If set the CRTC uses non-wrapped addresses andshifts them 0-2 bits left depending on sequencer mode.SEt in HiColor modes, but does not controll the DAC mode.5 Vertical Retrace Edge Control to load line address6 VREB4. Bit 4 of the Vertical Retrace End Register (3d4h index 11hbits 0-3). Only valid if bit 7 set.7 VRC4EN. If set the Vertical Retrace Register (3d4h index 11h bits0-3) is extended with bit 6 of this register.Note: This register can only be written when 3d4h index 1Ah bit 4 is set3d4h index 1Ah (R/W): CRTC Extended Register 2bit 0 6845 Emulation Mode. If set forces the CRTC to 6845 mode.1 EGA Emulation Mode. If set emulates the IBM EGA CRTC. Causes displayto wrap at 512K ?2 (2228) Enable hardware cursor if set4 Protect Hardware Configuration. If clear disables writes to 3d4hindex 19h, 1Dh and 3CEh index 0Bh and 0Fh. If set enables access toall extended registers5 If set causes color shifts ?6-7 (R) Version Number. 1: ALG2201, 3: ALG2101, 2: ALG2228/ALG23013d4h index 1Bh (R): Configuration Register 1bits 0-7 Reserved.2 Set for the ALG2228, clear for the ALG2201 & ALG2301 (this couldalso be a bus ID (set for VESA, clear for PCI) or similar ??)3d4h index 1Ch (R/W): Configuration Register 2bit 0 DRAM Configuration. 0: 4 256Kx4 (512K), 1: 8/16 256Kx41 Data Buffer Configuration. If clear the data bus is buffered with a74LS245 (or similar), if set it is unbuffered.2 3C3h/46E8h Select. If set the VGA Enable Port is at 3C3h, if clearat 46E8h.3 BIOS ROM Access Enabled if set4 Reserved (0=MCA bus, 1=ISA bus)?5 ROM Type. 0: 27128 (16K) ROM, 1: 27256 (32K) ROM.7 -MCS16 Decoding Control. If set -MCS16 is decoded from LA17-23, ifclear from SA16-19Note: The contents of this register are latched from M02D0-7 on the fallingedge of the RESET signal.3d4h index 1Dh (R/W): Configuration Register 30 Address Latch Enable. If set the address lines are latchedinternally on the falling edge of ALE, if clear the internal latchis transparent.1 Write-per-bit. If set forces the Sequencer to support DRAM write-per-bit operaton ?3 Clock Select Pin Putput Enable. If set VCLK1, VCLK2 and VCLK3 areoutput pins, if clear input pins.4 Output Enable. If set enables all output pins, if clear all outputpins except -DATAENL, DIR, -DATAENH, RAS; CKS0, CKS1 and CKS2 aretristated.5 Slot Size Detection. Set if the slot is 16bit, clear if 8bit.6 External Video. If set enables the P0-7, BLANK, PCLK, HSYNC andVSYNC pins for video output, if clear tristates them.Note: The contents of this register are latched from M1D0-7 on the fallingedge of the RESET signal.Note: This register can only be written when 3d4h index 1Ah bit 4 is set3d4h index 1Eh (R/W):bit 0-1 Video memory. 0=256k, 1=512k, 2=1M, 3=2Mbytes.6-7 Max Horizontal Frequency: 0=38kHz, 1=48kHz, 2=56kHz, 3=64kHz.3d4h index 1Fh (R/W):bit 0-1 Emulation. 0=VGA, 1=EGA, 2=CGA,3=MDA3d4h index 20h (R/W):bit 0-2 Display start address bit 16-18.Note: if 3CEh index Ch bit 4 is set, the display start is in units of 8 bytes,rather than 4 as in std vga.3d4h index 21h (R/W): Cursor X positionbit 0-7 Bits 3-10 of the HW cursor X position. The lower bits are in index25h.3d4h index 23h (R/W): Cursor Y positionbit 0-7 Bits 1-8 of the HW cursor Y position. The upper bits are in index25h.Note: in non-interlaced modes (3d4h index 19h bit 0 is 0) the Y co-ordinateshould be multiplied by 2.3d4h index 25h (R/W): Cursor controlbit 0-1 Bit 9-10 of the HW cursor Y position. The lower bits are in index23h2-4 Bits 0-2 of the HW cursor X position. The upper bits are in index21h5 If set enables the HW cursor. To preserve the stability of thecursor, this bit should be set with each update of this register.6 Bit 0 of the HW cursor Y position. (see note on interlace).3d4h index 27h W(R/W): Cursor Map addressbit 0-10 The address in video memory where the HW cursor map starts.In planar modes this address is in units of 256 bytes,in packed modes in units of 1024 bytes.The HW cursor is a 64x64 bitmap imposed on the display.The cursor map is stored as a 64x64x2bit array, where each pixel is:0: Background color (3C0h index 16h)1: Foreground color (3C0h index 15h)2: The screen data (transparent cursor).3: Inverted screen data (XOR cursor)Note: in interlaced modes the cursor is shown double height.=== S3 has no 28, avance has... check VGA_S3 = S3 and VGA_CRTC = VGA3d4h index 28h (R/W): Vertical Extended regbit 7 CRTC Offset bit 8. Bits 0-7 are in 3d4h index 13hNote: The extensions of the CRTC registers in this register are onlyactive if 3d4h index 19h bit 7 is set.3d4h index 2Ah (R/W): Horizontal Extended reg (2201 +)bit 0 Horizontal Total bit 8. Bits 0-7 are in 3d4h index 00h3 Horizontal Blanking ??.4 ??5 ??Note: The extensions of the CRTC registers in this register are only activeif 3d4h index 19h bit 7 is set.3D6h (R/W): Read Address Registerbit 0-4 64k Read bank number. If 3CEh index Fh bit 2 is set all reads usethis bank number, if clear all accesses use 3D7h.3D7h (R/W): Read/Write Address Registerbit 0-4 64k Bank number. If 3CEh index Fh bit 2 is clear all accesses usethis bank number, if set writes use this bank and reads use 3D6h.8280h W(R/W): Source address lowbit 0-15 The lower 16 bits of the pixel address of the source area.8282h (R/W): Source address highbit 0-7 The upper 8 bits of the pixel address of the source area.Calculated as (line no.)*(pixels per line)+(pixel no. in line).8284h W(R/W): Source area scanline width.bit 0-15 The number of pixels in a scanline at the source.8286h W(R/W): Destination address low.bit 0-15 Lower 16 bits of the pixel address of the destination area.8288h (R/W): Destination Address high.bit 0-7 The upper 8 bits of the pixel address of the destination area.Calculated as (line no.)*(pixels per line)+(pixel no. in line).828Ah W(R/W): Destination area scanline widthbit 0-15 Number of pixels in a scanline at the destination.828Ch W(R/W): Width of op.bit 0-15 Width of the blit area in pixels.828Eh W(R/W): Height of op.bit 0-15 Number of lines in the blit area.8290h (R/W):bit 0-5 7 If moving towards higher co-ordinates, 1 if moving towards lower.0 (or don't care) for line draws6 If set drawing only happens within the rectangle defined by8294h-9Ah.X co-ordinate must be >= 8294h and <=8296h.Y co-ordinate must be >= 8298h and <=829Ah.8292h W(R/W):bit 0-7 always 0Dh ???8 (Line Draw) If set the final position is to the left of the start9 (Line Draw) If set the final position is above the start10 (Line Draw) If set (Delta X) and (Delta Y) are swapped whencalculating the Bresenham constants in 82A2h-A6h.11 ??12 Set if moving towards lower co-ordinates, clear if not.8294h W(R/W): Clipping leftbit 0-15 If 8290h bit 6 is set drawing only happens if the X-co-ordinate is>= this value8296h W(R/W): Clipping rightbit 0-15 If 8290h bit 6 is set drawing only happens if the X-co-ordinate is<= this value8298h W(R/W): Clipping topbit 0-15 If 8290h bit 6 is set drawing only happens if the Y-co-ordinate is>= this value829Ah W(R/W): Clipping bottombit 0-15 If 8290h bit 6 is set drawing only happens if the Y-co-ordinate is<= this value829Ch W(R/W): Start X co-ordinatebit 0-15 Starting X co-ordinate of the destination area.829Eh W(R/W): Start Y co-ordinatebit 0-15 Starting Y co-ordinate of the destination area82A0h W(R/W):bit 0-15 Always set to 0 ??82A2h W(R/W): Bresenham Constant 1bit 0-15 The Bresenham Constant 1 used for line drawingCalculated as 2*(Delta Y). If 8292h bit 10 is set 2*(Delta X) isused.82A4h W(R/W): Bresenham Constant 2bit 0-15 The Bresenham Constant 2 used for line drawingCalculated as 2*((Delta Y) - (Delta X)). If 8292h bit 10 is set(Delta Y) and (Delta X) are swapped in the calculation.82A6h W(R/W): Bresenham Error Termbit 0-15 The Bresenham Error Term used for line drawing.Calculated as 2*(Delta Y) + (Delta X). If 8292h bit 10 is set(Delta Y) and (Delta X) are swapped in the calculation.82A8h W(R/W):bit 0-15 (Line draw) Pattern mask. Only the set bits are drawn.82AAh (R/W): COP status/instructionbit 0-3 (R) When 0 the COP is free.0-7 (W) Graphics instruction:1: Fill rectangle2: Copy rectangle4: ?8: Line draw82B0h82BAh (R): Status??bit 7 Set if busy ?82BCh82C0h82C8h W(R/W):bit82CAh W(R/W):82CCh W(R/W):ID Avance Logic chip:old:=rdinx($3d4,$1A);clrinx($3d4,$1A,$10); {Disable extensions}if not testinx($3d4,$19) then // first invalid indexbeginsetinx($3d4,$1A,$10); {Enable extensions} // second invalid indexif testinx($3d4,$19) and testinx2($3d4,$1A,$3F) thenAvance Logic AL2101 !!end;wrinx($3d4,$1A,old);Video modes:20h T 132 25 1621h T 132 30 1622h T 132 43 1623h T 132 60 1624h T 80 30 1625h T 80 43 1626h T 80 60 1627h G 960 720 16 PL428h G 512 512 256 P829h G 640 400 256 P82Ah G 640 480 256 P82Bh G 800 600 16 PL42Ch G 800 600 256 P82Dh G 768 1024 16 Pl42Eh G 768 1024 256 P82Fh G 1024 768 430h G 1024 768 16 PL431h G 1024 768 256 P833h G 1024 1024 256 P836h G 1280 1024 16 PL437h G 1280 1024 256 P840h G 320 200 64k P1641h G 512 512 64k P1642h G 640 400 64k P1643h G 640 480 64k P1644h G 800 600 64k P1645h G 1024 768 64k P1648h G 640 480 16m P2449h G 800 600 16m P24