Omnimaga
Calculator Community => TI Calculators => ASM => Topic started by: SirCmpwn on November 09, 2010, 08:04:16 pm
-
I pull up WikiTI for information about memory mappings.
I go to the 83+ Family Ports page.
I notice that 4D-5B are documented.
DOUBLE-TAKE!
I look through them. Not knowing much about USB, I don't know how much we can do with that information. However, I want to know how it was obtained, and what we can do with it. FloppusMaximus edited it last.
-
WikiTI is magic :o
EDIT: But anyway, /me wonders too
-
That information has been known for a long time. But I think this is the first time anyone has put it into formal writing. There is the old talk page (http://wikiti.brandonw.net/index.php?title=83Plus:OS:84_Plus_USB_Information) but that is mostly just guesses. Really, the only place to get hard information about USB is to look at the source from USB8X, but even that is old (2005 I think).
I guess the only way to have up to date information is to be BrandonW. ;)
-
I think it would be nice if when someone discovers a new trick and ensures that it actually works that he adds it to WikiTI or get someone to add it, so the info is not forgotten by people after a while. WikiTI is one amazing source of info for ASM learning.
-
I totally agree. Personally I have no idea how low level USB works. The only clues I've ever gotten are from looking at USB8X.
In addition, there is virtually no information on using hooks I remember the way I learned how to use them was actually by seeing examples posted in forums. Flash is also completely undocumented (but perhaps that's a good thing.)
-
I wish that TI would just give us their documentation. I have heard that there is a single document they are withholding from us that details everything we need to know. And we know how to access Flash, it's totally documented. I can't remember where I got it, but I have the full spec sheet on my hard drive.
-
I actually asked for that once. They said that they requested it.
-
The flash docs, or the usb docs?
-
All of the above. And the hardware for the calcs.
-
If you get ahold of those usb specs, you should post them somewhere. They would be immensely valuable to anyone developing a 3rd party OS. I really don't want to think of creative ways of stealing TI's code without actually stealing it (which I have thought of several ways).
-
still haven't got it. Doubt I will. I'm trying to figure out a "sure-fire" way to do usb though. Let's see, given my current schedule, and assuming my teachers decide not to give me many super-hard projects over the break, I can try around Christmas to test a bunch of theories.
-
Well, we know almost nothing about those ports. We pretty much have to use TI's routines, which I can't steal and put in KnightOS unless I'm clever about it. With the information we have, I could probably manage unit-to-unit file transfers, but for advanced stuff like unit-to-PC and peripherals such as flash drives we need more documentation.
-
Aren't a lot of the usb routines contained in the second boot page? You might be able to access them from KnightOS.
-
That's a hack I'm considering.
-
Oh, and the stuff like flash drive access can be figured out by looking at USB8X source code I'd think. There certainly isn't any code for that in TI-OS.
-
Wait a minute, can I access the second boot page? I can practically read hex...
-
Yeah, I have the USB8X source code lying around, but it depends heavily on TIOS routines. I would also probably write most of that stuff from the ground up, considering that it has no support for hubs, and is a bit outdated.
-
Oh, yeah, I was starting to write up documentation of the USB ports at one point. Then I got distracted by something else. That seems to happen a lot.
Yeah, I have the USB8X source code lying around, but it depends heavily on TIOS routines. I would also probably write most of that stuff from the ground up, considering that it has no support for hubs, and is a bit outdated.
USB8x doesn't actually use the OS routines for very much - there's not very much interesting stuff the OS routines can do. The main thing USB8x relies on the OS for is USB interrupt handling, and that's because there isn't any other choice if you're going to use IM 1. (But that should be pretty easy to re-implement yourself if you want to.)
It does have some basic hub support - if a hub is connected, AutoSetup will turn on the ports one by one and try to connect to the first non-hub device it finds. I'm not sure how much more is physically possible, as I'm not sure that there's any way to talk to, or listen to, more than one peripheral device at a time. But I haven't tested anything to do with hubs myself.
Well, we know almost nothing about those ports. We pretty much have to use TI's routines, which I can't steal and put in KnightOS unless I'm clever about it. With the information we have, I could probably manage unit-to-unit file transfers, but for advanced stuff like unit-to-PC and peripherals such as flash drives we need more documentation.
Which ports are we talking about here?
And talking to a PC is easier than talking to another calculator: in the former case you only have to deal with peripheral mode, whereas in the latter case you need both host and peripheral modes. And maybe SRP and HNP.
-
Ports are most of the USB ports, if WikiTI is anything to go from. As for USB8x, I'll have to look deeper into it, thanks for the heads up!
Talking to another calculator looks absurdly easy - port 4D looks like it could be used in a similar manner as the I/O port.
-
Oh, I see. You mean going around behind the USB controller's back, as it were, and controlling the data lines individually. I don't know if that's even possible - as far as I know, the set of low-level operations that the CPU can control is pretty limited.
And it wouldn't be compatible with the OS or with standard USB devices, and you'd be relying on the least-well-understood parts of the hardware, and it would be much slower than using the USB protocol, but who knows? Maybe it's worth a try. I suspect that using the USB protocol would be easier and more rewarding, though.
-
Would you look at that (http://wikiti.brandonw.net/index.php?title=83Plus:OS:Hooks). Someone made a hooks page.
Since it is a wiki, feel free to fix any mistakes I made.
(This marks the first time that I linked the word "that")
-
After seeing USB and hooks documentation added (I could have wrote the hooks page if I had that idea earlier, fortunately someone had the idea) I added some interesting stuff and updated some things... Looking at WikiTI with fresh eyes again makes occur some ideas to add.
-
Great wiki, never had heard 'bout it until now, looks promising :D
-
Would you look at that (http://wikiti.brandonw.net/index.php?title=83Plus:OS:Hooks). Someone made a hooks page.
Since it is a wiki, feel free to fix any mistakes I made.
(This marks the first time that I linked the word "that")
Nice. I love wikis :D
-
I'll be adding lots of pages to this when I can, I searched for lots of stuff that wasn't there, so the COMMMUNITY has to add a lot :) And I will help :D
-
That's great to hear. WikiTI is a great resource already, but there's so much more stuff that could be documented. It's a shame that it's been inactive lately. I'll try to do my part.
-
That's great to hear. WikiTI is a great resource already, but there's so much more stuff that could be documented. It's a shame that it's been inactive lately. I'll try to do my part.
If you edit the to do list with what could be documented and it is on my reach I would start the documentation.
-
One day I really should enhance the TI community history part of the site, such as individual teams, and maybe have an article talking about which forum were active over the year and the major releases and events.
-
It's great that every day I come back to WikiTI and find more and more USB documentation. Thanks guys!
-
Yeah it's cool that every single bit of USB stuff people know is being put together in one place. I am wondering if this wiki could explain the drastic increase in ASM program quality over the last few years? It has been around for 4 years, but back then it often got hacked or spammed by bots so people avoided it. Now it's solved and it seems to get more popular.
-
Yeah it's cool that every single bit of USB stuff people know is being put together in one place. I am wondering if this wiki could explain the drastic increase in ASM program quality over the last few years? It has been around for 4 years, but back then it often got hacked or spammed by bots so people avoided it. Now it's solved and it seems to get more popular.
Well, my problem is that I'm not a fan of the link:
http://wikiti.brandonw.net/index.php?title=WikiTI_Home (http://wikiti.brandonw.net/index.php?title=WikiTI_Home)
I think you could have a domain for it only, instead of 'hosting' it in brandonw.net.
Make a poll with it to know what people want :S
-
The original WikiTI was dying, and BrandonW picked it up and hosted it himself before it completely crashed and burned.
-
Yeah it's cool that every single bit of USB stuff people know is being put together in one place. I am wondering if this wiki could explain the drastic increase in ASM program quality over the last few years? It has been around for 4 years, but back then it often got hacked or spammed by bots so people avoided it. Now it's solved and it seems to get more popular.
Well, my problem is that I'm not a fan of the link:
http://wikiti.brandonw.net/index.php?title=WikiTI_Home (http://wikiti.brandonw.net/index.php?title=WikiTI_Home)
I think you could have a domain for it only, instead of 'hosting' it in brandonw.net.
Make a poll with it to know what people want :S
The link to the Wiki front page is http://wikiti.brandonw.net/ , not http://wikiti.brandonw.net/index.php?title=WikiTI_Home . It will change to the last link after typing the first, but still remains the fact you can access it from the shorter link in the first place.
A domain name costs money. It's very cheap, but life problems can happen and he's already paying for other domain names (such as BrandonW.net). If BrandonW ever lost his job for any reason and had extreme financial issues, then bye bye to the two domain names. Plus, the Wiki sub-domain http://wikiti.brandonw.net isn't that bad as a URL. It could have been worse, like http://s221544699.onlinehome.us/djomnisongs/ . I think it is fine where it is, now. At least it's online, that's what counts.
I think you should maybe contribute more to the community instead of always complaining about everything. BrandonW is doing a great job in the community. Maybe offer to buy a domain name yourself for BrandonW?
-
It is very well hosted under brandonw domain. ;)
I am wondering if this wiki could explain the drastic increase in ASM program quality over the last few years? It has been around for 4 years, but back then it often got hacked or spammed by bots so people avoided it. Now it's solved and it seems to get more popular.
I have no idea how much people visit WikiTI except the regulars in the community that visit it occasionally to see updates and update links to their projects.
But I have seen a programmer to create an account in WikiTI for starting develop for a z80.
When I saw a lot of changes in wiki I started to contribute again too recently. I hope it continues. :)
I can write something if it is on my reach if you request it and even better add ideas to http://wikiti.brandonw.net/index.php?title=To_Do_List .
EDIT: don't forget Hackspire is already a good wiki about Nspire. (it has ports documented, some hardware)
-
I use WikiTI a ton when working on z80 calcs. A lot of KnightOS comes from WikiTI.
-
I use WikiTI a ton when working on z80 calcs. A lot of KnightOS comes from WikiTI.
I saw the threads of documentation on programming OSes for z80 and I started the topic in WikiTI. It makes sense to unite everything now in there.
Do you mind to heavily rely on code you posted on forums? I ask mainly for having complete peace of mind but I know you posted for others to use, so it is not an issue in principle. As always I fully acknowledge work of others. ;)
Here's the link http://wikiti.brandonw.net/index.php?title=Programming_an_OS_for_z80_calculators
-
I use a little code posted on it, but I use it mostly for port documentation in KnightOS.
-
Yeah it's cool that every single bit of USB stuff people know is being put together in one place. I am wondering if this wiki could explain the drastic increase in ASM program quality over the last few years? It has been around for 4 years, but back then it often got hacked or spammed by bots so people avoided it. Now it's solved and it seems to get more popular.
Well, my problem is that I'm not a fan of the link:
http://wikiti.brandonw.net/index.php?title=WikiTI_Home (http://wikiti.brandonw.net/index.php?title=WikiTI_Home)
I think you could have a domain for it only, instead of 'hosting' it in brandonw.net.
Make a poll with it to know what people want :S
The link to the Wiki front page is http://wikiti.brandonw.net/ , not http://wikiti.brandonw.net/index.php?title=WikiTI_Home . It will change to the last link after typing the first, but still remains the fact you can access it from the shorter link in the first place.
A domain name costs money. It's very cheap, but life problems can happen and he's already paying for other domain names (such as BrandonW.net). If BrandonW ever lost his job for any reason and had extreme financial issues, then bye bye to the two domain names. Plus, the Wiki sub-domain http://wikiti.brandonw.net isn't that bad as a URL. It could have been worse, like http://s221544699.onlinehome.us/djomnisongs/ . I think it is fine where it is, now. At least it's online, that's what counts.
I think you should maybe contribute more to the community instead of always complaining about everything. BrandonW is doing a great job in the community. Maybe offer to buy a domain name yourself for BrandonW?
I know it is tiwiki.brandown.net, and that's what I meant to say, sorry.
However, I suggest a free domain, sth like
www.wikiti.co.cc
Want me to get this one and to redirect to wikiti.brandonw.net. Agree?
-
I still think it's fine as it is now. Anyway if you absolutely want to use a sub-domain, you may have to ask permission to BrandonW first.
-
I still think it's fine as it is now. Anyway if you absolutely want to use a sub-domain, you may have to ask permission to BrandonW first.
Yeah of course, I await his response
-
I actually prefer wikiti.brandonw.net. I use it every day and it's not like its hard to remember. It's just brandonW's site with wikiti in front of it. I like having brandonw.net instead of co.cc because brandonw.net actually means something, whereas co.cc doesn't.
That's just my opinion, I vote for keeping the original.
-
Yeah that's another good point. :P
-
I already contributed DJ, anyways, i didn't like this:
I think you should maybe contribute more to the community instead of always complaining about everything. BrandonW is doing a great job in the community. Maybe offer to buy a domain name yourself for BrandonW?
:s
-
Well the issue is that you always criticise everything negatively so when I posted this I was quite pissed. By contributions I mean constructive comments, project updates and tutorials.
-
Well the issue is that you always criticise everything negatively so when I posted this I was quite pissed. By contributions I mean constructive comments, project updates and tutorials.
I know, i usually 'recommend' (this is the exact word I use) people updates.
Anyways, this is not the thread for that
-
/me hopes there won't be a flame war between DJ and scoutdavid... :(
also scoutdavid: advice, NEVER tell an admin what to post in a thread in their forums, I learned the hard way many years ago...
-
/me hopes there won't be a flame war between DJ and scoutdavid... :(
also scoutdavid: advice, NEVER tell an admin what to post in a thread in their forums, I learned the hard way many years ago...
Mh... This is so totally right, from my point of view, the thread concerning the fantastic game My First Quantum Translocator isn't the adequate post to discuss my personality. If you don't think so, I respect your opinion. If you agree with me, then great!
-
/me hopes there won't be a flame war between DJ and scoutdavid... :(
Nah, if that ever happens, there will most likely not be time for one to start anyway, plus it's not just me anyway, seeing a certain hidden sub-forum.
Anyway I think it might be best to go back on-topic now. If BrandonW wishes, he can create a domain name or let you create one.
-
I never really used wikiTI, but I looked at it once or twice. Not really complete enough for my uses at the time I looked.
That was a long time ago though
/me hopes there won't be a flame war between DJ and scoutdavid... :(
also scoutdavid: advice, NEVER tell an admin what to post in a thread in their forums, I learned the hard way many years ago...
Mh... This is so totally right, from my point of view, the thread concerning the truly most non heinous game Pyyrix's Most Excellent Adventure isn't the adequate post to discuss my personality. If you don't think so, I respect your opinion. If you agree with me, then great!
Fixed in Bill and Ted language ;)
-
Oh it grew quite a bit. Of course it's best if you also use ASM in 28 days and such tutorial, since WikiTI is more a compilation of documentation about the z80 calcs rather than tutorials on how to program z80 assembly, but it sure contains a lot of important information nonetheless. It can even be useful to Axe programmers.
-
ooo, I just looked at the site again. Looks much better now, missing a few articles but very complete indeed.
-
ooo, I just looked at the site again. Looks much better now, missing a few articles but very complete indeed.
I would like to create content, but dunno what, so...
Maybe create a page for some games, like the:
truly most non heinous game Pyyrix's Most Excellent Adventure
and maybe Impossible Game, I don't know. It would be cool actually
-
Just make sure to not add pretty much every kind of game, though. I am sure if someone added his latest quadratic solver, it would be removed. It's mostly for programs that appears on http://www.ticalc.org/archives/files/featured.html or stuff by BrandonW, ExtendeD, etc, that revolutionarized the community (Nspire jailbreaking, breaking TI protections, jailbreaking a PS3 with a calculator) or stuff like that.
-
Back to the subject of the USB hardware, I've added my documentation for port 91h. It's quite complicated, so I'd very much appreciate any comments or criticism, if there's anything that's unclear. Of course, a lot of the complexity is just because USB itself is horribly complex. But I'd still like to make the documentation as accessible as possible.
I think maybe what we need is, in addition to the detailed port documentation, a nice overview or tutorial to the USB system as a whole. I'd volunteer to write this myself, but, sadly, I doubt I'll have time to do it in the near future. If somebody else wanted to get started, I could probably help fill in some of the details.
-
I still haven't gotten around to learning how USB works. I'll probably look into it on the flight home.
-
On an off-topic note, how's the trip to Japan so far? ;D
-
Great, thanks! I'm in Tokyo at the moment, posting on my phone in the subway.
-
Ah cool to hear. I hope I can travel far one day :D
-
Come visit Colorado Springs sometime!
-
That would be an idea ^^
I would need to seek for a certain blue lobster to defend myself in case, though.
-
Returning to WikiTI:
This topic is inside the Assembly Programming Forum... WikiTI is for Assembly only?
I'm quite confused now, since I made Axe Parser's page :S
-
Wikiti is more or less describing the calculator os and ports and such, so it is basically asm. It's not really an asm tutorial, but more of a reference. So i don't see why something about axr should be put in there, unless it's talking about commands or something. Ask brandonw about it, he would know.
-
Wikiti is more or less describing the calculator os and ports and such, so it is basically asm. It's not really an asm tutorial, but more of a reference. So i don't see why something about axr should be put in there, unless it's talking about commands or something. Ask brandonw about it, he would know.
Then, this could be moved to a wider calculator forum in Omnimaga, I think :S
-
Wikiti is more or less describing the calculator os and ports and such, so it is basically asm. It's not really an asm tutorial, but more of a reference. So i don't see why something about axr should be put in there, unless it's talking about commands or something. Ask brandonw about it, he would know.
Then, this could be moved to a wider calculator forum in Omnimaga, I think :S
If I understand what graph said, though, it is for ASM, so I think this topic belongs here...
-
Yeah, i meant a reference for asm.
-
That said, Axe could be included in the notable releases section, though. ALso there's a BASIC section in WikiTI showing HEX routines I think. Maybe there could be an Axiom section?
-
DJ: It's in the notable programs section, if that's what you meant: http://wikiti.brandonw.net/index.php?title=Notable_programs (http://wikiti.brandonw.net/index.php?title=Notable_programs) :)
-
http://wikiti.brandonw.net/index.php?title=Axe (http://wikiti.brandonw.net/index.php?title=Axe)
I created this, though :S
-
DJ: It's in the notable programs section, if that's what you meant: http://wikiti.brandonw.net/index.php?title=Notable_programs (http://wikiti.brandonw.net/index.php?title=Notable_programs) :)
Ah ok that's good. I didn't know if it was added or if I added it, since it was pretty recent last time I edited stuff on the Wiki.
-
You are the one who added Axe to the list, or at least someone who chose to identify themself as DJ Omnimaga ;D
-
Oh ok so that was me then. It wasn't recently so I forgot. Should there be a page for each notable app like what ScoutDavid did?
-
Returning to WikiTI:
This topic is inside the Assembly Programming Forum... WikiTI is for Assembly only?
I'm quite confused now, since I made Axe Parser's page :S
WikiTI is for whatever we make it. :) It is mostly focused on assembly programming because that's where third-party documentation is most needed - TI's documentation barely scratches the surface of what assembly language can do. But there's no reason to exclude other languages. I don't think there's a need to document the Axe language itself - that's what the official documentation is for - but programming tips, example code, and tutorials would be very much welcome.
-
Well, for TI-BASIC there is already TI-BASIC Developer wiki. For Axe I guess it could be a good idea maybe.
-
Well, for TI-BASIC there is already TI-BASIC Developer wiki. For Axe I guess it could be a good idea maybe.
There is also z80-heaven, which I assume is no longer being updated. Last update was 171 days ago.
-
Ah right I rememeber that one. I think it came out a while later but then people prefered to update WikiTI instead, although WikiTI went down for a while.
That said, for Axe, I think SirCmpwn was gonna write a tutorial available on the forums or for download. It might be good I guess on WikiTI to have special routines and stuff to help Axe programmers, since it's more documentation-based than tutorial based.
-
Returning to WikiTI:
This topic is inside the Assembly Programming Forum... WikiTI is for Assembly only?
I'm quite confused now, since I made Axe Parser's page :S
WikiTI is for whatever we make it. :) It is mostly focused on assembly programming because that's where third-party documentation is most needed - TI's documentation barely scratches the surface of what assembly language can do. But there's no reason to exclude other languages. I don't think there's a need to document the Axe language itself - that's what the official documentation is for - but programming tips, example code, and tutorials would be very much welcome.
Thanks for the explanation, BUT this is the Assembly category, what, why?
-
As we said, WikiTI is almost completely ASM info now. And Sir made this topic about the USB documentation that he found on WikiTI. Guess it could go in Other calc disc., but not really needed right now...
-
Returning to WikiTI:
This topic is inside the Assembly Programming Forum... WikiTI is for Assembly only?
I'm quite confused now, since I made Axe Parser's page :S
WikiTI is for whatever we make it. :) It is mostly focused on assembly programming because that's where third-party documentation is most needed - TI's documentation barely scratches the surface of what assembly language can do. But there's no reason to exclude other languages. I don't think there's a need to document the Axe language itself - that's what the official documentation is for - but programming tips, example code, and tutorials would be very much welcome.
Thanks for the explanation, BUT this is the Assembly category, what, why?
I see no need to move the topic for now. If WikiTI ever diverges into non-ASM stuff for real, then we can consider moving the topic.
IMHO, though, I think WikiTI should continue focusing on the calcs documentation from the memory to the LCD for now.
-
About that : http://wikiti.brandonw.net/index.php?title=83Plus:Ports:01
In 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.
-
By the way, if you want to help improving the wiki, feel free to sign up an account (I think someone has to approve it). Follow the main page instructions.
However, it seems that WikiTI server is incredibly slow lately. When I edited the Omnimaga and DJ Omnimaga pages yesterday, each page took 1 minute to load.
-
If you request an account, be sure to ping me on IRC, or might not get approved for some time, because I don't check the queue everyday.
About that : http://wikiti.brandonw.net/index.php?title=83Plus:Ports:01
In the example, a "xor" must be used, not an "and".
No, the example is correct. Reset for a bit means that the key is held, the following CALL instruction tests for Z, not NZ. If you use XOR, you have to reverse the test.
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.
The TI-84+CSE uses the same ASIC (which handles the keyboard) as older TI-84+/SEs with 128 K RAM, so anything true of the TI-84+CSE ASIC is true of the older TI-84+/SE ASIC. I wouldn't be surprised if, on average, the delays required are lower on the TA2 ASIC, but you should still have some.
-
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...
-
$FD and $FD = $FD, right ?
Ah, you're right. It should say ~0FDh; that is, it should be ANDing with the complement of FD
-
Actually, that should work with xor $FD.
Of course, that is only the case when only LEFT is pressed in that group...
/e : Thx for the editing, but btw, no calculator returned more than 6 cycles in cpu mode 0. All results there : http://www.omnimaga.org/asm-language/8x%28se%29-testers-needed/?PHPSESSID=4g7m837h7uo8jgcgmfpdcn1592 (http://www.omnimaga.org/asm-language/8x%28se%29-testers-needed/?PHPSESSID=4g7m837h7uo8jgcgmfpdcn1592)
-
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)
-
I'm of the opinion that resetting the group port is not necessary. Axe's direct key input routine has never done so, and if it didn't work, I'm sure we'd have heard about it from any one of its hundreds of users by now. (I did actually hear about problems a few times, but simply upping the delay seemed to fix any issues)
For reference, the current version of the direct key input routine explicitly waits for a fairly generous 40 cycles, or if you want to count the cycles of delay in the out/in instructions themselves, 51 cycles.
-
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...
-
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 =/
-
I'm of the opinion that resetting the group port is not necessary. Axe's direct key input routine has never done so, and if it didn't work, I'm sure we'd have heard about it from any one of its hundreds of users by now. (I did actually hear about problems a few times, but simply upping the delay seemed to fix any issues)
For reference, the current version of the direct key input routine explicitly waits for a fairly generous 40 cycles, or if you want to count the cycles of delay in the out/in instructions themselves, 51 cycles.
Wow that's a lot. O.O is it for 15MHz compatibility ?
-
I'm of the opinion that resetting the group port is not necessary. Axe's direct key input routine has never done so, and if it didn't work, I'm sure we'd have heard about it from any one of its hundreds of users by now. (I did actually hear about problems a few times, but simply upping the delay seemed to fix any issues)
For reference, the current version of the direct key input routine explicitly waits for a fairly generous 40 cycles, or if you want to count the cycles of delay in the out/in instructions themselves, 51 cycles.
Wow that's a lot. O.O is it for 15MHz compatibility ?
It is. If you look at the old data the_mad_joob collected, some people's calculators were recorded as needed up to 29 cycles of delay at the high CPU speed. So I overshot that to be safe.
-
Speaking of the key port...
I don't know if anybody else does this, but in some high-speed programs that only use 1 or 2 groups, I disable interrupts, set the key group(s) I need, and I never have to write to the port again (just read). So for example, I made a Snake game that only used the arrows and [2nd], [mode], and [del], so I wrote $BE to the port. At the beginning of the game loop, I just need to do in a,(1) with no worry about delays to read the key press. So yeah, in some of my games, pressing things like F2 to F5 will also act as arrow presses.
Otherwise, if I need _GetK and the program needs to be small and can use interrupts, turn on interrupts and spend only 13 cycles to either read 8445h or 843Fh (whichever is needed) for the same effect.
-
Oh wow that's what Soru was talking about the other day. O.O Nice trick.
-
Oh wow that's what Soru was talking about the other day. O.O Nice trick.
Hehe, I got the trick from Iambian and geekboy :P
-
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.
-
https://wikiti.brandonw.net/index.php?title=83Plus:Ports:2F
Quote : "After every write to the LCD bit 1 of port 2 resets for a certain amount of time based on the current cpu speed and if the calculator is in hi speed mode."
It's actually working after every read aswell (tested with both ports $10 & $11).
https://wikiti.brandonw.net/index.php?title=83Plus:OS:Memory_Layout
The stack goes until $FFFE ($FFFF is actually unused by the system, that's right, an extra scrap byte).
https://wikiti.brandonw.net/index.php?title=Z80_Instruction_Set
Quote : "POP Same syntax as PUSH. Copies (SP) to regLSB, increments SP, copies (SP) to regMSB, then increments SP again. The word based at the starting value of SP is zeroed."
The last sentence is wrong and should be removed.
Also, no matter how useful they are, the following instructions are missing :
ld J,N
ld ixh,ixh
ld ixl,ixl
ld iyh,iyh
ld iyl,iyl
https://wikiti.brandonw.net/index.php?title=83Plus:OS:Certificate/Headers:Fields:Application_Headers
Quote : "In theory, it is legal to specify the master field as 800D xxxx if the application is less than 64 K in size. However, rabbitsign won't sign it."
It should be "800E" instead of "800D", or even more accurately "800DXX or 800EXXXX".
https://wikiti.brandonw.net/index.php?title=83Plus:OS:Raw_Flash_Commands
In the example code of the "Writing" section, using a "bit 5,(hl)" instruction is actually wrong.
Indeed, if the writing becomes successful after the xor (hl) instruction, reading (hl) again won't return status data anymore.
In other words, such algorithm could return a failure where there isn't any.
The right way to do it is to check both bits from a single reading.
Unoptimised replacement code :
...
programWaitLoop:
in a, (keyPort)
cp 0BFh
jr z, abortProgram
ld a, (hl)
ld c, a
xor b
bit 7, a
jr z, programDone
bit 5, c
jr z, programWaitLoop
abortProgram:
...
https://wikiti.brandonw.net/index.php?title=Category:83Plus:Ports:By_Address
Quote : "All writes to mirrored ports are ignored."
That is wrong and should be removed.
https://wikiti.brandonw.net/index.php?title=83Plus:OS:Variable_Storage_in_the_User_Archive
It's stated that a sector can start with $FC, anybody knows in which case ?
https://wikiti.brandonw.net/index.php?title=83Plus:Ports:2E
It's worth noting that as far as bits 0 & 4 are concerned, the extra clock cycle is doubled if the instruction is prefixed.
We can safely deduct that the port adds a clock cycle each time the R register is incremented.
https://wikiti.brandonw.net/index.php?title=83Plus:Ports:01
Quote : "While a key is in a state between pressed and released, it will repeatedly turn on and off."
It's worth mentioning that such behaviour only occurs for keys that were just released, not pressed.
In other words, a key that was just released can be detected as pressed right after, but not the other way around.
https://wikiti.brandonw.net/index.php?title=83Plus:Ports:20
In the "Examples" section, it's worth mentioning that the second method will switch to CPU speed 3, not 1.
That speed may not be fully supported software-wise, most notably because the default delays provided by ports $29>$2C|$2E|$2F vary from one speed to another.
Here is a jump-free method that switches to speed 1 instead :
in a,($02)
rlca
and %00000001
out ($20),a
-
You can edit the pages on wikiti btw. As for the mirrored port writing being ignored, that's actually really handy to know. I suspect that two different people contributed those facts, or maybe it was he came person who forgot?
-
As for the mirrored port writing being ignored, that's actually really handy to know.
I found back my old 83+ from 1999, so i was finally able to test that.
So, i can confirm that writes to mirrored ports are definitely NOT ignored, updated my previous post.
At least, writing to port $20 had the exact same effect as actually writing to port $00.
Cheers.
-
Oh, thanks for confirming that. I know the code to set 15MHz mode does take some advantage of that, because it essentially writes a 0 to port 20h (mirror of the link port) on those calcs which is generally safe, but writes a non-zero value on the other calcs.
-
Oh, thanks for confirming that. I know the code to set 15MHz mode does take some advantage of that, because it essentially writes a 0 to port 20h (mirror of the link port) on those calcs which is generally safe, but writes a non-zero value on the other calcs.
I actually just re-tested that method aswell.
While it's safe on the 83+BE if there's no link activity, i wouldn't recommend using it on other models, see my note on port $20 on my synthesis post.
-
Oh, thanks for confirming that. I know the code to set 15MHz mode does take some advantage of that, because it essentially writes a 0 to port 20h (mirror of the link port) on those calcs which is generally safe, but writes a non-zero value on the other calcs.
I actually just re-tested that method aswell.
While it's safe on the 83+BE if there's no link activity, i wouldn't recommend using it on other models, see my note on port $20 on my synthesis post.
Well I made some of those fixes from above. You should get yourself an account :D .
-
Well I made some of those fixes from above. You should get yourself an account :D .
Thanks for your time, and for the community.
My name wasn't necessary in the credits at all, but i understand, i would have done the same.
I have some more discoveries in my backpack, so yeah, i'll try to make an account next time.