Bug reporting for VICE

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
vicist
Vic 20 Afficionado
Posts: 352
Joined: Tue Oct 09, 2012 5:26 am
Location: Sheffield, UK

Bug reporting for VICE

Post by vicist »

I wanted to report that the rnd(0) function is not working in the latest builds of xvic (2.4.25-x86-r30683 and up) so I navigated to the webpage

https://sourceforge.net/p/vice-emu/bugs/

but I'm old and stupid and can't find a way to actually report it.

Any advice on how to do this would be appreciated.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Bug reporting for VICE

Post by Mike »

In any case you'd need to register at Sourceforge first.
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bug reporting for VICE

Post by groepaz »

and make sure to provide a testcase that is verified to work ok on a real machine :) and if you can, check earlier builds and tell the last one that worked...

edit: so far i tracked down the point where "something changes" to r29646 ... i cant verify the behaviour on real vic20 right now though... if this is the right spot, then either the powerup- or reset- values for some VIA registers are wrong (and basically it only worked by chance before....)

(is there a documented BASIC ROM listing online somewhere?)

edit^2: ok, rnd(0) does indeed put the VIA1 timers 1 and 2 into the seed - without them being ever initialized! that means the behaviour relies on the powerup/reset values. proper test program is needed :) i tried to come up with one a while ago: https://sourceforge.net/p/vice-emu/code ... _defaults/ - however for the timer values we still need convincing defaults (which we know should be different than 0 now....)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Bug reporting for VICE

Post by Mike »

groepaz wrote:(is there a documented BASIC ROM listing online somewhere?)
"VC-20 intern" is available in the F64 cloud. :)
edit^2: ok, rnd(0) does indeed put the VIA1 timers 1 and 2 into the seed - without them being ever initialized!
The relevant routine is located in $FDF9. There, indeed only VIA2 timer 1 gets proper latch values... $4826 for PAL, some other value for NTSC.

VIA1 timers 1 and 2 presumably start with $0000 in their latches on power-on. Especially timer 1 has good chances to just cycle between $0000 and $FFFF (it gets reloaded from the latch on underflow), while timer 2 is free-running (even if this is called "one-shot" that merely means it does one interrupt. It only reloads from its latch, when the underflow has been acknowledged by the CPU.

I'll check against real HW, but I can do this tomorrow evening earliest. Anyone else willing to settle this faster? vicist asked about this statement in direct mode:

Code: Select all

PRINT INT(RND(0)*100)+1
... which only seems to return 1 or 100 directly after power-on, without any other program loaded first.
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bug reporting for VICE

Post by groepaz »

i was curious enough to connect the vic20 and check... i used a program like this:

Code: Select all

5 x=0: rem timer reg
10 n=peek(37140+x):if n>m then m=n:print n
20 goto 10
it seems that the timers(and t1 latch) is initialized with $ff (instead of 0 - which it was initialized to before that). or to be more precise, for me the values look like this
T1LO: 0...255
T1HI: 0...223
T1LOLATCH: 191
T1HILATCH: 223
T2LO: 0...255
T2HI: 0...255
... also the value in T1HI/T1HILATCH changes slightly after each powercycle (tested a few times, it was always > 200 but never 255 for me - reason unknown :))

it would be interesting to see numbers from a few more real machines so we can see if that behaviour is deterministic or just random.

i updated r30703 accordingly - please test :)

edit: it would also be interesting what happens after RESET instead of poweron..... ie poke some other values to the timer, reset, and read it back - the datasheet says that timer latches will not get cleared, but you never know if that is true :) (cant test myself, still need to add a reset button to this vic20....)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
vicist
Vic 20 Afficionado
Posts: 352
Joined: Tue Oct 09, 2012 5:26 am
Location: Sheffield, UK

Re: Bug reporting for VICE

Post by vicist »

Wow - you guys work real fast! :shock:
Took me all afternoon tracking the bug to these versions:-

WinVICE-2.4.19.29634-x86 = working
WinVICE-2.4.20.29655-x86 = not working

Can't test anything until the nightly build appears on the website.
User avatar
tokra
Vic 20 Scientist
Posts: 1120
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Bug reporting for VICE

Post by tokra »

Ok, I tried the test-program on my VIC-20 PAL CR no expansion:

Cold Power on:
T1LO: 0...255
T1HI: 0...255
T1LOLATCH: 255
T1HILATCH: 255
T2LO: 0...255
T2HI: 0...255

Same values after power-cycle or reset
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bug reporting for VICE

Post by groepaz »

could you also please poweron, then poke 0 to all the registers, RESET, and then run the tests? that'll tell us if those registers are affected by reset or not
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
tokra
Vic 20 Scientist
Posts: 1120
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Bug reporting for VICE

Post by tokra »

Ok, I did so (fori=0to5:poke 37140+i,0:next) and resetted the machine. Then I typed in the test-program again, these are the results:

T1LO: 255
T1HI: 255
T1LOLATCH: 0
T1HILATCH: 0
T2LO: 255
T2HI: 255

The timers just pop out 255, so it looks like they are not running.
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Re: Bug reporting for VICE

Post by groepaz »

ok, that confirms what the datasheet says for RESET at least - and xvic is behaving correctly :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Post Reply