| delorie.com/archives/browse.cgi | search |
| From: | "pwillard" <pwillard AT mindspring DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| References: | <8cg55n$1kl$1 AT mailint03 DOT im DOT hou DOT compaq DOT com> <200004061524 DOT UAA01453 AT midpec DOT com> <sB7H4.2784$x62 DOT 8311 AT typhoon DOT southeast DOT rr DOT com> <8cj7cu$6fskm$1 AT fu-berlin DOT de> |
| Subject: | Re: How to get bios timer tick count? |
| Lines: | 39 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2615.200 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2615.200 |
| Message-ID: | <acuH4.4040$x62.15925@typhoon.southeast.rr.com> |
| Date: | Fri, 07 Apr 2000 23:30:14 GMT |
| NNTP-Posting-Host: | 24.31.125.207 |
| X-Complaints-To: | abuse AT mediaone DOT net |
| X-Trace: | typhoon.southeast.rr.com 955150214 24.31.125.207 (Fri, 07 Apr 2000 19:30:14 EDT) |
| NNTP-Posting-Date: | Fri, 07 Apr 2000 19:30:14 EDT |
| Organization: | MediaOne - Atlanta |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Got it, thanks...
Dieter Buerssner <buers AT gmx DOT de> wrote in message
news:8cj7cu$6fskm$1 AT fu-berlin DOT de...
> [There is bad line wrapping in the C++ style comment I cite]
>
> pwillard AT mindspring DOT com (pwillard) wrote:
>
> >#include <sys\farptr.h>
> >#include <go32.h>
> >
> >int main (void)
> > {
> > long int x;
>
> I would suggest, to make x an unsigned long.
>
> >
> > // Ok, the formula for accessing DOS memory using
> >the_go32_conventional_mem_selector()
> > // command is segment * 16 + offset, so we need to access 0x40 * 0x10
> >+0x6c
> > // This assumes the first argument in PTR in pascal is segment and
> >thelatter offset.
> >
> > x = _farpeekl(_go32_conventional_mem_selector(), 0x40 * 0x10 + 0x6C);
> >
> > printf("The BIOS tick count is %d.", x);
>
> The %d is wrong for long int. Use %ld instead (or %lu if you make
> x unsigned long). Yes, I do know, that %d will work with DJGPP, but
> more by accident, than by design.
>
> > }
>
> -- Regards, Dieter
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |