My solution in the emulator is to compute the ratio of
on/off over that
1/60th of a second and then use that to display an image of a lamp.
Actually, I go one better than that. I have a simple first order time
constant model of the lamp so that it doesn't go from 0->100% in 1/60th
of a second. new_intensity = K*old_intensity + (1-K)*new_duty_cycle.
Pick K to approximate the thermal inertia of the lamp.
Oh, to keep from having to compute a tally of all the lamps after each
instruction simulation cycle, I have an array of 256 counters for each
byte of address or data bus. So for a given byte, after each instruction
I just do: histo[byte_value]++. At the time it comes to display each
lamp, I look at all the buckets and figure out the average duty cycle
for each of the 8 lamps in the group.
A nice idea! But my VGA interface has only 3 bit... So I cannot display "soft"
lights.
Otherwise I would implement your approach, sounds good!
Philipp
--
http://www.hachti.de