2023-07-19 03:55:53 My friend who works at Oracle says OCI is actually good 2023-07-19 03:55:58 He might be a little biased ;) 2023-07-19 10:37:32 hello guys 2023-07-19 10:38:29 i found a forth in tasm it is camel86 2023-07-19 10:39:01 hope i can use it for DOS games 2023-07-19 10:40:08 by the way what is direct threading? 2023-07-19 10:44:51 Direct threading means that your definitions are lists of addresses, and at those addresses one finds machine code. 2023-07-19 10:45:15 Indirect threading adds an extra level of indirection - the definition items are addresses, which point to other addresses, which point to code. 2023-07-19 10:45:33 Code threading means that the definitions contain machine code directly. 2023-07-19 10:45:48 You can implement a Forth system in any of those ways - the internal details are just different. 2023-07-19 10:46:09 Slight performance differences, some things are easier to implement one way over another, some things harder. 2023-07-19 10:46:21 None of them represent "wrong answers," so to speak. 2023-07-19 10:46:42 The earliest Forths tended to be indirect threaded - the other options came along later. 2023-07-19 10:47:44 Indirect threading facilitates keeping all of your machine code in one small tight RAM region. 2023-07-19 10:48:58 It's commonly felt that direct threading is faster, but you still wind up doing that extra level of indirection. You just do it with a machine code jump, generally. Though you don't HAVE to - you can have larger snips of code at those direct locations. 2023-07-19 10:49:49 All of those decisions are just little tradeoffs you have to make choices on. 2023-07-19 10:50:15 Speed, size, and elegance - those are the three things you're trading off against one another. 2023-07-19 10:50:28 this explains jump pretty well - https://www.youtube.com/watch?v=010KyIQjkTk 2023-07-19 10:51:05 I've usually written indirect threaded Forths, gravitating toward what I regard as elegance, but I'm considering something very different for my next effort. 2023-07-19 10:52:18 what are the disadvantages of direct threading? 2023-07-19 10:53:24 depends on the machine architecture, but one is that you can not jump directly into a colon definition midway 2023-07-19 10:55:00 i using dosbox 2023-07-19 10:55:51 Yes, direct threading doesn't allow you to have two definitions "adjacent" to one another and just execute right through one of them into the other. 2023-07-19 10:56:06 Whether that's a "disadvantage" or not depends on your tastes. 2023-07-19 10:56:31 Some implementations of indirect threading don't allow that either - it depends on how you set up where everything is. 2023-07-19 10:56:51 I write my systems to that it is possible to "fall through" like that, and I routinely have definitions with multiple entry points. 2023-07-19 10:57:05 Well, "often." I don't know if it's "routine." 2023-07-19 10:58:32 In the earliest Forths, everything went into one continuous RAM region. Each definition had a header (basically the word name), one or two pointers, and then the definition item addresses themselves. These all came one right after another in RAM. 2023-07-19 10:58:50 So the definitions were separated from one another by their own headers and so on. 2023-07-19 10:59:08 But it is possible to move those things into a different RAM region, in which cases the definitions become truly adjacent. 2023-07-19 10:59:20 Then it's up to you whether you put a "return" at the end of one. 2023-07-19 11:00:15 In those old systems if you didn't put a return at the end, you'd try to execute the next definition's header, and that's no bueno. 2023-07-19 11:01:55 thanks guys 2023-07-19 12:18:48 I'm debating how to extend the F18A instruction set for sub-cell memory operations. One option is just to add the whole fleet of instructions. 2023-07-19 12:19:29 The other is to allocate registers as increment values and masks, and have a set of four instructions (maybe +1 +2 +4 +8) to set those, and then the existing instructions use them. 2023-07-19 12:19:47 But that's two registers, and that's kind of pricey. 2023-07-19 12:20:02 Although I think this design is going to be less register heavy that my others, so it might be fine. 2023-07-19 12:20:43 One nice t hing about it is that it COULD support auto decrement too. 2023-07-19 13:51:14 I think it's no surprise at all that F18A unext is one of the opcodes that can live in the three-bit fourth slot of a cell. 2023-07-19 13:51:32 Since it's looping within the cell, that makes longer loops possible. 2023-07-19 13:51:53 I'd want to make that one of the ones that could live in the two-bit sixth slot of a cell. 2023-07-19 13:52:10 Microloops with up to five instructions. 2023-07-19 14:01:16 which is must better interpret or compile? 2023-07-19 14:03:07 compiled seems faster 2023-07-19 14:03:08 They're just "different." Interpreting means taking the ASCII name of each word, finding that name in the dictionary, and executing the associated code. 2023-07-19 14:03:45 Compiling means finding the address of each of those bits of code and storing them in a new word's definition - then you can run them all one after another without having to look them up at run-time. 2023-07-19 14:04:12 You'd still look up the name of the newly compiled word, but the *defining components* of that word are directly accessible via those addresses. 2023-07-19 14:04:22 And you can nest such definitions to an arbitrary extent. 2023-07-19 14:04:38 : foo bar bam ; 2023-07-19 14:04:58 New entry foo is put in the dictionary, and associated with it is the addresses of bar, bam, and the runtime for ;. 2023-07-19 14:05:18 And yes, it's faster because you don't have to look up bar, bam, and the ; runtime. 2023-07-19 14:05:49 That process of making definitions, using them to make more, and so on is more the "heart and soul" of Forth than just about anything else. 2023-07-19 14:06:10 In fact, that ability and a post-fix stack more or less make it qualify as Forth. 2023-07-19 14:08:49 thanks KipIngram 2023-07-19 14:09:51 siesta: Traditionally searching for names involves walking a linked list one item at a time, and even so it's quite fast on modern machines (obviously not as fast as compiled words). That's a linear search process and if you have a lot of words in your dictionary it just keeps taking longer. 2023-07-19 14:10:13 These days though there are better data structures and some systems use a hashing approach that's formally O(1) search time. 2023-07-19 14:10:48 I measured GForth's search time once, and it was just too fast for it to POSSIBLY be a linked list search. Later one of the other guys here found it documented - they have a hashing-based methodology. 2023-07-19 14:10:58 I want to use hashing on future designs. 2023-07-19 14:11:29 And I feel like once I take that step I ought to support "dictionaries" as a standard usable data structure, like you can do in Python. 2023-07-19 14:11:39 After all, to some extent I'll already have written the code. 2023-07-19 14:13:47 but is there a limit of items in hash? 2023-07-19 14:14:22 if im targetting 16bit DOS 2023-07-19 14:14:31 Well, at any given time there is, but there's a method referred to as "table doubling" where when you need to you allocate a new, twice as big RAM region and re-hash everything into it. 2023-07-19 14:14:43 But yes, hash tables have a size limit. 2023-07-19 14:15:30 Hashing with table doubling (in both directions - toward smaller and toward larger) at a ppropriate times is the standard way dictionaries are implemented in languages that have them. 2023-07-19 14:15:37 Computer scientists love O(1). 2023-07-19 14:15:47 And even with the table doubling, it's still O(1) "on average." 2023-07-19 14:16:19 oh ok table doubling is new to me 2023-07-19 14:16:31 It was to me too up until a couple of months ago. 2023-07-19 14:16:52 Or rather it was when I encountered it a couple of months ago. 2023-07-19 14:17:34 Once you know what it is it's kind of obvious. It's exactly the brute-force thing you'd expect it to be. And re-hashing everything you've got into the new table - obviously that takes significant time. 2023-07-19 14:17:43 But you don't have to do it often enough for it to break your O(1). 2023-07-19 14:19:39 my js forth is just dict[word]=action; and action is just js code 2023-07-19 14:21:14 Yes - it's common to see that kind of thing in high level language Forth implementations. 2023-07-19 14:21:26 You sort of hijack your language's built in capabilities. 2023-07-19 14:22:08 cause js has eval 2023-07-19 14:22:13 Right. 2023-07-19 14:22:26 Nothing wrong with that kind of thing as a learning tool. 2023-07-19 14:24:45 what if my assembly code is in brainfuck and on top is forth? 2023-07-19 14:25:12 hmm 2023-07-19 14:29:06 why those forth cpu's ran so fast 2023-07-19 14:29:45 they said it has no clock 2023-07-19 14:32:43 Chuck's latest chips are fully asynchronous. 2023-07-19 14:32:52 That's not "typical" - designing such things is hard. 2023-07-19 14:34:26 and thinking about pointer to pointer to pointer make crazy hahaha 2023-07-19 14:34:40 :-) 2023-07-19 14:34:55 Once you get familiar with it it's pretty straightforward. 2023-07-19 14:35:03 There's a reason for each layer of indirection. 2023-07-19 14:35:27 different intepreters 2023-07-19 14:35:40 The first layer of pointers, the ones in the definitions, are just to specify the items that form that definition. 2023-07-19 14:36:01 Then the next layer is there to let you associate a) code and b) data with each word. 2023-07-19 14:36:25 You could think of those as describing the individual word's data and the word "category's" "type." 2023-07-19 14:36:40 oww sorry im thinking about threading 2023-07-19 14:36:46 Me too. 2023-07-19 14:37:45 There wind up being several ways you can set up storing the necessary information, and somewhere out there you can generally find Forths that have tried it all the different ways. 2023-07-19 14:39:16 Like, when a definition specifies some particular word, that word might be a primitive, where all you have its it's machine code, or it might be another definition, or it might be a variable or a constant or a vocabulary or something else that you invented. But Forth wants to treat them all exactly the same at the level of compiling references to them. 2023-07-19 14:39:29 So the data structures involved have to be able to embody that flexibility. 2023-07-19 14:40:06 why not all is a string? 2023-07-19 14:40:37 So when a word is used in a definition, the definition has a poitner to that word. And then that word has a pair of pointers - one to the word instant's data, and the other to some representation of what the word is supposed to "do" with that data. 2023-07-19 14:40:51 then specify a a different intepreter for each 2023-07-19 14:40:53 s/instant/instance/ 2023-07-19 14:41:18 That's basically what's done - you associate different code with each different "kind" of word. 2023-07-19 14:42:45 wow this is power computing not like any languages i know 2023-07-19 14:43:00 Yes - it's an extremely powerful model. 2023-07-19 14:43:08 You can extend Forth as far as you like. 2023-07-19 14:43:22 And the whole time the syntax stays consistent. 2023-07-19 14:43:28 how about security? 2023-07-19 14:43:49 anyone can add word to my system 2023-07-19 14:45:52 just like playing corewars hahaha 2023-07-19 14:45:52 Yeah, there's basically no security in the Forth model itself. You could always design some in in various ways, but the language as normally thought of offers no protection of any kind. 2023-07-19 14:46:04 You can seriously stub your toe if you're not careful what you're doing. 2023-07-19 14:46:34 The real strength of Forth, in my eyes, is that it lays the entire machine before you, to do anything with you please. 2023-07-19 14:46:41 It's really "meanT" to be run on bare metal. 2023-07-19 14:47:06 just like the first time ive run pygmy forth ive trashed the code 2023-07-19 14:47:12 Multitasking is most often cooperative, etc. 2023-07-19 14:47:24 Won't be the last time, most likely. 2023-07-19 14:47:56 I added enough signal handling to mine to let me avoid segfaulting every time I accidently accessed a wrong memory address. 2023-07-19 14:48:07 But that's not a typical feature. 2023-07-19 14:48:14 And it was pretty hard to figure ou thow to do it. 2023-07-19 14:48:35 But it sure made it more friendly to use. 2023-07-19 14:51:29 just like in DOS days too many viruses in my system I get tired of using scan and let them live 2023-07-19 14:52:06 meanwhile, installing anti-virus software on openbsd decreases system security 2023-07-19 14:53:33 i like forth's simplicity but simple is not easy 2023-07-19 14:54:50 It really depends on how you define easy. It's easy to "learn the rules." But getting good at Forth coding just requires a period of practice. 2023-07-19 14:55:01 I don't think there's any shortcut for that - it's a mind set you have to develop. 2023-07-19 14:55:21 yes my mind is wired at c language 2023-07-19 14:55:27 The book Thinking Forth (available as a pdf online) is really good at presenting and discussing that mind set. 2023-07-19 14:55:50 It focuses on Forth, but the concepts provided are really generically applicable to all programming. 2023-07-19 14:55:51 using forth is kind of strange at first 2023-07-19 14:55:55 It is. 2023-07-19 14:56:16 I was lucky - in college I used an HP-41CV calculator, which is RPN, and it was the first device I ever programmed. 2023-07-19 14:56:26 So I was comfortable with stack machines right from the start. 2023-07-19 14:56:39 When I discovered Forth it immediately felt fairly natural. 2023-07-19 14:57:09 i program a return stack when i encountered procedural brainfuck 2023-07-19 14:57:18 Initially RPN was my main reason for liking Forth, but as I learned more about it it gained additional "beauty" for me. 2023-07-19 14:58:39 i fond of forth's word -> action association 2023-07-19 14:59:17 almost no syntax at all 2023-07-19 15:01:19 if I is loop counter what is J? 2023-07-19 15:02:29 is j the end count? 2023-07-19 15:02:55 J is a nested loop counter. 2023-07-19 15:03:03 Doesn't always even exist - not all Forth's have it. 2023-07-19 15:03:12 It's just there so you can do nested loops. 2023-07-19 15:03:18 camel86 has 2023-07-19 15:03:33 Forth keeps those on the return stack, and also exposes the return stack to your direct manipulation. 2023-07-19 15:03:52 So you have to be careful what you do within loops - muck about with the return stack and you can step on your own loop counters. 2023-07-19 15:04:23 I, REBOOT 2023-07-19 15:05:11 oh ok 2023-07-19 15:06:02 i like the code of camel86 2023-07-19 15:06:42 its in Turbo Assembler 2023-07-19 15:07:58 Nice - maybe you can tinker it into what you want. 2023-07-19 15:08:24 By the way, I agree with what crc said yesterday about graphics - for DOS I'd set the mode and go straight for the graphics RAM buffers. 2023-07-19 15:08:30 yes i can add some gfx stuff 2023-07-19 15:08:57 i know mode 13 2023-07-19 15:09:39 write directly to screen memory 2023-07-19 15:12:10 i like memory mapped Virtual Machines 2023-07-19 15:12:47 the registers ans flags are in memory 2023-07-19 15:21:15 thanks KipIngram 2023-07-19 15:21:46 i got to go now 2023-07-19 19:55:32 hello guys 2023-07-19 20:18:12 cd dos 2023-07-19 20:18:18 opps 2023-07-19 20:43:03 good evening siesta 2023-07-19 21:08:57 hello crc 2023-07-19 21:10:30 its hard to greet using time we differ in zones 2023-07-19 21:10:36 hahaha 2023-07-19 21:10:59 epoch appropriate greetings, etc 2023-07-19 21:11:03 time is just invented so they can sell clocks 2023-07-19 21:16:52 there are military and economic uses 2023-07-19 21:32:48 but in bible's point of view god created time 2023-07-19 21:38:02 Then you have people who try to say time doesn't exist - that the past, present, and future all just "are" in a big 4D structure. 2023-07-19 21:38:20 I don't really think a lot of those ideas. 2023-07-19 21:45:27 I only really watch time with regard to going to/leaving work or occasional social events 2023-07-19 21:49:45 Same here. These days I don't watch any "scheduled" TV these days - that was one of the big things that used to involve a clock. 2023-07-19 21:50:06 these days these days these days... :-) I got distracted while typing that sentence. 2023-07-19 22:05:34 i use time for medicine so sad 2023-07-19 22:10:59 thyme is said to have health benefits