• Domingo 15 de Diciembre de 2024, 13:48

Autor Tema:  <dos.h>  (Leído 5169 veces)

arkaitz

  • Nuevo Miembro
  • *
  • Mensajes: 6
    • Ver Perfil
<dos.h>
« en: Lunes 10 de Diciembre de 2007, 04:51 »
0
Buenas... soy nuevo en esto asi que voy a nesecitar una manito con este codigo...
estoy tratando de aprender un poco de C y me encontre con un problema cuando quiero compilar el siguiente codigo:

Código: Text
  1.  
  2. #include &#60;stdio.h&#62;
  3. #include &#60;dos.h&#62;
  4.  
  5. void Modo13h(void)
  6. {
  7.         union REGS r;
  8.  
  9.         r.h.ah=0;
  10.         r.h.al=0x13;
  11.         int86(0x10, &r, &r);
  12. }
  13.  
  14.  

me tira el siguiente error cuando quiero compilar:
Citar
C:\Dev-Cpp\DBM\SinNombre1.c storage size of 'r' isn't known

Por lo que tengo entendido union REGS esta definido en <dos.h>, y no entiendo por que me tira este error....

arkaitz

  • Nuevo Miembro
  • *
  • Mensajes: 6
    • Ver Perfil
Re: <dos.h>
« Respuesta #1 en: Lunes 10 de Diciembre de 2007, 05:04 »
0
Encontre mi error :P
Tenia que usar la libreria dos.h del turbo c en vez de la dos.h del dev cpp...

Pero ahora tengo otro problema...

Código: Text
  1.  
  2. #include &#60;stdio.h&#62;
  3. #include &#34;DOS.H&#34;
  4.  
  5.  
  6. void Modo13h(void)
  7. {
  8.         union REGS r;
  9.  
  10.         r.h.ah=0;
  11.         r.h.al=0x13;
  12.         int86(0x10, &r, &r);
  13. }
  14.  

Código: Text
  1.  
  2. /*  dos.h
  3.  
  4.   Defines structs, unions, macros, and functions for dealing
  5.   with MSDOS and the Intel iAPX86 microprocessor family.
  6.  
  7.   Copyright (c) Borland International 1987,1988
  8.   All Rights Reserved.
  9. */
  10. #if __STDC__
  11. #define _Cdecl
  12. #else
  13. #define _Cdecl  cdecl
  14. #endif
  15.  
  16. #if     !defined(__DOS_DEF_)
  17. #define __DOS_DEF_
  18.  
  19. /* Variables */
  20. extern  int    _Cdecl _8087;
  21. extern  int    _Cdecl _argc;
  22. extern  char        **_Cdecl _argv;
  23. extern  char        **_Cdecl  environ;
  24. extern  int    _Cdecl _doserrno;
  25. extern  unsigned  _Cdecl _heaplen;
  26. extern  unsigned char  _Cdecl _osmajor;
  27. extern  unsigned char  _Cdecl _osminor;
  28. extern  unsigned   _Cdecl _psp;
  29. extern  unsigned  _Cdecl _stklen;
  30. extern  unsigned   _Cdecl _version;
  31.  
  32. #define FA_RDONLY  0x01    /* Read only attribute */
  33. #define FA_HIDDEN  0x02    /* Hidden file */
  34. #define FA_SYSTEM  0x04    /* System file */
  35. #define FA_LABEL  0x08    /* Volume label */
  36. #define FA_DIREC  0x10    /* Directory */
  37. #define FA_ARCH    0x20    /* Archive */
  38.  
  39. #define NFDS  20      /* Maximum number of fds */
  40.  
  41. struct  fcb  {
  42.   char  fcb_drive;    /* 0 = default, 1 = A, 2 = B */
  43.   char  fcb_name[8];    /* File name */
  44.   char  fcb_ext[3];    /* File extension */
  45.   short  fcb_curblk;    /* Current block number */
  46.   short  fcb_recsize;    /* Logical record size in bytes */
  47.   long  fcb_filsize;    /* File size in bytes */
  48.   short  fcb_date;    /* Date file was last written */
  49.   char  fcb_resv[10];    /* Reserved for DOS */
  50.   char  fcb_currec;    /* Current record in block */
  51.   long  fcb_random;    /* Random record number */
  52. };
  53.  
  54. struct  xfcb  {
  55.   char    xfcb_flag;  /* Contains 0xff to indicate xfcb */
  56.   char    xfcb_resv[5];  /* Reserved for DOS */
  57.   char    xfcb_attr;  /* Search attribute */
  58.   struct  fcb  xfcb_fcb;  /* The standard fcb */
  59. };
  60.  
  61. struct  country {
  62.   int  co_date;
  63.   char  co_curr[5];
  64.   char  co_thsep[2];
  65.   char  co_desep[2];
  66.   char  co_dtsep[2];
  67.   char  co_tmsep[2];
  68.   char  co_currstyle;
  69.   char  co_digits;
  70.   char  co_time;
  71.   long  co_case;
  72.   char  co_dasep[2];
  73.   char  co_fill[10];
  74. };
  75.  
  76. struct  DOSERROR {
  77.   int  exterror;
  78.   char  class;
  79.   char  action;
  80.   char  locus;
  81. };
  82.  
  83. struct  dfree  {
  84.   unsigned df_avail;
  85.   unsigned df_total;
  86.   unsigned df_bsec;
  87.   unsigned df_sclus;
  88. };
  89.  
  90. struct  fatinfo {
  91.   char  fi_sclus;
  92.   char  fi_fatid;
  93.   int  fi_nclus;
  94.   int  fi_bysec;
  95. };
  96.  
  97. struct  devhdr  {
  98.   long    dh_next;  /* Next device pointer */
  99.   short    dh_attr;  /* Attributes */
  100.   unsigned short  dh_strat;  /* Driver strategy routine */
  101.   unsigned short  dh_inter;  /* Driver interrupt routine */
  102.   char    dh_name[8];  /* Device name */
  103. };
  104.  
  105. struct  time  {
  106.   unsigned char  ti_min;    /* Minutes */
  107.   unsigned char  ti_hour;  /* Hours */
  108.   unsigned char  ti_hund;  /* Hundredths of seconds */
  109.   unsigned char  ti_sec;    /* Seconds */
  110. };
  111.  
  112. struct  date  {
  113.   int    da_year;  /* Year - 1980 */
  114.   char    da_day;    /* Day of the month */
  115.   char    da_mon;    /* Month (1 = Jan) */
  116. };
  117.  
  118. struct WORDREGS {
  119.   unsigned int  ax, bx, cx, dx, si, di, cflag, flags;
  120. };
  121.  
  122. struct BYTEREGS {
  123.   unsigned char  al, ah, bl, bh, cl, ch, dl, dh;
  124. };
  125.  
  126. union  REGS  {
  127.   struct  WORDREGS x;
  128.   struct  BYTEREGS h;
  129. };
  130.  
  131. struct  SREGS  {
  132.   unsigned int  es;
  133.   unsigned int  cs;
  134.   unsigned int  ss;
  135.   unsigned int  ds;
  136. };
  137.  
  138. struct  REGPACK {
  139.   unsigned  r_ax, r_bx, r_cx, r_dx;
  140.   unsigned  r_bp, r_si, r_di, r_ds, r_es, r_flags;
  141. };
  142.  
  143. #define FP_OFF(fp)  ((unsigned)(fp))
  144. #define FP_SEG(fp)  ((unsigned)((unsigned long)(fp) &#62;&#62; 16))
  145.  
  146.  
  147. typedef struct {
  148.   char  drive;    /* do not change  */
  149.   char  pattern [13];  /*  these fields,  */
  150.   char  reserved [7];  /*   Microsoft reserved */
  151.   char  attrib;
  152.   short  time;
  153.   short  date;
  154.   long  size;
  155.   char  nameZ [13];  /* result of the search, asciiz */
  156. }  dosSearchInfo;  /* used with DOS functions 4E, 4F  */
  157.  
  158.  
  159. int   _Cdecl absread  (int drive, int nsects, int lsect, void *buffer);
  160. int   _Cdecl abswrite(int drive, int nsects, int lsect, void *buffer);
  161. int   _Cdecl allocmem(unsigned size, unsigned *segp);
  162. int   _Cdecl bdos  (int dosfun, unsigned dosdx, unsigned dosal);
  163. int   _Cdecl bdosptr  (int dosfun, void *argument, unsigned dosal);
  164. struct  country *_Cdecl country  (int xcode, struct country *cp);
  165. void   _Cdecl ctrlbrk  (int _Cdecl (*handler)(void));
  166. void   _Cdecl delay  (unsigned milliseconds);
  167. void   _Cdecl disable  (void);
  168. int   _Cdecl dosexterr  (struct DOSERROR *eblkp);
  169. long   _Cdecl dostounix  (struct date *d, struct time *t);
  170. void          __emit__();
  171. void   _Cdecl enable  (void);
  172. int   _Cdecl freemem  (unsigned segx);
  173. int   _Cdecl getcbrk  (void);
  174. void   _Cdecl getdate  (struct date *datep);
  175. void   _Cdecl getdfree(unsigned char drive, struct dfree *dtable);
  176. void   _Cdecl getfat  (unsigned char drive, struct fatinfo *dtable);
  177. void   _Cdecl getfatd  (struct fatinfo *dtable);
  178. unsigned _Cdecl getpsp  (void);
  179. int   _Cdecl getswitchar  (void);
  180. void   _Cdecl gettime  (struct time *timep);
  181. void  interrupt   (* _Cdecl getvect(int interruptno)) ();
  182. int   _Cdecl getverify  (void);
  183. void   _Cdecl harderr  (int _Cdecl (*handler)());
  184. void   _Cdecl hardresume  (int axret);
  185. void   _Cdecl hardretn(int retn);
  186. int   _Cdecl inport  (int portid);
  187. unsigned char  _Cdecl inportb(int portid);
  188. int   _Cdecl int86  (int intno, union REGS *inregs, union REGS *outregs);
  189. int   _Cdecl int86x  (int intno, union REGS *inregs, union REGS *outregs,
  190.        struct SREGS *segregs);
  191. int   _Cdecl intdos  (union REGS *inregs, union REGS *outregs);
  192. int   _Cdecl intdosx  (union REGS *inregs, union REGS *outregs,
  193.        struct SREGS *segregs);
  194. void   _Cdecl intr  (int intno, struct REGPACK *preg);
  195. void   _Cdecl keep  (unsigned char status, unsigned size);
  196. void    _Cdecl nosound  (void);
  197. void   _Cdecl outport  (int portid, int value);
  198. void   _Cdecl outportb(int portid, unsigned char value);
  199. char  *_Cdecl parsfnm  (const char *cmdline, struct fcb *fcb, int opt);
  200. int   _Cdecl peek  (unsigned segment, unsigned offset);
  201. char   _Cdecl peekb  (unsigned segment, unsigned offset);
  202. void   _Cdecl poke  (unsigned segment, unsigned offset, int value);
  203. void   _Cdecl pokeb  (unsigned segment, unsigned offset, char value);
  204. int   _Cdecl randbrd  (struct fcb *fcb, int rcnt);
  205. int   _Cdecl randbwr  (struct fcb *fcb, int rcnt);
  206. void   _Cdecl segread  (struct SREGS *segp);
  207. int   _Cdecl setblock(unsigned segx, unsigned newsize);
  208. int   _Cdecl setcbrk  (int cbrkvalue);
  209. void   _Cdecl setdate  (struct date *datep);
  210. void   _Cdecl setswitchar  (char ch);
  211. void   _Cdecl settime  (struct time *timep);
  212. void   _Cdecl setvect  (int interruptno, void interrupt (*isr) ());
  213. void   _Cdecl setverify  (int value);
  214. void   _Cdecl sleep  (unsigned seconds);
  215. void    _Cdecl sound  (unsigned frequency);
  216. void   _Cdecl unixtodos  (long time, struct date *d, struct time *t);
  217. int   _Cdecl  unlink  (const char *path);
  218.  
  219.   /* These are in-line functions.  These prototypes just clean up
  220.      some syntax checks and code generation.
  221.    */
  222.  
  223. void  _Cdecl  __cli__    (void);
  224. void  _Cdecl  __sti__    (void);
  225. unsigned char _Cdecl __inportb__(int portid);
  226. void  _Cdecl  __outportb__  (int portid, unsigned char value);
  227. void  _Cdecl  __int__    (int interruptnum);
  228.  
  229. #define disable()  __cli__()    /* Clear interrupt flag */
  230. #define enable()  __sti__()    /* Set interrupt flag */
  231. #define inportb(portid) __inportb__(portid)  /* Byte IN instruction */
  232. #define outportb(portid, v) __outportb__(portid,v)/* Byte OUT instruction */
  233. #define geninterrupt(i) __int__(i)    /* Interrupt instruction */
  234.  
  235. /* some other compilers use inp, outp for inportb, outportb */
  236. #define inp(portid)  inportb(portid)
  237. #define outp(portid,v)  outportb(portid,v)
  238.  
  239. #if !__STDC__
  240. char far *cdecl getdta(void);
  241. void    cdecl setdta(char far *dta);
  242.  
  243. #define MK_FP(seg,ofs)  ((void far *) &#092;
  244.          (((unsigned long)(seg) &#60;&#60; 16) | (unsigned)(ofs)))
  245.  
  246. #define poke(a,b,c)  (*((int  far*)MK_FP((a),(b))) = (int)(c))
  247. #define pokeb(a,b,c)  (*((char far*)MK_FP((a),(b))) = (char)(c))
  248. #define peek(a,b)  (*((int  far*)MK_FP((a),(b))))
  249. #define peekb(a,b)  (*((char far*)MK_FP((a),(b))))
  250. #endif
  251.  
  252. #endif
  253. 
  254.  

Citar
2 C:\Dev-Cpp\DBM\SinNombre1.c In file included from SinNombre1.c
180 C:\Dev-Cpp\DBM\DOS.H syntax error before '*' token
211 C:\Dev-Cpp\DBM\DOS.H syntax error before '*' token
211 C:\Dev-Cpp\DBM\DOS.H `interrupt' declared as function returning a function
252 C:\Dev-Cpp\DBM\DOS.H stray '\26' in program
2 C:\Dev-Cpp\DBM\SinNombre1.c In file included from SinNombre1.c
252:2 C:\Dev-Cpp\DBM\DOS.H [Warning] no newline at end of file
 C:\Dev-Cpp\DBM\Makefile.win [Build Error]  [SinNombre1.o] Error 1

Eternal Idol

  • Moderador
  • ******
  • Mensajes: 4696
  • Nacionalidad: ar
    • Ver Perfil
Re: <dos.h>
« Respuesta #2 en: Lunes 10 de Diciembre de 2007, 08:09 »
0
Ese no es tu problema, solo podes usar ese modo en MS-DOS, usa un compilador para ese S.O. obsoleto.

Nacional y Popular En mi país la bandera de Eva es inmortal.


Queremos una Argentina socialmente justa, económicamente libre y  políticamente soberana.
¡Perón cumple, Evita dignifica!


La mano invisible del mercado me robo la billetera.