%\YY!@BzRetro11.62013.08.12ok    H' 66''  n n<<'v,( n- ) Place TOS **here** and increment **heap** by 1 p<6withClass( ac- ) Execute a function via the specified class handler<<.word( a- ) Class for normal functions<J-.macro( a- ) Class for immediate functions"<N\.data( a- ) Class for data (variables, literals, etc) R<[.primitive( a- ) Class for functions corresponding to VM opcodes; used for simple optimizations[dup ( n-nn ) Duplicate TOS[#1+ ( n-n ) Increment TOS by 1 [FK1- ( n-n ) Decrement TOS by 1 ?[puswap ( xy-yx ) Exchange positions of TOS and NOSg[drop ( n- ) Drop TOS from the stack[and ( xy-n ) Bitwise AND[or ( xy-n ) Bitwise OR[xor ( xy-n ) Bitwise XOR[8=@ ( a-n ) Fetch a value from a memory location2[pu! ( na- ) Store a value to a memory locationj[+ ( xy-n ) Add two values (x+y)[- ( xy-n ) Subtract two values (x-y)[* ( xy-n ) Multiply two values (x*y)[.3/mod ( xy-rq ) Divide and Remainder. This performs symmetric division%[{<< ( xy-n ) Shift bits left (x<<y)t[>> ( xy-n ) Shift bits right (x>>y)[out ( np- ) Write a value to an I/O port[ in ( p-n ) Read a value from an I/O port<:Dwait ( - ) Wait for an I/O event1<iqover ( xy-xyx ) Place a copy of NOS over TOS`<not ( x-y ) Same as -1 xor; invert TOS and subtract 1<on ( a- ) Set a variable to -1 (true)<off ( a- ) Set a variable to 0 (false) <FM/ ( xy-q ) Divide two numbers (x/y)@<w}mod ( xy-r ) Modulus of two numbers (x%y)o<negate ( x-y ) Invert sign of TOS<do ( a- ) Call a function by address<@+ ( a-ac ) Fetch a value from an address, return the next address and the value<cl!+ ( ca-a ) Store a value to an address, return next address\<here ( -a ) Next free address in **heap**/;; ' ( - ) Compile an exit into a function, but do not stop compilation/2;; ( - ) Compile an exit into a function and stop the compiler'w w' ,/push' ( n- ) Push a value to the address stack/pop' ( -n ) Pop a value off the address stack/ 0;' ( n-n || n- ) If TOS is not zero, do nothing. If TOS is zero, drop TOS and exit the function/l q repeat ( R: - C: -a ) Start an unconditional loopa / again'' ( R: - C: a- ) Jump to the code following the most recent **repeat** <  redraw  ( - ) Update the display. Can be disabled temporarily by **update** <[ g putc: ( c- ) Display a characterR < cr [ ( - ) Display a newline character[  < <puts>!I  ( $- ) Helper; default way to display strings <  puts ( $- ) Display a string N" . keymap( -a ) Variable, determines whether or not to use the keymap # Nk ~ keymap:PREFIX( -a ) Variable, holds prefix for triggering keymap lookups. Default is #9 (tab)l N keymap:TABLE( -a ) Variable, jump table for keymap handlers <# ) STRING-LENGTH ( -n ) Return the max length for a string <f l STRING-BUFFERS ( -n ) Return number of temporary string buffersS < tib#  ( -a ) Returns address of text input buffer < remapKeys ( c-c ) Remap one ASCII value to another <+Yremap:whitespace 5 =   J !  W ( c-c ) helper for remapping whitespace<getc:unfiltered: ( -c ) Read a keypress and return the ASCII value on the stack<getc:with/remap  +  ( -c ) Read a keypress and return the ASCII value on the stack.\nThis differs from **getc:unfiltered** in that the key value is processed\nby **remapKeys** before being returned.\nUnlike **getc** it does not attempt to support the keymaps.<  keymap:handlerJ ( c-c ) handle keymaps<-?getc   :+ / ( -c ) Read a keypress and return the ASCII value on the stack.\nBoth remapping and keymaps are handled by this.   [  -  c    [ - [    c $< accept  c ( c- ) Read a string, ending with the specified character. The string is returned in **tib**<d->class ( a-a ) Given a dictionary header, return the address of the class handler. Use **@** to get the actual pointer.w< d->xt ( a-a ) Given a dictionary header, return the address of the function start (*xt*). Use **@** to get the actual pointer.<d->doc ( a-a ) Given a dictionary header, return the address of a documentation string. Use **@** to get the actual pointer.<d->name ( a-a ) Given a dictionary header, return the address of the name. This is the actual start of the name. <headero*'N'''~ ( $- ) Given a name, create a new header with a class of **.data**<create   ( ``- ) Parse for a name and call **header**J:A[[ ( - ) Turn compiler off3<`g]] ( - ) Turn compiler onv'' Y<:<`~ ( ``- ) Calls **create**, changes class to **.word**, and turns **compiler** on.J()  ( ``- ) Parse for ) and ignore everything it reads<:Equote ( -a ) Helper function for quotationsJq[:'' ( - ) Start a quote (code block)kJ]i   ( -a ) End a quote (code block) <if   ( fqq- ) Execute first quote if flag is true, second if false<ELifTrue ( fq- ) Execute quote if flag is true:<~ifFalse ( fq- ) Execute quote if flag is falser<dip ( nq-n ) Call a quote while temporarily hiding the top item on the stack<sipi ( nq-n ) Call a quote with an item on the stack, restoring that item after the quote returns  <= ws( xy-f ) Compare two values for equality. Use **==** instead{<== ( xy-f ) Compare two values for equality.< <> ws( xy-f ) Compare two values for inequality. Use **!=** instead.<RW!= ( xy-f ) Compare two values for inequality.K<>= ws( xy-f ) Compare for greater than or equal to<<= ws( xy-f ) Compare for less than or equal to<< sw( xy-f ) Compare two values for less than<8@> >sw( xy-f ) Compare two values for greater than2<ycompare   { ( $$-f ) Compare two strings for equality m<getLength ( a-n ) Return the length of a string<withLength ( a-an ) Same as **dup getLength**<JRstring ( - ) helper for strings<zkeepStringJ'~ ( a-a ) Move the string to a permanent locationk<:devectorcp ( a- ) Restore a function to its original state<:isc ( aa- ) Alter a function to point to a new function<LXatib#  ( -a ) Returns address of alternate text input bufferC<"L "  L ( ``-$ ) temporary function to create strings until __`` is defined 0123456789ABCDEFC< numbers ( -a ) Function returning address of string containing all valid numeric characters i t kw f v   0f   -   f <toNumber ( $-n ) Convert a string to a number <1>isNumber? ( $-f ) See if a string is a valid number in the current **base**#<boot   [  ( - ) Called when the image first loads; use for custom startup routines:     @A  y % : 8- <IPfindE- ( $-af ) Search for a name in the dictionary. Returns a dictionary header and a flag@<'  I   ( ``-a ) Interpret time: return the address ('xt') of a name__&  I +I * 6  <?J<notFound>F  H ( -f ) Called by **notFound**; hook for custom error handling. Used by the prefix system. Returns a flag of 0 if the error is cleared, or -1 if not 0<notFound?   [ ?[ ( - ) Called when a name is not found. Calls **<notFound>** and displays an error message if necessary<m { ok " ( - ) Displays the ``ok`` prompt N6 1   6 f < listenm   I  ( - ) Top level interpreter. Reads and process input. < !!save: ( - ) Save the image!<4!?!bye : ( - ) Exit Retro,!NY!last( -a ) Variable; pointer to most recent dictionary headerP!N!compiler( -a ) Variable; holds compiler state!N!fb( -a ) Variable; Is canvas present?!N!fw( -a ) Variable; Framebuffer width!N #"fh( -a ) Variable; Framebuffer height"NR"memory( -a ) Variable; Holds amount of memory provided by the VMG"N "cw( -a ) Variable; Console width"N "ch( -a ) Variable; Console height"N"heap( -a ) Variable; Pointer to current free location in heap"N'#which( -a ) Variable; Holds pointer to most recently looked up header#N v#remapping( -a ) Variable; indicates whether CR, LF, and TAB should be treated as whitespaceh#N #eatLeading?( -a ) Variable; indicates whether **accept** should ignore leading delimiters#N1$base( -a ) Variable; holds current base for numeric conversion and display($N $update( -a ) Variable; flag indicating whether or not **redraw** should update the displayx$N$version( -$ ) String holding version information$N%build( -$ ) String holding a build identifier%NvL%vector( -a ) Variable; compile function as a vector%N! %tabAsWhitespace( -a ) Variable; treat tab as whitespace? z%<%%:docz J( $- ) attach documentation string to latest defined function%<&&nip J( xy-y ) Drop the NOS from the stack &<I&R&rot J( xyz-yzx ) Rotate the top three values on the stackA&<&&tucki J( xy-yxy ) Put a copy of TOS under NOS&<&&+! J( na- ) Add value to value at address&<& '-! J( na- ) Subtract value from value at address&<='F'++& J( a- ) Increment variable by 16'<l'u'--& J( a- ) Decrement variable by 1e'<''?dup J( -n ) Duplicate TOS if non-zero. If zero, leave value alone'N'listP['<'({{*v'c J( - ) Start a namespace (private portion)'<>(M(---reveal---*v' J( - ) Switch to public portion of a namespace-(<((}}*v':(' :(':('R(   J( - ) Close a namespace, sealing off private symbols{(<((devector J( ``- ) Same as **:devector**, but parses for name of function(<C)K)is J( a``- ) Same as **:is**, but parses for name of function<)J))default:' J( ``- ) Compile call to default definition of a function, ignoring any revectoring)<)*HEADERS J( -n ) Returns number of private headers permitted)<A*scratch# # f # )#  5*Na*nextcX*Nl*split:*l*:*:*a*a*  :*  b*N*z:*l*A*a*'* :*l*@( :*l*( 0k:ii:*& E* *****:*** :+ ** **** )<%+/+d' J( ``-a ) Parse for a name and return the dictionary header corresponding to it+<++xt->dF*ii:+ :+&  J( a-d ) Given an address, return the corresponding dictionary header or 0 if not found~+<+,:hide+:, :,+  J( a- ) Remove a name from a dictionary. Specify the address of a function. Used by **hide**+<|,,hide+ J( ``- ) Remove a name from the dictionarys,<,,reclass J( a- ) Change class of most recent function to specified class,<--reclass:%+ J( a``- ) Same as **reclass**, but parse for function to change class of+6 -Jp-v-__&N J( a-a ) Prefix; returns address of a variable or functionh-J--__@`-8`- J( a-n ) Prefix; execute function or data element and fetch from addres returned-J.".__!`-p`- J( na- ) Prefix; execute function or data element and store value to address returned.J..__+`-&< J( na- ) Prefix; execute function or data element and add value to value at address returnedw.J..__-`-&< J( na- ) Prefix; execute function or data element and subtract value from value at address returned.J`/i/__2`-`- J( a- ) Prefix; execute function twiceX/<//.compiler J( a- ) Class for functions that can only be used inside a definition/</0immediateJ, J( - ) Set the most recent function to **.macro** class/<M0U0compile-only/, J( ``- ) Set the most recent function to **.compiler** class<0/00`'R:0N' :0 1:0 NN'   J( ``- ) Either execute a function, or compile the xt and a call to the corresponding class handler. This will also work with numbers0/[1f1jump:'' J( ``- ) Compile a jump to another functionQ1J11[]qJJ J( - ) Empty quote1<11while:11  J( q- ) Execute quote until quote returns a flag of1< 22until:22  J( q- ) Execute quote until quote returns a flag of -12<_2t2curry:l2:i2qJ N 'J J( nq-q ) 5 [ . ] = [ 5 [ . ] do ]U2<22take:2:2qJ ' NJ J( qq-q ) 5 [ . ] = [ [ . ] do 5 ]2<22bi J( xqq- ) Apply each quote to a copy of x2<3(3bi* J( xyqq- ) Apply q1 to x and q2 to y3<T3[3bi@3 J( xyq- ) Apply q to x and yL3<33tri:3  J( xqqq- ) Apply each quote to a copy of xx3<33tri*:3:3   J( xyzqqq- ) Apply q1 to x, q2 to y, and q3 to z3< 44tri@3 J( xyzq- ) Apply q to x, y, and z4<?4Q4consqJNT3J J( ab-q ) Create a quote returning two data elements64<44preserve8:4  J( aq- ) Given a variable (a) and a quote (q), preserve the contents of (a) while executing the quote, and restore the original contents of (a) after execution completes. (a) is removed from the stack before (q) is executed.4<55when:5i :5 :5  J( nqq-n ) Execute q1, with a copy of n on the stack.\n\nIf q1 returns a true flag, run q2 and exit the caller.\n\nIf not, discard q2 and return to the caller.\n\nq2 is permitted to discard n, which will alter the stack effect.5<66whend:6i :6& :6  J( nqq-? ) Execute q1, with a copy of n on the stack.\n\nIf q1 returns a true flag, drop n, run q2 and exit the caller.\n\nIf not, discard q2 and return to the caller. / /'' ii /[/ 6<77timesi:77 :7  J( nq- ) Run quote (n) times7<77iterdi:77 :7  J( nq- ) Run quote (n) times and push counter to stack each time. Counts down.7<G8g8iteri:^8p7R8 :c8  J( nq- ) Run quote (n) times and push counter to stack each time. Counts up.:8:8  7 8:88 :8  I&I&8 :88ii:8 i 1 >8<89<each@> J( ...t- ) Hook into **each@** for adding additional types8<H9w9each@:P9 86:Y9 86:b9 :i98 6:p9 868 J( ...t- ) Supercombinator for applying a quote to each item in various data structures.\nProvide one of the following stack forms:\n\n ARRAY: aq-\n BUFFER: anq-\n STRING: $q-\n LIST: lq-\n\nFor LIST, *l* should be a variable pointing to the li:doc>9<::copy::c 7 J( aan- ) Copy n values from source (a1) to dest (a2)|:<::fill::c 7 J( ann- ) Fill (n2) memory locations starting at (a) with value (n1):<1;=;ahead'' J( -a ) Used in conditionals; compiles a branch to be patched in later';/;;if;</[ J( f- ) Exit function if TOS is a non-zero flag;<;;withini J( xlu-f ) Is (x) within lower (l) and upper (u) bounds?;<&<-<variable:' J( n``- ) Create a new variable with an initial value <<p<x<variable&< J( ``- ) Create a new variable with an initial value of 0c<<<<constant J( n``- ) Create a numeric constant<<<<string:z< J( $``- ) Create a string constant<<+=E=allot:7=& :A=:?=' 7  J( n- ) Allocate space in the heap+=  !=<==elementsg=l=7 J( n``- ) Create a series of variablesv=<==decimal  J( - ) Switch **base** to 10=<==hex J( - ) Switch **base** to 16=<>)>octal J( - ) Switch **base** to 8><P>Z>binary J( - ) Switch **base** to 20 >='> v>>:>>c E>:>c 7 -> E><>>toString:>> :>> 2>>>v> J( n-$ ) Convert a number into a string><+?3?clear[ J( - ) Clear the display!?<U?]?space [ J( - ) Display a space character (ASCII 32)K?<??putn> J( n- ) Display a number?<??.parse J( a- ) Class for parsing prefixes?<??parsing?, J( - ) Set most recent function to **.parse** class:2@N 4 ??=@E@__$Y=*@ J( $-n ) Prefix; treat number as hexadecimal (base5@?@@__#=*@ J( $-n ) Prefix; treat number as decimal (base 10)w@?@@__%P>*@ J( $-n ) Prefix; treat number as binary (base 2)@?AA__'N J( $-n ) Return character following '@N7AxAdictsVJ( -a ) Array; used by chained vocabularies and search order codeOX\Y|%%:AAi 2 AA A/A -A<AA%%A J( - ) Close a vocabulary. Use with cautionA</B=B<%>A J( a- ) Open a vocabulary. Use with caution'B<sBB.chain7A/B J( a- ) Class for vocabularieshB<BBchain:'sB,AA J( ``- ) Create a new vocabularyB<BB;chainAA:B :B 2 J( - ) End a vocabularyB< C1C:with7A7A7A=' J( a- ) Add a vocabulary to the search order (by pointer)C<sCzCwith C J( ``- ) Add a vocabulary to the search order (parses for name)jC<CCwithout7A7A J( - ) Remove a vocabulary from the search order C<DDglobal7A J( - ) Remove all vocabularies from the search order, leaving just the global dictionary D<DDfindInChain CIC J( $a-df ) Open a chain (using **:with**) and search for a name. Closes the chain when done.qD<D Ewith|D  Ay I:E C D J( ``- ) Open a series of vocabularies, ending when `` is encounteredD<^E}Erename:++:oE :yE 2 J( a``- ) Rename a function@A\YE7A7A/BEE E:EE :EE 2E E EK:EEE  EEEEEE:EEE :FEK  E+':FEE E FEEEEE:)FE :0FE+  #W?AA__^3F4F6 7F&5F I:hF:\F4F :dF3F 2 :mF  4F?:F6F5F;F :F5FI:F;F6F   6F DFQFpF6F # # f #  RE<FFtempStringFf :FF EF# F:F: F=' J( a-a ) Move a string to a temporary buffermA# #  zFN Gi:GG Gl'G :FG2G :PGGcG  G":bG2G)G :gG      GG jG  -[ F?GG__"GSG:G =G:GSG:G :GG=G  1 ~ J( ``-$ ) Prefix; parse and return a stringGJGG":G" GG sG J( ``-$ ) Parse and return a stringGN&H(HformattedJ( -a ) Variable; toggles whether **puts** uses escape sequences or notp4 :Hn :H 6:H' :H"[ 6:H[ :H[ [ 5[ :Hd :H:H=? oH 6:Ho :H:H>? oH 6:Hx :H:H=? oH 6:Hc :H[ 6:Hs :H&H &H 6[ \:IyH E%:IH E[ H :I[ H9 :4I &H:,IH I  H<>ILIdepth: J( -n ) Return number of items on stack4I<}IIreset>I&I J( ...- ) Remove all items from stackI?U? sI<II.s>I:IJ\n<%d> I I J( - ) Display all items on stack:I U? H9 7A 7AIJ I<J.Jwords &H:*JJ I 4 J( - ) List all names in dictionaryI:WJ :]J  Jkeymap:PREFIXbJQJ Jkeymap:TABLEyJQJ :J`J:JwJ:J& :J  E J<JJgetToken  F J( ``-$ ) Read a string, stopping at first whitespaceJ<K KgetNumberJ J( ``-n ) Read a number from the input streamJ<EKPK:include: J( $- ) Include a file8K<rKyKincludeJEK J( ``- ) Same as **:include**, but parse for file namefK<KKtime: J( -n ) Return the current unix timeK<KLdelayK:KK8 1 J( n- ) Delay for (approximately) n secondsK<9LDLgetEnv: J( a$- ) Get a copy of environment variable $ in buffer.L<LLlater J( - ) Defer execution of caller until a later time'' {L/LLyield''L< 'L< J( - ) Return from a function, with execution resuming from point after **yield** when the function is next calledL<kMMdoc{JJ}docoMymM J( ``- ) Parse tokens up to *}doc* and ignore.\n\nThis is intended as a means of embedding docs into libraries.bM<MNvariables|JJ|Ny 'M J( ``- ) Create a series of variablesMsBNNinternals'JA%%HN<:ZNquoteJ( -a ) Helper function for quotationsON<JNstringJ( -a ) Helper function for stringsJ( - ) vocabulary containing functions used internally by Retro8NsBUPPbuffer'JA%%O N<OOstartO J( -a ) Get starting address of buffer O<MOUOendO J( -a ) Address at end of bufferEO<}OOaddMOO='O J( c- ) Add value to end of bufferuO<OOgetOl'MOO J( -c ) Read and remove value from bufferO<OOemptyOOO J( - ) Remove everything from the bufferO<+P3PsizeMOO J( -n ) Number of values in buffer"P<]PfPsetOO J( a- ) Set buffer to memory address and empty itJ( - ) vocabulary for dealing with LIFO buffersNsBVVstrings'JA%%'AA# #   :Ql'P  : Q:  P:QP :"QP 2P PPQP=' PRPy:OQPP E P<]QsQsearchPQP:lQ*Q7Q 7P J( $$-f ) Search for a string (2) within a string (1); return string starting with substringRQ<QRfindCharP:Q :Q P:R :R Q J( $c-a ) Search for a character within a string; return string starting at the characterQ<pR~RchopFi J( $-$ ) Return a new string, with the last byte removedgR<RRgetSubsetP# :PPPPPPP:PF J( $nn-$ ) Return a subset of ($) starting at (n1) with length of (n2)R<9SRStrimLeft:MS:DS  :JSR 2 1 J( $-$ ) Trim whitespace from left side of string,S<SStrimRightP:S# : :Si: :SP 3F J( $-$ ) Trim whitespace from right side of stringS<STprependP# :P:P:PF J( $$-$ ) Append first string to secondS<3T:TappendS J( $$-$ ) Append second string to first(T<pTTappendCharF:~Tc  J( $c-$ ) Append character to a stringaT<TTtoLowerF:T:TAZ;:T  E H9  J( $-$ ) Convert a string to all upper caseT< U-UtoUpperF:)U:%Uaz;:!U  E H9  J( $-$ ) Convert a string to all upper caseU<dUUreverseF]P:qU 2:zU}O 7OF J( $-$ ) Reverse the characters in a string; returns a new stringXU<UUsplitiiR J( $n-$$ ) Split a string into two partsU<V)VsplitAtChariiiQiR:%VQ  J( $c-$$ ) Search for a character and return two strings (up to and including (c), and after ($2))VJVVsplitAtChar:JNV< J( $``-$$ ) Parse for a character and call **splitAtChar**J( - ) vocabulary with functions for dealing with stringsP?#WGW__^'VI:AWD:=W:5W ::W 26   J( ``- ) Allow direct access to functions in a chainW<WW:needsI&:WJlibrary/WSpRJ.rxW3TEK  J( $- ) Load a vocabulary from the library if not already loaded{W<WWneedsJW J( ``- ) Load a vocabulary from the *library* if it is not already loaded (parsing)WsBXYtypes'JA%%[XNmXARRAYJ( -n ) Type constant for arraysbXNXBUFFERJ( -n ) Type constant for buffersXNXSTRINGJ( -n ) Type constant for stringsXNXLISTJ( -n ) Type constant for linked listsJ( - ) vocabulary with constants for data types. Used with **each@**OX<iYYdescribe%+ +:wY :YJunknown{Y Jclass: %s\nY :Y :YJno documentation providedY  J( ``- ) provide information about a function:Y U?@