0 Members and 1 Guest are viewing this topic.
Wow pretty impressive research job, I'm sure this will be useful !
xor aloop out (1),a ; all groups enabled dec a out (1),a ; asking to disable all groups; delay needed here in a,(1) inc a jr z,loop
All set bits will disable the corresponding groups, but it will take some time (the famous delay).Note that when you ask the keyboard to disable a group that is already disabled, it will do nothing (no delay).So, basically, the keyboard only needs a delay when changing a group bit from 0 to 1.
It appears that when you enable all groups, and then ask the port to disable them, my calc needs exactly 121 cycles to perform a full disabling, in cpu speed 1.In other words, that's the time the keyboard needs to switch all 8 groups from 0 to 1.That's about 16 cycles per group, which is huge.Anyway, my second theory was right : the more groups the port has to disable, the longer it takes.
Whoa, that I did not expect. I'll definitely want to play with that myself on hardware. Maybe that could explain the rare occurrences I still hear about of mis-registered keypresses in Axe, as the getKey(0) command reads from all groups to check if any key is pressed and might be causing issues for any subsequent single key read attempt.
Whoa nice. Only weird thing is that it looks like it takes 4 times more cycles for 15-16MHz but it's not even 3 times the speed.
Quote from: Streetwalrus on May 16, 2014, 10:24:50 amWhoa nice. Only weird thing is that it looks like it takes 4 times more cycles for 15-16MHz but it's not even 3 times the speed. Yeah, i really never figured out why myself...
I have an 83+SE, a 128k 84+ and a TI-82stats.fr (TI 83 rom on 83+BE hw) that I can test for you.
Your delay figures don't count the amount of cycles spent in the out/in instructions, do they? I believe that could account for the discrepancy you're seeing. It may not add exactly 11 cycles of delay though, as a physical port write might not happen after the same amount of time/cycles relative to the start of the instruction as a physical port read.
Quote from: Runer112 on May 16, 2014, 01:10:17 pmYour delay figures don't count the amount of cycles spent in the out/in instructions, do they? I believe that could account for the discrepancy you're seeing. It may not add exactly 11 cycles of delay though, as a physical port write might not happen after the same amount of time/cycles relative to the start of the instruction as a physical port read.All my tests were made using OUT (1),A and IN A,(1), without including any cycles spended by the instructions themselves.Mainly because i think it's easier for the programmer to just know how much delay he has to put between the two lines.From what i've tested, the delays are about the same when using the C register (delay-1 or so...).
I understand that you don't count the cycles spent in the in/out instructions for simplicity purposes. I just wanted to clarify why the 6MHz and 15MHz delays you recorded are not in a ratio of 6:15.