00:00:00 --- log: started retro/10.01.04 04:17:53 --- join: crcx (i=d8012b82@gateway/web/freenode/x-qhhcjzpecutklxms) joined #retro 06:38:14 --- join: Mat2 (i=4d177c24@gateway/web/freenode/x-shzrjhsylctjxlhf) joined #retro 06:38:50 happy new year to all ! 06:40:26 --- part: Mat2 left #retro 06:46:15 js4: can you send me the vm you compiled under cygwin? 06:47:59 sure, how? 06:48:35 btw, you can probably guess 2 of the 3 most popular literals, but if you can guess the *most* popular, you have to tell me *why* it's so popular. 06:49:01 just a sec... 06:50:54 Hmmmm how do you send a pm in irc? I forget.... 06:51:23 Ah... 4th time is the charm ^_^ 06:53:06 js4: send to crc @ retroforth.org 06:53:32 thanks :) 06:56:33 --- quit: crcx (Ping timeout: 180 seconds) 06:57:30 --- join: crcx (i=d8012b82@gateway/web/freenode/x-fhzagvkdbrohnedu) joined #retro 06:57:34 0 and -1 ? 06:57:37 Well... there is a pretty sharp fall off in SLCB size around 6 or 7 instructions. But I suspect a bug in my code right now (you have the latest and greatest btw). There are too many blocks 0 long for me to trust it. 06:57:56 0 and -1 are about tied, and are tied for second/thrid place. 06:58:18 what is the most popular? 06:59:11 And it is *twice* as popular as 0 or -1. It's 6. 07:00:24 how are you determining this? 07:00:41 something like 40% of the constants are 6, 20% are -1 20% are 0, and the other 20% are all over the place. with an interesting peak at 3584 and 127... 07:00:51 every time a lit instruction runs, I peek at the value. 07:01:19 if (VM_LIT == opcode) 07:01:19 { 07:01:19 int lit = vm->image[vm->ip + 1]; 07:02:04 what forth code are you running? 07:02:13 rebuilding the image file 07:02:30 doesn't make any difference though. even when I run my ll test 6 is the winner. 07:02:35 what opcode is 6? 07:02:48 pop 07:03:03 yup 07:03:21 hmmmm... strange.... I wouldn't bet money on it yet. I suspect bugs still... 07:03:31 6??? *why*????? 07:04:15 has to be a popular constant scanning the dictionary is all I can guess... 07:04:55 like from nf to link is 6 cells or something... I know that's not it, but something like that maybe... 07:06:12 it's used in keepString and .. 07:06:24 err, . 07:06:26 that would do it. every string 07:07:01 yup 07:08:29 3584 -- address of TIB 07:08:51 it's like maybe the 4th or 5th most popular constant? 07:09:24 possible. I've never tracked the frequency of constants 07:11:09 yep, it's about #4. Almost everything else is "noise" if it's not 0, -1, 6, or 3584. Actually 3584 is not so far behind 0 and -1. 35K uses to 46K for 0 to 65K for -1 to 130K for 6 07:11:44 1 comes in at 9k... 07:12:29 ooops, multiply every thing I just said by 10... sorry... 07:13:19 1.3meg: 6, around .5 meg: 0, -1, TIB, and around .1meg 1 07:14:09 I bet there is a nice speedup lurking in your string code. Make that 6 a 0 somehow. 07:16:46 [crcx/retro10] 460d0e: eliminate a push/pop in keepString 07:16:59 try this patch and see if it works 07:17:20 6 is involved with push/pop???? 07:17:26 * js4 git pull 07:18:29 hmmmm all I got was style.rst... 07:18:44 it changes core.retro 07:19:17 js4: the only other significant place 6 is used is in 'for' 07:19:44 Oh... I forgot... I have to mess with the website, I can't just pull... 07:19:49 holdon, loging in... 07:20:37 for/next has 6 as a literal, but I can't eliminate that 07:25:47 [js4/retro10] 6f6608: fix to ifDefined / ifNotDefined 07:26:47 no obvious impact... let me do some math and see what changed... 07:28:58 You cut it down from 1.300 million to 1.299 million v.v 07:29:49 can you track the address it occurs at? 07:30:24 for has a 5, not a 6. 07:31:00 oh 5 == push, 6 == pop... 07:31:01 next has the 6 07:31:04 next has the pop 07:31:58 but that would mean 5 and 6 should be about tied if for was the cause of it. 07:32:22 and 5 is way down 07:32:25 times used | literal value 07:32:25 1 | -4 07:32:25 1 | -3 07:32:25 1 | -2 07:32:25 651712 | -1 07:32:26 461783 | 0 07:32:28 88832 | 1 07:32:30 28108 | 2 07:32:32 30074 | 3 07:32:34 5933 | 4 07:32:36 4693 | 5 07:32:38 1300390 | 6 07:32:40 that's before your change 07:32:53 here's after: 07:32:54 times used | literal value 07:32:54 1 | -4 07:32:54 1 | -3 07:32:54 1 | -2 07:32:54 651381 | -1 07:32:55 461562 | 0 07:32:57 88799 | 1 07:32:59 28096 | 2 07:33:01 30065 | 3 07:33:03 5930 | 4 07:33:05 4691 | 5 07:33:07 1299734 | 6 07:33:14 and that lit only runs when you compile a for/next. 07:35:55 yeah, I'll go find out what address the 6 is at hold on... 07:45:48 grrrrrr.... this is being tricky.... 07:46:21 how so? 07:46:58 848 07:47:51 well, as popular as it is, it isn't ever used 3 times in a row at the same place. So I had to hack something that quit as soon as it was used 1000 times at one place. 848 is probably the place. 07:48:12 100000 actually 07:49:31 yeah, pretty sure it's at 848. What's there? 07:51:27 compare 07:51:45 string compare... dictionary search. 07:51:57 6 being the address of the flag variable 07:53:02 I was just gonna ask that... 07:54:19 flag is used in several words in core.retro, which explains it 07:54:34 looks like you can keep it on the stack for compare... 07:55:06 hmmmm let me think about this... there is nothing wrong with being a popular variable.... 08:00:36 really be nice to have a and b registers like in color forth huh? 08:01:07 that's what they are made for... @+a @+b .... 08:04:26 2dup @ swap @ 2swap 1+ swap 1+ swap 2swap 2dup + 0; =if .... 08:04:55 0; drop =if 08:12:11 2dup @ swap @ 2dup !if 2drop 2drop 0 ;; then + 0 =if drop ;; then 1+ swap 1+ swap 08:12:16 that's the loop 08:13:11 for compare? 08:13:12 ( $$-a match | $$-0 nomatch ) 08:13:16 yep 08:13:48 0 terminated strings? 08:14:29 yes 08:14:50 doc/RetroLanguage.rst is not being rendered when I browse to it in github for some reason. 08:14:50 2dup get-set 2dup !if 2drop 2drop 0 ;; then + 0 =if drop ;; then next-set 08:15:05 * docl leaves for work in 4 minutes 08:15:26 I'll test my string compare and have it for you when you get back. with no flag 08:16:42 working with zero terminated strings is a lot more fun. 08:17:40 the fact that they take up only one stack space is certainly a plus. 08:17:47 docl: I know. I'm trying to find out why it's not being renderd 08:18:33 although you could do that with a variable that stores the count, with the string allocated immediately afterward. 08:18:45 counted strings are a big advantage in string compare. first check the lengths, then run a for loop if the lengths are equal. bail from the for with failure, or fall out with success 08:19:45 I have to learn about temp strings in forth now so I can test my compare. 08:19:51 btw, Hi Doc! 08:19:57 or bye... 08:20:02 : type ( $- ) dup @ swap 1+ over for 2dup + emit next 2drop ; or some such 08:20:08 :) 08:20:31 * docl is not a doctor in real life, although I plan to get a doctorate at some point. 08:20:52 see ya 08:20:54 I am abdt-phd. 08:21:06 abdt? 08:21:10 all-but-dissertation-topic-phd 08:21:14 awesome 08:21:29 decided I didn't like writing papers nearly as much as writing programs ^_^ 08:21:36 closer than me, I've been in the first couple years of college for like 5 years 08:21:41 :) 08:21:58 lol, I loved grad school though. Not the papers, but all the rest. 08:35:37 js4: thans 08:35:49 it working for you? 08:35:53 js4: I just pushed a new compare based on your implementation 08:36:03 coolo! 08:36:16 * js4 pokes web and pulls git 08:37:46 [crcx/retro10] fdd629: new "compare" that doesnt use "flag"; based on cod... 08:39:43 I reallized you can go faster still... you don't have to do 1+ swap 1+ swap. You can leave out the last swap. 08:43:01 js4: thanks 08:43:23 you are welcome. I have some funny bug that's crashing retro though... still investigating... 08:43:29 can you run the constants analysis again and provide current numbers? 08:43:43 sure, hold on a sec... 08:43:45 [crcx/retro10] e2d642: slightly faster compare; thanks js4 08:45:55 [js4/retro10] 6a6a63: new "compare" that doesnt use "flag"; based on cod... 08:46:10 hmmmmm 08:46:53 times used | literal value 08:46:53 1 | -4 08:46:53 1 | -3 08:46:53 1 | -2 08:46:53 329483 | -1 08:46:53 476996 | 0 08:46:55 88359 | 1 08:46:57 27933 | 2 08:46:59 29889 | 3 08:47:01 5885 | 4 08:47:03 4664 | 5 08:47:05 *giggle* 08:47:07 962 | 6 08:47:09 66 | 7 08:47:11 9216 | 8 08:47:13 17504 | 9 08:47:15 19815 | 10 08:47:17 Yay!!! 08:47:38 that takes care of the the 6's :) 08:47:52 the hmmm was cause the first time I built it it was still using the old def even while creating the new. 08:48:12 I don't think there's much to do about TIB 08:49:07 9216 | 8 08:49:07 17465 | 127 08:49:07 17465 | 13 08:49:07 17465 | 557 08:49:07 17504 | 9 08:49:07 19815 | 10 08:49:09 20221 | 556 08:49:11 24718 | >4096 08:49:13 27933 | 2 08:49:15 29889 | 3 08:49:17 30401 | 490 08:49:19 32210 | 637 08:49:21 88359 | 1 08:49:23 322688 | 3584 08:49:25 329483 | -1 08:49:27 476996 | 0 08:49:29 times used | literal value 08:49:33 looks like a reasonable distribution to me now 08:51:22 476996 | 0 ? 08:53:02 what's wrong with that? 0 is a popular number. 08:53:15 ok think I found the crash bug... 08:53:27 : zl s" " ; 08:53:39 0 length string 08:54:19 then dies as soon as it sees the nest ." 08:54:22 sorry, I misread that 08:55:05 if I define : zl s" " ; it works, no crash. if I define : zl s" " ; then it crashes while compiling a large word. 08:55:37 the parser expects strings to have a length of at least 1 character 09:00:46 oh, now I see why you kept the second swap in next-set... for strlen. clever. 09:01:09 I moved the second swap out in strlen to make compares faster 09:02:02 and I bet over all it will go faster if you don't do the second 2dup, but repeat the get-set. Most strings aren't very similar. 09:02:28 2dup get-set !if ... then get-set +..... 09:03:22 2dup get-set !if 2drop 0# ; then get-set ... rest the same ... 09:03:32 really, just ";" not ";;" ?? 09:04:48 ; in the metacompiler 09:07:18 ooo do you have @+ in the vm ? 09:07:30 no 09:07:49 @+ and !+ are strong possibilities for adding in the future 09:08:08 ok... the more I think about it the more painfull the stack juggling gets... 09:08:28 x y @+ uhhh... ummm.... rot? 09:08:53 ? 09:09:31 I want to do @+ to x and keep the result from the @+ on y. don't really wanna push swap @+ pop but I could I guess 09:10:37 repeat @+ push swap @+ pop 2dup !if ............ -1 # ; again 09:11:16 @+ rot @+ rot 2dup ?? 09:11:29 or -rot... never can remember 09:12:25 x y @+ --> x y+1 z 09:12:49 x y @+ rot --> y+1 z x 09:12:53 @+ rot @+ -rot 09:13:15 no that's not either... like I said... stack juggling. 09:13:25 gimme a and b registers in my forth please! 09:13:45 use variables :) 09:14:24 x a! y b! repeat @+a @+b 2dup if ................. -1 # ; then again 09:15:06 yeah, chuck reccomends that. That's how literals like 8532 get popular. 09:15:07 variable a : a! a ! ; : @+a @+ a ! ; ...... 09:15:34 registers are just hardware level variables 09:15:40 yep 09:18:08 think my dream cpu will have @+a @+b !+a !-b so you can copy, copy with reverse, and compare. 09:18:53 meh... go look at statistics some more... 09:19:11 a 0, and -1 instruction... or a short literal looks pretty good right now... 09:21:03 Oh! THat's why 0 length SLCB is so popular. call 123, call 234, call .... 09:22:02 times seen | straight line code length 09:22:02 3643113 | 0 09:22:02 1653811 | 1 09:22:02 1111503 | 2 09:22:02 70153 | 3 09:22:03 779920 | 4 09:22:05 718211 | 5 09:22:07 1412907 | 6 09:22:09 20808 | 7 09:22:11 10738 | 8 09:22:13 252 | 9 09:22:15 1 | 10 09:22:17 1 | > 32 10:04:41 Hmmm next version of the image file, I have some ideas... 10:05:07 a: put a byte order mark in it so you don't have to pass an argument, it swabs if it has to. 10:05:35 b: break file into length-type-data chunks. 10:05:59 c: so that you can have a big image, but small file. Sparse file stuff. 10:08:21 d: don't save the first 64 bytes of the memory image. fill them with 1f 1f 1f. Then make 1f be a jump instruction. Falling anywhere in there will jump to 1f and at 20 have the address of a "catch problems" word. Put the start address at the first saved bytes. Maybe at 64 decimal. 10:08:27 Just some ideas... ^_^ 10:12:06 future versions of ngaro will support compressed images which will help with the size issue 10:15:08 good idea. the sparse technique was just a first step in that direction. Also would let you more easily jam block files onto images. cp image_original block_header block_file block_header block_file > image_to_use. 10:15:27 and then make the loader unpack the block files from 1 char/byte to 1 char/cell. 10:16:25 like all software -- it's forgotten, or has an infinitely long feature request list ^_^ 10:20:34 js4: upload a file with notes on ideas for future image formats to the mailing list 10:21:03 mailing list? oh... not a bad idea... 10:22:19 http://groups.google.com/group/retro-10 10:22:36 oh... google v.v 10:31:40 the mailing list makes a good long-term archive, and google provides support for uploading files 10:42:00 hmmm which do you prefer if (!foo) or if (! foo) ? do you care? 10:42:58 either works 10:43:06 ! foo is more readable IMO 10:43:08 I like the idea of a mailing list, I just don't liike google much these days. They are getting too nosey. 10:43:19 ok (! foo) it is. 10:43:57 google is into everything now. but the mailing list works well enough. 10:49:53 [js4/ngaro] b2e429: Collect stats for SLCB and literals 10:50:46 Hmmm 3 todos left for sure: read existing stats file and update it, track stack size distributions, track length of jumps (my own suspicion is short jumps are very common, others are very rare.) Maybe also track call distances, time executing, and even "hot addresses" since they will point at foth you might want to speed up. 10:52:45 oh, and maybe control over which of these stats you want it collecting. Hot addresses and hot lits does seem like a good tool to profile the forth code. Opcode frequencies and jump distances are the kinda thing only I am probably interested in. 10:53:58 oh yeah, and gotta put over, nip, rot, !+ !- @+ and @- into the vm. Just to see how frequent they would be if they were instructions. I already know over is very popular. 10:55:01 maybe make the traditional if in too. (zbranch, or jeqz) I know I would have used it if it were a primitive in that string compare. 10:56:02 VM_EQZ_JUMP, VM_OVER, VM_NIP, VM_ROT, VM_NROT, VM_STORE_INC ... 10:56:46 [crcx/ngaro] 002217: Add --opstats [file] to console vm 10:57:29 oh yeah, that check in also cleans things up a bit. 10:57:46 I should be matched to your code nw 10:57:48 *now 10:59:23 maybe worth pulling it out into a separate file is a good idea... idunno. The reason I am doing all this is cause I want to find out the "best" opcode set for a forth cpu. And for a forth VM implemented in software. Slightly different, but similar concerns. And that's all about going fast with little code. And that means I don't want to slow the VM down more than I have to... I hated pulling all that code into a 10:59:23 function... I *nearly* made it a macro. 11:00:46 [js4/wheke] 8ff8e5: safety net: now reset initial jump on save 11:03:01 Hmmm... maybe I will do an elisp version of ngaro... 11:04:26 if you do, I 11:04:33 I'd like to include it in the repo 11:04:41 ok, gonna take a break for a bit... don't think I broke the build, if I did I apologize. 11:05:21 Sure, if I do it I'll be happy to contribute it. I have actually started on an ITC forth in elisp, code words written in lisp. 11:06:10 This is next... (setq flw (ta2cfa flip) 11:06:10 flip (nextta flip) 11:06:10 flx (cfa2ca flw)) 11:06:10 (funcall flx) 11:06:20 was thinking about doing fig forth kinda... 11:07:14 sadly it's gotta be subroutine call, not jump in the next. 11:08:06 oh that *does* remind me. I do know how to make the ngaro.c be a real direct threaded implementation. Not too hard actually, though would need to make a little change in the meta compiler. 11:08:17 ok, break time. bbiab! 11:09:23 (defcode sqrt (rplaca fld (sqrt (car fld)))) 11:09:23 (def: square dup star ret) 11:09:23 (def: dist sub square push sub square pop add sqrt ret) 12:17:55 --- join: arti4-92 (n=chatzill@actt162.neoplus.adsl.tpnet.pl) joined #retro 12:18:10 hi arti4-92 12:18:18 hi crcx 12:18:40 my english is poor :P 12:19:37 that's ok 12:20:31 --- join: arti4-92_ (n=chatzill@actt162.neoplus.adsl.tpnet.pl) joined #retro 12:20:45 --- quit: arti4-92 (Nick collision from services.) 12:20:50 --- nick: arti4-92_ -> karti4-92 12:20:54 --- nick: karti4-92 -> arti4-92 12:21:53 --- join: arti4-92_ (n=Arti4-92@actt162.neoplus.adsl.tpnet.pl) joined #retro 12:21:56 --- quit: arti4-92 (Nick collision from services.) 12:22:07 --- nick: arti4-92_ -> arti4-92 12:23:39 --- join: arti4-92_ (n=Arti4-92@actt162.neoplus.adsl.tpnet.pl) joined #retro 12:23:45 --- quit: arti4-92 (Nick collision from services.) 12:23:54 --- nick: arti4-92_ -> arti4-92 12:25:42 --- part: arti4-92 left #retro 12:33:20 * crcx will be working late tonight 13:02:27 whatcha workin on? 13:05:24 inventory 13:25:43 --- join: erider (n=chatzill@unaffiliated/erider) joined #retro 13:26:38 hi erider 13:27:02 Hi erider 13:27:32 js4: this is the busiest time of the year for me at work :( 13:30:39 hi guys 13:32:00 v.v Well, at least they pay ya... I'm lookin for work myself. 13:54:12 hey crcx 13:54:41 yes? 13:54:46 I can't remember what this notation means in asm [edi] 13:55:30 contents of memory address that edi points to 13:55:58 yeah that is right 13:56:04 damn 13:56:43 crcx what about [edi+ecx] 13:57:56 DWORD PTR [edi+ecx] 14:00:18 same thing. edi = base addr, ecx = offset 14:00:38 probably for an array calculation or similar 14:03:07 crcx so the contents of what is located at addr_base+offset 14:05:09 yes 14:06:55 thanks 14:08:13 no problem 14:08:23 bbl 14:08:29 --- quit: crcx ("Page closed") 15:02:35 back 15:02:38 home now :) 15:03:13 cool 15:03:39 welcome back (home)! 15:04:03 Sorry, I obsesed a little and got I think a good speed up to compare... this is tested code... 15:04:06 : comp ( $$-f ) 15:04:06 repeat 15:04:06 over @ over @ 15:04:06 over !if drop drop dup xor ;; then 15:04:06 0 =if drop dup xor 1- ;; then 15:04:06 1+ swap 1+ 15:04:08 again 15:04:10 ; 15:04:36 it is the same size as compare, but makes many fewer calls 15:05:02 hey crc when you guys talk about context are you talking about scope 15:07:37 js4: less readable though 15:07:40 I know it's not half as pretty, but it is the inner most loop of the interpreter, it deserves attention. 15:07:47 *much* less readable. 15:09:56 I don't know what context you refer to erider. 15:11:36 nevermind 15:11:41 also, it is *that* string compare that is the reason adding over as a primitive is such a big win. 2dup is "call xxx ( call yyy ( push dup pop swap ; ) call yyy (...) ; ) " 15:12:07 : 2dup over over ; 15:12:14 : over push dup pop swap ; 15:15:53 * crc has never claimed that ngaro is a particularly efficient vm 15:16:51 nope, but that's what I'm kinda interested in. making a small cpu (real hardware) and a forth to go with it. Making it fast enough to be "usefull". 15:17:42 which probably mean I'll need network hardware and to write atleast irc and maybe some lynx-ish web browser maybe... dunno.. we'll see. huge project. 15:17:50 running for over a year now. 15:27:41 hmmm infact I bet it's that same loop that's one reason colorForth uses the funny pre-parsed-and-tokenized source. 15:28:31 probably 15:28:50 a hashed dictionary would be faster, but I like the simplicity of the linked list used now 15:29:14 if I ever get a chance to do a hardware implementation, a lot will be done differently 15:29:59 well you could get a 4x speed up by just packing and padding strings. 15:30:14 and the compare function wouldn't change. 15:30:18 * crc is content with the current speed 15:30:54 * js4 will go find out what the most popular addresses to call are. 15:32:39 and as for hardware... an fpga based cpu with limited memory is around $300 or so. 15:33:06 course, you have to program the fpga to *be* your favorite cpu... 15:33:16 * crc doesn't have $300 and likely won't for several months at best 15:33:37 I don't even have income v.v 15:34:01 I make enough to cover my needs 15:34:12 but it would be cool to build ngaro2 cpu, admit it! 15:34:17 yes it would 15:34:21 ^_^ 15:34:28 I hope to do so one day 15:34:57 I'll be happy to share what little I know if you ever go there... meanwhile.. hmm easy fast way to find popular call targets... 15:35:58 I've already created verilog source for one forth cpu. Only tested with a simulator though. It's fun, and free. 15:36:58 back in like 15-20... 15:55:10 back 15:55:18 hi erider 15:56:53 h 15:56:54 i 15:59:35 back too, hi again erider 15:59:46 hi 16:23:15 easy way to convert decimal addresses to the word name? 16:24:32 look at the code for the decompiler (source/stage3.retro) 16:25:01 or hack 'words' to give a list of names + addresses (easy) 16:40:05 : words-with-addresses last repeat @ 0; dup d->name type dup d->xt @ . cr again ; 16:43:35 well... I can find many of them, but not all of them are in the dictionary with names... and there's not much news v.v 16:43:46 17465 | 603 -- key 16:43:47 17465 | 629 -- ekey 16:43:47 24863 | 504 -- emit 16:43:47 26709 | 491 -- redraw 16:43:47 27209 | 5179 -- .does -- does> 16:43:47 29681 | 4561 -- variable--constant 16:43:49 32809 | 12613 -- ??? 16:43:51 33025 | 12559 -- ??? 16:43:53 33873 | 12347 -- ??? 16:43:55 34009 | 12313 -- ??? 16:43:57 42329 | 107 -- wait 16:43:59 125593 | 11 -- ??? 16:44:01 319220 | 732 -- d->name 16:44:03 319220 | 821 -- compare 16:44:05 335726 | 808 -- ( -- compare 16:44:07 636443 | 128 -- 2drop 16:44:09 671452 | 159 -- 2dup 16:44:11 1345676 | 121 -- over 16:44:13 frequency on the left, address and word or braketing words on the right. 16:44:15 with a few exceptions 16:44:54 12613, etc are outside the core space after the image is built 16:44:59 I am guessing I know the names of 3 instructions to add 16:45:39 2drop, 2dup, over :) 16:46:44 yep. I'll go add them later tonight I think. 16:47:14 I am debating about checking this code in though... maybe commented out. Unlike the other stats this one noticeably slows processing down. 16:47:49 I need a better test case than "build the image" v.v 16:48:11 js4: are you working on adding new words for rretro 16:48:19 we need a comprehensive test suite for the words in the image too, but test code is horrible for profiling. 16:48:29 or examples 16:48:33 erider: he's analyzing retro 16:48:37 I will add those 3 words to the vm so I can see where they stack up. 16:48:43 erider: word usage, etc 16:48:55 I don't plan to change the vm, just an experimental branch maybe? 16:49:04 makes sense 16:49:09 ok 16:49:25 my big goal is "what is the minimal instructionset for a forth cpu that doesn't stink?" 16:49:41 I wasn't sure because I came in late on the conversation 16:50:21 I *know* I can get away with only 16 instructions, but it is right on the edge of the tar pit. I *know* 33 is more than enough, many many forth cpus and vms have about that number. c18 has 33. 16:51:15 the chosen set in ngaro was based on my earlier experiences with retro, back in the 7.x days 16:51:55 but the demands on a cpu and on a vm are different. In a vm it makes sense to go to 64 instructions even. you want as much as reasonable going on in the vm rather than in forth. 16:52:54 js4: crc does a lot of stopping and starting of the parse/compiler to perform a lot of his magic :) 16:53:31 in a cpu I am building myself I want the simplest, fewest instructions that doesn't stink. silicon is harder than C (for me.) 16:53:43 erider, what do you mean? 16:53:52 js4: I understand completely 16:54:36 ' ['] ` etc 16:54:46 vm you want an instruction like "read block from a disk file". cpu you want "write to an output port" if you are gonna do ports... 16:54:47 immediate 16:55:01 yeah, but that's just how compiling in forth works. 16:55:32 that "over" that get's called so much? about 90% of it's work is doing string compares I bet. 16:59:21 808 is either next-set or get-set 16:59:47 probably get-set 17:00:22 so, surprise, rebuilding the image means the dominant thing you are doing is searching the dictionary. 17:00:42 what the heck is 11 though... 17:01:52 11 should be part of the strings 17:02:11 I bet it's okmsg 17:03:20 nope, okmsg is at 31... 17:03:54 11 is the O in RETRO 10 17:03:59 copytag??? no way, no match, maybe... 17:04:02 11 is a bug! 17:04:40 if it calls to 11, the vm should exit 17:05:49 what are you guys talking about 17:06:00 I agree, along with those like 12000 addresses... /me reads the code somemore... 17:09:02 --- quit: crc (farmer.freenode.net irc.freenode.net) 17:09:51 I got a list of what addresses are called most frequently. trying to figure out what words they are... and where the bug must be in my code that made the list. 17:16:30 --- join: crc (n=charlesc@c-68-80-139-0.hsd1.pa.comcast.net) joined #retro 17:16:30 --- mode: irc.freenode.net set +o crc 17:17:32 * docl is back 17:18:07 wb doc! 17:18:22 uninitialized memory is the source of the bug *blush* 17:19:43 * docl has been walking to/from work 17:19:57 a positive lifestyle change brought about by the death of a transmission 17:20:33 Yay for health! (boo for broken cars v.v) 17:21:30 yep 17:21:57 my wife decided to stay in idaho for a while to take some classes. there's plusses and minuses to that as well. 17:23:00 certainly more time on my hands uninterrupted :) 17:24:11 * docl is looking at your recent changes 17:24:38 Yay for code reviews! 17:31:34 OK, at this point I am convinced there is real code up at 12000. 17:33:47 ok 12347 17:33:47 ok addr 17:33:47 ok ! 17:33:47 ok (see) 12347 Unknown: 7522 17:33:47 12348 ! 17:33:47 12349 call 7539 17:33:49 12351 call 7539 17:33:51 12353 lit 32 17:33:53 12355 call 704 ( accept ) 17:33:55 12357 lit 3584 ( tib ) 17:33:57 12359 call 12053 17:33:59 12361 ; 17:34:01 ok 17:34:58 something to do with the meta-compiler is my only guess... 17:35:08 : next-set ( ab-cd ) 1+ swap 1+ ; <- would ( ab-dc ) be clearer? 17:37:51 that looks like "32 accept tib getLength" 17:38:08 in other words, get a word from the prompt and make a counted string from it 17:39:14 js4: where did that code come from 17:39:25 lit, call etc 17:40:25 erider: see generates those based on numbers in the memory 17:40:50 they are actually ngaro opcodes 17:40:53 ah its the code the retro compiles too 17:40:55 to* 17:41:01 yep 17:41:28 yes, that is a dissasssembly of some random address outside the dictionary. retro is so popular it's already got viruses! eep! 17:42:13 js4: I'm thinking those codes were created during metacompilation, it's likely a dupe of something defined elsewhere 17:42:15 No, those must be some part of the meta-compiler. And the kernel I used to decompile those addresses wasn't exactly the same as the one that generated my list of interesting addresses. 17:43:25 I made the vm track the target of every call instruction, and those are some of the most popular call targets when rebuilding the image of retro using the metacompiler. 17:44:33 But it doesn't really say much v.v When I run it on my linked list test 1: I get no funny 12000 addresses, 2: the hot addresses are almost the same otherwise. And they are all in the text input/output/dictionary scan. 17:44:48 11869 | 629 -- ekey 17:44:48 11870 | 558 -- (remap-keys) 17:44:48 11870 | 569 -- 17:44:48 11870 | 603 -- key 17:44:48 12348 | 504 -- emit 17:44:48 12563 | 491 -- redraw 17:44:50 14879 | 814 17:44:52 24220 | 107 -- wait 17:44:54 111435 | 732 -- d->name 17:44:56 111435 | 821 -- compare 17:44:58 126160 | 808 -- ( -- compare 17:45:00 222010 | 128 -- 2drop 17:45:02 252320 | 159 -- 2dup 17:45:04 507806 | 121 -- over 17:47:17 569 is probably ws, a word in the source but not exposed in the dictionary. 808 is part of string compare. 814 is probably also part of compare. 17:51:14 so basically all I learned was : strongly consider over, 2dup and 2drop for inclusion in the vm opcode set. (From previous experiments if you need to make space, eliminate some of the branch opcodes I sugest.) Also learned that string handling, and mainly string comparison, is the most used part of the code in my tests. 17:52:07 makes sense 17:52:12 Anyone have some other test cases? Say 3d rendering? climate prediction? web browser?? anything??? 17:52:22 with a forth, you can't have it work without scanning the dictionary 17:52:40 you could look in forthlets 17:52:43 only if you are doing lots of compiling. 17:53:36 what are they? Where are they?? 17:54:17 http://github.com/crcx/forthlets 17:54:26 examples and applications 17:57:29 crcx: and docl: do you know "wicrowriter" ? 17:58:47 * docl doesn't 17:59:13 microwriter? 17:59:45 microwriting is one of the chording standards that was/is popular. I learned it and implemented software to do chording under dos, then windows 3 and 32. 17:59:57 nifty 18:00:29 so what is it, 6 keys? 18:00:32 I forget lots of letters right now... 18:00:40 sorta 5 sorta 7 18:01:09 most typing is done one handed on 5 keys. sometimes the thum will hit a funny thumb key. 18:01:11 recording pushing multple keys simultaneously is hard to do portably, unfortunately 18:01:38 http://www.bellaire.demon.co.uk/bellaire_cykey_about.html 18:01:54 http://www.bellaire.demon.co.uk/bellaire_microwriter_agenda.html 18:02:22 it was a truely awesome computer for it's day. it is amazing to type 35-40 wpm one handed. 18:02:28 with your eyes closed 18:02:42 cool 18:02:56 it will make more sense if you look at the second link -- the think about 5/7 18:04:05 interesting 18:04:26 http://www.bellaire.demon.co.uk/bellaire_cykey_codes.html 18:04:40 that's the chord set. It's pretty good, though you can invent better ones. 18:07:40 ok, I guess I'll have to write tetris and pacman for retro now... 18:08:01 about time someone did that :) 18:10:24 I'd actually rather see block words, and a nice forth "ide" built. If I can volunteer y'alls time ^.~ 18:11:10 and maybe a colorForth using ansi escape sequences... 18:11:29 rebuild the whole thing... colorforth on ngaro *giggle* 18:12:20 personally I still wanna learn a few more things about opcode usage and stuff... then I'll pick a real forth project to do stop messing with C for a while. 18:15:05 yeah, seems like colorization would be a neat effect 18:17:32 * docl thought we had that a while back 18:18:26 if you have the right terminal emulator, or right vm there is already color. 18:21:29 cool! 18:27:37 : ansii 27 emit char: [ emit 32 accept tib type ; 18:27:37 ansii 1;31m 18:29:01 --- quit: erider ("ChatZilla 0.9.86 [Firefox 3.5.6/20091201220228]") 18:30:58 ^_^ 18:49:30 : fg 27 emit s" [1;3" type 48 + emit char: m emit ; 18:49:31 : bg 27 emit s" [1;4" type 48 + emit char: m emit ; 18:50:44 s/1;// 18:50:44 "red fg purple bg" is the usage pattern? 18:50:58 exactly 18:51:02 coolo! 18:52:05 : bold 27 emit s" [1m" type ; 18:52:05 : fg 27 emit s" [3" type 48 + emit char: m emit ; 18:52:05 : bg 27 emit s" [4" type 48 + emit char: m emit ; 18:52:43 : bold ( - ) 27 emit s" [1m" type ; 18:52:43 : fg ( n- ) 27 emit s" [3" type 48 + emit char: m emit ; 18:52:44 : bg ( n- ) 27 emit s" [4" type 48 + emit char: m emit ; 18:54:33 what were the colorforth conventions again? 18:55:06 RED is : red 18:55:21 GREEN is : foo green green ; 18:55:57 see the end of http://colorforthray.info/ 18:56:41 * docl just went there :) 18:57:25 In colorForth a new word is red, green words are compiled, yellow executed. 18:57:33 white comments 18:58:24 http://colorforth.com/parsed.html bottom half has details 18:59:15 : RED green [ yellow ] green ( white ) ; and some other stuff too... 19:00:49 BLUE is executed at edit time. Words include CR BREAK TAB ... maybe some others. 19:02:11 : norm ( - ) 27 emit s" [0m" type ; 19:02:11 : bold ( - ) 27 emit s" [1m" type ; 19:02:11 : fg ( n- ) 27 emit s" [3" type 48 + emit char: m emit ; 19:02:11 : bg ( n- ) 27 emit s" [4" type 48 + emit char: m emit ; 19:02:11 : r bold 1 fg ; 19:02:13 : g norm 2 fg ; 19:02:16 : m bold 5 fg ; 19:02:43 now, fix see. 19:02:50 make an editor ^_^ 19:06:38 back 19:06:40 woah, you do some of the work :) 19:06:47 hi crc, welcome back! 19:07:03 * docl has been fiddling with ansi sequences 19:07:25 of course they're terribly nonportable :( 19:07:37 lol! Hey, I found the web pages didn't I? 'sides I'm gettin ready to check in the call tracking code with "--callstats" option defaulting to off even when you do "--opstats" 19:09:00 how do you do that? 19:09:22 do what? 19:10:14 if ((VM_CALL == opcode) && (call_count)) 19:10:14 { 19:10:14 int target = vm->image[vm->ip + 1]; 19:10:14 /* maybe call realloc */ 19:10:14 call_count[target] += 1; 19:10:14 } 19:14:19 is this in ngaro? 19:14:42 docl: soon 19:14:58 the opstats code is there now, but not the callstats 19:15:22 yep about to commit now... 19:17:34 ok, on the way. 19:17:55 [js4/ngaro] bcb1c0: Add --callstats default off track call targets fre... 19:17:55 [crcx/ngaro] bcb1c0: Add --callstats default off track call targets fre... 19:18:16 it feels like a pretty big speed penalty to run with --callstats, maybe you run at half normal speed? dunno. it's slow 19:19:08 and unless we get some new testcases, it's only gonna tell us "hey, searching the dictionary takes a lot of time when you are compiling. I gotta do it every time you type something!" 19:19:13 js4: still faster than with --trace though 19:19:29 yes :-S Trace is *slow* 19:20:08 "You want me to look up every *single* word? wow! man!!..." 19:20:44 "Uh... maybe you could like, just use more spaces? the spaces are pretty easy." 19:21:44 Actually, a colorListen shouldn't be too hard... what did you do in colorRetro crc: ? 19:22:55 http://github.com/crcx/colors/blob/master/colors.retro 19:23:06 I bet there's not much stopping you from applying my changes to another C bassed vm. I haven't dont it cause I can't test other platforms. 19:23:39 I saw that crc, 'spose I could read it more closely this time... 19:23:42 * js4 clicks 19:24:07 I've not looked at the code in quite a while 19:25:20 ooh, snazzy 19:25:23 it's a custom interpret loop, with (remap-keys) used to set the interpreter behavior based on particular key sequences 19:25:45 console only, not compatible with canvas-based vms (no sdl or js) 19:29:05 what is 96? 19:29:20 oh ` ? 19:31:15 ok, gonna make some food, afk a while... 19:32:21 ESC$, clever 19:33:12 this was written before char: was added 19:34:19 well it is a string, so it makes sense that it uses s" 19:35:00 oh, the 96 19:35:20 and the 49..54 19:42:21 well... it is colorful... 19:45:22 oh, that's interesting... "js4 (committer)" does that just mean I'm me looking at one of my forks? 19:48:27 where do you see that? 19:49:45 when I look at http://github.com/js4/wheke 19:51:27 * docl sees it too 19:51:44 I think that means you committed it 19:51:49 js4: that's from a patch you pulled from my repo 19:51:57 I'm the author, but you commited it to your repo 19:55:26 ok... that's the only uh... blob I added files to. The other two, ngaro and retro, I've only submited changes... 19:55:34 done cooking, now eating... 19:56:35 I should probably roll the colored retro into forthlets 19:57:01 it seems to work funny for me cause I don't have curses in my vm 19:57:20 no curses, but it does require a terminal supporting ANSI escape sequences 19:57:31 which windows doesn't do :( 19:57:47 hmmm... ok... felt really different with no OK prompt and "exciting space" 19:59:08 * docl couldn't get it to behave well on linux either 19:59:24 my eventual goal with my forth computer project is something like Factor+E on home built hardware. 20:00:38 the output I *want* would cost thousands of dollars... the output I'll probably go with is one of those little "small extra lcd monitors that plug into USB and I don't know what they are called" for output, and a usb keyboard for input... maybe a microwriter bassed chording system too... 20:01:38 here's the font page about the output... http://www.twyman.org.uk/Fonts/ 20:02:05 I want a 16x64 set of 7 segment led's for output. Would run near $1000 un-assembled v.v 20:19:26 * crc would hate using 7 segment led's for output 20:26:10 I would only do it for the sillyness/coolness factor. There is almost no puctuation available. The forth would have to adjust a bit ^_^ 20:28:02 I'd use a dumb terminal for I/O :) 20:32:08 what do you call those little lcd monitors with usb? Aren't intended for a full display, kinda an accessory? 20:33:03 usb display modules? 20:36:46 [crcx/ngaro] 6034ba: remove excess whitespace 20:36:53 I was thinking of stuff one level higher in the product chain... but yeah basically. 20:37:01 Eeep? end of line whitespace?? 20:38:09 yes 20:38:46 [js4/ngaro] d429ec: remove excess whitespace 20:39:11 how do I dif what I hvae against that so I can tell where I am habitually doing that 20:39:55 depends on your editor. in nano, which I use most of the time, I have this in my ~/.nanorc: 20:40:03 syntax "default" 20:40:03 color ,green "[[:space:]]+$" 20:40:26 which highlights any trailing whitespace so I can spot it easily 20:41:21 no, I mean a git command line invocation. right now I took your change in github web interface, but "git diff" in cygwin bash shell shows no changes. 20:41:45 I found how to get the dif on the web page... still wanna know how to do it on the command line 20:41:46 that I'm not sure of 20:50:11 (defun my-c-mode-hook() 20:50:11 (setq tab-width 4) 20:50:11 (setq indent-tabs-mode nil) 20:50:11 (set-variable 'show-trailing-whitespace t) 20:50:11 (setq show-trailing-whitespace t) 20:50:11 (c-set-style "stroustrup")) 20:50:30 now in my .emacs file. I have to manualy set the 2 spaces instead of 4 though... 20:58:46 [js4/ngaro] ec37eb: fix comment, remove two blank lines 21:00:13 sigh... have to do accumulating stats at the least. Then build a test suite. Then come back to messing with opcode... I should prolly branch for that though. I've been on main... master, master all this time. 21:00:48 [crcx/ngaro] d429ec: remove excess whitespace 21:49:55 someone should invent a 16 character alphabet 21:50:36 then you could just chord it in 21:51:58 http://www.twyman.org.uk/Fonts/ 21:52:05 http://letterfrequency.org/ 21:52:19 (stupid mixed clipboard) 21:53:03 hmm 21:53:20 the easiest ones to chord should be the ones most frequently used 21:53:38 etaoin-shrdlu-cmfgyp-wbvkxj-qz 21:54:13 of course, programming you might have different needs. punctuation. 22:03:42 I remember "eatnoirshdlucmfpybgvwjkqxz" == "eat.no.irsh.dlu.c.m.fpy.bg.vw.jkqxz" == "Eat no Irish stew, see them? flopy big vw? jkqxz" It's pretty close, and easy to remember for me. 22:04:56 yeah 22:05:01 As for chording... the big deal is "what was q again? no, that's j... that's comma too?? oh, that..." So I find nmemonics better than letter frequency as the big guiding force. 22:05:07 * docl remembers it eatonrish 22:05:22 ahh 22:05:27 so shapes? 22:05:29 My nmemonic for english letter order is def wrong. 22:05:45 Yes shapes too. Did you see the microwriting page? 22:05:48 yeah 22:06:43 Some of it's shapes, some words/jokes... they don't show the full set. It includes all the keys on the ibm pc keyboard (at the time). 22:07:29 some of the earliest chorders just keyed in 7 bit ascii. 22:07:46 They said it's not too hard... but they have phd's and I don't. 22:08:19 I found learning microwriting to be pretty easy. 30 minutes to have the nmemonics memorized... about a week till it was effortless. 22:09:36 They do obvious things like ' apostrophe is "funny thumb + a" 22:10:45 my chorder uses 8 keys two handed 22:11:06 but it can't do simultaneous keypresses 22:11:19 it can do 256 values though 22:11:32 er, 128 22:12:24 awef/jio; with h/u setting an offset of 64 22:12:49 all the letters are above 64 22:16:32 meh, it's probably not the best. I should keep trying until I find something really intuitive 22:24:08 --- quit: SimonRC (Read error: 60 (Operation timed out)) 22:35:42 I don't understand. How is it chording if it isn't simultaneous? 22:36:13 the chord keyboards i've used ... pressing ioj generates d when the j finaly comes up. 22:36:53 so does all the 6 posible ways my keyboard might show it 22:37:00 oij ijo ijo jio joi oji oji ijo 22:37:13 all the same letter with spaces between 22:38:15 I guess if your fingers never leave the home keys that counts for a lot. 22:39:44 on a regular keyboard ;oijn make a good set of keys to microwrite with. 22:40:16 oh and b 22:40:49 but the touch on a regular keyboard is kinda heavy for chording. 22:55:20 --- quit: docl (Read error: 104 (Connection reset by peer)) 23:01:17 Wow, jumps are shorter than I thought. 23:01:18 times used | jump distance 23:01:19 1 | 2489 23:01:19 2 | 3 23:01:19 39 | -9 23:01:19 111 | 19 23:01:19 113 | -13 23:01:21 117 | 11 23:01:23 128 | -8 23:01:25 392 | -5 23:01:27 496 | -6 23:01:29 587 | 13 23:01:31 1026 | -12 23:01:33 1154 | 8 23:01:35 1243 | -17 23:01:37 2705 | -27 23:01:39 4345 | 18 23:01:41 4345 | -33 23:01:43 5212 | 4 23:01:45 9672 | 7 23:01:47 13889 | 6 23:01:49 14160 | 5 23:01:51 60840 | -21 23:01:53 61546 | 10 23:01:55 64535 | 9 23:03:56 All the distances would be scaled down if you packed pultiple instructions per cell. So probably a jump range of [-16,15], signed 5 bits would cover it. Course the instruction sequencer does get a little trickier if you pack multiple ops per cell, and worse, the compiler has to start worrying about alignment. 23:05:01 Even [-8 to +7] probably covers it if you can pack 4 ops per cell. If your jump can't take you there "lit push ret" can. 23:10:06 The weighted average of SLCB length is real close to 3. So on average we will be getting about 3 ops per cell. At best. So trying to fill a cell with more than 6 is silly. 23:11:15 Right now I think the way to go is 8 bits per opcode byte code with jump displacements coded into the byte. 23:11:51 so the easy way to do call is it only gets a 24 bit address. 26 effectively if you want to stay cell aligned. 23:13:44 wow, it's worse on a 64bit machine. Really should do the painfull work to make the cpu be happy with byte alignment if you go over 32 bits, and at 32 bits it's a close call. 23:14:04 hmmmm /me goes to mess with ngaro some more... 23:59:59 --- log: ended retro/10.01.04