RE: RE: RE: RE: A83: Apps, adding to current menues
[Prev][Next][Index][Thread]
RE: RE: RE: RE: A83: Apps, adding to current menues
OK, I think I have everything figured out except for have you figure out the
hookaddress. Would the it be a lable in an app or is it a memory address.
If it is a memory address, then how do you figure it out?
-----Original Message-----
From: owner-assembly-83@lists.ticalc.org
[mailto:owner-assembly-83@lists.ticalc.org]On Behalf Of Dan Englender
Sent: Tuesday, November 28, 2000 11:00 PM
To: assembly-83@lists.ticalc.org
Subject: Re: RE: RE: A83: Apps, adding to current menues
1) No. :)
To correct your code:
First, you want to load HL with the address of the key hook routine. I'm
actually not sure what you meant by $1B, but since $1B would be an address
in the ROM, I'll assume this is not where your keyhook routine will be
located :) And you want to 'in a,(6)' not 'ld a,(6)'. You're not loading
the value in memory address 6, you're inputting the value from port 6 (which
happens to be the current ROM page).
That said, the "best" way to set a the key hook is to use the ROM entry
point that I mentioned. It takes up much less space to do it that way and
accomplished the same task. I just provided the code of what the entry
point did so you could see exactly what was going on.
2) The calculator is different from what you might be used to on the PC.
There is no multitasking (no comments from the peanut gallery please...),
only one thing is running at a time. When you quit from the program to
TIOS, TIOS is running, your program no longer is. However, if you set the
key hook, TIOS will call (that is, run a certain routine) in your program
(or application in this case right?) when the key "events" occur.
3) Refer to answer to question one. You need to set the address of the key
hook routine. Keep in mind that the main reason you must do this from an
application is that if you try to do it from a program, the address of your
routine will not stay in a constant place in memory. (Of course you could
be sneaky and make a program that was the first thing in the archive, and
then it wouldn't move around...but that's more trouble than it's worth). If
you have an application, the location of your routine will stay in a
constant place, and on a constant page.
-Dan Englender
----- Original Message -----
From: "Robby Proie" <playnogamz@nls.net>
To: <assembly-83@lists.ticalc.org>
Sent: Tuesday, November 28, 2000 7:45 PM
Subject: RE: RE: RE: A83: Apps, adding to current menues
>
> Ok, here come the next batch of questions. I think I am starting to get a
> little bit farther on this though.
>
> 1. OK, is this the right way to set the keyhook?
> ld hl,1Bh
> ld (9B88h),hl
> ld a,(6)
> ld (9B8Ah),a
> set 0,(iy+34)
>
> When I run the program like this, with a clear screen call and an that
exit
> call, it returns to tios without an error
>
> 2. How do you get back to tios, do you simply end the program, or is there
a
> way to go to tios with the program still running (that is needed for what
I
> intend on doing).
>
> 3.Ok, looking at what you tolk me, tios looks at the key hook before and
> after the routine where it checks for the key input. Where does the code
> that tells TIOS or the calc what I want to do go? This may refer back ti
> question 1.
>
> Thanks again for all of your help so far.
>
> Robby
>
>
> -----Original Message-----
> From: owner-assembly-83@lists.ticalc.org
> [mailto:owner-assembly-83@lists.ticalc.org]On Behalf Of Dan Englender
> Sent: Tuesday, November 28, 2000 6:32 PM
> To: assembly-83@lists.ticalc.org
> Subject: Re: RE: A83: Apps, adding to current menues
>
>
>
> 1) You don't edit the ROM. You just set a memory address in RAM which
the
> TIOS checks during a certain process. This is, as you mentioned, called a
> hook. So, when the TIOS is running its keyboard process, it checks to see
> if a key hook was set, and if it was, it calls the specified address for
the
> hook (and passes you certain information through the registers.)
>
> 2) As I mentioned, the routine you specify for TIOS to use as the key
hook
> will be called twice during every "loop" of the TIOS key handler. It will
> be called once when the key handler is starting, and once again afterwards
> to report which key was pressed. You can tell which call is which by
> looking at the registers when your key hook routine is called. If A=$1A,
> then it's the 'key handler init' call, if A=$1B, then it's the 'key press
> report' call. If A=$1B, then register B will hold the GetCSC scan code
for
> the key that was pressed.
>
> 3) Port one is the keyboard port, it's not quite the same thing, but
you've
> got the right idea. To input a value from port four, you'd just do:
> in a,(4)
>
> 4) Well, remember that in the $1B call of the key hook routine, TIOS
> expects you to return the GetCSC scan code that you want processed by the
> system in register A. Thus, if you wanted the apps screen to load, you'd
> pass the scan code for APPS in register A. (I'd have to look it up, but I
> think it's $27)
>
> 5) ZDS does not allow you the use the dollar sign ($) to denote
hexadecimal.
> You have to put an 'h' after the number instead. IE: 4F7Bh. If the
> hexadecimal number starts with a "letter" character, you'll have to
precede
> the number with a zero, like 0FFFFh.
>
> -Dan Englender
>
> ----- Original Message -----
> From: "Robby Proie" <playnogamz@nls.net>
> To: <assembly-83@lists.ticalc.org>
> Sent: Tuesday, November 28, 2000 6:02 PM
> Subject: RE: RE: A83: Apps, adding to current menues
>
>
> >
> > OK, I think that I am finally starting to understand exctlly what is
going
> > on. First of all, I would like to sincearly thank you for all of the
help
> > you have give me so far. I am not the best coder, however I am slowly
> > learning, and will probably have many more questions. Ok, here are my
> list
> > of quesstions.
> > Note: Many of them will make refrences to mirage.
> >
> > 1. This is more of a process question than codiing (I think).
> >
> > When you say that TIOS will pass you something, does that mean that
mirage
> > is running in the background, that you have edited the rom, or that you
> have
> > simply set a little hook? (I am pretty sure it is the hook, but just to
> > save myself from a lot of no purpose work, I thought I would make sure).
> >
> > 2. How exactly do you check the keypress. I think that you told me this
> > before, but I didn't quite understand it.
> > To expound, does the keypress cause tios to jump to a certain place,
orrun
> > a certain process or what.
> >
> > 3. When you say look at bit 3 of port 4, how do you do that? (I think I
> was
> > just inspired, by port 4, are you talking about the Direct input of keys
> > port?)
> >
> > 4. How do you call a certain screen through this. For instance the apps
> > screen. This would be helpful in coding. To be more spacific do you
just
> > do a LD $B1,$27 or is it a little bit more complex.
> >
> > 5. 2 letters ago you said that I should use B_CALL $4F7B to set the key
> hook
> > (which answers question 1 for me), however, when I try to compile it
with
> > ZDS, it gives me an error. Do I have to define it first?
> >
> > I know you probably think I'm not the brightest thing with two legs
after
> > you have read these questions, but I guess that this is the only way for
> me
> > to learn.
> >
> > Thanks,
> > Robby
> >
> > -----Original Message-----
> > From: owner-assembly-83@lists.ticalc.org
> > [mailto:owner-assembly-83@lists.ticalc.org]On Behalf Of Dan Englender
> > Sent: Monday, November 27, 2000 10:54 PM
> > To: assembly-83@lists.ticalc.org
> > Subject: Re: A83: Apps, adding to current menues
> >
> >
> >
> > See, the problem is that it's quite complicated to do that sort of
thing.
> I
> > don't have any really great code to copy and paste in here, but I'll try
> to
> > give you a start at least.
> >
> > First of all, if you want to make your life much easier, use an
> > [on]+something hotkey combination. This way TIOS will still read it as
a
> > keypress and pass you the "something" during the $1B pass of the key
hook.
> > You can then just check to see if the [on] key is currently pressed when
> you
> > receive the proper key and jump to your handler code if it is. To check
> if
> > the [on] key is pressed, just look at bit 3 of port 4. If the bit is a
0,
> > then the [on] key is currently being pressed.
> >
> > Then you want to do something once you receive this keycode, and you
> picked
> > a hard one - start an application. There might be a RunApplication
entry
> > point laying around somewhere undocumented but if there is, I don't know
> > about it. And running an application by just jumping to it's start
> address
> > could get a touch messy due to context and other issues. So the best
way
> > (though it's a very ugly hack) to run an app as far as I know is to make
> the
> > system pretend that you ran the app from the keyboard.
> >
> > How do you do this? Well, first you need to load the APPS menu. That's
> not
> > so hard, just return the APPS key scan code from the $1B that you
detected
> > (should be $27 I think). However, you'll have to set some sort of
> indicator
> > to yourself, so that you know that you should continue loading the app.
> > System flags are dangerous to use, though I'm not real sure of anything
> > better. Anyhow, in the next $1B pass through the key code, when you see
> > that the indicator was set, load the name of the application into the
> > progName memory address, and pass the enter key as being pressed. It's
a
> > pretty weird system, but the TIOS will run the app loaded in progName
> > whenever the enter key is pressed at the APPS menu (which is good luck
> since
> > it would have been a pain in the neck otherwise).
> >
> > There's just one little detail left (which you're probably wondering
> about).
> > If this is the method I use to run MirageOS with key hooks, why don't
you
> > see the APPS menu pop up? Well, in version 1.1, if you don't have
> auto-sort
> > enabled, you do see the APPS menu pop up for just a second. What I did
> was
> > turn of the LCD before I loaded the APPS menu, then turned it back on
once
> > MirageOS starts. That way the user can't see the APPS menu at all.
> > Unfortunately for me, I slightly botched the order of things up in 1.1
so
> > that if auto-sort is off, you see the APPS menu briefly.
> >
> > Hope this helps at least a bit,
> > -Dan Englender
> >
> > P.S. I figured all this out by trial and error. Took a while...
> >
> > ----- Original Message -----
> > From: "Robby Proie" <playnogamz@nls.net>
> > To: <assembly-83@lists.ticalc.org>
> > Sent: Monday, November 27, 2000 8:38 PM
> > Subject: RE: A83: Apps, adding to current menues
> >
> >
> > >
> > > I'm not sure that I understand what you are saying. Lets say that I
> > wanted
> > > to call a one page app called "THEAPP" when the user presses the shift
> key
> > > and than the clear key (If that is possible). What would the exact
code
> > be
> > > the set this up. If that key-combo is not possible, than what about
if
> > they
> > > help the ON key and then pressed enter (which is somewhat like
mirage's
> > > ON+APPS key combo). Thanks for your help so far.
> > >
> > > Robby
> > >
> > > P.S. How have you figured out all of this information?
> > >
>
>
>
>
>
References: