A Simple Menu

72 views
Skip to first unread message

Carl Attrill

unread,
Mar 26, 2013, 1:35:21 PM3/26/13
to fign...@googlegroups.com
Hi everyone 

I have made a Menu that can easily be navigated with the Fignition. 
Simply Use the Up / Down switches and press space to select.

When you press space the program checks Pos location then acts upon the result.
?pos is checked by checkUp and checkDown to make sure the cursor stays in the zone, if it exceeds it will stay put and not mess things up.
select reads Pos and looks up what you want to do.
dokey reads the pad waiting for up down or space.
cursor displays '>'
nocursor puts a space in place of  '>'


You can alter all parameters and the text to suit your needs.

I will put this program on figgi.boards.net with the others so you can all reference them there.

Enjoy!

Carl.

Bytes High no Limits!  



menu100.hex
menu200.hex
menu300.hex
simple_menu.fth
menu for fig.jpg

carl

unread,
Mar 26, 2013, 1:38:38 PM3/26/13
to fign...@googlegroups.com
and here is the listing.
[1]

( simple FIGmenu)
128 var Pos
000 var ?pos 
: select 
Pos @ 128 = if 1 23 at ." you picked 1" then 
Pos @ 178 = if 1 23 at ." you picked 2" then
Pos @ 228 = if 1 23 at ." you picked 3" then
Pos @ 278 = if 1 23 at ." you picked 4" then
Pos @ 328 = if 1 23 at ." you picked 5" then
Pos @ 378 = if 1 23 at ." Quit selected BYE!" quit then ;
 ( put what you like to happen in this part i.e. say xx load xx)



[2]

( the menu)
: screen cls 
22 1 do 1 i at 160 emit 23 i at 160 emit loop
24 1 do i 1 at 160 emit i 22 at 160 emit loop ;
: options 
7 2 at ." Simple Menu"
4 5 at ." 1)Opt one"
4 7 at ." 2)Opt two"
4 9 at ." 3)Opt three"
4 11 at ." 4)Opt four"
4 13 at ." 5)Opt five"
4 15 at ." 6)Quit" ; ( put your options here)


[3]

( move cursor)

: cursor 62 vram Pos @ + ic! ;
: nocursor 32 vram Pos @ + ic! ;
: down Pos @ 50 + Pos ! ;
: up Pos @ 50 - Pos ! ;
: checkDown ( gone too far? )
?pos @ 379 > if nocursor 376 Pos ! cursor then ;
: checkUp ( gone too far)
?pos @ 127 < if nocusor 128 Pos ! cursor then ;
: dokey ( move the cursor with U/D select with space)
inkey 
dup 10 = if nocusor down cursor then
dup 11 = if nocursor up cursor then 
32 = if select then ;

( run)
: init
128 ?pos !
128 Pos !
screen options cursor
begin
Pos @ ?pos !
checkDown
checkUp
dokey
Pos @ 500 = until ;



carl

unread,
Mar 28, 2013, 7:46:37 AM3/28/13
to fign...@googlegroups.com
Hi again,
Grrrr
Just one day in my life I will get a listing right first time. {:-<

checkDown should be altered from.....


: checkDown ( gone too far? )
?pos @ 379 > if nocursor 376 Pos ! cursor then ;

can you see what happens, when you go as far as 379, Pos is called 376, this puts the '>' in the wrong place!

it should be Called to when you want it to be......

: checkDown ( gone too far? )
?pos @ 379 > if nocursor 378 Pos ! cursor then ;

Anyone tried this yet anyway?

The cool thing about forth is that 'exec' is in the lexicon until its smudged of forgotten, so you can type exec to go back to the menu at any time.





Reply all
Reply to author
Forward
0 new messages