.. index:: words4, dictionary, list .. _words4: Words4 ====== words4 sample output. .. note:: This is a non standard Wordlist using Words generated by :ref:`SVD2FORTH`. .. image:: projects/words4/pics/words4.jpg Viewing The Mecrisp-Stellaris Dictionary ---------------------------------------- To view the Mecrisp-Stellaris Dictionary one can use the following Words. Each one has a different format: Words ----- words sample output. :: words ... Address: 0000CDB8 Link: 0000CDDC Flags: 00000030 Code: 0000CDC2 Name: str Address: 0000CDDC Link: 0000CE04 Flags: 00000030 Code: 0000CDE8 Name: strb Address: 0000CE04 Link: 0000CE2C Flags: 00000030 Code: 0000CE10 Name: strh Address: 0000CE2C Link: 0000CE50 Flags: 00000030 Code: 0000CE36 Name: ldr Address: 0000CE50 Link: 0000CE78 Flags: 00000030 Code: 0000CE5C Name: ldrb Address: 0000CE78 Link: 0000CEA0 Flags: 00000030 Code: 0000CE84 Name: ldrh ... List ---- list sample output. "list" is part of the /common/dissasembler-m0.txt and /common/dissasembler-m3.txt files. :: list ... + - 1- 1+ 2- 2+ cell+ negate not shr shl 2* cells 2/ abs u/mod /mod mod / even base binary decimal hex hook-emit hook-key hook-emit? hook-key? hook-pause emit key emit? key? pause serial-emit serial-key serial-emit? serial-key? cexpect accept tib >in current-source setsource source query compare cr bl space spaces [char] char ( \ ." c" s" count ctype type hex. h.s u.s .s words unused registerliteral, call, literal, create does> <, string, allot forgetram compiletoram? compiletoram compiletoflash (create) variable 2variable nvariable buffer: dictionarystart dictionarynext skipstring find hook-find (find) cjump, jump, here flashvar-here then else if ahead repeat while until again begin k j i leave unloop +loop loop do ?do case ?of of endof endcase token parse digit number .digit hold hold< sign #> f#S f# #S # <# f. f.n ud. d. u. . evaluate interpret hook-quit quit eint? eint dint ipsr nop unhandled reset irq-systick irq-fault irq-collection irq-exti0_1 irq-exti2_3 irq-exti4_15 irq-tsc ... List Source ^^^^^^^^^^^ :download:`DOWNLOAD list.fs` .. literalinclude:: projects/words4/code/list.fs Words4 ------ words4 sample output. :: words4 ... nop unhandled reset irq-systick irq-fault irq-collection irq-exti0_1 irq-exti2_3 irq-exti4_15 irq-tsc irq-dma_ch1 irq-dma_ch2_3 irq-dma_ch4_5 irq-adc irq-tim1_up irq-tim1_cc irq-tim2 irq-tim3 irq-tim6_dac irq-tim14 irq-tim15 irq-tim16 irq-tim17 irq-i2c1 irq-i2c2 irq-spi1 irq-spi2 irq-usart1 irq-usart2 irq-cec_can --- Flash Dictionary --- b32loop. b16loop-a. b16loop. b8loop. 4bl. 4bh. 2b. 1b. 15b. b32sloop. bin. u.4 u.2 dump16 dump TEMPLATE ... Words4 Creation --------------- I wanted a neat, four column lister that printed like the listing above, with 20 character wide columns, but also handled Words greater than 20 characters. My "words4" source (based on word.fs above) is below. Words4 Source ------------- :download:`DOWNLOAD words4.fs` .. literalinclude:: projects/words4/code/words4.fs Key Words Used ^^^^^^^^^^^^^^ :: dictionarystart ( - - a-addr ) Current entry point for dictionary search dictionarynext ( a-addr - - a-addr flag ) Scans dictionary chain and returns true if end is reached. ctype ( cstr-addr - - ) Prints a counted string. count ( cstr-addr - - c-addr length ) Convert counted string into addr-length string Words4 Operation ---------------- Words4 utilises the default "dictionarystart and dictionarynext" Words to iterate thru each Word name to the end of the dictionary. Each Word name is printed with "ctype" and the number of characters is determined using "count". As each column is 20 characters wide, any Word of less than 20 characters is 'padded' out with spaces so that it is exactly 20 characters in length. A column counter emits a carriage return after four Word names have been printed. Words greater than 20 characters end the column sequence after they are printed, and normal operation continues on the next line as illustrated by the "--- Flash Dictionary ---" Word above. This code maintains 2 items on the data stack throughout its operation, they are the address of each Word and the column number, so to better understand how it works one should view the data stack after each line with ".s". Reading at my initial 'proof of concept' code below (list4b) may assist the understanding of what is being done. .. _coloured.columns: Coloured Columns ---------------- This version adds colour to the list. .. note:: requires :ref:`colour-term.fs` .. image:: projects/words4/pics/words4c.jpg Words4c ^^^^^^^ .. note:: This is for a Terminal with a WHITE background, change "black" Words for another colour below if you use a BLACK background :: : words4c ( -- ) cr \ A coloured columnar Word list printer. Width = 20 characters. 0 \ column counter dictionarystart begin dup 6 + dup 3 pick \ copy the column counter value case \ NOTE: colours here are for a WHITE terminal BACKGROUND ! 0 of black endof 1 of blue endof 2 of black endof 3 of blue endof endcase ctype \ print word white count nip \ get number of characters in the word and drop the address of the word 20 swap - dup 0 > if \ if Word is less than 20 chars spaces swap \ pad with spaces to equal 20 chars else drop cr \ issue immediate carriage return and drop negative number nip -1 \ and reset to column -1 then dup 3 = if 3 - cr \ if at 4th column, zero column counter else 1 + then swap dictionarynext \ ( a-addr - - a-addr flag ) until 2drop ;