[2021-03-23 00:42:02] ⇐ _whitelogger_ quit (~whitelogg@uruz.whitequark.org): Remote host closed the connection [2021-03-23 00:45:03] → _whitelogger_ joined (~whitelogg@uruz.whitequark.org) [2021-03-23 00:53:16] → gravicappa joined (~gravicapp@h109-187-21-33.dyn.bashtel.ru) [2021-03-23 01:37:18] mark4, you compiling something in C? [2021-03-23 03:23:14] → f-a joined (~f-a@151.38.128.220) [2021-03-23 03:26:23] ⇐ cheers- quit (~user@unaffiliated/cheers): Quit: cheers- [2021-03-23 03:44:18] → dave0 joined (~davezero@069.d.003.ncl.iprimus.net.au) [2021-03-23 04:21:15] ⇐ f-a quit (~f-a@151.38.128.220): Read error: Connection reset by peer [2021-03-23 04:24:06] → f-a joined (~f-a@mi-18-45-185.service.infuturo.it) [2021-03-23 04:24:33] ⇐ dave0 quit (~davezero@069.d.003.ncl.iprimus.net.au): Ping timeout: 256 seconds [2021-03-23 04:27:20] ⇐ mark4 quit (~mark4@cpe-75-191-74-68.triad.res.rr.com): Read error: Connection reset by peer [2021-03-23 04:27:41] → mark4 joined (~mark4@cpe-75-191-74-68.triad.res.rr.com) [2021-03-23 04:36:32] → dave0 joined (~davezero@069.d.003.ncl.iprimus.net.au) [2021-03-23 05:05:58] ⇐ shmorgle quit (~patrick@gw.neurotica.com): Ping timeout: 276 seconds [2021-03-23 05:24:32] ⇐ f-a quit (~f-a@mi-18-45-185.service.infuturo.it): Quit: leaving [2021-03-23 05:40:24] → f-a joined (~f-a@mi-18-45-185.service.infuturo.it) [2021-03-23 05:53:31] ⇐ f-a quit (~f-a@mi-18-45-185.service.infuturo.it): Quit: leaving [2021-03-23 06:33:38] Anyone familiar with gforth's c interface, I'm failing to define a word for SDL_FillRect (https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlfillrect.html) [2021-03-23 06:33:45] This is my definition: c-function sdl-fill-rect SDL_FillRect a a n -- n [2021-03-23 06:34:26] I'm wondering if I need to define the struct types too? The docs don't mention that though. [2021-03-23 06:35:43] The error I'm getting: .gforth/libcc-named/.libs/sdl.so.0: undefined symbol: gforth_c_SDL_FillRect_aan_n [2021-03-23 06:36:20] → f-a joined (~f-a@mi-18-45-185.service.infuturo.it) [2021-03-23 06:43:41] Also puzzled how to set a 16-bit (short) field with 64-bit gforth. [2021-03-23 07:08:02] Ah nevermind, I forgot to include the appropriate header! [2021-03-23 07:08:30] Ah no, it wasn't that. [2021-03-23 07:20:16] ⇐ Guest20418 quit (~dch@gateway/shell/hashbang/x-wamagrgxzdqnqxqi): Quit: leaving [2021-03-23 07:20:25] → WilhelmVonWeiner joined (dch@gateway/shell/hashbang/x-mcoyowkqgpoxkssx) [2021-03-23 07:35:32] → tech_exorcist joined (txrcst@gateway/shell/hashbang/x-ybweqtqtdtzjqjdg) [2021-03-23 07:42:54] ⇐ f-a quit (~f-a@mi-18-45-185.service.infuturo.it): Quit: leaving [2021-03-23 07:46:59] neuro_sys: It's using your stack signature in the name, so make sure you are writing that exactly as they do [2021-03-23 07:47:12] Or ask on comp.lang.forth [2021-03-23 07:48:54] mark4: check a vt100 manual [2021-03-23 09:05:56] ⇐ nihilazo quit (e33ac355b6@198.108.76.81): Ping timeout: 265 seconds [2021-03-23 09:26:15] Thanks veltas, I got around it for now. [2021-03-23 09:26:21] https://gist.github.com/neuro-sys/3a343445ef16390025ee20374a91df13 [2021-03-23 09:26:30] No problem [2021-03-23 09:26:31] I'll try parsing it next into memory [2021-03-23 09:27:02] I'm going to try using Forth with some C libraries, worried about how floats will work but we'll see [2021-03-23 09:27:03] I'm thinking of the floats, I think the format for EVALUATE would require an "e" at the end, so I should think of another way to parse it. [2021-03-23 09:27:14] Great minds think alike [2021-03-23 09:27:41] Haha [2021-03-23 09:28:05] EVALUATE is a terrible idea for security reasons, unless you are completely certain the source is trusted [2021-03-23 09:28:27] I'm doing a toy 3d rasterizer with Forth using fixed point arithmetic, but I want to convert the Blender output to and embed in the code. [2021-03-23 09:28:57] I don't particulalry care about security, as long as I convert it to some format I can use it in my code. [2021-03-23 09:29:47] The goal is to practice some Forth doing that [2021-03-23 09:31:45] I guess I will do it the hard way then, one character at a time. [2021-03-23 09:49:57] proteus-guy: yes uCurses is in C, it is a full text user interface similar to ncurses but MUCH smaller and in some way MUCh more powerful [2021-03-23 09:50:15] tho not as reliable across all terminal types [2021-03-23 09:50:17] yet [2021-03-23 09:50:35] neuro_sys: >FLOAT [2021-03-23 09:51:05] just filed a bug against kde's konsole because hitting backspace returns a 0x7f instead of the 0x08 specified in its terminfo file. the dev said oh thats ok, you can edit your current profile so it returns the right value! [2021-03-23 09:51:08] fucking MORON [2021-03-23 09:51:56] me fixing it on MY machine does not make applications compile against my TUI work on every terminal there is. Konsole has incorrect behavior and its the konsole dev that needs to pull his head out and fix it [2021-03-23 09:52:09] Yeah welcome to bug reports [2021-03-23 09:52:30] its idiot attitudes like him that make ncurses have to have 286552987658972 gigs of duct tape code in them [2021-03-23 09:52:57] Terminals are overly complicated [2021-03-23 09:53:04] needlessly [2021-03-23 09:53:16] Simplify the requirements, output to paper :P [2021-03-23 10:25:09] mark4, uCurses is going to be integrated into your forth? [2021-03-23 10:29:07] → shmorgle joined (~patrick@gw.neurotica.com) [2021-03-23 10:32:32] it was written first in forth years ago but the forth version is a bit rotty right now [2021-03-23 10:32:53] and with the c version i made changes such as the ability to do gray scales and full rgb text colors [2021-03-23 10:33:06] the intent is to redo the forth version [2021-03-23 10:44:09] You mean you will rebuild it again in forth? Or your final version target is the C release? [2021-03-23 10:48:12] why not just use 9front or plan9port instead of fighting with curses? [2021-03-23 10:51:57] joe9: is the 9 in your name a reference to plan9? [2021-03-23 10:54:51] no the forth stuff will be redone :) [2021-03-23 10:55:56] I like rewriting C in Forth too [2021-03-23 10:56:29] People say that Python is good for prototyping before writing in C, well I think C is good for prototyping before writing in Forth :P [2021-03-23 11:00:02] actually the prototype was in forth :) [2021-03-23 11:06:11] What hidden power do you possess? [2021-03-23 11:06:17] pls share [2021-03-23 11:06:26] ? [2021-03-23 11:06:44] >prototype was in forth [2021-03-23 11:07:51] i wrote my curses in forth first. im doing the c version now [2021-03-23 11:08:03] the forth version is a bit old and sufferenig from lack of attention [2021-03-23 11:08:11] the c version has features not present in the forth [2021-03-23 11:08:16] finish c... redo forth [2021-03-23 11:10:02] → hosewiejacke joined (~hosewieja@i5C742976.versanet.de) [2021-03-23 11:19:38] mark4, approximately how many lines of forth do you anticipate it'll end up being? [2021-03-23 11:20:40] Under 10000 lines of code, everything in perfect balance [2021-03-23 11:28:46] proteusguy: i dont expect it to take up much more than 8k of code space :) [2021-03-23 11:29:08] but the number of lines i couldnt tell you. you could look in x4/src/terminal for an idea :) [2021-03-23 11:29:42] current version is 1412 total lines [2021-03-23 11:29:53] im not sure if wc -l counts blank lines too [2021-03-23 11:30:21] Of course it does [2021-03-23 11:31:20] :) [2021-03-23 11:31:58] sorry slight lie there. that was src/ext/terminal line count [2021-03-23 11:32:05] there is also src/ext/tui [2021-03-23 11:32:08] 1585 [2021-03-23 11:32:17] so add the two totals for the total total [2021-03-23 11:32:21] → nihilazo joined (e33ac355b6@198.108.76.81) [2021-03-23 11:32:39] 4144 lines of c so far [2021-03-23 11:34:11] cat *.c *.h | sed '/^$/d' | wc -l [2021-03-23 11:34:59] ⇐ fiddlerwoaroof quit (~fiddlerwo@unaffiliated/fiddlerwoaroof): Quit: Gone. [2021-03-23 11:35:18] → fiddlerwoaroof joined (~fiddlerwo@unaffiliated/fiddlerwoaroof) [2021-03-23 11:36:26] ⇐ jimt[m] quit (jimtmatrix@gateway/shell/matrix.org/x-yzmwhkfosdqrlrcw): Ping timeout: 240 seconds [2021-03-23 11:37:41] ⇐ patrickg quit (patrickgeo@gateway/shell/matrix.org/x-hcdxrgalfxzielpg): Ping timeout: 244 seconds [2021-03-23 11:37:41] ⇐ siraben quit (sirabenmat@gateway/shell/matrix.org/x-fdyejfvjphhisdvz): Ping timeout: 244 seconds [2021-03-23 11:37:59] ⇐ tech_exorcist quit (txrcst@gateway/shell/hashbang/x-ybweqtqtdtzjqjdg): Ping timeout: 245 seconds [2021-03-23 11:44:43] i once saw a cartoon of 3 cavemen saying ugh grrr uhhhhh and then those same characters saing sed, awk, grep [2021-03-23 11:45:44] ⇐ xek quit (~xek@46.204.48.92.nat.umts.dynamic.t-mobile.pl): Remote host closed the connection [2021-03-23 11:46:46] → xek joined (~xek@46.204.48.92.nat.umts.dynamic.t-mobile.pl) [2021-03-23 11:49:46] → tech_exorcist joined (txrcst@gateway/shell/hashbang/x-hshtbuyrmlwhdpes) [2021-03-23 11:55:43] Is it possible to define words within words during interpretation? Context: I'm reading a file to count the number of elements, and want to ALLOT that much space in dictionary associated with a word. [2021-03-23 11:56:17] My code so far looks like: open-file count-vertices alloc-vbuffer rewind slurp [2021-03-23 11:56:47] create does> ? [2021-03-23 11:57:13] Ah that magic, I knew I'd run into a case where I have to use it :) [2021-03-23 11:57:15] for example : constant create , does> @ ; [2021-03-23 11:59:38] → jimt[m] joined (jimtmatrix@gateway/shell/matrix.org/x-kwbwmmqpgygvnvte) [2021-03-23 12:01:35] Is it possible to define words not during interpretation [2021-03-23 12:02:26] I guess if it is a MAIN standalone [2021-03-23 12:03:25] You sound like DOES> is something you have avoided :P [2021-03-23 12:06:40] Hmm right, words are defined during interpretation by switching to compilation with the word : and once finished going back to interpretation with ; right? Just to confirm the basics. [2021-03-23 12:07:11] Been avoding DOES> so far indeed, now it seems the right time to learn/use it. [2021-03-23 12:09:41] I think what I needed was this : alloc-buffer create allot does> here ; and later use it as 10 alloc-buffer buffer1 20 alloc-buffer buffer2 [2021-03-23 12:09:53] Woops, not here, but >body [2021-03-23 12:13:57] → siraben joined (sirabenmat@gateway/shell/matrix.org/x-yfumbrfrhkufdprl) [2021-03-23 12:14:11] Actually, I didn't need to use does> for what I needed. I'll share the code once I'm done though for review. [2021-03-23 12:14:43] I'm sure it's all unidiomatic and far from ideal. At least I'm not using locals any more. [2021-03-23 12:14:57] Or locals as in the special syntax in the later specs. [2021-03-23 12:15:39] → patrickg joined (patrickgeo@gateway/shell/matrix.org/x-dyffbnqhtrsrekfb) [2021-03-23 12:27:39] ⇐ jess quit (jess@freenode/staff/jess): Quit: K-Lined [2021-03-23 12:48:04] found what i believe is a very VERY serious bug in clang [2021-03-23 12:48:35] i have a function called re_switch() where you pass a character, a function table and a table length [2021-03-23 12:48:56] it scans the table for that character and jumps to the function vecor for that char if its found [2021-03-23 12:49:10] re_switch(&p_codes[0], PCOUNT, next_c()) [2021-03-23 12:49:28] here is my one invocation of that public function thats going to be exported for lib users to use if they chose [2021-03-23 12:49:30] oopts cant [2021-03-23 12:49:56] because here is what that one call is compiled down to [2021-03-23 12:49:59] .text:00000000002057D4 loc_2057D4: ; CODE XREF: do_parse_format+17↑j [2021-03-23 12:49:59] .text:00000000002057D4 call next_c [2021-03-23 12:49:59] .text:00000000002057D9 movsx edi, al ; s [2021-03-23 12:49:59] .text:00000000002057DC call re_switch [2021-03-23 12:49:59] .text:00000000002057E1 jmp short loc_2057AE [2021-03-23 12:50:08] mp referemce to p_table or PCOUNT [2021-03-23 12:50:19] because BOTH of those are now built into the now single purpose function [2021-03-23 12:50:39] no referene to... [2021-03-23 13:15:13] is it a static function with this as its only user, or an LTO build to an executable (in both cases the compiler could do that until you add another invocation that passes different arguments) [2021-03-23 13:29:32] ⇐ hosewiejacke quit (~hosewieja@i5C742976.versanet.de): Ping timeout: 260 seconds [2021-03-23 13:42:49] → hosewiejacke joined (~hosewieja@i5C742976.versanet.de) [2021-03-23 14:15:11] ⇐ dave0 quit (~davezero@069.d.003.ncl.iprimus.net.au): Quit: dave's not here [2021-03-23 14:18:24] ⇐ hosewiejacke quit (~hosewieja@i5C742976.versanet.de): Ping timeout: 245 seconds [2021-03-23 14:20:06] ⇐ proteus-guy quit (~proteus-o@183.88.230.179): Ping timeout: 265 seconds [2021-03-23 14:31:58] → proteus-guy joined (~proteus-o@mx-ll-183.88.230-179.dynamic.3bb.co.th) [2021-03-23 15:23:26] ⇐ gravicappa quit (~gravicapp@h109-187-21-33.dyn.bashtel.ru): Ping timeout: 264 seconds [2021-03-23 15:23:46] → gravicappa joined (~gravicapp@h109-187-0-47.dyn.bashtel.ru) [2021-03-23 15:47:44] → hosewiejacke joined (~hosewieja@i5C742976.versanet.de) [2021-03-23 15:48:21] https://gist.github.com/neuro-sys/dd659939c04ee85cdeb1971f507ec31f#file-obj2f3d-fs [2021-03-23 15:50:02] I'm pretty sure this is NOT how it should be done, but anyway, this's how it turned out. [2021-03-23 16:00:00] ⇐ hosewiejacke quit (~hosewieja@i5C742976.versanet.de): Remote host closed the connection [2021-03-23 16:50:47] ⇐ gravicappa quit (~gravicapp@h109-187-0-47.dyn.bashtel.ru): Ping timeout: 260 seconds [2021-03-23 17:12:08] ⇐ cantstanya quit (~chatting@gateway/tor-sasl/cantstanya): Remote host closed the connection [2021-03-23 17:14:31] → cantstanya joined (~chatting@gateway/tor-sasl/cantstanya) [2021-03-23 17:46:49] So, if anyone is interested I have a fairly tidy and fully debugged implementation of QUERY and EXPECT I put together for the re-write of my system I'm working on. [2021-03-23 17:46:53] It's here: [2021-03-23 17:46:55] https://imgur.com/a/kR1qzIB [2021-03-23 17:47:09] It uses some special features of my system, like conditional and multi-level returns. [2021-03-23 17:47:26] Also, a . at the beginning of a word generally means the word keeps one more item on the stack than you'd expect. [2021-03-23 17:47:40] So .emit for example doesn't drop the character tha tit outputs. Etc. [2021-03-23 17:48:33] .: also indicates a special feature of my system - it defines a "temporary word." After defining a bunch of those, and using them to build actual visible definitions, I can execute .wipe and they're all removed from the dictionary. Keeps the namespace tidy. [2021-03-23 17:48:47] You could certainly do that equally well with vocabularies. [2021-03-23 17:50:00] Just as a quick example, .!=; is a conditional return word. It does != (not equal), which ordinarily would consume two arguments. But it has a . at the start, so it only consumes one. [2021-03-23 17:50:19] In this case that means it consumes the ascii code I put on that to compare to, but doesn't consume the keyboard-entered char. [2021-03-23 17:50:34] And the ; at the end means the return is taken if the != operation is true. [2021-03-23 17:51:00] I've found those conditional returns to be very valuable - my definitions definitely became shorter when I started using them. [2021-03-23 17:51:07] I recommend them. [2021-03-23 17:51:13] ;; returns two levels, of course. [2021-03-23 17:52:35] s0 s1 s2 s3 access stack variables relative to a "frame register" that my system contains. { saves the current frame register on the return stack. } retrieves it, sets the stack pointer back to what it was when { was issued, and then drops the number of arguments specified. In this case 4. [2021-03-23 17:52:46] So query puts an address and a max count on the stack. [2021-03-23 17:53:19] Expect adds two 0's that represent string size and cursor position within the string, and then frames up those four things so that s3 - s0 gets the address of those stack cells for standard operations. [2021-03-23 17:54:15] Very handy in a situation like this where you have several important pieces of information you need access to. Here we have a buffer address, a max string length, a current string length, a cursor position, and sometimes also an ASCII code from the keyboard. That's a lot to juggle without some sort of special stack access. [2021-03-23 17:55:18] If you pick through it you'll see how the conditional returns and the multi-level returns let construct control structures that run up and down in the call stack. It's like an extra "dimension" to use in building those control structures. [2021-03-23 17:56:36] I may someday add the ability to bind the sn frame variables to names specified in a ( ... ) comment, but that would all be handled at compile time. I don't find it that hard to remember what I have in the various stack cells, and I don't usually use stack effect comments anyway, so... maybe / maybe not on that. [2021-03-23 17:57:09] This supports backspace, cursor left, cursor right, beginning of line, and end of line control keys. [2021-03-23 17:57:34] It would be easy to add in cursor up and cursor down to add a command history - I've done that in my recent syste, but it's not reflected here. [2021-03-23 17:59:30] The "read" word is basically an infinite loop - it runs quit? each character, and that will do a double return on Enter - breaking the loop. [2021-03-23 18:00:38] Oh, and "me" in my system "me" is a stand-in for recursively calling the word it's in. I could have just put "read" after "insert" in there. However, the "me" mechanism supports conditional looping too; like the 0=me word loops back to the start if the top of stack is 0. And consumes the top of stack, since there's no . [2021-03-23 18:01:16] I have [ at the end of a few of those words because they end in me. I don't need (;) - I just need to get out of compile mode. [2021-03-23 18:01:39] I suppose I could still put ; and tail recursion would optimize it away. [2021-03-23 18:01:58] I may confirm that and change it. Just for readability. [2021-03-23 18:02:19] The thing is, though, "me" is not a compiled Forth word. It's a primitive. [2021-03-23 18:02:33] So that might not work. [2021-03-23 18:03:00] Definitely wouldn't work. [2021-03-23 18:05:49] This relies on the keyboard being in "raw" mode, and the enter key (which I think normally returns ^j has been flagged to return ^m instead. [2021-03-23 18:06:17] But you just can't really implement standard Forth console behavior using a cooked console. [2021-03-23 18:06:39] Once you call for a line of input, you don't get control back until the user hits Enter. [2021-03-23 18:07:16] It ignores all control keys except for the ones explicitly checked for. [2021-03-23 18:08:07] It does all the right things, though - ignores backspace and cursor left if the cursor is at position 0, ignores cursor right if it's at the other end, and stops taking anything if you reach the max size. [2021-03-23 18:08:38] It does put a null at the end, so I probably should 1- max before framing up, to make sure a spot is left for the null. [2021-03-23 18:11:23] KipIngram did you not just copy the L&P version from F83 :) [2021-03-23 18:11:46] No, I've never looked at that. [2021-03-23 18:11:57] But it wouldn't surprise me to find it's similar to something soemone else did. [2021-03-23 18:12:04] laxen and perry wrote the original 83 standards compliant forth for dos :) [2021-03-23 18:12:17] pretty much everyone copied them from there :) [2021-03-23 18:12:23] Nah, not me. [2021-03-23 18:12:29] including tom zimmer for FPC for dos and ME for x4 etc :) [2021-03-23 18:12:44] I just started with nasm and a blank slate - this is implemented in assembly. [2021-03-23 18:12:53] their expect definition does not really allow for line editing other than backspace :/ [2021-03-23 18:13:25] But hey, you should have seen the monstrosity that was my first Forth, which I wrote before gettinng a copy McCabe's "Forth Fundamentals." [2021-03-23 18:13:40] I didn't' really know how a system was supposed to work under the hood, so mine was nowhere close to elegant. [2021-03-23 18:13:53] I read McCabe and was like "Holy shit - that is CLEAN." [2021-03-23 18:14:10] So I didn't copy anyone's source code, but I copied a lot of exiting ideas. [2021-03-23 18:14:13] patrickg i was building the "application" with -flto yes and that is what was causing the not really a bug [2021-03-23 18:14:26] converting the project into a library fixed that issue [2021-03-23 18:14:41] thats the best way [2021-03-23 18:14:59] i just copied the FPC code pretty much verbatum out of lazyness lol and being used to the way it works [2021-03-23 18:15:13] query is usually just : query tib XXX expect ; [2021-03-23 18:15:20] in dos xxx would be 80 :) [2021-03-23 18:15:41] Sure. What else would it be, you know? :-) [2021-03-23 18:15:46] heh [2021-03-23 18:15:56] It's only purpose is to just wrapper expect for use as system input. [2021-03-23 18:16:05] ya [2021-03-23 18:16:15] you can also do foo-buffer 1234 expect [2021-03-23 18:16:25] but i never did lol [2021-03-23 18:23:40] My existing prior effort here was also in nasm, but I got infaturated with some of Chuck's "sourceless programming" ideas and tried to implement them, and eventually the memory management got more involved than I like, and then something changed in the MacOS build tool chain and it's not quite working right now. So this is a do-over, intent on keeping things much simpler. I've got a nice set of nasm macros [2021-03-23 18:23:42] that handle all the dictionary building part. Headers and bodies are in separate sections. When it starts up it allocates two blocks of RAM using system calls and copies those sections into them, and then it abandons the original image. So there's no more bother with write permissions in the code space and things like that. [2021-03-23 18:24:32] I do have to juggle two HERE's, but I'll manage. [2021-03-23 18:25:46] It puts the CFA and PFA portions of definitions up with the name strings, so declaring a new symbol in the middle of a definition doesn't jam anything into the middle of the definition address list. Let's me have multiple entry points, a la [2021-03-23 18:25:57] : foo ... ... ... :bar ... ... ; [2021-03-23 18:26:24] That was really the main reason I didn't just do a standard FIG structure. [2021-03-23 18:27:15] I'll pastebin those macros for the dictionary and share them later. [2021-03-23 18:27:41] Lets definitions in the assembly look like this: [2021-03-23 18:27:43] ;;; .: quit? 13 .!=; >end ;; [2021-03-23 18:27:45] def "quit?", quitq, COVERT [2021-03-23 18:27:47] run plit, 13+do, dnesem, gtend, dosem2 [2021-03-23 18:30:52] Top two bits of the count byte are used for things - 0x80 is the immediate flag and 0x40 is the "temporary word" flag. In my last system I actually put the headers of temporary words into temporaryily allocated RAM, and got rid of them when I was done. I blew that sophistication off - this time the headers will stay but that bit will get set and the search will just pass over them. Much simpler. [2021-03-23 18:31:03] It's just insane these days to get all wound up over saving RAM. :-( [2021-03-23 18:31:14] I get a little anal about such stuff at times. [2021-03-23 18:32:14] aha so headerless [2021-03-23 18:32:17] I mentioned copying things around - this is all 100% relocatable. Put it anywhere, and set a register to the base address. Everything that hapens is relative to one of those two registers. [2021-03-23 18:32:24] The previous one, yes. [2021-03-23 18:32:43] It would put the CFA and PFA in the main header position, but the name was off in a temporary buffer. [2021-03-23 18:33:03] right [2021-03-23 18:33:25] It actually worked quite well. But I'm not going to introduce dynamic memmory into the system so early this time. [2021-03-23 18:33:50] in x4 what i do is flip dp and hp with headerless versions of them that i initialize to 16k above hhere [2021-03-23 18:34:04] i can flip flop between making headerful and headerless words and behead later [2021-03-23 18:34:06] With the other one I actually compiled new stuff into dynamic memory. I could use quite small pages, and if one filled up I'd get a new one. [2021-03-23 18:34:22] And that worked - a definition could come to the end of a page and would jump off to some other page to continue. [2021-03-23 18:34:49] It's all pleasing when something like that works, but all that complexity gradually adds up. [2021-03-23 18:36:38] Before I try to read through it all, what's query and expet in general? [2021-03-23 18:37:36] got a new battery for my mouse, need to crack open the mouse and take the old one out and solder its connector onto my new battery [2021-03-23 18:37:53] going for 600mha to 800 but did not know the 1k would have fit in there too lol [2021-03-23 18:37:58] get taht one next time [2021-03-23 18:39:23] Expect takes an address and a max size on the stack and manages the keyboard entry of a string of up to that length into the buffer. [2021-03-23 18:39:47] Query just specifies the standard console input buffer and calls expect - it's used exclusively in the outer interpreter loop. [2021-03-23 18:40:01] Expect, though, is general purpose for anytime you need a keyboard string. [2021-03-23 18:40:41] With a cooked keyboard, just getting any keyboard input is basically "expect," provided off in the OS. [2021-03-23 18:40:55] Without modifying the termios you can't read a single keystroke from the console. [2021-03-23 18:42:09] So this code is doing all the stuff the OS would do for you on a cooked keyboard. Manages the cursoring around, opening up space in an existing string to insert a char into the middle of it, and so on. [2021-03-23 18:42:31] It doesn't use or support the standard cursor keys. [2021-03-23 18:42:36] It uses vim keys. [2021-03-23 18:43:01] ^h for cursor left, ^l for cursor right. ^p for end of line, ^o for start of line. [2021-03-23 18:43:27] As it stands now, if you hit one of the cursor keys, it would ignore the Escape and then take what followed as though you'd typed it. [2021-03-23 18:44:24] Apparently the cursor keys are [A through [D. [2021-03-23 18:44:55] I really wish that the people who devised all this way back when had chose something other than for starting off those strings [2021-03-23 18:45:08] Something, anything, that you can't also make yourself as an independent keystroke. [2021-03-23 18:45:35] I see. I'm curious why forth-standard.org/search doesn't have both words, but gforth does. [2021-03-23 18:45:40] Because if you read from the keyboard, you can't tell if that was pressing the key and that's all there is, or if it's an extended key and there's some unknown number of bytes after that to expect. [2021-03-23 18:45:54] So they are not standard words, but present in all/most Forths? [2021-03-23 18:45:59] Oh, well, QUERY does very little. [2021-03-23 18:46:18] You could easily dispense with it and just use
EXPECT instead. [2021-03-23 18:46:36] I don't think QUERY is in the standard. [2021-03-23 18:46:43] It was in the old FIG Forths though. [2021-03-23 18:46:53] Like I said, it barely passes as needed. [2021-03-23 18:46:56] And if I understand correctly, your Forth solution is useful for platforms where the OS does not provide a handy call for that? [2021-03-23 18:47:06] Just slightly shortens some definition in the outer interpreter. [2021-03-23 18:47:19] EXPECT is not on that website either for some reason. [2021-03-23 18:47:34] Right. This system doesn't even use a c library. [2021-03-23 18:47:46] It does system calls directly to the OS. [2021-03-23 18:48:02] syscall 3 is read file, and 0 for the file makes it the keyboard. [2021-03-23 18:48:08] syscall 4 writes. [2021-03-23 18:48:14] file #1 is output. [2021-03-23 18:48:19] file 0 == stdin [2021-03-23 18:48:22] file 1 == stdout [2021-03-23 18:48:45] syscall 54 is ioctl [2021-03-23 18:49:12] I think I'm using read, write, ioctl, and allocate memory syscalls, and nothing else at all external to what I've written. [2021-03-23 18:49:27] It'd definitely intended to be something I could port to some bare metal project I do in the future. [2021-03-23 18:50:14] Last time the primitives were my base layer, and would need to be rewritten for a port. [2021-03-23 18:50:37] This time I'm trying to define a "virtual machine layer" - I implement virtual instructions for that machine using macros, and then write the primitives using those. [2021-03-23 18:50:50] So that those virtual instructions should be the only things I have to port to a new platform. [2021-03-23 18:51:01] There should be fewer of them than there are primitives,. [2021-03-23 18:51:16] But I'm not trying to minimize the number of virtual instructions. I could, but I'd wind up with a poorly performing system. [2021-03-23 18:51:43] I'm going for a set of instructions that's relatively easy to port, but still lets me use near optimal machine code on at least x86 and ARM. [2021-03-23 18:53:50] are you doing a simple interpreter, or compiling/fusing the virtual instructions? [2021-03-23 18:55:47] I'm not sure what you mean. Once I have it all working, I do want to put enough assembly support in Forth to allow the thing to rebuild itself. [2021-03-23 18:55:51] Then leave nasm behind. [2021-03-23 18:56:31] The virtual instructions are nasm macros. So a list of virtual instructions just becomes a normal primitive. There's no extra "call" in there for that layer. [2021-03-23 18:56:46] It's just a different way of writing the same machine code primitives. [2021-03-23 18:56:49] ah, I thought you meant something like [2021-03-23 18:57:02] being an STC forth + having inline machine code, but that's for a virtual machine [2021-03-23 18:57:15] and then either emulating or compiling that to the real target machine code [2021-03-23 18:57:45] Right. No, this is just a straight up implementation. Once it can rebuild itself, though, I ought to be able to use it to compile an image for a different platform. [2021-03-23 18:59:14] Like for instance, I have a macro "getd". I can write [2021-03-23 18:59:38] getd rrTOS, rrSP [2021-03-23 18:59:41] annd that becomes [2021-03-23 19:00:02] mov rcx, [r12] [2021-03-23 19:00:35] the macro "knows" what I'm using the registers for, and so on. The only purpose of this layer is to allow a smaller set of things to re-impilement on a port. [2021-03-23 19:01:58] This system and the other nasm system has 64-bit stacks and "basic data." But 32-bit system internals. The cells in a definition that species a word are 32 bits each. [2021-03-23 19:02:13] That was just to reduce size. [2021-03-23 19:02:31] I just saw no need to be able to have a system bigger than 4GB. :-) [2021-03-23 19:12:55] lol [2021-03-23 19:13:14] you are being too restrictive! [2021-03-23 19:13:15] lol [2021-03-23 19:56:33] ⇐ tech_exorcist quit (txrcst@gateway/shell/hashbang/x-hshtbuyrmlwhdpes): Quit: tech_exorcist [2021-03-23 20:42:18] wonder if i should fix this memory leak in the pulldown menus of my library lol [2021-03-23 21:01:46] → X-Scale` joined (~ARM@174.195.28.37.rev.vodafone.pt) [2021-03-23 21:02:43] ⇐ X-Scale quit (~ARM@134.218.137.78.rev.vodafone.pt): Ping timeout: 265 seconds [2021-03-23 21:02:43] * X-Scale` → X-Scale [2021-03-23 21:12:27] considering that many systems at the present far outstrip 4 GB in memory... [2021-03-23 21:27:43] but not one application lol [2021-03-23 21:27:44] i hope [2021-03-23 21:28:00] → dave0 joined (~davezero@069.d.003.ncl.iprimus.net.au) [2021-03-23 21:37:43] umm, firefox, chromium? [2021-03-23 21:38:24] my web browser has a habit of making my machine lock up by making it thrash [2021-03-23 21:40:46] It wouldn't surprise me - the software community seems to have no ability to restrain themselves whatsoever. They just pile new libraries on top of new frameworks and on and on and on. [2021-03-23 21:41:02] A 4 GB application should be able to run your whole life. [2021-03-23 21:41:44] I makes my mind reel when I think about the first IBM PC I got in '86 or so. I "splurged" to get the upgraded 30 MB hard drive, instead of the standard 20 MB. [2021-03-23 21:41:53] — tabemann is currently targeting much smaller platforms, though, in which a 32-bit address word is plenty [2021-03-23 21:42:47] the board I'm currently working with has 320K RAM, 1MB internal flash, and 16MB external flash [2021-03-23 21:43:03] and it's considered to be "big" by embedded standards [2021-03-23 21:43:27] I bought a little thumb drive Cortex M4 system a couple of years ago. Like 256 kB of RAM, and some flash. I had it in mind I wanted to run that last Forth on it. That was why I worked onn supporting such small page sizes, so I could multi-sessionn work on that little thing. [2021-03-23 21:43:34] Never quite got to it. [2021-03-23 21:44:08] Wanted to be able to fire up another "screen" in a new 4kB page. [2021-03-23 21:44:33] That would just be the stuff specific to that process, of course - it would all share the same code. [2021-03-23 21:45:00] what I'm currently using is a Cortex-M7, even though zeptoforth also targets the Cortex-M4 [2021-03-23 21:45:45] it doesn't support multiple terminals, though [2021-03-23 21:46:08] due to issues with compilation occurring simultaneously on different terminals [2021-03-23 21:46:34] (when compiling to flash, what happens if two terminals try to compile code simultaneously?) [2021-03-23 21:47:06] well [2021-03-23 21:47:22] you could make it work with multiple terminals with some modifications [2021-03-23 21:47:37] it just wouldn't like it if you tried to compile from both of them simultaneously [2021-03-23 21:47:56] Looks like my two code sections together are currently at 4390 bytes. [2021-03-23 21:48:32] That's basically with everything needed to implement that QUERY/EXPECT stuff - I made a fairly straight shot at that. [2021-03-23 21:48:44] Basically nothing else is implemented yet. [2021-03-23 21:51:11] all in all, I did not see it as being worth it to make zeptoforth a true multiuser forth, even though it is a multitasking forth [2021-03-23 21:51:27] after all, it's targeting an MCU of all things [2021-03-23 21:57:29] okay, time to hit the sack [2021-03-23 21:57:32] g'night [2021-03-23 22:32:24] → boru` joined (~boru@unaffiliated/boru) [2021-03-23 22:32:26] ⇐ boru quit (~boru@unaffiliated/boru): Disconnected by services [2021-03-23 22:32:29] * boru` → boru [2021-03-23 23:21:51] ⇐ sts-q quit (~sts-q@91.200.108.225): Ping timeout: 256 seconds [2021-03-23 23:29:20] → sts-q joined (~sts-q@212.53.219.189) [2021-03-23 23:51:51] ⇐ dave0 quit (~davezero@069.d.003.ncl.iprimus.net.au): Quit: dave's not here