home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!benrg
- From: benrg@ocf.berkeley.edu (Ben Rudiak-Gould)
- Newsgroups: comp.os.msdos.programmer
- Subject: Re: djgpp 2.2.2 Q's: mouse/svga/assembler/bios
- Date: 7 Sep 1992 09:24:03 GMT
- Organization: U.C. Berkeley Open Computing Facility
- Lines: 136
- Distribution: world
- Message-ID: <18f73jINN2gr@agate.berkeley.edu>
- References: <25586@castle.ed.ac.uk>
- NNTP-Posting-Host: earthquake.berkeley.edu
- Summary: two answers and a "me too!"
-
- First of all, the file DOCS\VERSION in my DJGPP distribution says,
- "This distribution of DOS 386/G++ is version 1.05". Does yours
- really say, "2.2.2", or are you talking about the version number of
- something else? If the former, where did you get that version?
-
- In article <25586@castle.ed.ac.uk> eonu24@castle.ed.ac.uk (I Reid) writes:
-
- >Question 2: Trident 8900 driver problems.
- >
- >I have a Tseng ET4000 based svga board with a Sierra HiColor RAMDAC
- >and the standard driver (tseng4k.grd) works perfectly for everything I
- >have tried so far. Unfortunately my flatmate has not had the same
- >success with his trident 8900 based board (in a 486-50). We have tried
- >the trident.grd and tridnt89.grd without any success. I know my test
- >code is running perfectly on his machine in text mode so the problem
- >is definitely something to do with the graphics. Has anyone else had
- >this difficulty and found a solution?
-
- I ran into this problem as well, and solved it. The drivers have only
- two routines--one to set a graphics mode and one to do a bank-switch.
- A little bit of experimentation revealed that the bank-switch routine
- was the one causing the problem. I noticed that the source code had a
- notice saying it was derived from VGAKIT 3.4. I have 4.1 and it works
- fine. So, I changed the bank-switch code in tridnt89.asm to conform
- to the new VGAKIT code, and now it works fine as well.
-
- Here's the new bank-switch routine:
-
- (this isn't the end of my article; it continues after the code)
-
- ;--------------------------------------------------------------------------
- ; Entry: AH=read page
- ; AL=write page
- ;
- ; NOTE: This runs in protected mode! Don't mess with the segment registers!
- ; This code must be relocatable and may not reference any data!
- ;
- ; Exit: VGA configured.
- ; AX,BX,CX,DX,SI,DI may be trashed
- ;
- ; Code derived from VGAKIT version 3.4
- ; Copyright 1988,89,90 John Bridges
- ;
- ; Code modified by Ben Rudiak-Gould to conform to VGAKIT version 4.1
-
- assume ds:nothing, es:nothing
-
- paging_routine proc far
- mov cx,ax
- mov dx,3ceh ;set page size to 64k
- mov al,6
- out dx,al
- inc dl
- in al,dx
- dec dl
- or al,4
- mov ah,al
- mov al,6
- out dx,ax
-
- mov dl,0c4h ;switch to BPS mode
- mov al,0bh ;was mov ax,000bh
- out dx,al ;was out dx,ax
- inc dl ;was nonexistent
- in al,dx
- dec dl ;was nonexistent
-
- mov ah,cl
- xor ah,2
- mov dx,3c4h
- mov al,0eh
- out dx,ax
-
- ret
-
- paging_routine endp
-
- ;--------------------------------------------------------------------------
-
- >Question 4: Interrupt routines
- >
- >Are interrupt handlers possible using djgpp? Can anyone give me an
- >example of source code for one?
-
- I would definitely like to know this too.
-
- >Question 4: 386 assembler and BIOS
- >
- >2 questions really...
- >
- >1. I'm fairly comfortable with 80x86 assembly language and make extensive
- > use of the inline assembly features of Borland's Turbo C compiler. I
- > read somewhere in the djgpp docs that it supports inline assembly? Can
- > anyone send me an example of some to point me in the right direction?
-
- The assembly language supported by DJGPP is not ordinary Intel notation.
- In fact, is resembles 680x0 assembly more than x86 assembly. You can
- get an example of it by compiling with the -S option, or by looking in
- the LIBSRC directory. The main differences are:
-
- o The destination operand is the last operand, rather than the first.
-
- o Registers are referred to with a prepended `%' (i.e. %eax), and
- immediate operands with a prepended `$' (i.e. $10 or $_label). I
- think (but I'm not sure) that hexadecimal constants can be written
- as $0x89ab.
-
- o Register names like %bl and %cx are not used; instead, the word size
- is indicated by a letter (`b', `w', or `l') appended to the instruction
- mnemonic. (This is not done for operations like shrd, where there is
- no possibility of confusion.)
-
- o Most of the addressing modes are written differently.
-
- For example, the following function will multiply two fixed-point
- integers (each with 16 bits of integer and 16 bits of fraction), and
- return their product as a third:
-
- int fixed_mul(int a, int b)
- {
- asm("movl 8(%ebp),%eax"); /* get operands from stack into %eax */
- asm("movl 12(%ebp),%edx"); /* and %edx (%ebp is set up for us) */
- asm("mull %edx"); /* do the multiplication */
- asm("shrd $16,%edx,%eax"); /* shift off lower 16 bits from */
- /* 64-bit result */
-
- } /* result is in %eax, which is where djgpp wants it */
-
- Note that I deduced the assembly notation from looking at examples, and
- the inline notation by trial and error. If anybody knows of any official
- documentation for this (in the full gcc package?) let me know.
-
- --
- Ben Rudiak-Gould
- benrg@ocf.berkeley.edu
- You know, the worst thing about censorship is
-