This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - the_mad_joob
Pages: 1 ... 7 8 [9] 10 11 ... 24
121
« on: May 17, 2014, 12:38:35 am »
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. I understood the clarification, but i wasn't sure about the "do they?". Thx =]
122
« on: May 16, 2014, 06:24:32 pm »
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. I'll post my program tomorow, but i'm not sure your TI-82stats.fr will like it Anyway, i just tested the keys of my 83+be. The shortest delay is 0. The longest is 6. The concerned keys are not the same as on my 84+se. It seems keyboards may differ... 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. 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 was thinking of something. What happens when you write to the port in the middle of a disabling job ? I mean, is the second OUT failing, or does the port stops what he was doing and follow the new instructions ? Some interesting questions...
123
« on: May 16, 2014, 11:50:12 am »
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.
Yeah, i really never figured out why myself... Next steps : > check the maximum possible delay at 6 Mhz > code a decent prog & find someone to test on another 84+se (to know if the fastest/slowest keys are the same, me curious) > find a trick to know when the keyboard has finished the enabling/disabling job, to avoid having to use a predefined delay > reformating post#1 into something more understandable
124
« on: May 16, 2014, 07:06:17 am »
Interesting... It seems that each key on the keyboard needs a specific time to be disabled.
old group map > new group map group,key=delay6mhz/delay15mhz 00000000>00000001 0,0=4/21 0,3=4/20 11111110>11111111 0,0=4/21 0,3=4/20 00000000>00010000 4,0=6/29 4,7=4/20 11101111>11111111 4,0=6/29 4,7=4/20 00000000>01000000 6,0=5/26 6,7=4/18 10111111>11111111 6,0=5/26 6,7=4/18 00000000>11111111 0,0=4/21 0,3=4/20 4,0=6/29 4,7=4/20 6,0=5/26 6,7=4/18
Such results prove that i was wrong about 2 things : 1) Key bits are NOT processed in a linear order during the disabling process (bit0, bit1, ..., bit7). Instead, it seems it is hardware specific (probably depends on the electric scheme). 2) Writing 1 over 1 does NOT take time. (post#1 updated)
It's getting clearer & clearer. Now, i'm curious to find which key needs the longest time to be disabled =P
EDIT :
Tested all keys. It's official, the key that takes the longest time to be disabled is [5] : 7 cycles at 6 Mhz & 31 cycles at 15 Mhz. That's very funny, cause that totally explains why that was the only key that could break my loop (see one of my previous posts) =] The fastest is [ALPHA], with 4 cycles at 6 Mhz and 16 cycles at 15 Mhz. So, i think it's safe enough to use 8 cycles at 6 Mhz, and 32 at 15 Mhz. But again, such delays are only safe when checking one key at once !
125
« on: May 15, 2014, 01:27:48 pm »
@Matrefeytontias : You should wait a little, cause some values would need to be more accurate.
#####
Some new discoveries =] > My intuition was right, it seems the time the port needs to do a disabling is not the same for each group (looks like bits are processed in a a linear way). Group bit 0 is the fastest to set, whereas group bit 7 is the longest. Example : 00000010 > 00000011 : 23 cycles needed 00000010 > 01000010 : 27 cycles needed > I was wrong when i said that writing a 1 over a 1 is instantaneous. Looks like it takes around 1/4 cycles per group at 15 Mhz. > I updated post 1 with all that juicy stuff =] > I'm trying to think of a way to know when the group map has been totally updated...
126
« on: May 15, 2014, 09:05:29 am »
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.
Neither did i =] I re-checked it, and it appears all keys corresponding to key bit 2 at once could break the loop, but after a few loop iterations. So, i had to let the loop run with a heavy thing on all keys for long enough, overlol. New world record : 123 cycles (tested with cpu speeds 1,2,3).
127
« on: May 15, 2014, 05:18:46 am »
Wow pretty impressive research job, I'm sure this will be useful !
Thx =] Well, the discovery could be at least useful in some unusual circumstances. Like, for example, if you need to add some new group(s) in your scan, without disabling the previous ones, you don't need a delay. Also, we now know that when you send 0 to port 1 (code checking for any key pressed, etc)., you can read directly without waiting =] Here is the piece of code i'm testing (interrupts disabled ofc) : xor a loop 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 As you can see, i ask the port to disable all groups, to see the maximum needed delay. It seems that 29 cycles isn't enough (tested @ 15Mhz). Even more fun, only the [5] key can exit that loop, don't ask me why EDIT 1 : I suspect it's because the group including [5] is in the middle of the disabling process, when the IN instruction occurs. EDIT 2 : @ 30 cycles, no single key can exit the loop. However, 2 keys from different groups can Seems like the only way to know the real maximum delay is to hold absolutely all keys at once. Checking that right away... EDIT 3 : @ 66 cycles, 4 keys from different groups can exit the loop... @ 88 cycles, 5 keys... @ 96 cycles : 6... LAST EDIT FOR THAT POST : 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 is huge. Anyway, my second theory was right : the more groups the port has to disable, the longer it takes.
128
« on: May 15, 2014, 04:34:23 am »
At first, i was kinda curious to know why sending $FF would remove the necessity to wait for a delay between writing & reading. I couldn't believe that sending that was processed somehow differently than sending anything else. After many boring tests, here is what i discovered :
> About sending $FF :
Sending that to port 1 was called a "reset" by some. It is true in the fact that it disables the scanning of all groups. But, i can confirm that it doesn't have any additional effects. I mean, sending $FF has the exact same effect as sending $7F (the unused group). It just disables all groups, and is interpreted by port 1 like any other sending.
> About the (famous) needed delay :
Whenever you need to check specific keys (IN), you sometimes have to send one or more group map(s) first (OUT), to be sure that the key presses will be detected. Sometimes, a delay is needed between OUT & IN, sometimes not. First, you have to understand that the port always remember the last group map you have sent to him. We'll call it the current group map. If you really want to optimize your code, you'd better know what the current group map is, each time you intend to update it. In other words, each time you use an OUT, it's better to know what you last sended to the port with the previous OUT. When you update the current group map, here is how it works :
1) You write a 0 to a group bit. Technically, it can be : - sending a 0 over a 0 : It has no effect on the concerned group. > No delay is required before reading keys in that group. - sending a 0 over a 1 : You actually ask the port to enable a group. Fortunately, it is done almost instantly. > No delay is required before reading keys in that group. In other words, if you don't disable any group(s), you're free to use a IN right after a OUT without fear, even at 15Mhz.
2) You write a 1 to a group bit. Technically, it can be : - sending a 1 over a 1 : It has no effect on the concerned group. > No delay is required cause all the keys in that group should already be disabled. - sending a 1 over a 0 : You actually ask the port to disable a group. > A variable delay is required before all the keys in that group are disabled. Disabling a group actually means that you don't need to check keys in it anymore. However, if some of those keys are pressed when you read the port, and are not disabled yet, they will return a zero bit if pressed, even if you think you are reading another (enabled) group. So, basically, if you don't care if the keys in a disabled group are pressed or not, you don't need to wait. But, if you want to be 100% sure that all the keys in that group have been disabled, continue reading. When you disable a group, the keys in it are not disabled simultaneously. Actually, some take more time than others. Here is what i gathered : - Disabling only one group : Strangely, the more keys are being pressed during the disabling process, the faster it is. The slowest scenario is when only one key is pressed. The highest needed delays measured were 7 cycles at 6 Mhz, and 31 at 15 Mhz (Using 8 & 32 would be safe enough.). - Disabling multiple groups : The delay can go pretty high. The slowest scenario is when you disable the entire keyboard (changing the group map from %00000000 to %11111111). In that case, The delays measured were 46 cycles at 6 Mhz, and 125 at 15 Mhz (Using 48 & 128 would be safe enough.). According to several tests, what makes that delay so high is that many keys of the same key bit are being pressed at the same time (The keyboard needs a huge time to disable those.).
> Note :
The way i made my tests, all delays refer to the needed cycles between a OUT (1),A line and a IN A,(1) line. Those values were all obtained by checking pressed keys. Due to how the keyboard works, the real time it needs to enable|disable unpressed key(s) remains unknown...
129
« on: May 13, 2014, 07:48:28 pm »
Yes xedy, reading multiple groups at the same time should be done, when possible =]
I'm very curious about something. Like i said earlier, we basically have these 2 behaviours :
write delay read
or
reset delay write read
The question is, why doing a reset removes the delay needed bewteen a write & a read ? Hardware-speaking, i have no ideas how the keyboard really works, but i have a theory that could explain that. What if :
Case 1 : The writing causes one or more group(s) to be disabled (one or more bit(s) in the group map changes from 0 to 1). > slow operation for the keybord, delay required before reading That is the case when you switch from one group to another, for example.
Case 2 : All other cases (enabling groups or not modifying them) > very fast operation, no delay That is the case when you write anything after having performed a reset, but also when you enable some more groups without disabling the previous ones.
I will try to verify that asap...
#####
EDIT 1 :
Ok, just tested it, and it doesn't work like that. However, i found something strange. Here is the code i used :
di
ld a,1 out ($20),a ; 15Mhz
ld a,00000010b out (1),a ; enabling all groups except the one including [CLEAR]
ld b,0 loop1 djnz loop1
loop2
ld a,11111101b out (1),a ; enabling group including [CLEAR]
in a,(1) cp 10111111b ; checking if [CLEAR] being pressed jr nz,loop2 As you can see, there is no delay before i read port 1. Guess what ? PC actually exits the loop instantly when i press [CLEAR]. Any idea why ?
#####
EDIT 2 : found out : loop2 starts, OUT done, IN skipped, jump, OUT skipped, IN done, exit Not what i wanted to find, but anyway, it seems a delay is also needed between reading & writing...
#####
EDIT 3 : Did some more tests. It seems my initial theory was half-right. I decided to create a dedicated topic about it.
130
« on: May 12, 2014, 11:17:11 am »
Still about the keyboard :
I finally found a little something. The challenge was to find a way to know if the current group has been updated (similar to reading bit 7 of port $10 for the LCD). It seems impossible, since reading port 1 doesn't actually give any infos about that. But, fortunately, there is a way to know if : the group has been updated AND a key is being pressed on that group. I believe it is compatible with all possible hardware types, for all CPU speeds. There you go :
LD A,$FF OUT (1),A LD BC,$??01 < ?? = group to be checked LOOP OUT (C),B < using C to make the loop faster IN A,(1) INC A JR Z,LOOP < JP maybe better, not sure... < group updated & key(s) pressed DEC A < A holds the key map for the desired group, safe to check it.
Of course, that is the safe way, not necessarily the fastest.
/e : just corrected it
/e2 : realised that it only allows to test one group at once =/
131
« on: May 12, 2014, 08:53:50 am »
40 is very generous, indeed =]
Anyway, there seems to be 2 methods : - no reset : delay required between setting group and reading it - reset : delay required between resetting and setting the group (delays a lot shorter, but you have to spend some cycles to actually do the reset)
I'm currently thinking of a safe way to know if the current group has been updated or not. Maybe it's possible by using a trick, involving the blank group $7F...
132
« on: May 12, 2014, 06:53:54 am »
Allright, since i was curious about it, i did some tests, but this time, resetting the port first. When you do that, i can confirm that no delay is needed bewteen sending the group and reading the key. However, a delay is now needed between resetting the port and sending the group.
A bit more visual explanation : LD A,$FF OUT (1),A < resetting the port ... < that is where i mesured how many cycles are needed before writing to the port again (likely to include an instruction to actually load the group to be monitored in A) OUT (1),A < sending the group (no delay needed here) IN (1),A < reading the keys
I only tested my 84+se for now, but it is a good reference (had the longest possible delays in my previous tests). That is what i got : cpu speed 0 > 4 cycles needed (maybe less, but that is the minimum cycles you need to load your group in A anyway) cpu speed 1,2,3 > 17 cycles needed
That is interesting, cause it could imply that writing to port 1 is faster than reading from it.
When i have time, i'll check if the delays are similar when using the C register for input/output...
EDIT :
When using the C register for input/output (as expected) : cpu speed 0 > 4 cycles cpu speed 1,2,3 > 16 cycles (one less than on the previous test, but that is probably because in/out operations take 1 more cycle)
134
« on: May 11, 2014, 06:28:04 pm »
Hmm... there's something i don't get, then. If left is pressed, (1) will return $FD. $FD and $FD = $FD, right ? So, why checking if if the result is zero before calling ? Can somebody tell me where i missunderstand it ?
And about the CSE delays, yes, i remember you were surprised when my code returned those results. Maybe i f***ed up somewhere in it...
135
« on: May 11, 2014, 04:45:28 pm »
About that : http://wikiti.brandonw.net/index.php?title=83Plus:Ports:01In the example, a "xor" must be used, not an "and". Also, a little paragraph about delays between writing & reading could be necessary, don't you think ? For what we had tested, maximum cycles was 6 in cpu speed 0, and 29 in any other (about a dozen models tested). The cse has longer delays, but we were only able to test one calc.
Pages: 1 ... 7 8 [9] 10 11 ... 24
|