6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Jun 16, 2024 5:05 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Feb 26, 2021 11:58 pm 
Offline

Joined: Sun Apr 26, 2020 3:08 am
Posts: 357
In another thread I brought up the idea of using screens for data storage. Here is one of those ideas.

I have trouble remembering what kind of data is required when entering a word definition and what data is present on the data stack on exit of a word definition. I am sure that most peoples desktop are plastered with notes for remembering such requirements. I like to be able to find the answer without searching through all my notes. This is what I came up with.

The way this works is just type "HELP word" and the word is returned with its requirements like so:
Colons are used as the delimiters.

HELP ENCLOSE ( this is typed )
:ENCLOSE ( addr1 c -- addr1 n1 n2 cnt ) : ( this is returned with colons as delimiters )

( Scrn #10 )
0 ( word matching )
1 : ?stack2 ( -- f ) sp@ csp @ 2- swap u< ;
2 : postpone [compile] [compile] ; immediate
3 : [char] bl word here 1+ c@ postpone literal ; immediate
4 11 constant firsthelp ( set the first screen of help data here )
5 0 variable tscr 0 variable lasthelp
6 : inithlp dr1 ?stack2 if firsthelp then tscr ! tscr @ 5 +
7 lasthelp ! ;
8 : disp dup [char] : enclose >R drop drop R> type ;
9 : match ( addr -- f ) here 1+ here c@ rot swap -dup if over +
A swap do dup c@ i c@ - if 0= leave else 1+ then loop else drop
B drop 0 then ;
C : help inithlp bl word begin 0 tscr @ (line) drop dup
D b/buf + swap do i c@ [char] : = if i 1+ match if i disp drop
E quit then then loop tscr inc lasthelp @ = until ;
F ( notes: b/buf is bytes per buffer )

( note: make firsthelp the starting screen# the below words start at )

( notes: I=Immediate, C=Compile only, U=User variable, E=Execution only )
( c=character, n=number, d=dbl number, u=unsigned number, addr=address, cnt=count, rem=remainder, quot=quotient, prod=product, b=byte )

( Scrn #11 )
:! ( n addr -- ) :!csp ( -- ) :# ( d1 -- d2 ) :#> ( d -- addr cnt ) :#S ( d1 -- d2 ) :' ( -- addr ) :( ( -- ) :(.") ( -C- ) :(;code) ( -C- ) :(+loop) ( n -C- ) :(abort) ( -- ) :(do) ( -C- ) :(find) ( addr1 addr2 -- pfa len tf ) :(line) ( n1 n2 -- addr cnt ) :(loop) ( -C-) :(number) ( d1 addr1 -- d2 addr2 ) :* ( n1 n2 -- prod ) :*/ ( n1 n2 n3 -- n4 ) :*/mod ( n1 n2 n3 -- rem quot ) :+ ( n1 n2 -- sum ) :+! ( n addr -- ) :+- ( n1 n2 -- n3 ) :+buf ( addr -- addr2 flag ) :+loop ( n1 -E- )( addr n2 -- ) :+origin ( n -- addr ) :, ( n -- ) :- ( n1 n2 -- dif ) :--> ( -I- ) :-dup ( n1 -0- n1 ) ( n1 -- n1 n1 ) :-find ( -- pfa len tf ) ( -- ff ) :-trailing ( addr n1 -- addr n2 ) :. ( n -- ) :." ( -I- ) :.line ( line scr -- ) :.R ( n1 n2 -- ) :/ ( n1 n2 -- quot ) :/mod ( n1 n2 -- rem quot ) :0< ( n -- flag ) :0= ( n -- flag ) :0branch ( flag -C- ) :1+ ( n1 -- n2 ) :2+ ( n1 -- n2 ) :: ( -PE- ) :; ( -IC) :;code ( -IC- ) :;S ( -I- ) :< (n1 n2 -- flag ) :<# ( -- ) :<builds ( -C- ) := ( n1 n2 -- flag ) :> ( n1 n2 -- flag ) :>R ( n -C- ) :? ( addr -- ) :?comp ( -- ) :?csp ( -- ) :?error ( flag n -- ) :?exec ( -- ) :?loading ( -- ) :?pairs ( n1 n2 -- ) :?stack ( -- ) :?terminal ( -- flag ) :@ ( addr -- n ) :abort ( -- ) :abs ( n -- u ) :again ( addr n -IC- ) :allot ( n -- ) :and ( n1 n2 -- n3 ) :b/buf ( -- n ) :b/scr ( -- n ) :back ( addr -- ) :base ( -U- addr ) :begin ( -IC- addr ) :bl ( -- c ) :blanks ( addr cnt -- ) :blk ( -U- addr ) :block ( n -- addr ) :branch ( -C- ) :buffer ( n -- addr ) :c! ( b addr -- ) :c, ( b -- ) :c@ ( addr -- b ) :cfa ( pfa -- cfa ) :cmove ( from to cnt -- ) :cold ( -- ) :compile ( -C- ) :constant ( n -- ) :context ( -U- addr ) :cr ( -- ) :create ( -- ) :csp ( -U- addr ) :d+ ( d1 d2 -- dsum ) :d+- ( d1 n -- d2 ) :d. ( d -- ) :d.r ( d n -- ) :dabs ( d -- ud ) :decimal ( -- ) :definitions ( -- ) :digit ( c n1 -- n2 tf ) ( c n1 -- ff ) :dlist ( -- ) :dliteral ( d -E- d ) ( d -- ) :dminus ( d1 -- d2 ) :do ( n1 n2 -E- ) ( addr n -IC- ) :does> ( -- ) :dp ( -U- addr ) :dpl ( -U- addr ) :dr0 ( -- ) :dr! ( n -- ) :drop ( n -- ) :dump ( addr n -- ) :dup ( n -- n n ) :else ( addr1 n1 -IC- addr2 n2 ) :emit ( c -- ) :empty-buffers ( -- ) :enclose ( addr1 c -- addr1 n1 n2 cnt ) :end ( -IC- ) :endif ( addr n -IC- ) :erase ( addr n -- ) :error ( line -- in blk ) :execute ( addr - ) :expect ( addr cnt -- ) :fence ( -U- addr ) :fill ( addr cnt b -- ) :first ( -- n ) :fld ( -U- addr ) :forget ( -E- ) :forth ( -I-) :here ( -- addr ) :hex ( -- ) :hld ( -- addr ) :hold ( c -- ) :I ( -C- n ) :id. ( addr -- ) :if ( flag -E- ) ( -IC- addr n ) :immediate ( -- ) :in ( -U- addr ) :index ( from -- ) :interpret ( -- ) :key ( -- c ) :latest ( -- addr ) :leave ( -C- ) :lfa ( pfa -- lfa ) :limit ( -- n ) :list ( n -- ) :lit ( -C- n ) :literal ( n -IC- ) :load ( n -- ) :loop ( addr n -IC- ) :m* ( n1 n2 -- d ) :m/ ( d n1 -- rem quot ) :m/mod ( ud1 u2 -- rem dquot ) :max ( n1 n2 -- max ) :message ( n -- ) :min ( n1 n2 -- min ) :minus ( n1 -- n2 ) :mod ( n1 n2 -- mod ) :mon ( -- ) :move ( addr1 addr2 cnt -- ) :nfa ( pfa -- nfa ) :number ( addr -- d ) ( addr points to an ascii based number prefixed by length and terminated with a space ) :offset ( -U- addr ) :or ( n1 n2 -- n3 ) :out ( -U- addr ) :over ( n1 n2 -- n1 n2 n1 ) :pad ( -- addr ) :pfa ( nfa -- pfa ) :prev ( -U- addr ) :query ( -- ) :quit ( -- ) :R ( -- n ) :R# ( -U- addr ) :R/W ( addr blk flag -- ) :R> ( -- n ) :R0 ( -U- addr ) :repeat ( addr n -IC- ) :rot ( n1 n2 n3 -- n2 n3 n1 ) :rp! ( -- ) :s->d ( n -- d ) :s0 ( -U- addr ) :scr ( -U- addr ) :sign ( n d -- d ) :smudge ( -- ) :sp! ( -- ) :sp@ ( -- addr ) :space ( -- ) :spaces ( n -- ) :state ( -U- addr ) :swap ( n1 n2 -- n2 n1 ) :then ( -IC- ) :tib ( -U- addr ) :toggle ( addr b -- ) :traverse ( addr1 n -- addr2 ) :type ( addr cnt -- ) :u* ( u1 u2 -- ud ) :u/ ( u1 u2 -- urem uquot ) :u< ( u1 u2 -- flag ) :until ( flag -E- ) ( addr n -IC- ) :update ( -- ) :use ( -- addr ) :user ( n -- ) :variable ( n variable word ) :voc-link ( -U- addr ) :vocabulary ( -E- ) :warning ( -U- addr ) :while ( flag -E- ) ( addr1 n1 -C- addr 1 n1 addr2 n2 ) :width ( -U- addr ) :word ( c -- ) :xor ( n1 n2 -- xor ) :[ ( -I- ) :[compile] ( -I- ) :


Last edited by IamRob on Sat Feb 27, 2021 4:33 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 27, 2021 6:19 am 
Offline

Joined: Sun Apr 26, 2020 3:08 am
Posts: 357
Ha! Totally forgot about some colon combinations getting converted to smiley emoji's.when the text was posted to the forum.

What to do? What to do?


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 27, 2021 7:56 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8458
Location: Southern California
IamRob wrote:
Ha! Totally forgot about some colon combinations getting converted to smiley emoji's.when the text was posted to the forum.

What to do? What to do?

Just click "Edit" under the post, at the right side, and then check the "Disable smilies" box below the area where you write or edit the post.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 27, 2021 4:36 pm 
Offline

Joined: Sun Apr 26, 2020 3:08 am
Posts: 357
Thanks! The computer that has my emulator for Forth uses an outdated web browser and doesn't have the EDIT button. Didn't see it right away.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: