"49,87,9
To do that, then select the A:Pen from the draw menu, add an additional 87,159 (159=112+47). Finally, the arrows are 1=down,2=left,3=right,4=up. Combining all this:"49,87,9,87,159,9,2,2,2,2,1,1,1,1,3,3,3,3,4,4,4,4
That will select ClrDraw, then Pen, then it will draw you a box :)ex_helloworld:
Delay(30)
; Text(56,0,"New Program")
Key(skprgm)
Key(skright)
Key(skright)
Key(skenter)
Key(skpower) ;H
Key(sksquared) ;I
Key(skminus) ;W
Key(sk7) ;O
Key(sktimes) ;R
Key(skrparen) ;L
Key(skinverse) ;D
Key(skEnter)
Key(skClear)
Key(skprgm)
Key(skright)
Repeat(skdown,7)
Key(skEnter)
Key(skEnter)
Key(skprgm)
Key(skright)
Repeat(skdown,2)
Key(skEnter)
Key(sk2nd)
Key(skAlpha)
Key(skplus)
Key(skH-112)
Key(skE-112)
Key(skL-112)
Key(skL-112)
Key(skO-112)
Key(skSpace-112)
Key(skW-112)
Key(skO-112)
Key(skR-112)
Key(skL-112)
Key(skD-112)
Key(skAlpha)
Key(skMath)
Repeat(skRight,3)
Repeat(skDown,3)
Key(skEnter)
Key(sk2nd)
Key(skMode)
Key(skPrgmToken)
Key(sk2nd)
Key(skAlpha)
Key(skpower) ;H
Key(sksquared) ;I
Key(skminus) ;W
Key(sk7) ;O
Key(sktimes) ;R
Key(skRParen) ;L
Key(skinverse) ;D
Key(skEnter)
ExitTutor()
It is 65 bytes, by the way.
/=====================\
| Key(val) | 1 byte
\=====================/
This is the main command. This tells the engine which key to
simulate. For example, to simulate [ENTER], use Key(skEnter).
/=====================\
| Delay(val) | 2 bytes
\=====================/
This sets the delay between simulated key presses. I find 30
to work well.
/=====================\
| Text(y,x,string) | 4 bytes + length of string
\=====================/
This is how you communicate to the user. This is like the
BASIC command, except it draws over whatever is on the LCD, not
just the graph screen. For the worried, this does not affect the
contents of the graph screen. So for example:
Text(56,0,"Hello World!")
/=====================\
| WaitForKey(key) | 2 bytes
\=====================/
This waits for the user to press the appropriate key. When the
user presses the key, it will be registered. No other keys
respond while waiting.
/=====================\
| Repeat(key,num) | 3 bytes
\=====================/
This will simulate a key press a number of times in a row.
This is useful for navigating menus to get to an item.
/=====================\
| ExitTutor() | 1 byte
\=====================/
This ends the tutorial and normal OS stuff resumes.
These commands should be enough for most tasks. However, if
there are more commands for the adventurous:
/=====================\
| SetAns(num) |
\=====================/
This will set the "Ans" variable to the specified value. Note
that this whole program works with 1-byte values, 0 to 255.
/=====================\
| TestAnsEqu(num) |
\=====================/
If 'Ans' is equal to 'num', then 'Ans' is set to 1, else it
is set to 0.
/=====================\
| GetKey(num) |
\=====================/
Stores the user's keypress to Ans. This isn't as responsive
as it could be, yet, but it works.
/=============================\
| JumpIfAnsEqu(num,label) | 4 bytes
\=============================/
This will jump to a label if Ans=num. Note that the label must
be on the same flash page.
/=====================\
| PushAns() |
\=====================/
This pushes Ans onto a stack for later retrieval with
PopAns(). The stack is currently 240 bytes, but it may be
smaller in the future.
/=====================\
| PopAns() |
\=====================/
This removes the last value on the stack and stores it to
'Ans'.
I think once I add in the menu the process will be much easier. I am glad I added in the ability to use Text() today because it makes it much more interactive :) The code that is used for the "tutorial" in the screenie is:ex_helloworld:
Key(skClear)
Delay(30)
Text(44,0,"First, we need to make")
Text(50,0,"a new program. Press PRGM,")
Text(56,0,"and the Tutor will do the rest.")
WaitForKey(skPRGM)
Key(skright)
Key(skright)
Key(skenter)
Text(56,0,"Enter the program name")
Key(skpower) ;H
Key(sksquared) ;I
Key(skminus) ;W
Key(sk7) ;O
Key(sktimes) ;R
Key(skrparen) ;L
Key(skinverse) ;D
Key(skEnter)
Key(skClear)
Key(skprgm)
Key(skright)
Repeat(skdown,7)
Key(skEnter)
Text(50,0,"Press ENTER to go to the")
Text(56,0,"next line of code.")
WaitForKey(skEnter)
Key(skprgm)
Key(skright)
Repeat(skdown,2)
Key(skEnter)
Key(sk2nd)
Key(skAlpha)
Key(skplus)
Key(skH-112)
Key(skE-112)
Key(skL-112)
Key(skL-112)
Key(skO-112)
Key(skSpace-112)
Key(skW-112)
Key(skO-112)
Key(skR-112)
Key(skL-112)
Key(skD-112)
Key(skAlpha)
Key(skMath)
Repeat(skRight,3)
Repeat(skDown,3)
Key(skEnter)
Key(sk2nd)
Key(skMode)
Key(skClear)
Text(50,0,"Enter the program name,")
Text(56,0,"then press ENTER to run it.")
Key(skNULL)
Key(skPrgmToken)
Key(sk2nd)
Key(skAlpha)
Key(skpower) ;H
Key(sksquared) ;I
Key(skminus) ;W
Key(sk7) ;O
Key(sktimes) ;R
Key(skrparen) ;L
Key(skinverse) ;D
WaitForKey(skEnter)
ExitTutor()
MainMenu:
Menu("Command Index",cmdindex)
Menu("Math Tutorials",mathtutorials)
Menu("Programming Tutorials",programming)
.db 0
programming:
Item("Hello World",ex_helloworld,0)
cmdindex:
mathtutorials:
.db 0
Anything labeled as a Menu() will open a new menu when it is selected and anything labeled as Item() well set it as the tutorial to use. I think I will make it a simple list that the user can scroll through and I think that I will change the format, too. This way the menu or item name is part of the data and there can be several organisation options. For example, a command that falls under several categories might be like this:MainMenu:
Menu(cmdindex)
Menu(mathtutorials)
Menu(probstattutorials)
.db 0
cmdindex:
.db "Command Index",0
Item(cmd_nCr)
.db 0
mathtutorials:
.db "Math",0
Item(cmd_nCr)
.db 0
probstatstutorials:
.db "Probability/Statistics",0
Item(cmd_nCr)
.db 0
cmd_nCr:
.db "nCr",0
.db tut_nCr
And now each menu is just an LUT of 3-byte elements. 1 byte is for the Menu/Item and 2 bytes for the pointer to the item data.
Menu_0:
.db "Menu name",0
.dw number_of_items
.dw Item_pointer_0
.dw Item_pointer_1
.dw Item_pointer_2
...
The item pointers point to an item of the types named above. Tutorials have the following syntax:Tuto_0:
.db "Item Name",0,0
;Tutorial data
ExitTutor() ;also .db 0
Menu Links have the following format:MenuLink_0:
.db "Item Name",0,1
.dw MenuPtr