public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
* clock.c/bcc bug
@ 2002-12-06 10:15 jb1
  2002-12-09  1:01 ` ELKS questions Dan Olson
  2002-12-19 23:53 ` Tandy 1000 and IBM PS/2 Dan Olson
  0 siblings, 2 replies; 3+ messages in thread
From: jb1 @ 2002-12-06 10:15 UTC (permalink / raw)
  To: linux-8086

What appears to be a bug in elkscmd/sys_utils/clock.c is probably a bug in 
bcc's parser for #asm/#endasm blocks.

The original clock program does not display the CMOS real-time-clock
correctly. Although the update-in-progress seems to be detected correctly,
each of the time/date registers appears to return the value in the
"seconds" register.

I found that at least "clock", "clock -r" and "clock -s" work correctly if
a semicolon is placed on the line immediately preceding the first "#asm"
or the line immediately following the first "#endasm" in the cmos_read()
function. For example:

unsigned char cmos_read(reg)
unsigned char reg;
{
  register unsigned char ret;
; /* <------------- Null-statement workaround for bcc (?) bug -- jb1 */
#asm
  cli
#endasm
  outb (reg | 0x80, 0x70);
 ...

As far as I know, such a null statement should generate no code, yet the 
filesize is increased from 7528 to 7544 bytes.

While this workaround seems to have fixed clock.c, there are probably 
other programs that compile incorrectly!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-19 23:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-06 10:15 clock.c/bcc bug jb1
2002-12-09  1:01 ` ELKS questions Dan Olson
2002-12-19 23:53 ` Tandy 1000 and IBM PS/2 Dan Olson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox