home .. forth .. nosc mail list archive ..

[colorforth] Non-working colorForth

Hi there,

I managed to get colorForth to boot and save on my HP Vectra XA with a
Matrox Millenium PCI (NOT AGP) card. I worked once I understood a bit
more about the PCI bus and how many modern VGA cards put a linear frame
buffer in memory.

For those interested, the following is a summary of how I did it. It's
somewhat technical and if you do it to your own PC then I admit NO
responsibility if you screw up. Anyway...

I used a tool called pci.exe (Craig Hart's PCI+AGP bus sniffer)
available from http://members.hyperlink.net.au/~chart/ to identify the
VGA registers in PCI space. It generated the following:-

PCI bus 00 device 0A function 00:  Header Type 'non-bridge' (single-
Vendor: 102B    Matrox Graphics, Inc.                             
Device: 0519    2064W (Millenium)                                 
Class:    03    display                 Revision:       01
SubClass: 00    VGA                     ProgramI/F:     00
CommandReg:      0083 = I/O-on mem-on wait-cyc
Status Reg:      0280 = fast-trns (med)
CacheLine:         00   Latency:        00      BIST:        00
SubsysVendor:    0000   SubsysDevice: 0000
Base Addresses:
        (0) FEDFC000 = mem base=FEDFC000 len=16K
        (1) FE000008 = mem base=FE000000 len=8M prefetchable

I then edited the gen.asm file to use 80005008h instead of 80010008h in
the following lines:

ati0: ;  call dev
;   mov  EAX, 80010008h ; AGP
    mov  EAX, 80005008h ; PCI? Bus 0 dev 10 fun 0
    add  AL, 24h-8 ; look for prefetch
    mov  CL, 5
@@:     DUP_
        call north
        xor  AL, 8
        jz   @f
        sub  EAX, 4
        next @b
    call north
    and  EAX, 0fffffff0h
;   mov EAX, 0FE000000h ; works on Vectra XA! (with matrox mill II)
@@: mov  displ, EAX

Reassembling this produced a bootable colorForth. Using the same method
as xxx to add on the source blocks produced the final file.

Notice the commented-out line where I originally forced the value of
FE000000h into the "displ" variable to check whether this was the
correct frame buffer address.


Notice in the constant 80005008h that the 1 is replaced by 0 compared
with the original 80010008h. This indicates that bus 0 is to be used
instead of bus 0, which is usual for non-AGP cards. Also note the 5.
This translates to the device address 0Ah (or 10 if you prefer).

I worked this out after studying the document pci.txt from the vga file
collection I downloaded from http://www.programmersheaven.com/,
the following comments on the PCI registers:
CF8h D(R/W):
bit   0-7  Index into the configuration space to read/write at CFCh
    11-15  Card ID (0 - 31)
    16-19  PCI Bus ID (0 - 15)
       31  Set to enable the PCI bus configuration space

CFCh D(R/W):
bit  0-31  The index register identified by the PCI bus/card ID/Index in
           can be accessed here.

Hope this helps a few of you.


Steve Smith

To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems   -   List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site   -   http://www.ultratechnology.com