Re: [cc65] two little bugs

From: Groepaz <groepaz1gmx.net>
Date: 2009-08-24 23:37:10
On Montag 24 August 2009, Ullrich von Bassewitz wrote:
> On Mon, Aug 24, 2009 at 12:00:13PM -0400, Greg King wrote:
> > A hardware-reset stops all of the timers in the CIA chip.  After that,
> > the Time-Of-Day clock will not run until you have written a time into it.
> >  The firmware does not write into those registers.  [Even though BASIC's
> > rnd(0) reads some of  those registers in CIA1 -- see the entry for
> > location 57495 in the "MAPPING THE Commodore 64" book.]
>
> I cannot find anything about that in the data sheet. Yes, the timer control
> registers are set to zero on reset, which means that both timers are halted
> - but there is no start/stop bit for the TOD clock.
>
> Has anybody tried the test program with another VICE version? I'm still
> wondering if it's a cc65 related problem or not. A more current version of
> vice is unavailable for Centos, so I would need to create one myself. After
> installing 54 development packages, an opencbm rpm was not found, so I
> would have to create this one beforehand, and that was the point where I
> stopped :-)

this works just fine for me: (yeah its ugly, and i am using CIA2, but it 
shouldnt make a difference)

void _init_systime (void)
{

	*(uint8_t*)0xdd0e=0x80;
	*(uint8_t*)0xdd0f=0;
	
	*(uint8_t*)0xdd0b=0; // hours
	*(uint8_t*)0xdd0a=0; // minutes
	*(uint8_t*)0xdd09=0; // seconds
	*(uint8_t*)0xdd08=0; // 1/10 seconds

}
	
time_t _systime (void)
{
	time_t t=0;
	uint8_t n;

	n=*(uint8_t*)0xdd0b; // hours
	t+=(n&0xf);
	t+=((n>>4)&0x1)*10;
	t*=60;
	n=*(uint8_t*)0xdd0a; // minutes
	t+=(n&0xf);
	t+=((n>>4)&0xf)*10;
	t*=60;
	n=*(uint8_t*)0xdd09; // seconds
	t+=(n&0xf);
	t+=((n>>4)&0xf)*10;
	n=*(uint8_t*)0xdd08; // 1/10 seconds
	return t;
}

-- 

http://www.hitmen-console.org    http://magicdisk.untergrund.net
http://www.pokefinder.org        http://ftp.pokefinder.org

Ich bin nicht faul.... ich hab nur keine Lust.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Aug 24 23:36:05 2009

This archive was generated by hypermail 2.1.8 : 2009-08-24 23:36:06 CEST