delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/19/07:18:36

From: Sterten AT aol DOT com
Message-ID: <9.187bbe3f.28881b90@aol.com>
Date: Thu, 19 Jul 2001 07:16:32 EDT
Subject: Re: pokeb peekb
To: eliz AT is DOT elta DOT co DOT il
CC: djgpp AT delorie DOT com
MIME-Version: 1.0
X-Mailer: AOL 3.0 16-bit for Windows sub 60
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:

 >On Thu, 19 Jul 2001 Sterten AT aol DOT com wrote:
 >
 >> 1) what's the shortest complete program that pokes a face (ascii 1)
 >>    into the exact middle of the screen and exits to DOS ?
 >
 >_farpokeb (_dos_ds, ScreenPrimary + 12*160 + 80, 1);
 >
 >(This is not a complete program, but the rest is easy to add.)

not for me. Although I found and printed some helpful tutorials
from avly meanwhile.
Here are my attempts so far:

------------------------------------------------------------------

#include<go32.h>
#include<dpmi.h>
#include<sys/farptr.h>

_farpokeb (_dos_ds, ScreenPrimary + 12*160 + 80, 1);

                                                                              
  
D:\GCC203>gcc video3.c -o video3.out
video3.c:5: parse error before `.'
video3.c:5: conflicting types for `_farpokeb'
d:/gcc203/include/sys/farptr.h:84: previous declaration of `_farpokeb'
video3.c:5: warning: data definition has no type or storage class

---------------------------------------------------------------------

#include<go32.h>
#include<dpmi.h>
#include<sys/nearptr.h>

unsigned char *videoptr=(unsigned char *)0xB8000;

__djgpp_nearptr_enable();
videoptr[12*160+80+__djgpp_conventional_base]=1;
__djgpp_nearptr_disable();

                                                                              
  
                                                                              
  
D:\GCC203>gcc video.c -o video.exe                                            
  
video.c:7: warning: data definition has no type or storage class              
  
video.c:8: variable-size type declared outside of any function                
  
video.c:8: variable-sized object may not be initialized                       
  
video.c:8: conflicting types for `videoptr'                                   
  
video.c:5: previous declaration of `videoptr'                                 
  
video.c:8: warning: data definition has no type or storage class              
  
video.c:9: conflicting types for `__djgpp_nearptr_disable'                    
  
d:/gcc203/include/sys/nearptr.h:20: previous declaration of 
`__djgpp_nearptr_dis
able'                                                                         
  
video.c:9: warning: data definition has no type or storage class              
  


-------------------------------------------------------------------

#include<go32.h>

void main(){
--asm--("
movw %0,%%ax\n
movw %%ax,%%es\n
movl $0xb87d0,%%edi\n
movb $1,%%al\n
stosb\n
"
:
:"g"(_dos_ds)
);
}

                                                                              
  
D:\GCC203>gcc video2.c -o video2.exe
video2.c:3: parse error before `--'


------------------------------------------------------------------


 >> 2) what , if it has to be fast (~50 cycles)
 >
 >The above line of code expands into 2 instructions of inline assembly.  
 >How much faster can you ask it to be?

that's OK. This was for the case that you were calling int 21h  or such,
e.g.  with  printf

 >> 3) what , if it is required to compile on a large variety of compilers ?
 >
 >Forget it: the glyph which will be displayed when you put ASCII 001 to 
 >the screen is not the same on each system, and the way to print directly 
 >to the screen memory is different on every OS and each compiler.

but it would be possible to write a routine, that works on the
-say- 5 most common compilers  . Wouldn't it ?

It is very unsatisfactory IMO , when all the different compilers
are so much incompatible !


Guenter

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019