home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / msdos / programm / 9119 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  5.2 KB

  1. Path: sparky!uunet!spool.mu.edu!agate!benrg
  2. From: benrg@ocf.berkeley.edu (Ben Rudiak-Gould)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: djgpp 2.2.2 Q's: mouse/svga/assembler/bios
  5. Date: 7 Sep 1992 09:24:03 GMT
  6. Organization: U.C. Berkeley Open Computing Facility
  7. Lines: 136
  8. Distribution: world
  9. Message-ID: <18f73jINN2gr@agate.berkeley.edu>
  10. References: <25586@castle.ed.ac.uk>
  11. NNTP-Posting-Host: earthquake.berkeley.edu
  12. Summary: two answers and a "me too!"
  13.  
  14. First of all, the file DOCS\VERSION in my DJGPP distribution says,
  15. "This distribution of DOS 386/G++ is version 1.05".  Does yours
  16. really say, "2.2.2", or are you talking about the version number of
  17. something else?  If the former, where did you get that version?
  18.  
  19. In article <25586@castle.ed.ac.uk> eonu24@castle.ed.ac.uk (I Reid) writes:
  20.  
  21. >Question 2: Trident 8900 driver problems.
  22. >
  23. >I have a Tseng ET4000 based svga board with a Sierra HiColor RAMDAC
  24. >and the standard driver (tseng4k.grd) works perfectly for everything I
  25. >have tried so far. Unfortunately my flatmate has not had the same
  26. >success with his trident 8900 based board (in a 486-50). We have tried
  27. >the trident.grd and tridnt89.grd without any success. I know my test
  28. >code is running perfectly on his machine in text mode so the problem
  29. >is definitely something to do with the graphics. Has anyone else had
  30. >this difficulty and found a solution?
  31.  
  32. I ran into this problem as well, and solved it.  The drivers have only
  33. two routines--one to set a graphics mode and one to do a bank-switch.
  34. A little bit of experimentation revealed that the bank-switch routine
  35. was the one causing the problem.  I noticed that the source code had a
  36. notice saying it was derived from VGAKIT 3.4.  I have 4.1 and it works
  37. fine.  So, I changed the bank-switch code in tridnt89.asm to conform
  38. to the new VGAKIT code, and now it works fine as well.
  39.  
  40. Here's the new bank-switch routine:
  41.  
  42. (this isn't the end of my article; it continues after the code)
  43.  
  44. ;--------------------------------------------------------------------------
  45. ; Entry: AH=read page
  46. ;        AL=write page
  47. ;
  48. ; NOTE: This runs in protected mode!  Don't mess with the segment registers!
  49. ; This code must be relocatable and may not reference any data!
  50. ;
  51. ; Exit: VGA configured.
  52. ;       AX,BX,CX,DX,SI,DI may be trashed
  53. ;
  54. ; Code derived from VGAKIT version 3.4
  55. ;       Copyright 1988,89,90 John Bridges
  56. ;
  57. ; Code modified by Ben Rudiak-Gould to conform to VGAKIT version 4.1
  58.     
  59.     assume  ds:nothing, es:nothing
  60.  
  61. paging_routine  proc    far
  62.     mov     cx,ax
  63.     mov     dx,3ceh         ;set page size to 64k
  64.     mov     al,6
  65.     out     dx,al
  66.     inc     dl
  67.     in      al,dx
  68.     dec     dl
  69.     or      al,4
  70.     mov     ah,al
  71.     mov     al,6
  72.     out     dx,ax
  73.         
  74.     mov     dl,0c4h         ;switch to BPS mode
  75.     mov     al,0bh          ;was  mov ax,000bh
  76.     out     dx,al           ;was  out dx,ax
  77.     inc     dl              ;was nonexistent
  78.     in      al,dx
  79.     dec     dl              ;was nonexistent
  80.  
  81.     mov     ah,cl
  82.     xor     ah,2
  83.     mov     dx,3c4h
  84.     mov     al,0eh
  85.     out     dx,ax
  86.  
  87.     ret
  88.  
  89. paging_routine  endp
  90.  
  91. ;--------------------------------------------------------------------------
  92.  
  93. >Question 4: Interrupt routines
  94. >
  95. >Are interrupt handlers possible using djgpp? Can anyone give me an
  96. >example of source code for one?
  97.  
  98. I would definitely like to know this too.
  99.  
  100. >Question 4: 386 assembler and BIOS
  101. >
  102. >2 questions really...
  103. >
  104. >1. I'm fairly comfortable with 80x86 assembly language and make extensive
  105. >   use of the inline assembly features of Borland's Turbo C compiler. I
  106. >   read somewhere in the djgpp docs that it supports inline assembly? Can
  107. >   anyone send me an example of some to point me in the right direction?
  108.  
  109. The assembly language supported by DJGPP is not ordinary Intel notation.
  110. In fact, is resembles 680x0 assembly more than x86 assembly.  You can
  111. get an example of it by compiling with the -S option, or by looking in
  112. the LIBSRC directory.  The main differences are:
  113.  
  114. o  The destination operand is the last operand, rather than the first.
  115.  
  116. o  Registers are referred to with a prepended `%' (i.e. %eax), and
  117.    immediate operands with a prepended `$' (i.e. $10 or $_label).  I
  118.    think (but I'm not sure) that hexadecimal constants can be written
  119.    as $0x89ab.
  120.  
  121. o  Register names like %bl and %cx are not used; instead, the word size
  122.    is indicated by a letter (`b', `w', or `l') appended to the instruction
  123.    mnemonic.  (This is not done for operations like shrd, where there is
  124.    no possibility of confusion.)
  125.  
  126. o  Most of the addressing modes are written differently.
  127.  
  128. For example, the following function will multiply two fixed-point
  129. integers (each with 16 bits of integer and 16 bits of fraction), and
  130. return their product as a third:
  131.  
  132. int fixed_mul(int a, int b)
  133. {
  134.     asm("movl 8(%ebp),%eax");    /* get operands from stack into %eax */
  135.     asm("movl 12(%ebp),%edx");    /* and %edx (%ebp is set up for us) */
  136.     asm("mull %edx");        /* do the multiplication */
  137.     asm("shrd $16,%edx,%eax");    /* shift off lower 16 bits from */
  138.                     /* 64-bit result */
  139.  
  140. }        /* result is in %eax, which is where djgpp wants it */
  141.  
  142. Note that I deduced the assembly notation from looking at examples, and
  143. the inline notation by trial and error.  If anybody knows of any official
  144. documentation for this (in the full gcc package?) let me know.
  145.  
  146. --
  147. Ben Rudiak-Gould
  148. benrg@ocf.berkeley.edu
  149. You know, the worst thing about censorship is
  150.