2023-01-19 00:01:40 So, enthddd|||, what's motivating this Morse code notion? 2023-01-19 00:01:47 You into ham radio? 2023-01-19 00:32:11 Holy cow - I've heard of Lagrange polynomials my whole life, but never really knew what they're *for*. 2023-01-19 00:32:51 They're the "easy and right" way to quickly fit an n-1 order polynomial (a unique one) through n arbitrary x/y points. 2023-01-19 00:33:18 this is where the term "Lagrange interpolation" springs from. 2023-01-19 01:30:36 I have a question for you. If Forth is so much cooler, and it probably is, why all the 8-bit microcomputers have had BASIC (if they had a programming language translator at all) in the ROM? 2023-01-19 01:31:06 And while Forth was available it was only loaded externally 2023-01-19 01:32:42 i would guess compatibility 2023-01-19 01:34:05 I think Forth IF operator is quite confusing, why not to have it as [ condition ] [ do-true ] [ do-false ] if-else for example ? 2023-01-19 01:34:12 i think apple had the first or one of the first microcomputers and it had basic in it 2023-01-19 01:34:48 Stalevar: there is the jupiter ace which actually had forth 2023-01-19 01:35:15 https://jupiter-ace.co.uk/ 2023-01-19 01:35:24 Same as say 5 2 - means 5 minus 2, while things are pulled in reverse order from stack, if and else could also pull the thing from stack in reverse order but interpret them in a way that allows to write if stuff in same way as it's written in other languages (cond-true-false) 2023-01-19 01:35:32 * in same order 2023-01-19 01:35:59 dave0, Altair was the first one 2023-01-19 01:36:21 Imsai 8080 came shortly after and I think it was really cool 2023-01-19 01:36:39 If I was to choose one 8-bit microcomputer to get, I'd go for IMSAI 2023-01-19 01:37:15 Stalevar: [condition] [do-true] [do-false] if-else you would have to delay evaluating do-true and do-false until you reach [if-else] 2023-01-19 01:37:18 Neither had Basic in ROM, since they got no ROM 2023-01-19 01:37:52 dave0, they are just put into the stack, it's fast, isn't it? 2023-01-19 01:38:11 Stalevar: forth evaluates it as soon as you get to it 2023-01-19 01:38:12 in dc [ ] means to put a string into stack 2023-01-19 01:38:22 it can be pulled out and executed with x 2023-01-19 01:38:49 forth can have had some quotes 2023-01-19 01:38:54 Stalevar: you could simulate that 2023-01-19 01:39:32 Tcl has a similar thing, { } means a string, it's evaluated only when the command gets to it. But the commands in Tcl are written in direct order: command arg1 arg2 ... 2023-01-19 01:39:58 if {cond} {do-then} {do-else} is just a command 2023-01-19 01:40:10 it can accept additional argument `else` 2023-01-19 01:40:21 if {cond} {do-then} else {do-else} 2023-01-19 01:40:36 it does nothing but makes code more readable 2023-01-19 01:41:27 Stalevar: have a multiplexer word : mux ( flag true false -- n ) 2 pick invert and >r and r> or ; condition s" do-true" s" do-false" mux evaluate 2023-01-19 01:41:35 Things in {} are just strings, so they aren't evaluated until if decided to evaluate them 2023-01-19 01:42:12 Stalevar: mux picks the first string if flag is true, but the second string if flag is false, and then it is evaluated 2023-01-19 01:43:21 Stalevar: that tcl isn't reverse polish 2023-01-19 01:44:00 Yeah, but direct-polish notation is actually as powerful as reverse polish one 2023-01-19 01:44:08 Stalevar: it doesn't take long to get used to [condition] if [true] else [false] then 2023-01-19 01:44:23 But why else goes before then? 2023-01-19 01:44:24 Stalevar: you can convert between them with an algorithm 2023-01-19 01:44:45 Stalevar: then terminates the if 2023-01-19 01:45:00 Why not condition if [true] then [false] else 2023-01-19 01:45:14 Stalevar: that's infix 2023-01-19 01:45:17 Ah, I see, it would make else mandatory 2023-01-19 01:45:54 Stalevar: if you swapped then and else in your line, you have forth's if..else..then 2023-01-19 01:46:15 I see, forth order makes sense 2023-01-19 01:46:28 then is used instead of endif 2023-01-19 01:46:29 Stalevar: it might be easier to imagine if you made END-IF 2023-01-19 01:46:35 Stalevar: right 2023-01-19 01:47:23 Stalevar: Well, Forth is cool. However, it is also *different* from the way most kids are taught to do arithmetic, so many, many people are just unwilling to open their minds to a "new way." I happen to believe RPN is *better* than infix, but that's definitely a personal opinion and a minority one. 2023-01-19 01:47:43 dave0, there is also prefix notation, which is same as reverse polish notation, but in reverse. It's used by languages Rebol and Red 2023-01-19 01:47:52 As far as why BASIC caught on so, that has a lot to do with it being pushed by Microsoft in the early days of computing. 2023-01-19 01:48:15 It won the popularity contest, and as you well know popularity contests are definitely not always "merit-based." 2023-01-19 01:48:26 KipIngram, but isn't direct-polish as good as reverse-polish ? 2023-01-19 01:48:31 or maybe even better 2023-01-19 01:49:20 As far as why IF works the way it does, remember the simplicity of Forth. The goal in Forth is to make a single scan, word by word, through the code, and know what to do. I didn't study your proposed syntax with complete care - maybe it would support that. 2023-01-19 01:49:24 Stalevar: if you mean infix, that is what children are taught when they teach them mathematics 2023-01-19 01:49:34 But Forth is almost entirely devoid of what you would call "syntax." 2023-01-19 01:49:45 IF ... ELSE ... THEN is certainly syntax. 2023-01-19 01:49:57 dave0, I mean prefix 2023-01-19 01:50:14 Say, (2+2)*2+2 is infix notation 2023-01-19 01:50:16 But those elements are much more the exception than the rule, and to achieve them you need to pass information forward from IF to THEN and ELSE on the stack at compile time. 2023-01-19 01:50:16 Stalevar: prefix is lisp 2023-01-19 01:50:32 2 2 + 2 * 2 + is postfix 2023-01-19 01:50:40 Yes. 2023-01-19 01:50:59 + * + 2 2 2 2 2023-01-19 01:51:03 Postfix and a data stack just "fit" hand in glove. 2023-01-19 01:51:39 OR better... 2023-01-19 01:51:46 Stalevar: you could argue that postfix or prefix is more natural, and i would agree, but math formulas are infix which kids learn in school, and people like familiar things 2023-01-19 01:52:05 Stalevar: (+ (* (+ 2 2) 2) 2) 2023-01-19 01:52:10 Also don't forget that a large part of Forth at least started out the way it did (and a lot of it stuck) because it was invented by a single guy and that was just what seemed sensible to him at the time. 2023-01-19 01:52:14 That's lisp, yes 2023-01-19 01:52:20 Stalevar: but forth needs even less syntax than lisp 2023-01-19 01:52:45 I go back and forth on whether I actually consider Lisp more complicated than Forth or not. 2023-01-19 01:52:50 In a lot of ways they're very similar. 2023-01-19 01:53:00 Forth uses a push down stack; Lisp uses parentheses. 2023-01-19 01:53:07 But the purpose is the same in both cases. 2023-01-19 01:53:22 Their simplest interpreter can fit in the boot sextor on x86 2023-01-19 01:53:28 sectorlisp and sectorforth 2023-01-19 01:53:31 Yes. 2023-01-19 01:53:34 maybe there was sectorbasic? 2023-01-19 01:53:49 My main interest in Lisp has been an interest in its "simple implementation." 2023-01-19 01:53:55 Stalevar: there is sector basic! i believe it's called bootbasic 2023-01-19 01:53:58 I did get the feeling that it could perhaps rival Forth in that regard. 2023-01-19 01:54:10 And having a sector version of both kind of supports that. 2023-01-19 01:54:16 Stalevar: https://github.com/nanochess/bootBASIC 2023-01-19 01:54:47 Are there other sector languages? 2023-01-19 01:54:48 But I don't regard BASIC as even in the same league as Forth or Lisp. 2023-01-19 01:55:05 BASIC is an abomination... but it supports infix notation 2023-01-19 01:55:07 It was just popular for a period of time because it was made available on a massive scale. 2023-01-19 01:55:14 For free, once you bought your computer. 2023-01-19 01:55:23 i think there is brainfuck in a boot sector 2023-01-19 01:55:24 It's like a calculator 2023-01-19 01:55:39 I don't regard supporting infix as a feature. 2023-01-19 01:55:47 Yeah, but that not real language (I also wrote a branfuck compiler, so I know), even if turing complete 2023-01-19 01:55:47 But Forth can be coded to support infix too. 2023-01-19 01:56:14 The language's inventor, Chuck Moore, lays that out in a book he wrote (self-published) very early on, before Forth was very mature. 2023-01-19 01:56:34 At the time he seemed to feel a need to "respond to" criticisms of that sort (your math is weird). 2023-01-19 01:56:44 Later he became more... confident. 2023-01-19 01:57:24 Later he would have said Forth doesn't use infix because infix is inferior. 2023-01-19 01:57:58 Anyway, tell me how do I do a string in forth and how do I read a thing from stdin? I guess that's what I miss, and then I will be able to write stuff in forth 2023-01-19 01:58:01 Stalevar: someone pointed out that C/Java/Javascript/algol-ish languages function calls are prefix... name(a,b,c) => in lisp (name a b c) 2023-01-19 01:58:04 Ah. 2023-01-19 01:58:08 Now you're onto a weakness. 2023-01-19 01:58:30 Forth generally has rather poor string support. There may be some floating around out there that improve on it, and it's definitely something I want to improve on. 2023-01-19 01:58:42 but, essentially Forth lets you create arrays, of anything you like. 2023-01-19 01:58:49 Just tell me how to put a string into stack 2023-01-19 01:58:51 And what you do with them and how you do it is up to you to code. 2023-01-19 01:58:59 'Hello world' emit 2023-01-19 01:59:00 Stack won't hold a string. 2023-01-19 01:59:01 or whatever 2023-01-19 01:59:02 Stalevar: you can define strings as s" mystring" and there is ACCEPT to read a line from stdin 2023-01-19 01:59:16 You put the string in RAM, and a pointer to it on the stack. 2023-01-19 01:59:26 Stalevar: : hello s" hello world" type ; 2023-01-19 01:59:43 Note that that is compiled. 2023-01-19 01:59:49 It may or may not work interpreted. 2023-01-19 01:59:57 See, in a definition, there is a place to put the string. 2023-01-19 02:00:01 How about 'what is your name?' - you type Stalevar - "Hello, Stalevar!" ? 2023-01-19 02:00:02 It goes inline in the definition. 2023-01-19 02:00:10 And you get that address put on the stack when you run it. 2023-01-19 02:00:13 Usually second example in any language 2023-01-19 02:00:22 But if you just type it at the interpreter it doesn't have anywhere to put the string data. 2023-01-19 02:00:29 Unless you've enhanced your system in some way. 2023-01-19 02:00:38 Which Forth DOES let you do. 2023-01-19 02:00:44 but you have to build it. 2023-01-19 02:01:02 Stalevar: hang on i'll try and write that 2023-01-19 02:01:05 i'm planning to use a data structure called ropes to do mine, when I get around to it. 2023-01-19 02:01:18 I'll use ropes for arrays / lists of whatever type I want. 2023-01-19 02:01:43 By the way, we were talking about Forth for linux 2023-01-19 02:01:47 I found Jones Forth 2023-01-19 02:01:54 maybe it's better than pforth? 2023-01-19 02:02:05 Forth gives you the stack to put integers on, and it gives you the dictionary to put everything else in. 2023-01-19 02:02:19 Dictionary space is allocated linearly, and its in no way "dynamic memory." 2023-01-19 02:02:32 you can "forget" back to an earlier point, but then everything back to that point is gone. 2023-01-19 02:02:42 So arrays go into the dictionary. 2023-01-19 02:02:53 That's where your definitions go too. 2023-01-19 02:03:28 You can allocate a chunk of memory using ALLOT, and then you can use it for anything you like - the dictionary will continue to grow after it. 2023-01-19 02:03:35 Stalevar: : greet ." what is your name? " cr pad pad 100 accept cr ." hello, " type ; 2023-01-19 02:03:57 cr is carriage return? 2023-01-19 02:04:06 Stalevar: yes 2023-01-19 02:04:15 Stalevar: pad is scratch space 2023-01-19 02:04:22 Notice, though, that that "what is your name" string doesn't get stored in a way that lets you ADDRESS it outside of that definition. 2023-01-19 02:04:23 : hi s"Hello, world!" type ; 2023-01-19 02:04:23 :5: Undefined word 2023-01-19 02:04:24 : hi >>>s"Hello,<<< world!" type ; 2023-01-19 02:04:31 gforth doesn't understand this 2023-01-19 02:04:31 ." PRINTS it, immediately, and then it's not used again. 2023-01-19 02:04:33 Stalevar: pad 100 accept inputs up to 100 chars, and returns the actual number 2023-01-19 02:04:50 Stalevar: need a space after s" 2023-01-19 02:05:00 pad changes when you add something new to the dictionary - that's not a permanent allocation. 2023-01-19 02:05:11 KipIngram: oh whoops! 2023-01-19 02:05:19 CREATE MYSTRING 100 ALLOT 2023-01-19 02:05:41 That gives you room for a 100-byte string (that includes either a count byte or a null termination). 2023-01-19 02:05:45 So 99 data chars. 2023-01-19 02:06:10 Well, wait, dave0 does ACCEPT null terminate the input string? 2023-01-19 02:06:18 Or does it think giving you the count is enough? 2023-01-19 02:06:36 KipIngram: afaik it just gives you the count 2023-01-19 02:06:38 Stalevar: ACCEPT is a later addition to Forth, and my knowledge is mostly from older designs. 2023-01-19 02:06:57 Ok. Then scratch what I said about 99 chars - it sounds like it is 100. 2023-01-19 02:07:02 The 100 ALLOT that is. 2023-01-19 02:07:20 Stalevar: there are some interesting words where you need to put a space 2023-01-19 02:07:27 dave0, so cr is same as 10 emit? 2023-01-19 02:07:28 CREATE adds MYSTRING to the dictionary, and running it will give you the address where the 100 bytes start. 2023-01-19 02:07:40 Stalevar: yes 2023-01-19 02:07:42 Yeah. Or 13 emit, depending on your system. 2023-01-19 02:07:51 Or 10 emit 13 emit, if you're on an OS that uses both. 2023-01-19 02:08:21 It does whatever your system needs it to do to newline on your console. 2023-01-19 02:08:21 Usually 13 goes before 10 2023-01-19 02:08:26 Whoops. 2023-01-19 02:08:26 10 13 emit emit 2023-01-19 02:08:29 Sorry. :-) 2023-01-19 02:08:45 Stalevar: nice, you're getting it :-) 2023-01-19 02:08:49 I guess it should work either way 2023-01-19 02:08:49 Been a long time since I mucked with Windows. 2023-01-19 02:09:01 It's not only Windows 2023-01-19 02:09:09 Well, I don't see it on Linux. 2023-01-19 02:09:16 Teletypes and things needed CR LF 2023-01-19 02:09:30 ^ see above about "long time." :-) 2023-01-19 02:09:36 Because those bytes commanded the printing head to move 2023-01-19 02:09:51 Right - that makes total sense. 2023-01-19 02:09:53 Two motors. 2023-01-19 02:09:57 Different motions. 2023-01-19 02:10:11 13 means moving the head to the beginning of line and 10 means scroll by one line 2023-01-19 02:10:21 right. 2023-01-19 02:10:52 In linux 13 is used to output counters or progress bars on the terminal 2023-01-19 02:10:53 It actually makes pretty good sense to separate them. 2023-01-19 02:11:30 Say, wget progress bar 2023-01-19 02:12:34 Anyway, the core point here is that Forth leaves it up to you to build most of this stuff - core Forth at least. Different imps in the world have added features around things like strings for a long time, but none of them really have the power and flexibility of, say, Python string handling. 2023-01-19 02:12:59 Easy string munging is what really usually winds up getting me to pick up Python for little stuff I write at work. 2023-01-19 02:13:27 I've done a lot of "text munging" applications, where I take some output designed for humans to read and force some sort of automation onto it. 2023-01-19 02:14:34 One of my long-term Forth goals is to develop Forth application code that lets me do the kind of work I might do in Octave or Matlab. 2023-01-19 02:14:41 And for that I want a stack that can hold anything. 2023-01-19 02:14:54 An "object" stack. Ints, reals, complex, vectors, etc. etc. 2023-01-19 02:14:58 Matrices. 2023-01-19 02:15:07 So that will really be a stack with pointers on it. 2023-01-19 02:15:44 I think sometimes about arranging it so that items that will fit in a 64-bit cell can live directly on the stack, but that might be more of a kludge than anything else. 2023-01-19 02:15:54 Might be better just to bite the bullet and make it solid pointers. 2023-01-19 02:16:07 And the data will live in that ropes environment. 2023-01-19 02:16:22 And I will be able to do dynamic memory management around that. 2023-01-19 02:16:31 But that isn't something I'll think of as my "core Forth." 2023-01-19 02:16:46 It'll be a tool written for a specific type of work. 2023-01-19 02:17:33 But then I will be able to just type a string, and the data will go into the ropes (space being allocated at that time), and the pointer will go on the stack. 2023-01-19 02:17:57 then I'll be able to print it, split it, concatenate it, search it, etc. - whatever I want to write the code for. 2023-01-19 02:18:21 I also want some sort of regular expression support in that system, too. 2023-01-19 02:18:36 dave0, why pad two times? 2023-01-19 02:18:54 But all of that will happen because I write it - not because anything comes out of a box with those features. 2023-01-19 02:19:10 PAD just gives you an address some arbitrary distance beyond the end of the dictionary. 2023-01-19 02:19:19 It leaves that address on the stack. 2023-01-19 02:19:42 If you do anything that moves the dictionary boundary, then PAD will return a new address, further a long. 2023-01-19 02:20:03 HERE gives yo the next byte that will be allocated from the dictionary. 2023-01-19 02:20:05 So 2023-01-19 02:20:14 : PAD HERE + ; 2023-01-19 02:20:18 KipIngram, python string handling is not that good, actually, it has some problems with UTF-8, even python 3 2023-01-19 02:20:24 where is just some system dependent number. 2023-01-19 02:20:32 It has worked well for me. 2023-01-19 02:20:43 And I haven't done any sort of deep search for "the best." 2023-01-19 02:20:52 I've heard SNOBOL excels, but I've never used it. 2023-01-19 02:21:17 Stalevar: it's needed for type ... you could write it like : hi ." what's your name?" cr pad 100 accept pad swap cr ." hello, " type ; 2023-01-19 02:21:21 But really it's not just strings that draw me to Python. 2023-01-19 02:21:26 > An "object" stack. Ints, reals, complex, vectors, etc. etc. | Did you look into APL line: APL, J, K, stuff like that? 2023-01-19 02:21:38 Python's choice of features just somehow "clicks" with my typical needs, when I need something quick and dirty. 2023-01-19 02:22:03 Yes, I went on an APL kick a year ago or so. 2023-01-19 02:22:06 Maybe a little under. 2023-01-19 02:22:21 I like it, and I like real APL with the terse symbols better than the wordy variants. 2023-01-19 02:22:37 I don't know it very well, but I wet my whistle a little. 2023-01-19 02:22:48 Just enough to get a vague feel for it. 2023-01-19 02:23:03 There's a guy here in channel, nick eris, that seems to be pretty good with it. 2023-01-19 02:23:11 Stalevar: pad 100 accept puts up to `100` chars at `pad` and returns a length ... pad 10 type prints `10` chars from `pad` but the 10 is not known in advance, you need to shuffle the stack a bit 2023-01-19 02:23:16 nickname eris 2023-01-19 02:23:33 But... 2023-01-19 02:23:38 pad 100 accept ... 2023-01-19 02:23:40 : foo ; 2023-01-19 02:23:45 pad 10 type ... 2023-01-19 02:23:47 Won't work. 2023-01-19 02:24:00 That's where the 2023-01-19 02:24:07 KipIngram: ohh.. 2023-01-19 02:24:14 CREATE ... 100 ALLOT 2023-01-19 02:24:16 comes in. 2023-01-19 02:24:24 Whatever word you create will forever point to those 100 bytes. 2023-01-19 02:24:43 PAD is meant for VERY transient uses. 2023-01-19 02:24:59 ah ok 2023-01-19 02:25:14 Heh. Glad I got to point that out to you before it bit you. 2023-01-19 02:25:20 Stalevar: KipIngram specifically allocates some space for the name 2023-01-19 02:25:41 Yeah, then you've got it, by that name, forever. 2023-01-19 02:25:43 KipIngram: my forth just sticks pad in memory somewhere and ignores it :-) 2023-01-19 02:25:50 It's the "larger space" equivalent of VARIABLE 2023-01-19 02:26:04 : VARIABLE CREATE CELL ALLOT ; 2023-01-19 02:26:17 KipIngram: i'm redesigning my forth dictionary _again_ 2023-01-19 02:26:27 : CONSTANT CREATE , DOES> @ ; 2023-01-19 02:27:19 i like create it is my favorite maker of variables :-) 2023-01-19 02:27:34 Stalevar: CREATE just makes an empty word and allocates nothing. When executed, that word will leave the address of the first unused dictionary byte at the time it was compiled. 2023-01-19 02:27:51 The , takes a number from the stack and adds it to the dictionary (allocating the cell for it). 2023-01-19 02:28:08 And DOES> lets you write defining words that have a custom runtime behavior. 2023-01-19 02:28:34 So because I used CREATE in CONSTANT up there, the address of the cell is left on the stack by default. The DOES> causes an @ to be added at run time as well. 2023-01-19 02:28:41 Fetching the value you put in there with , 2023-01-19 02:29:50 dave0, I still don't understand. What does `pad` do alone? Why `pad 100` instead of `100 pad` ? 2023-01-19 02:30:04 : PAD HERE + ; 2023-01-19 02:30:15 It leaves the address that is N bytes past the end of the dictionary on the stack. 2023-01-19 02:30:24 Stalevar: `pad` by itself pushes the address of some memory 2023-01-19 02:30:25 An address of currently unutilized RAM. 2023-01-19 02:30:31 For you to do something quick and dirty with. 2023-01-19 02:30:37 I see 2023-01-19 02:30:45 You got an address 2023-01-19 02:30:53 It's kind of a "suspect idea," using unallocated memory. 2023-01-19 02:30:59 Then you have another `pad`, you got the same address? 2023-01-19 02:31:06 But so long as you're careful about it, it works, and you don't have to worry about de-allocating. 2023-01-19 02:31:15 Stalevar: then 100 just pushes that number, so on the data stack you have
<100> 2023-01-19 02:31:16 Only if you didn't change the dictionary. 2023-01-19 02:31:24 The same gets allocated every time. 2023-01-19 02:31:34 Stalevar: the ACCEPT word takes those 2 parameters 2023-01-19 02:31:35 That's why I broke it above when I put : foo ; in between. 2023-01-19 02:31:38 Why do you need pad pad 100 instead of pad dup 100 ? 2023-01-19 02:31:50 Stalevar: you could have done that with dup, sure 2023-01-19 02:31:52 I think he just wanted to leave a second copy for later use. 2023-01-19 02:31:57 Could have been PAD DUP 2023-01-19 02:32:03 yup 2023-01-19 02:32:09 The ACCEPT takes a copy. 2023-01-19 02:32:14 And he needed another for TYPE 2023-01-19 02:32:35 OK, accept moves the data allocator pointer 100 bytes forward 2023-01-19 02:32:42 No. 2023-01-19 02:32:45 Stalevar: in this case, PAD PAD and PAD DUP has the same effect, i didn't write it either way on purpose 2023-01-19 02:32:51 ACCEPT puts bytes from the keyboard somewhere, allocated or not. 2023-01-19 02:33:12 Stalevar: ACCEPT just fills that area of memory with a line of input 2023-01-19 02:33:15 Nothing in that example (except my : foo ;) moved the allocation pointer. 2023-01-19 02:33:29 Stalevar:
is where the characters go <100> is the maximum length 2023-01-19 02:34:05 My example with CREATE makes a permanent memory allocatin, using ALLOT 2023-01-19 02:34:15 Stalevar: say i type "dave" then ACCEPT will put 'd' 'a' 'v' 'e' at the address and return <4> 2023-01-19 02:34:19 ALLOT allocates the memory; the CREATE gives you a way to get at it by name. 2023-01-19 02:34:28 `type` takes address of zero-terminated string and prints it, right? 2023-01-19 02:34:33 Stalevar: no 2023-01-19 02:34:38 Takes address count 2023-01-19 02:34:41 Stalevar: type also takes
2023-01-19 02:34:54 accept pushes the length 2023-01-19 02:35:00 There isn't a standard word for printing a null terminated string. 2023-01-19 02:35:02 Stalevar: correct 2023-01-19 02:35:26 Forth is a little bipolar on counted strings and null terminated strings. 2023-01-19 02:35:47 Stalevar: but accept consumes the
... that's why i have two PAD's ... one for ACCEPT and one for TYPE 2023-01-19 02:35:50 I usually null terminate my counted strings too, just so I can use them either way. 2023-01-19 02:35:57 But obviously that's wasting a byte. 2023-01-19 02:36:27 Counted strings are very helpful because in your dictonary header entries the word names are stored as counted strings. 2023-01-19 02:36:42 So when you parse a word out of the input string to search for it, you really benefit from that being counted as well. 2023-01-19 02:36:54 You can just do an exact match search on the dictionary. 2023-01-19 02:37:01 I see, accept also won't let you type more than allowed 2023-01-19 02:37:21 Stalevar: right 2023-01-19 02:37:24 Usually all those dictionary names are strung together as a linked list, though there is this business of "vocabularies" that make it a little more complicated than that. 2023-01-19 02:37:32 Each vocabulary word list is a linked list. 2023-01-19 02:38:13 At any time you can specify which vocabularies you want in your "search path" and also which one should receive newly defined words. 2023-01-19 02:38:19 Stalevar: ACCEPT will consume
<100> and produce <4> (if i type "dave") 2023-01-19 02:38:23 But sorry- that's getitng a little off topic. 2023-01-19 02:38:33 null-terminated strings are quite annoying. They don't let you use embedded \0 in them 2023-01-19 02:38:36 Stalevar: then you have to juggle the stack to get
<4> TYPE 2023-01-19 02:38:39 so counted ones are superior 2023-01-19 02:39:27 Stalevar: standard forth tries to use
pairs on the stack 2023-01-19 02:39:36 Stalevar: but there is backwards compatibility 2023-01-19 02:39:55 i totally prefer
pairs and that's how i've coded my forth, but it is non-standard in some words 2023-01-19 02:41:35 the hard part is that other languages do it different... C has null-terminated strings, PASCAL has a byte+string 2023-01-19 02:41:51 sometimes you have to be compatible with other langauges 2023-01-19 02:42:23 counted strings in forth is another name for pascal strings 2023-01-19 02:42:47 Stalevar: True, but counted strings are limited to 255 bytes. 2023-01-19 02:43:01 But I agree. 2023-01-19 02:43:12 I guess hte attitude is just that "strings" aren't for binary data. 2023-01-19 02:43:26 In that ALLOTTED RAM space you can put absolutely anything you want. 2023-01-19 02:43:35 You keep up with the size however you want to. 2023-01-19 02:44:53 I use null terminated strings for console input and code loading because in my system (and others - I didn't invent this) there is a word in my system with "null string" as its name - just a name field with a 0 count byte and nothing else. 2023-01-19 02:45:09 And it is an "immediate" word, which means it executes RIGHT NOW, even if you're compiling. 2023-01-19 02:47:41 In my system that's how my interpreter "finishes." It's just an infinite loop, but the null causes a two-level return out of it to the caller. 2023-01-19 02:48:05 I think that's kind of a hack, but it's how a system I leanred from did it, so I've never stopped. 2023-01-19 02:48:58 Stalevar: the beauty of making your own forth is that you get to decide how strings work 2023-01-19 02:49:06 Gotta head to bed. Oh, obviously I survived the sedation at the dentist. :-) 2023-01-19 02:49:09 Night guys. 2023-01-19 02:49:14 nite KipIngram 2023-01-19 02:50:18 Stalevar: all my strings are pairs 2023-01-19 02:51:43 Stalevar: standard forth has support for for these pairs on the stack... it is the same as `double sized` numbers... they take up two cells on the stack 2023-01-19 02:52:18 Stalevar: so you can 2DUP to duplicate both cells and get 2023-01-19 03:00:17 dave0> Stalevar: it's needed for type ... you could write it like : hi ." what's your name?" cr pad 100 accept pad swap cr ." hello, " type ; << wait, doesn't ACCEPT allocate memory? Why pad doesn't return address of free memory after the line you typed? 2023-01-19 03:00:55 Stalevar: no, accept doesn't allocate memory 2023-01-19 03:02:03 Stalevar: KipIngram was talking about pad moving between times of allocating memory (either through ALLOT or making a definition) ... in this case, pad won't move 2023-01-19 03:02:44 Stalevar: you could refactor my code 2023-01-19 03:03:36 Stalevar: : get-name pad 100 accept pad swap ; : greet ." whats your name?" cr get-name cr ." hello, " type ; 2023-01-19 03:04:16 Stalevar: get-name will return a suitable to be TYPE'd 2023-01-19 03:05:01 Stalevar: you could test it by writing get-name type into the REPL 2023-01-19 03:05:21 I see 2023-01-19 03:06:06 Stalevar: you will hear people talking about refactoring in forth _a lot_ 2023-01-19 03:08:14 So Forth is a C-like language in this context, you have to juggle your memory yourself 2023-01-19 03:09:10 yeah sort of 2023-01-19 03:09:34 can you define new control structures similar to `if else then` in Forth? 2023-01-19 03:09:39 but different to c is that you can extend forth to handle it for you 2023-01-19 03:09:47 yes 2023-01-19 03:10:08 `if else then` can actually be written in forth itself 2023-01-19 03:10:15 jonesforth does that 2023-01-19 03:11:06 what is within the core forth than, which cannot be written in forth? 2023-01-19 03:11:32 https://github.com/cesarblum/sectorforth 2023-01-19 03:13:15 Why nand? 2023-01-19 03:13:37 you can use nand to make all the others and or xor invert etc. 2023-01-19 03:13:49 exit means ret 2023-01-19 03:14:08 in a certain sense, yes 2023-01-19 03:22:14 Somebody should rewrite jonesforth to C, I guess 2023-01-19 03:22:35 C is about as fast as assembly but works on say arm64 or amd64 2023-01-19 03:23:12 $ ./jonesforth 2023-01-19 03:23:12 Segmentation fault 2023-01-19 03:23:14 Nice... 2023-01-19 03:25:33 Though I am pretty sure there is already some forth core in C 2023-01-19 03:25:35 jonesforth is like a proof by example of building forth from the basic machine code 2023-01-19 03:25:51 yes gforth (gnu forth) is written in c 2023-01-19 03:26:08 But it's not like a core plus the rest in forth itself 2023-01-19 03:26:57 I'm talking about writing sectorforth or jonesforth in C and using that as core to build some more-or-less functional forth 2023-01-19 03:27:40 so it can be easily ported between machines like mips, arm, risc-v, x86, x86_64, aarch64 2023-01-19 03:28:44 you can certainly write a forth system in C 2023-01-19 03:29:06 hang on let me find a link 2023-01-19 03:29:56 https://github.com/ForthHub 2023-01-19 03:30:22 that has a lot of stuff of forth projects on github 2023-01-19 03:30:46 just looking at it there's a forth in javascript that probably runs in the browser 2023-01-19 03:32:44 Is it normal that jonesforth crashes immediately on amd64 machine? 2023-01-19 03:33:13 Stalevar: i don't think i've actually tried to run jonesforth directly 2023-01-19 03:33:23 Stalevar: i think you have to compile it in 32 bits 2023-01-19 03:33:33 Stalevar: gcc -m32 jonesforth.S 2023-01-19 03:34:05 i think i heard of someone porting jonesforth to amd64 hang on 2023-01-19 03:34:29 Makefile does that 2023-01-19 03:34:48 $ qemu-i386 jonesforth jonesforth.f 2023-01-19 03:34:49 10 emit 2023-01-19 03:34:49 PARSE ERROR: 10 emit 2023-01-19 03:36:07 sorry i can't help :-( 2023-01-19 03:36:19 you could install gforth 2023-01-19 03:36:38 it tries to be standard 2023-01-19 03:37:25 i managed to compile and run gforth on netbsd 2023-01-19 03:37:37 if you're on linux there's probably a package 2023-01-19 03:37:47 gforth has 1000's of words 2023-01-19 03:54:43 I already have gforth, yes 2023-01-19 03:58:23 sometimes i use gforth for quick one-liners because it's compatible with the standard .. whereas the forth i'm writing is not standard 2023-01-19 03:59:05 in my forth i'm learning how to write a forth, and also experimenting with different ideas 2023-01-19 03:59:15 for example i have no counted strings 2023-01-19 04:00:03 there's about 3 standard words that use counted strings ... which i intentionally left out 2023-01-19 04:04:09 So, I got jonesforth to do something, actually 2023-01-19 04:04:39 $ cat jonesforth.f - | qemu-i386 ./jonesforth 2023-01-19 04:04:39 JONESFORTH VERSION 47 2023-01-19 04:04:39 14499 CELLS REMAINING 2023-01-19 04:04:46 It wants CAPS 2023-01-19 04:05:19 oh! 2023-01-19 04:05:31 whoops! 2023-01-19 04:05:47 $ cat jonesforth.f - | qemu-i386 ./jonesforth 2023-01-19 04:05:48 JONESFORTH VERSION 47 2023-01-19 04:05:48 14499 CELLS REMAINING 2023-01-19 04:05:57 haa! 2023-01-19 04:06:00 nice one :-) 2023-01-19 04:06:44 that's pretty cool 2023-01-19 04:06:54 i've never actually tried to run jonesforth :-p 2023-01-19 04:16:47 Well in my Forth, there's *only* counted strings! 2023-01-19 04:16:56 Okay that's not actually true 2023-01-19 04:17:27 veltas: lol 2023-01-19 04:23:07 dave0: Where are all the promotional videos for your Forth with this music https://www.youtube.com/watch?v=07a9uSPwxSg 2023-01-19 04:23:32 Also none of the videos can actually say anything specific or useful about your Forth 2023-01-19 04:23:47 Just that it's vaguelly the future and larger than life 2023-01-19 04:24:14 ACTION has visions of his forth 2023-01-19 04:24:36 I'm backing it 2023-01-19 04:24:48 hmm if i knew random business words i would say them 2023-01-19 04:24:51 synergy 2023-01-19 04:25:28 Your customer journey is at the bleeding edge 2023-01-19 04:25:53 opportunity 2023-01-19 04:26:46 i feel like i'm accomplishing things by listening to this music :-) 2023-01-19 04:26:48 We've found how to retarget this game-changer product into a scalable SaS offering 2023-01-19 04:27:26 Microdosing capitalism 2023-01-19 04:28:17 We're crushing it 2023-01-19 04:29:12 Developers! Developers! Developers! 2023-01-19 04:31:26 "I love the second track, I can imagine a company is giving a speech over it where they address some of the complaints they received and resolve none of them." 2023-01-19 04:33:03 JFC, I just looked at that URL. How did you come across this? It's awful! 2023-01-19 04:34:03 I just had this idea that we could do a cheesy corporate video about Forth and wanted some inspiration so searched for "corporate music" on YouTube 2023-01-19 04:34:23 I can't voice it though, need someone with a really gnarly californian accent 2023-01-19 04:35:08 I feel like as this playlist continues, I am slowly dying inside. 2023-01-19 04:53:51 I have got a ZX Spectrum 48k clone. Do you think it's feasible to reflash it so it runs Forth instead of Basic off the ROM? 2023-01-19 04:54:08 But I guess basic line editing is kinda nice maybe 2023-01-19 05:04:06 Though as far as I can see from Jones Forth it isn't that hard to decompile Forth on site 2023-01-19 05:04:29 So the forth could decompile itself by LIST command or something 2023-01-19 05:04:54 Stalevar: there are zx spectrums clones that run forth by default 2023-01-19 05:05:15 https://en.wikipedia.org/wiki/Hobbit_(computer) 2023-01-19 05:05:33 ive had its rom images somewhere although it is 64k so probably will not be compatible 2023-01-19 05:06:57 You can try to replace ROM file in zx48k emulator and see if it runs 2023-01-19 05:10:25 Stalevar: i was trying, although very little documentation there is and most of it is in russian lol 2023-01-19 05:10:35 and that computer of course ahd inconsistent rosm anyway 2023-01-19 05:11:12 lich, so plainly replacing the file won't work? 2023-01-19 05:11:49 Stalevar: i had little luck before, will upload the hobbit rom when i find it again 2023-01-19 05:12:08 lich, if you need help with Russian docs I might be of help perhaps 2023-01-19 05:12:33 Though currently I'm leaning on another computer, Apogee BK-01C 2023-01-19 05:12:54 Stalevar: You might find this code helpful if you decide to write your own Forth ROM https://github.com/Veltas/zenv 2023-01-19 05:13:03 Stalevar: are you russian? 2023-01-19 05:13:06 C stand for Color, or Цвет ( cvet, tsvet), since it has RGB out 2023-01-19 05:13:18 I can understand Russian language 2023-01-19 05:13:23 I see 2023-01-19 05:14:00 You are welcome to ask me about ZX Spectrum, Z80, writing a Forth or ROM Forth for it 2023-01-19 05:15:13 do you have a tape file? 2023-01-19 05:15:42 Stalevar: also what emulator are you using for zx? 2023-01-19 05:15:44 https://file0.s3kr.it/7c2504bb68bd.BIN 2023-01-19 05:16:32 https://file0.s3kr.it/98b9e9f8a7d9.ZIP 2023-01-19 05:17:59 https://zx-pk.ru/threads/5620-khobbit.html here is the thread on russian zx spectrum enthusiast forum 2023-01-19 05:18:08 on later pages there are links to the files i uploaded here 2023-01-19 05:19:09 The forum is real slow 2023-01-19 05:20:02 works well on my side 2023-01-19 05:20:04 lich, what are bin and zip files? 2023-01-19 05:20:19 zip is the trd file 2023-01-19 05:20:25 .BIN is supposed be the rom 2023-01-19 05:20:28 what is trd file? 2023-01-19 05:20:33 rom from what? 2023-01-19 05:20:33 good question 2023-01-19 05:20:37 trd file for what? 2023-01-19 05:20:37 from hobbit 2023-01-19 05:21:00 https://zx-pk.ru/threads/5620-khobbit.html?p=892606&viewfull=1#post892606 here is the post with the .bin file 2023-01-19 05:21:22 https://zx-pk.ru/threads/5620-khobbit.html?p=878803&viewfull=1#post878803 here is the post with .trd file 2023-01-19 05:22:08 people are uploading there a lot of rom files assuming ПЗУ is rom 2023-01-19 05:22:16 I see, so it's same rom but in some format 2023-01-19 05:22:29 yeah, ПЗУ means постоянное запоминающее устройство 2023-01-19 05:22:36 permanent memory device 2023-01-19 05:22:43 ROM in other words 2023-01-19 05:22:55 https://file0.s3kr.it/05cff0c5cff1.rom here is another rom file from the thread (also hobbit one) 2023-01-19 05:23:12 as ive said, the device was very inconsistent with its roms :) 2023-01-19 05:23:21 The bin one is clearly not going to work on Spectrum since it only got 16k of ROM 2023-01-19 05:23:22 there were some that had forth, some that had just BASIC LOGO and CP/M 2023-01-19 05:23:37 Stalevar: lol, check the secodn one, it is 64k 2023-01-19 05:23:43 Yeah, 2023-01-19 05:23:47 and the guy says it has forth 2023-01-19 05:23:50 So it won't run on ZX spectrum 2023-01-19 05:23:55 > еще одна ПЗУ Хоббита, должна быть с Фортом 2023-01-19 05:24:12 well Hobbit was a 64K ZX clone 2023-01-19 05:24:22 I think it makes more sense to use veltas project 2023-01-19 05:24:51 veltas, do you have any idea what to change to make your forth go to 16k ROM replacing basic? 2023-01-19 05:25:00 There is an alternative basic for ZX 2023-01-19 05:25:29 8080 does not have relative jumps, so code cannot be moved around in memory unlike x86 PIC 2023-01-19 05:25:49 Z80 got some but most software probably relies on absolute jumps and calls still 2023-01-19 05:26:11 I had considered it. If you make a ROM you want to take advantage of the RST instruction 2023-01-19 05:26:23 To use with most emulators you need to just pad it out to 16K 2023-01-19 05:26:28 The image is way smaller than that 2023-01-19 05:26:48 Yeah, but it also needs to be somewhat compatible with existing software for ZX Spectrum (if it relies on some memory address for working 2023-01-19 05:26:49 And the end of the dictionary needs to be handled slightly differently because currently it's a tape program expecting to be loaded straight into RAM 2023-01-19 05:27:03 ROM also has the font 2023-01-19 05:27:13 If you want to be compatible with existing software than you need to have the real ROM present 2023-01-19 05:27:19 If you want just font then keep the font 2023-01-19 05:27:22 It really depends 2023-01-19 05:27:50 veltas, do you have an option to compile your project into 16k rom file which boots? 2023-01-19 05:28:08 No but I don't mind helping you do that 2023-01-19 05:28:09 You'd need to intialize the hardware and have fonts 2023-01-19 05:28:23 It wouldn't be that hard to get it working, you just need to add a font 2023-01-19 05:28:38 And some HW init code 2023-01-19 05:29:02 veltas, does your code use Z80-only instructions a lot? 2023-01-19 05:29:09 I am going to start with a 8080 machine 2023-01-19 05:29:14 And leave routines in the RST locations so you can do stuff faster 2023-01-19 05:29:21 It's more interesting to me than spectrum at the moment 2023-01-19 05:29:22 Yeah my code is Z80 based 2023-01-19 05:29:41 You might be better off looking at the 8080 FIG Forth 2023-01-19 05:29:44 What do you think about Radio 86rk? 2023-01-19 05:29:55 Don't know what that is 2023-01-19 05:30:13 Soviet microcomputer based on KR580VM80A CPU 2023-01-19 05:30:18 http://www.forth.org/fig-forth/fig-forth_8080_ver_11.pdf 2023-01-19 05:30:26 it came out in 1986 thus 86rk 2023-01-19 05:30:34 Cool 2023-01-19 05:30:53 Radiolyubitel'skij Komp'yuter 2023-01-19 05:31:05 Радиолюбительский Компьютер 2023-01-19 05:31:12 As in hobbyist computer 2023-01-19 05:31:46 It didn't come out as a device, it's schematics and guide how to build were published in Radio Magazine 2023-01-19 05:31:54 forth on hackernews.... https://news.ycombinator.com/item?id=34436049 https://udamonic.com/what-is-a-scamp.html 2023-01-19 05:32:28 veltas, but then it became popular and actual factories started to produce and sell it, and then improved somewhat compatible versions 2023-01-19 05:32:58 Much like the Altair 8800 2023-01-19 05:33:06 For example Апогей БК-01Ц 2023-01-19 05:33:16 Apogee bk-01c 2023-01-19 05:33:57 That one got 56k of main memory unlike rk86 which only got 16 or 32 2023-01-19 05:34:18 4k rom, which has rk86 monitor and additional subroutines 2023-01-19 05:35:01 veltas, IMSAI 8080 is better 2023-01-19 05:35:19 came out about the same time as Altair 2023-01-19 05:35:52 veltas, afair Altair was sold as a kit 2023-01-19 05:36:11 while Radio 86rk wasn't sold at all at first 2023-01-19 05:36:22 you have had to obtain chips one by one somewhere 2023-01-19 05:37:45 Actually Micro/80 came before 86rk, but it required way more chips, so not many were able to build it. 86rk is simplified and improved version, though it was somewhat harder to debug because of less modularity 2023-01-19 05:39:21 Then given Soviet Union got many various magazines, others published their computers too after Radio, namely Моделист-Конструктор (modelist-constructor) published Specialist computer, and Юный Техник (young technician) published ЮТ-88 computer 2023-01-19 05:40:36 Specialist got graphical display mode and UT-88 got modular design, first you build a programming calculator like device with 7-segment indicator and 0-9A-F keyboard 2023-01-19 05:40:56 Then you can add a video and connect it to a TV 2023-01-19 05:42:22 Since I'm not that much of a fan of graphical mode, since I games on those computers are going to be overly primitive by modern standards, I'd rather stick with text mode Radio 86rk 2023-01-19 05:43:06 Yeah text mode is great for work 2023-01-19 05:43:12 Graphical modes are good for games 2023-01-19 05:43:39 I wish spectrum had a text mode, huge waste of RAM only having high-res bitmap mode 2023-01-19 05:43:54 ZX Spectrum features some mixed mode, which is graphical but pixel order is optimized for using fonts 2023-01-19 05:44:13 It's not for fonts, it's to do with how the RAM is accessed in banked mode by the ULA 2023-01-19 05:44:57 I don't remember exactly how it works, but consecutive addresses fill 8x8 squares, or something? 2023-01-19 05:45:10 No it's more like scanlines 2023-01-19 05:45:34 Anyway, I don't remember it even though I wrote a fractal for it 2023-01-19 05:45:47 Each byte contains a bitmap for 8 pixels of a scanline, 32 bytes contain a whole scanline, the next scanline is 256 bytes away or something 2023-01-19 05:45:52 It's complicated 2023-01-19 05:46:24 It's easier to explain with bit manipulation than with dimensions 2023-01-19 05:46:59 Why they can't just use plain bitmap? 2023-01-19 05:47:16 https://i.imgur.com/VWYgaNI.png I wrote this code a while ago 2023-01-19 05:47:30 I don't remember what it does, but it is supposed to manipulate video memory 2023-01-19 05:47:45 As I said it's something to do with how a banked access is made to RAM 2023-01-19 05:48:29 Also the entire low 16K of RAM is slower because any access to that region will stall while video is being read, which is frequently 2023-01-19 05:48:46 I thought it was a pseudo-text mode, making it easy to write text applications 2023-01-19 05:48:58 Not really no 2023-01-19 05:49:13 I wish it was a proper text mode, would be better for most serious programs 2023-01-19 05:49:31 or at least a proper graphical mode? 2023-01-19 05:49:51 The colours apply to 8x8 tiles 2023-01-19 05:49:58 Like byte at certain address points to certain pixel without complex formula 2023-01-19 05:50:33 It's not a complex formula, it's simple with bit manipulation 2023-01-19 05:50:45 It's just not easy to reason about for hoomans 2023-01-19 05:50:55 still not as simple as width*row+col 2023-01-19 05:51:41 If you're within a 8x8 cell then the byte containing the next scaline is 256 away, i.e. increment the high address byte. It's not hard in binary 2023-01-19 05:51:50 It probably looks saner in assembly than in C 2023-01-19 05:52:06 Probably 2023-01-19 05:52:35 Anyway, I had a formula somewhere and wrote a fractal for it 2023-01-19 05:52:48 https://i.imgur.com/6p7AR4W.png 2023-01-19 05:53:04 Very nice 2023-01-19 05:56:25 There were two arrays as wide as horizontal res, first one is inited with all zeroes and 1, then copied to video memory with POKEs, then next row is computed, by some formula such as summing values above it in other array, and then pushed to video, then it's repeated but with first array is filled after the second array 2023-01-19 05:56:43 It was real slow and the screen took about 20 minutes to fill 2023-01-19 05:57:11 Or maybe I used an array as big as screen res containing either zero or one? 2023-01-19 05:58:08 so I remember that iterating over pixels in certain col and row required some formula 2023-01-19 05:58:48 The source code in the other screenshot has something to do with it but I don't remember 2023-01-19 05:59:07 i have basic source for that somewhere too, but also don't remember where 2023-01-19 05:59:39 Impressive, very nice https://i.imgflip.com/540p3h.png 2023-01-19 06:07:40 I think I just added two values above and % by 2 to get 1 or 0 2023-01-19 06:08:06 and poked green or black depending on it 2023-01-19 06:09:52 veltas, anyway, I don't like how you can't really access memory conveniently in BASIC, so I prefer 8bit computers with MONITOR program 2023-01-19 06:10:12 But maybe there is version of ZX ROM with monitor? 2023-01-19 06:10:45 You don't like CLEAR 2023-01-19 06:12:12 I don't know 'MONITOR' 2023-01-19 06:12:33 It's a very simple initial loader, which inits the hardware and provides a command line 2023-01-19 06:13:13 86k monitor has commands like G100 to execute starting from 0x0100, M100 to start typing hex codes to write in memory at certain address 2023-01-19 06:13:36 D100,1FF to show 256 bytes in hexdump 2023-01-19 06:13:42 Sinclair BASIC has USR and PEEK/POKE 2023-01-19 06:13:51 what does USR do? 2023-01-19 06:14:01 Jumps to a machine code routine at specified address 2023-01-19 06:14:03 peek poke aren't as convenient as monitor 2023-01-19 06:14:15 My ZX Spectrum Forth has DUMP 2023-01-19 06:14:19 But yes, it can do it too 2023-01-19 06:14:33 Very slowly 2023-01-19 06:14:36 I wrote a hexdump in ZX basic back when I poked with it 2023-01-19 06:14:54 Sinclair BASIC is quite slow (well some stuff is fast, but print loops are quite slow) 2023-01-19 06:15:05 I have verified that my real ZX has exactly same ROM byte to byte as the emulator 2023-01-19 06:15:19 I don't remember how exactly though 2023-01-19 06:15:32 Checksum? 2023-01-19 06:15:37 i don't remember 2023-01-19 06:15:57 i have all data on old broken laptop hard drive 2023-01-19 06:16:10 the drive itself works but I didn't pull it out 2023-01-19 06:23:46 veltas, do you have a command to write hex codes to certain memory address? 2023-01-19 06:34:09 https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Crash-Course-Tutorial.html#Crash-Course-Tutorial 2023-01-19 06:34:13 That's weird 2023-01-19 06:34:22 0 0 ! 2023-01-19 06:34:23 here execute 2023-01-19 06:34:23 ' catch >body 20 erase abort 2023-01-19 06:34:32 Type this to crash forth 2023-01-19 06:48:19 Stalevar: Sorry are you saying this is broken in my forth? 2023-01-19 06:48:37 nope 2023-01-19 06:48:40 i didn't try it 2023-01-19 06:48:55 You can write hex like this: HEX beef addr ! 2023-01-19 06:49:20 Or use $beef in newer forths 2023-01-19 06:49:35 that support base prefix from Forth 2012 2023-01-19 06:50:13 It's very easy to crash forth, although a lot of desktop forths handle things like segfaults so you have to try a little harder to really crash those 2023-01-19 06:50:54 FIG forth seem to be for CP/M 2023-01-19 06:51:48 Yeah that sounds right 2023-01-19 06:52:08 The code there is probably a good starting place for your own Forth if you want to write one 2023-01-19 06:52:40 In 8080 2023-01-19 06:52:59 I don't think I am ready to do that, I'd rather load an rkr file and poke in it some than write it from scratch 2023-01-19 06:53:13 same goes to ZX spectrum 2023-01-19 06:53:35 Though I am considering trying to write a replacement ROM which has a monitor I probably won't do that 2023-01-19 07:28:46 Stalevar: NAND is useful because it is a "universal logic function." You can do absolutely anything - build any digital function and therefore whole computers - using nothing but the NAND operation. That's not actually how it's usually done, of course; it's more efficient to do it other ways. But you *could*. NOR could work too. 2023-01-19 07:29:51 Stalevar: It would be interesting to have a Forth built purely from Jonesforth, but it's not necessarily what would result in highest performance. 2023-01-19 07:31:26 Stalevar: I wrote my first Forth back around 1982 or so. In college I used an HP-41CV calculator, and it was in fact really where I "learned to program." So it's not surprising (to me at least) that Forth instantly appealed to me, being stack-based. 2023-01-19 07:32:19 But when I wrote that, on a TRS-80 Color Computer using 6809 assembly language, I didn't really know how Forth worked "under the hood." My Forth "worked." But sometime not long after I found a book called "Forth Fundamentals, Volume 1" by Kevin McCabe. 2023-01-19 07:32:44 I then realized just how HORRIBLE my Forth was. It was super complicated compared to how simple and elegant Forth can actually be. 2023-01-19 07:34:10 I've been occasionally (like every few years) writing further Forths, throughout my whole life - I actually spend a lot more time writing Forth systems of my own than I do tinkering with ready to go Forths from the outside world. That's why I'm fuzzy on the operation of certain words. I never have tried to rigorously stick to some standard, and I commonly adjust the function of specific words and introduce 2023-01-19 07:34:12 new wrinkles of my own. 2023-01-19 07:36:41 At one point I wrote one purely in gcc. The primitives were written in C one-liners, using gcc's extension that allows pointers to labels. It actually "works" inside like a true Forth should. But it was pretty messy to look at source code wise. 2023-01-19 07:37:28 After that one I switched to nasm, and am currently working on my second nasm incarnation. I may begin again before long, though, because I have ideas about improving the portability of the design (so I can move it around across processor architectures - mostly x86 and ARM). 2023-01-19 07:38:09 What I really want as the next big "accomplishment" is to have an implementation that can be re-built using itself. Then I'll be able to leave nasm behind too, and work totally within my own environment. 2023-01-19 07:42:27 I've got some nice "dream plans" about how to set up my development environment, debugging, and so on when I get that all going. 2023-01-19 07:42:59 Mostly I just hope to do some gadget building of various sorts when I'm retired, and I'd like to use that as the development tool for it. 2023-01-19 07:43:57 Also right now I'm working on an FPGA-based Forth processor, implemented in Verilog. Recently bought a Xilinx Artix 7 dev board to platform that, though I also have hopes of eventually running it on a lower-power FPGA platform - maybe the Lattice iCE40 UltraPlus or something. 2023-01-19 07:46:05 If you scour around out there you will find various approaches to Forth (and related). Some of them try to use the fewest operations possible to build it upon - I've seen as few as eight or so. But doing it that way usually results in a system that's more complex to create and has lower performance. For performance you look at your processor's instruction set and do it whatever way seems to be the most 2023-01-19 07:46:06 efficient and effective. 2023-01-19 07:47:23 You define as "primitives" the things that perform best defined as primitives. Like the word 1+ for example - it's really almost silly to do that any way other than just using your processors INC instruction. So that primitive is just INC along with whatever your standard bit of code for moving from primitive to primitive is (that's usually referred to as NEXT, and all primitives end with it). 2023-01-19 07:48:27 This also gets into the common ways of having your Forth work - that low level control flow can be done in different ways. The earliest and "most original" approach is called indirect threading. Definitions are lists of addresses; those addresses point to the defined words, and in particular to a field which points to machine code. 2023-01-19 07:48:45 But you can also do "direct" threading - definitions are lists of addresses which point directly to code themselves. 2023-01-19 07:49:17 And finally you can do "code threading," in which words are actually machine code themselves, and you usually use the processor's subroutine call instructions. 2023-01-19 07:49:25 Code threading is "the most like" other languages. 2023-01-19 07:50:00 All of these can get the job done, and there are just various trade-offs with them. Size, speed, ease of implementing certain features, etc. 2023-01-19 07:50:10 I typically write indirect threaded Forths. 2023-01-19 07:50:22 that's described in Jones Fort 2023-01-19 07:50:31 It's just my opinion that some features code out more elegantly with it than with the others. 2023-01-19 07:50:52 I think direct threading and code threading are likely more "popular" currently. 2023-01-19 07:51:39 KipIngram, so you have started with 8-bit computers 2023-01-19 07:52:22 I guess so - 6809 was mostly an eight-bit micro, though it has some instructions that "harken toward" 16 bits. 2023-01-19 07:52:25 I have a different start, my first computer was 32-bit pentium IV running Windows XP, in fact I still have it, though do not use 2023-01-19 07:52:26 Kind of transitional. 2023-01-19 07:52:35 It's the processor I first learned assembly language on in college. 2023-01-19 07:52:42 Really a nice elegant little chip. 2023-01-19 07:52:48 Very orthogonal instruction set. 2023-01-19 07:52:52 similar to 6502, right? 2023-01-19 07:53:23 I've never actually used 6502. I read a book on it way back then, when you could just walk into bookstores and get such books. Probably. 2023-01-19 07:53:43 https://eater.net/6502 I like this project, but buying a kit would be too expensive, and probably impossible 2023-01-19 07:53:52 Some folks here know 6502; my impression from listening to them is that it's not as "smooth" as the 6809. 2023-01-19 07:53:57 so I am thinking about replicating it with Z80 2023-01-19 07:54:17 Oh, neat. 2023-01-19 07:54:26 Yeah, working with that old retro tech is fun. 2023-01-19 07:54:49 Well, if you're g oing to build your own computer, Forth is a great thing to consider. 2023-01-19 07:54:57 I think, it would be nice to have an IMSAI like computer but with Z80 CPU 2023-01-19 07:55:11 first of all it's better to start with just CPU and RAM 2023-01-19 07:55:17 Puts you in a position of doing your own software and yet still winding up with a complete usable system. 2023-01-19 07:56:01 I'd someday like to build a full system of my own, but using also my own FPGA-based processor. 2023-01-19 07:56:02 I want an IMSAI but with cheap components which can be bought and with no emulation 2023-01-19 07:56:11 My own graphics hardware, etc. 2023-01-19 07:56:24 https://eater.net/vga like this? 2023-01-19 07:56:30 I'm a hardware guy by original education. 2023-01-19 07:56:52 So whenever I start talking computer science, keep in mind I'm kind of a "lurker" on that stuff. 2023-01-19 07:57:08 I've read a lot about it, but I'm not a "professional" in that arena. 2023-01-19 07:57:10 Yeah, but can you help, with the design. How many chips do I need to make a very simple IMSAI-like computer with modern parts? 2023-01-19 07:57:30 https://github.com/jmacarthur/zeta256 this is similar to what I want but not quite 2023-01-19 07:57:42 I think I'd like to have at least 32k of ram 2023-01-19 07:57:45 I'm having to look up IMSAI; give me few minutes. 2023-01-19 07:57:50 That's enough for Forth. 2023-01-19 07:57:55 Same as Altair but cooler 2023-01-19 07:58:10 It has eight programmable LEDs 2023-01-19 07:59:20 I think my first was probably a 80386, got interested in ZX Spectrum from hearing about that kind of tech more recently, bought one, played with it a bit, was interested to see what you could do with a 3.5MHz chip 2023-01-19 07:59:33 I see it now. Ok, well, it's hard to give you a specific number, because there always winds up being "popcorn" parts that you need. How do you plan to do the basic logic for address decoding and stuff? You might go with 7400 style discrete parts, but you could also use various types of programmable logic parts. 2023-01-19 07:59:56 Obviously you need your CPU and your RAM and some kind of ROM or flash, just to get something that gets off the ground. 2023-01-19 08:00:09 rom is unnecessary however 2023-01-19 08:00:24 But then you need the aforementioned popcorn / support parts too, and that's hard to nail down before you've sketched out a design. 2023-01-19 08:00:27 IMSAI and Altair were fine w/o ROM 2023-01-19 08:00:40 Where do they execute from at reset? 2023-01-19 08:00:49 0 probably 2023-01-19 08:00:55 You somehow pre-load your RAM? 2023-01-19 08:01:10 The first computer I had came with Windows for Workgroups (3.11), and when someone showed me Windows 95 I had no idea where a window went when someone minimised it. It was like it had been closed. 2023-01-19 08:01:28 You can arrange to do that with switches and stuff, but it's probably not something you want to do every single time. 2023-01-19 08:01:28 https://www.s2js.com/altair/sim.html 2023-01-19 08:01:38 I didn't realise you could click on the button at the bottom to get it back 2023-01-19 08:01:59 Ok, but it must be storing that somewhere, if it gets saved. 2023-01-19 08:02:05 So you'll need whatever that is. 2023-01-19 08:02:13 Or maybe you expect to just keep the RAM under power. 2023-01-19 08:02:14 yeah, when I have seen Windows for first time, I thought maximize was a fridge 2023-01-19 08:02:43 I also wondered what the point of resizable windows was, and why windows were never maximised by default 2023-01-19 08:02:52 KipIngram, the idea for v0 computer: Arduino mega + Z80 CPU + RAM 2023-01-19 08:03:02 Do I need other chips? 2023-01-19 08:03:09 I see. The Arduino will load your RAM for you? 2023-01-19 08:03:11 That can work. 2023-01-19 08:03:35 So will it have any other peripherals and so on? 2023-01-19 08:03:39 v1: switch panel + CPU + RAM with optional arduino connection 2023-01-19 08:03:40 Input / output ports, etc? 2023-01-19 08:03:52 Yeah, I'm catching on now. 2023-01-19 08:03:54 So it works as basic altair or imsai 2023-01-19 08:04:11 Well, if it's going to be JUST CPU and RAM, then you can probably get by without many chips at all. 2023-01-19 08:04:31 it will have one input port which outputs upper address switches and one output port which sets the extra LEDs, same as IMSAI 2023-01-19 08:04:34 The popcorn I mentioned would be for activating RAM, or peripheral, etc. - activating the right hardware for any given bus cycle. 2023-01-19 08:05:07 so v1 is like basic altair or imsai with no rom 2023-01-19 08:05:31 v2 has an extra switch which masks upper addresses with a rom 2023-01-19 08:05:39 or even lower addresses 2023-01-19 08:06:12 it also needs some kind of serial port to go to a terminal or something 2023-01-19 08:06:27 v3 would have video and keyboard support 2023-01-19 08:06:32 Ok. So when the Arudino wants to manage the ram, will it just hold the Z80 in reset or something? 2023-01-19 08:06:36 Load up the RAM and then let it go? 2023-01-19 08:07:07 So, arduino is going to replace the switch panel 2023-01-19 08:07:35 Right - makes sense. This could be very minimal; you just need a way to have the Z80 "stand down" while the Arduino does its work. 2023-01-19 08:07:46 You may need more or less nothing other than Z80 and RAM. 2023-01-19 08:07:52 I am not sure how it should work exactly. When I get CPU and RAM working with software switch panel, I can start building a hardware switch panel 2023-01-19 08:08:18 I think there should be a pin putting CPU in WAIT 2023-01-19 08:08:25 Yeah. It could be very simple. If the Z80 tristates its outputs when it's in reset, then you're all clear to do your Arduino control. 2023-01-19 08:08:33 Or there may be some other Z80 signal that works for that. 2023-01-19 08:08:35 while CPU in wait, Arduion can flash RAM, then it can unwait Z80 2023-01-19 08:08:41 Some kind of bus arbitration. 2023-01-19 08:08:59 should be 2023-01-19 08:09:02 Yeah. Sounds fun, actually, and I take back my earlier popcorn remarks. 2023-01-19 08:09:23 Now, how do I connect hardware toggle switches to address and data bus however? 2023-01-19 08:09:26 You'd just let the Z80 go for a while, then take control back and inspect what it had done to RAM. 2023-01-19 08:09:32 That's enough to see how you're doing. 2023-01-19 08:09:41 I thought I would need to have some kind of buffer tristate register chips or three 2023-01-19 08:09:52 Well, check your Z80 docs. 2023-01-19 08:10:01 It may tristate all of its outputs when reset is active. 2023-01-19 08:10:08 It probably does 2023-01-19 08:10:08 If not, then yes, you may need some buffers. 2023-01-19 08:10:16 It would be the "right" thing for it to do. 2023-01-19 08:10:22 Wait, buffers are necessary either way 2023-01-19 08:10:43 I assume you can float your Arduino outputs? 2023-01-19 08:10:46 see, you need CPU to use the bus, so you need to have a way to connect and disconnect the switch panel to the bus 2023-01-19 08:11:04 That's what tri-stating the Arduino outputs would do. 2023-01-19 08:11:13 For v0, arduino should be enough, I think 2023-01-19 08:11:21 I know mostly nothing about Arduino here, so I'm working off what "feels like should work" to me. 2023-01-19 08:11:37 i don't know if arduino can put GPIO in high-impedance state, but it should be able to 2023-01-19 08:11:46 I don't either 2023-01-19 08:12:06 i have ordered Arduino Mega, Z80 CPU and 32k SRAM for now 2023-01-19 08:12:11 You don't neessarily have to have buffers. You could just connect pull-up resistors to your signals, and then the switches would ground them, or leave them floating. 2023-01-19 08:12:23 You'd just make sure all of your switches were open when you were ready to let the Z80 go. 2023-01-19 08:12:32 no, that's not the way to go 2023-01-19 08:12:44 There are a lot of ways you could go. 2023-01-19 08:12:57 I'm just spouting ideas and thinking about minimizing chips, since that seems of interest to you. 2023-01-19 08:12:58 i want switches to behave as on IMSAI 2023-01-19 08:13:12 Oh, I see. I didn't read the details yet. 2023-01-19 08:13:45 The article I found doesn't seem to say - how do they work? 2023-01-19 08:13:45 v1 computer should let me play kill the bit game 2023-01-19 08:13:57 Yeah, that's what I am wondering 2023-01-19 08:14:07 Well, I mean behaviorally. 2023-01-19 08:14:13 What do they seem to do? 2023-01-19 08:14:15 but I can tell you what they do, I got a bit of knack of it 2023-01-19 08:14:26 Because what I described with pull ups would "work" for controlling the system. 2023-01-19 08:14:37 But of course might not emulate what you're wanting. 2023-01-19 08:14:56 Yeah, just tell me that. 2023-01-19 08:15:31 So, it seems that the LEDs show address and data bus constantly, so I guess they can be connected passively 2023-01-19 08:15:40 via resistors 2023-01-19 08:15:43 Right. 2023-01-19 08:15:59 All a switch can do is either bring about a high signal or a low signal. 2023-01-19 08:16:25 With pull-ups as I suggested (which could also be part of your LED circuit anyway) you get high by just disconnecting the switch (turn it off). 2023-01-19 08:16:33 Examine would set data bus to state of 16 toggles, you'll see data from RAM on that address on top LEDs 2023-01-19 08:16:38 But when you turn it on it puts a hard ground on the signal, and you get low. 2023-01-19 08:16:55 The z80 couldn't fight your hard ground, but it can deal with that resistor just fine, if you size it right. 2023-01-19 08:17:10 So I'm picturing pull up to power and LED to ground, on every signal. 2023-01-19 08:17:25 And then connect your switches to that. 2023-01-19 08:17:47 hm... that's simple, but.... let me describe switches 2023-01-19 08:17:52 The pull-ups make sure the signal is high whenever no one is driving it, and that turns on your LED. 2023-01-19 08:18:07 yeah, I know, but... 2023-01-19 08:18:09 But if you pull to ground with the switch, it makes the signal low and turn soff the LEDs. 2023-01-19 08:18:32 I want it to work as on IMSAI and I do not want to risk interfering on Z80 exchange with RAM with constant pull up 2023-01-19 08:19:10 You could even have both switches and Arduino connected. You either have switches off, Arduino off, Z80 active, or switches off Arduino floating, Z80 active, or switches on, Arduino and Z80 floating. 2023-01-19 08:19:27 This is called a wire AND. 2023-01-19 08:19:38 Any driver can pull it low, otherwise it's high. 2023-01-19 08:19:51 And ONE driver can drive it high as well. 2023-01-19 08:20:08 I see the idea, I might try it too 2023-01-19 08:20:08 All you have to avoid is someone driving high and someone else driving low. 2023-01-19 08:20:26 But, I think IMSAI was more complex than this 2023-01-19 08:20:49 I'd recommend some kind of a little safety circuit that can tell if either more than one source is trying to drive. 2023-01-19 08:20:58 Not per-signal - something global. 2023-01-19 08:21:20 wait a second, let me describe what imsai/altair has 2023-01-19 08:21:30 It might take in the Z80 reset, some I'm driving signal from the Arduino, and something we'd cook up from the switch array. 2023-01-19 08:22:05 Just to protect your resources. :-) 2023-01-19 08:22:15 Examine / Examine next; Deposit / Deposit next; Reset / Ext. clear; Run / Stop; Single step / Single step; PWR ON / PWR OFF 2023-01-19 08:22:30 Ok, hmmm. 2023-01-19 08:22:32 Single step. 2023-01-19 08:22:36 Now that might be a little harder. 2023-01-19 08:22:51 That makes it sound like you can feed clock cycles to the Z80 one at a time. 2023-01-19 08:23:10 I was imagining a regular oscillator, but maybe you drive the clock signal somehow too. 2023-01-19 08:23:25 You could do that with a (debounced) switch, or with the Arduino. 2023-01-19 08:23:48 Probably still want a "real" clock you can select, for when you wnat the z80 to rock and roll. or maybe the Arduino is fast enough; not sure. 2023-01-19 08:24:10 If you are supplying a sufficiently fast clock from an Arduino output, then that would be simple. 2023-01-19 08:24:21 Then you could advance it cycle by cycle. 2023-01-19 08:24:38 But now this makes it sound like you might want to float the Z80 while it's a ctive and running, to inspect things. 2023-01-19 08:24:47 the plan I described above wouldn't really let you do that. 2023-01-19 08:25:03 Maybe the Z80 has a way of doing this? 2023-01-19 08:25:19 If reset is how you get Z80 off the bus, then you're starting over every time. 2023-01-19 08:25:32 Do you have a pinout for your Z80 part handy? 2023-01-19 08:26:11 Maybe it has some kind of bus sharing features. 2023-01-19 08:26:27 Also, do you know how fast your Arduino can wiggle its outputs? 2023-01-19 08:26:54 So, those work when CPU is in WAIT: Examine puts what is on the switches to the address bus and you can observe the RAM content on data bus; Examine Next takes what Address Bus already has, disregarding the switches, adds one and displays RAM at this address; Deposit takes state of lower 8 switches and writes it to memory at address of current address bus; Deposit next does the same but address is incremented first; Reset resets the CPU; Ext. cl 2023-01-19 08:26:54 does something with interrupts, but I'm not sure what, I won't implement it at first; Run puts CPU into state when it runs on a fast clock or puts it in WAIT when it doesn't run at all; Single step makes CPU advance one step, I guess it generates one or more clock pulses, since one singlestep seems to be enough to advance the address bus... 2023-01-19 08:27:06 Ok, good. WAIT will do the job. 2023-01-19 08:27:55 Well, I hope at least. I'd need to read something about your processor, and learn exactly how it does the WAIT stuff. 2023-01-19 08:28:00 so there must be an address register somewhere 2023-01-19 08:28:17 do you think it's on a separate chip? 2023-01-19 08:28:31 It should also have tri-state output to let the CPU drive the bus 2023-01-19 08:29:03 I don't know - don't know enough yet. A lot of those old CPUs took multiple clock cycles to do things, and we need to know if it can be stopped within the middle of those things, or only on instruction boundaries, or what exactly. 2023-01-19 08:29:16 I need a data sheet for your Z80 chip at this point, I think. 2023-01-19 08:29:28 Z0840004PSC 2023-01-19 08:29:38 Ok. Lemme look at that. 2023-01-19 08:29:41 This one was the cheapest, $2 only in China 2023-01-19 08:29:49 :-) Nice. 2023-01-19 08:29:55 32k SRAM was also $2 2023-01-19 08:30:03 And $5 more I got 20 switches 2023-01-19 08:30:17 it will come to me in two months or so 2023-01-19 08:30:32 So I'd like to order other chips in advance 2023-01-19 08:33:47 Trying to find a real datasheet still... 2023-01-19 08:35:54 I also have ZX Spectrum clone, at worst case I can try to swap the CPU between one I am going to get and the ancient one from ZX, in case if one I am getting doesn't support super-slow clock 2023-01-19 08:37:00 wait, my zx got the same chip 2023-01-19 08:37:38 I'm still coming up dry. I don't suppose you've got a data sheet on it do you? 2023-01-19 08:37:48 What part is it? 2023-01-19 08:37:53 Z0840004PSC 2023-01-19 08:38:02 Sure it's not Z8400? 2023-01-19 08:38:20 Well, it is I guess, but I'm just not turning up a data sheet. 2023-01-19 08:38:25 Let me try just z8400 2023-01-19 08:38:38 TI or Zilog? 2023-01-19 08:39:01 Ok, I found something. 2023-01-19 08:41:21 zilog Z80 CPU 2023-01-19 08:41:21 Stalevar: /BUSREQ is what you want. 2023-01-19 08:41:59 It has higher priority than NMI, and forces the address, data, and control signals to high impedance state. 2023-01-19 08:42:09 So with that you can, at any time, hold the Z80 off the bus. 2023-01-19 08:42:33 You assert it, and then you have to wait for /BUSACK before you drive any signals. 2023-01-19 08:42:41 So far it looks like you can do this at any time. 2023-01-19 08:42:55 You won't be able to use dynamic ram for this - it has to be refreshed and the CPU does that. 2023-01-19 08:43:03 But the amount of RAM you mentioned is easy to come by statis. 2023-01-19 08:43:05 static 2023-01-19 08:43:22 yeah, I got SRAM chip 2023-01-19 08:43:34 I didn't find 64k sram though so I picked 32k for now 2023-01-19 08:44:21 Ok, looks like RESET does send address and data to high impedance, but control signals only to "inactive." So that might be a small rub. 2023-01-19 08:44:38 You might be able to send those through resistors, though, so you could still muscle those signals from outside. 2023-01-19 08:44:44 More study required to answer that. 2023-01-19 08:45:13 Here's where I found the datasheet, btw: 2023-01-19 08:45:15 https://pdf1.alldatasheet.com/datasheet-pdf/view/25730/STMICROELECTRONICS/Z8400.html 2023-01-19 08:45:20 So how do I implement examine next and deposit next? 2023-01-19 08:45:32 do I need some chip to add 1 to current address? 2023-01-19 08:46:43 I think you use BUSREQ for that. Pull it low, wait for BUSACK, and then the bus is yours. 2023-01-19 08:47:00 Your switches or your Arduino can do anything you want, and as far as I can tell you can keep it that way as long as you want. 2023-01-19 08:47:08 Yeah 2023-01-19 08:47:11 You do your thing, clear off the bus, and drop BUSREQ. 2023-01-19 08:47:17 but... what about the next stage? 2023-01-19 08:47:18 It should continue with whatever it was doing. 2023-01-19 08:47:26 Next stage? 2023-01-19 08:47:28 When the computer should work as stand-alone machine? 2023-01-19 08:47:36 when I add a switch panel 2023-01-19 08:48:06 Look, if you're not going to have any ROM/flash, then you're always going to need a way to get your work loaded into RAM. 2023-01-19 08:48:11 The Arduino can do that for you. 2023-01-19 08:48:23 If you want to take it out, you'll need some kind of ROM. 2023-01-19 08:48:55 You've now got me liking the Arduino idea - I don't think I'd ever take it out. 2023-01-19 08:49:19 Just use it to initialize RAM, and then let the thing go and run - it'll be fully in charge so long as you leave it alone. 2023-01-19 08:49:33 Oh, do you know how fast your Arduino outputs are? 2023-01-19 08:49:43 no, I didn't even get it yet 2023-01-19 08:49:50 We still need to figure out whether the Arduino can be your "only" clock source or whether you also want an oscillator. 2023-01-19 08:50:00 and I want to have a switch-driven arduino-less version 2023-01-19 08:50:12 It should be 2023-01-19 08:50:21 Ok. If you do wind up with an oscillator as well, then switching between oscillator clock and Arduino output clock may be a bit touchy. We'd have to think about that when the time comes. 2023-01-19 08:50:24 even if it's slow we can bear with it 2023-01-19 08:50:41 You can have switches connected in parallel with the Arduino. 2023-01-19 08:50:52 No reason you can't have both / use either. 2023-01-19 08:51:03 I'd rather want to have only switches for principle 2023-01-19 08:51:11 As in a IMSAI relative 2023-01-19 08:51:25 Ok, then you will need some place for your production code to live so the Z80 can execute it on startup. 2023-01-19 08:51:27 Which only has simple parts such as CPU, RAM, toggles and stuff 2023-01-19 08:51:42 KipIngram, tape? 2023-01-19 08:52:00 No - it has to be CPU addressable, like RAM only non-volatile. 2023-01-19 08:52:05 I am not going to run anything serious on it at least at first 2023-01-19 08:52:25 And then you will need logic to decide whether RAM or ROM should drive the bus. 2023-01-19 08:52:26 i just want an imsai replica of a sort first 2023-01-19 08:52:40 It's usually pretty simple - you just recognize which part of hte address space you're in. 2023-01-19 08:52:55 You could let the most significant bit of the address bus select either RAM or ROM. 2023-01-19 08:52:56 I know, 6502 project by Ben Eater covers that 2023-01-19 08:53:25 That's the only additional thing you need, though, to be able to deep six the Arduino. 2023-01-19 08:53:57 v0: CPU, RAM, Arduino 2023-01-19 08:54:07 v1: CPU, RAM, Panel 2023-01-19 08:54:17 And ROM. 2023-01-19 08:54:21 For v1 2023-01-19 08:54:21 nope 2023-01-19 08:54:27 v2 has ROM 2023-01-19 08:54:30 v1 has no rom 2023-01-19 08:54:50 Ok, then you will have to switch in your whole code every time you power it up. 2023-01-19 08:54:57 And you'll get jolly sick of it. 2023-01-19 08:55:08 It should work like that, you turn the machine on, toggle your program in, run it, use the leds to observe the result 2023-01-19 08:55:15 Yes 2023-01-19 08:55:22 That's when I will have to go to v2 2023-01-19 08:55:37 Ok. You can do that, but it would drive me crazy. 2023-01-19 08:55:51 I have already tried it on the emulators 2023-01-19 08:55:51 But I have things I think are fun that a lot of folks don't, so... it's your ball game. 2023-01-19 08:56:18 It would be cool to have a bit of such experience on a real thing 2023-01-19 08:56:27 Also, I think you can also have v0.5, which would be Arduino and panel - you could debug your panel interface that way. 2023-01-19 08:56:38 They can easily live side by side, if you like. 2023-01-19 08:56:45 Yeah, could be 2023-01-19 08:56:47 But... 2023-01-19 08:56:55 But as I already implied, I'd never take the Arduino out - I'd just stop using it. 2023-01-19 08:56:57 :-) 2023-01-19 08:57:00 what chips do I need for v1, as in a fully stand alone computer? 2023-01-19 08:57:20 I still think you can wire the switches and the Z80 in parallel without any buffers. 2023-01-19 08:57:44 Just use that wire AND setup, and make sure you BUSREQ/wait for BUSACK before you let your switches drive anything. 2023-01-19 08:57:52 Oh, a question. 2023-01-19 08:58:01 but what about examine next? 2023-01-19 08:58:02 These operations - DEPOSIT, EXAMINE, etc. 2023-01-19 08:58:20 Yes, it means that switches have dual role 2023-01-19 08:58:24 Are those basically like write and read? 2023-01-19 08:58:32 yes 2023-01-19 08:59:05 Ok. So for deposit, you'd set up your address, set up your data, and then turn on the DEPOSIT switch to actually cause the write? 2023-01-19 08:59:31 That might be as simple as setting up addr/data and then toggling WRITE on and then off. 2023-01-19 08:59:57 Your RAM chip will comeinto play here at some point too. 2023-01-19 09:00:23 If any of your switches trigger SEQUENCES of operations, as opposed to just controlling signal levels, then you may need little logic machines to do those. 2023-01-19 09:00:39 But if I'd been making something like this back then, I'd have tried hard to stick with "level control." 2023-01-19 09:01:02 You'd just get the Z80 off of the bus and then "mimic" the signals it produces with the switches. 2023-01-19 09:01:57 There's likely to be a read enable input to your RAM, such that it won't drive the data bus unless that's enabled. 2023-01-19 09:02:10 Z80 would drive it on reads; you'd switch it on EXAMINES. 2023-01-19 09:43:56 /CS will stop most static RAM trying to drive the bus 2023-01-19 09:49:28 The Z80 has a feature for refreshing DRAM if I remember rightly 2023-01-19 09:49:51 I'm assuming they use it on the ZX Spectrum because it had DRAM chips 2023-01-19 09:53:35 With DRAM, it's usually just refreshing with reads for optimal throughput. 2023-01-19 09:55:47 In most cases, that's enough to clock refresh circuitry. 2023-01-19 09:59:42 yeah 2023-01-19 09:59:50 that's also why the screen layout on the Spectrum is so wonky 2023-01-19 09:59:58 I believe the Apple II HGR screens are similar 2023-01-19 10:06:52 there are two things going on, the refresh timing needs to hit all the rows within the 4116 DRAM within 2ms 2023-01-19 10:08:14 and (on the speccy) you have to sequence the memory so that you can pull out any row from the first 6144 bytes (pixel RAM) and a corresponding byte from the 768-byte attribute RAM 2023-01-19 10:09:25 now the 4116 has seven address pins, A0-A7, Din, Dout, and /RAS and /CAS 2023-01-19 10:11:30 in a Spectrum the screen is broken into thirds, which correspond to 64 pixels 2023-01-19 10:12:56 so you can load /RAS and keep flipping /CAS between the pixel byte and attribute byte you want, faster than addressing both each time 2023-01-19 10:37:39 : last_word ( -- ) here latest hex do i @ u. 4 +loop decimal ; redefined last_word ok 2023-01-19 10:37:39 last_word 7F74969854D0 900007F74 8000000000000009 7473616C80000000 726F775F7473616C 20202064726F775F 2020202020202064 404D9120202020 404D91 0 0 404EA800000000 404EA8 9693202800000000 7F7496932028 404EA800007F74 404EA8 9693930800000000 7F7496939308 404EA800007F74 404EA8 96932D9800000000 7F7496932D98 40585F00007F74 40585F 40596400000000 405964 405E4F00000000 405E4F 404EA800000000 404EA8 96933E7800000000 7F7496933E78 40518E00007F74 40518E 40000000 2023-01-19 10:37:50 what do you think? 2023-01-19 10:39:21 still, how do I print one byte in upper case hex with leading zero? 2023-01-19 10:39:28 03 ... FF like this 2023-01-19 10:41:44 Manually, unless your Forth has a word alredy existing for that formatting, in which case you'll have to find it in your docs. 2023-01-19 10:42:03 But if you write a simple converter that always computes two digits, you'll get the zero automatically. 2023-01-19 10:42:58 gforth 2023-01-19 10:44:09 I'm not familiar with Gforth's special output words. 2023-01-19 10:44:19 Does it have <# # and #> in its word list? 2023-01-19 10:44:34 Those are traditional formating "widgets." 2023-01-19 10:45:55 Usually the hard thing is to go the other way - to NOT print leading 0's. 2023-01-19 10:46:54 Yeah, it seems to have # 2023-01-19 10:47:27 .s 1 2 3 # .s <0> <3> 1 5534023222112865485 0 ok 2023-01-19 10:47:58 Ok. I don't remember exactly how they work, but usually <# "stars" a formatting process, # gets digits, and #> closes it out. The details will matter, though. 2023-01-19 10:48:11 But you should be able to write a two-hex-digit formatter pretty quick with those. 2023-01-19 10:49:23 s/"stars"/"starts"/ 2023-01-19 10:50:07 I'm guessing it'll be something like 2023-01-19 10:50:15 : 2hex <# # #> ; 2023-01-19 10:50:17 or 2023-01-19 10:50:27 : 2hex <# # # #> ; 2023-01-19 10:50:34 depending on exactly what <# and #> do. 2023-01-19 10:51:05 I know # just "plucks out the next digit," but somehow you've got to tell it where the buffer you're buidling the string in is, and that will be in the details of <# and #> 2023-01-19 11:07:50 KipIngram, so how can we implement next thing? 2023-01-19 11:08:01 Increase the address by one while the CPU is off the BUS 2023-01-19 11:08:05 Next thing? 2023-01-19 11:08:11 What is that, exactly? 2023-01-19 11:08:29 examine next, deposit next 2023-01-19 11:08:50 Oh oh - sorry. I was still on your hex digit thing. 2023-01-19 11:09:07 Well, examine is read RAM, deposit is write RAM. 2023-01-19 11:09:07 I didn't get it and so I decided to drop it for now 2023-01-19 11:09:14 yes, but `next`? 2023-01-19 11:09:39 Oh, well, your arduino will have to keep up with the address if you want it to increment it for you. 2023-01-19 11:09:45 I don't think it's achievable without some extra logic between the switches and CPU 2023-01-19 11:09:49 yes, ofc 2023-01-19 11:09:51 If you want to do that with switches, you... 2023-01-19 11:09:53 Right. 2023-01-19 11:09:57 That's what I was just typing. 2023-01-19 11:10:03 Something will have to be address aware. 2023-01-19 11:10:18 Yeah so what particular chips do I need to order? 2023-01-19 11:10:28 You'll need a counter chip; you load it from switches and increment it from switches. 2023-01-19 11:10:34 I don't know a chip # offhand. 2023-01-19 11:10:42 You'll just have to dig one up; they're certainly out there. 2023-01-19 11:10:43 SN74 probably? 2023-01-19 11:10:51 Yeah, there is a 74 that does that. 2023-01-19 11:11:26 74LS93 is a four-bit counter. You could gang several of those together. 2023-01-19 11:11:43 Stalevar: ya building your own screenbuffer or some such? 2023-01-19 11:11:46 Now, they may or may not have tri-statable outputs. 2023-01-19 11:11:50 sounds like a lot of work, are there eight, or even sixteen bit counters? 2023-01-19 11:11:53 If not, you'll have to put a buffer after them. 2023-01-19 11:11:59 Maybe. 2023-01-19 11:12:25 https://www.mouser.com/c/semiconductors/integrated-circuits-ics/counter-ics/?number%20of%20bits=16%20bit 2023-01-19 11:12:26 Zarutian_iPad, I want an IMSAI 8080 like thing but with Z80 and different design 2023-01-19 11:13:07 Z80, SRAM, switch panel 2023-01-19 11:14:56 KipIngram, the site wouldn't work 2023-01-19 11:16:14 also how about software-sense switches? 2023-01-19 11:16:34 CPU should be able to examine the top address switches by reading from port 0xff 2023-01-19 11:16:49 and read to top 8 leds by writing to 0xff port 2023-01-19 11:16:53 * set 2023-01-19 11:17:36 So bottom switches are multiplexed between address and data bus 2023-01-19 11:19:50 I guess original Altair and IMSAI schematics should be somewhere in the web, right? 2023-01-19 11:21:09 https://grantmestrength.github.io/RetroComputerInstructionManual/altair_front_panel.html 2023-01-19 11:22:06 https://grantmestrength.github.io/RetroComputerInstructionManual/altair_front_panel.html 2023-01-19 11:22:17 http://dunfield.classiccmp.org/altair/d/88fp_lgl.pdf 2023-01-19 11:23:17 I think with modern chips it should probably be doable with like two chips or so 2023-01-19 11:23:39 One chip for each 8 eight switches 2023-01-19 11:45:30 what do you think about forth being case insensitive? 2023-01-19 11:45:48 do you even write words in all caps always? 2023-01-19 11:47:17 I'm going to try having some sort of half transpiler/interpreter 2023-01-19 11:47:38 having words as subroutines and also as text with the code 2023-01-19 11:48:11 mainly the subroutines are made from that text, this way a colon word will be built from joining all the code of the words in the definition 2023-01-19 11:48:16 all caps is more an olden thing, modern forth (and LISP...) tend towards lower case 2023-01-19 11:48:39 thrig: but it's annoying if a forth is case sensitive? 2023-01-19 11:49:19 lisp for example is case sensitive 2023-01-19 11:49:36 what it does is to convert all symbols to caps while reading 2023-01-19 11:50:04 you can set it to not do it and then you have to use caps for every builtin 2023-01-19 11:54:53 I like it being case insensitive, but I think that's really because I like using lower-case. 2023-01-19 11:55:07 And historically it was upper case, so I figure if it wasn't insensitive it would be upper case. 2023-01-19 11:55:29 I don't know - maybe what I'd really like is "mostly use lower case" for stock words but be case insensitive. 2023-01-19 11:55:33 I mean case sensitive. 2023-01-19 11:55:56 C got me thorougly "lower case preferring." 2023-01-19 11:56:13 well I kind of dislike all caps 2023-01-19 11:56:27 Me too. 2023-01-19 11:56:39 If it's going to be case sensitive then I want the built-in's lower case. 2023-01-19 11:56:49 but when I see code in forth is always in caps and still I see it beautiful 2023-01-19 11:56:52 It might be nice to be able to have CamelCase be different from lowercase. 2023-01-19 12:03:56 KipIngram: talking with you yesterday made me want to have words compiled by default 2023-01-19 12:04:04 mainly my lang was just a word interpreter 2023-01-19 12:04:44 but I like a lot the fact to be able to have temp words just to make parts of a bigger definition 2023-01-19 12:04:59 https://termbin.com/5fq9p I have this which is the "base" of what I'm trying 2023-01-19 12:04:59 Sure - real compiled words are nice and snappy. 2023-01-19 12:05:13 It's a night and day performance difference. 2023-01-19 12:05:20 mainly a word has two forms, the source code and the subroutine created from that code 2023-01-19 12:05:27 That's right. 2023-01-19 12:05:36 Same as in C; source and object/executable. 2023-01-19 12:05:47 I remember some forth implementation had a way to show you the source code of a word 2023-01-19 12:06:01 In Forth your compiled code might be CODE, but it also might just be a list of addresses that can very quickly get you to code. 2023-01-19 12:06:06 Depends on your threading model. 2023-01-19 12:06:17 now a colon word is just to join all the code of those words with semicolons 2023-01-19 12:06:25 That's right. 2023-01-19 12:06:32 xD 2023-01-19 12:06:39 : creates a name in the dictionary, and marks a spot to start compiling. 2023-01-19 12:06:50 Then each word has its address looked up and added to the dictionary there. 2023-01-19 12:07:05 I'm not sure if I'll have troubles, it's fine as the interpreter has subroutine versions of them, for example if an immediate word is executed 2023-01-19 12:07:07 And finally ; will compile a (;) return "runtime" word and take you back out of compile mode. 2023-01-19 12:07:33 So : doesn't actually add any code to the definition, but ; does. 2023-01-19 12:07:52 ; isn't even a word in my lang 2023-01-19 12:08:03 So ; adds a return, unless your last word before the ; is also a : definition; if it is, then it converts that return to a jump to that word. 2023-01-19 12:08:08 That's what we call tail optimization. 2023-01-19 12:08:09 : will just read until it finds a ; then make the word 2023-01-19 12:08:42 Well, ; is immediate - the idea is that the system just reads each word and checks STATE to see whether to interpret it now or compile it for later. 2023-01-19 12:08:51 ; compiles that (;) and sets STATE back to 0. 2023-01-19 12:09:04 In most forths the interpreter loop and the compiler loop are the same loop. 2023-01-19 12:09:20 but there are some Forths where they are separate loops, and I read that's better for cross-compiling. 2023-01-19 12:09:36 when I started I had a $compiling flag in the interpreter 2023-01-19 12:09:42 and ; was an immediate word 2023-01-19 12:09:50 Ok. So you had STATE. 2023-01-19 12:09:56 : just set the $compiling to 1 2023-01-19 12:10:03 Folks have a love-hate relationship with STATE. 2023-01-19 12:10:05 now, meh 2023-01-19 12:10:08 It's handy and convenient. 2023-01-19 12:10:16 But it's also a global and has some downsides. 2023-01-19 12:10:19 : just reads from the source code and does everything 2023-01-19 12:10:44 Well, for compiling you have to decide how you're going to store your definitions. 2023-01-19 12:11:10 now I realize I'm not handling immediate words xD 2023-01-19 12:11:12 Usually you are working your way through some address list. 2023-01-19 12:11:52 If an address you pick up is the address of another address list, then the code you wind up executing for that word will push your instruction pointer onto the return stack and set that pointer to the new address. 2023-01-19 12:11:57 for immediate words what I was doing lately was to have a hash with those words and the value was the number of elements they push on the stack 2023-01-19 12:11:58 And then you just continue. 2023-01-19 12:12:08 the (;) will pop the return stack back into IP when it executes. 2023-01-19 12:13:39 I envy the simplicity of the forth syntax 2023-01-19 12:13:45 mine is polluted with lists 2023-01-19 12:14:04 That's Forth's strong suite. 2023-01-19 12:14:09 Big reason I love it. 2023-01-19 12:15:12 I feel it convenient to use lists as code, but I abuse them 2023-01-19 12:15:27 after all a word reading the source code would need delimiters anyways 2023-01-19 12:15:39 for example IF 2023-01-19 12:15:56 IF needs a THEN 2023-01-19 12:16:02 Stalevar: So, why don't you just let your NEXT switch communicate with the Arduino and let it remember and increment the address? 2023-01-19 12:16:25 my IF just expects a list 2023-01-19 12:16:35 I understand if you just want to be purist about it and do it it exactly the way that it was done historically, but it looks to me like your v0 is going to be more capable than your v1. 2023-01-19 12:16:39 well could be a string or a subroutine too 2023-01-19 12:16:58 Forth IF just expects a number on the stack. 2023-01-19 12:17:02 Either zero or not zero. 2023-01-19 12:17:37 The optional code follows it in the code stream. 2023-01-19 12:17:43 It either jumps over that code or doesn't. 2023-01-19 12:17:47 KipIngram: what is that hate/love relationship with STATE 2023-01-19 12:18:08 why can they hate to have a state as a flag for when compiling 2023-01-19 12:18:09 Well, part of it is just general dislike of global variables holding system state. 2023-01-19 12:18:19 then how do they? 2023-01-19 12:18:31 Those who avoid it have separate compiler and interpreter loops. 2023-01-19 12:18:45 Interpreter loop is running; when it sees : it makes a name and calls the compiler loop. 2023-01-19 12:19:02 hmm 2023-01-19 12:19:07 ; terminates the compiler loop, and control goes back to the interpreter loop. 2023-01-19 12:19:09 I made my interpreter as dumb as possible 2023-01-19 12:19:14 Now, mind you, I've never done one that way. 2023-01-19 12:19:21 the compiler are actually the words themselves 2023-01-19 12:19:21 I've always used STATE. 2023-01-19 12:19:57 I started with state and some array to hold the word being defined 2023-01-19 12:20:11 the interpreter just pushed the word into that array as long as it wasn't immediate 2023-01-19 12:20:25 if it was immediate then just executed the word 2023-01-19 12:20:54 words weren't able to read from the source code at that time 2023-01-19 12:21:36 That sounds a lot like Forth, actually. 2023-01-19 12:21:42 but once I did provide a way for words to read from the source, I liked to delegate this behavior to them 2023-01-19 12:21:48 In Forth the "array" is "all of your RAM" - your dictionary. 2023-01-19 12:22:37 In my system, a : definition's header in the dictionary contains a pair of pointers. Call them "code pointer" and "list pointer." 2023-01-19 12:22:52 The list pointer points to the list of addresses that specify the word. 2023-01-19 12:23:11 The code pointer points to machine code that does that instruction pointer push and reset operation. 2023-01-19 12:23:32 So it pushes IP and loads IP with the list pointer value, and that's all. The system will now march through THAT list. 2023-01-19 12:23:47 Primitive words don't need a list pointer, so it's optional in my headers. 2023-01-19 12:24:00 Primitives just point to code that implements the word - I just jump to it. 2023-01-19 12:24:33 Variable words have the list pointer point to where the variable i stored, and the code pointer points to code that pushes the list pointer onto the stack and continues. 2023-01-19 12:24:46 All those little "handling" routines are very simple. 2023-01-19 12:26:50 hmm but now being half transpiler/interpreter immediate words should return a string of code 2023-01-19 12:27:23 Immediate words just do whatever they do. 2023-01-19 12:27:29 Like all words. 2023-01-19 12:27:39 They just do it NOW even when compiling - that's the only difference. 2023-01-19 12:28:05 yeah, but for example [ was immediate 2023-01-19 12:28:14 Yeah, it just sets STATE=0. 2023-01-19 12:28:20 it created a list and pushed it on the stack 2023-01-19 12:28:25 So that the next word gets "interpreted." 2023-01-19 12:28:36 haha no, in my dirty lang is a list builder xD 2023-01-19 12:28:42 So you can see why this complicates cross-compiling. 2023-01-19 12:28:46 Consider that for a moment. 2023-01-19 12:29:00 When cross-compiling, you have a dictionary for the system you're running on - a regular dictionary. 2023-01-19 12:29:13 And its words all are designed to run on the machine you're using right now. 2023-01-19 12:29:28 But you're compiling an image for some other system, which might have an entirely differnt instruction set. 2023-01-19 12:29:36 So you also have a "target dictionary" that you are building. 2023-01-19 12:29:52 Obviously, when you are compiling a target definition, you want to find those words in the target dictionary. 2023-01-19 12:30:08 But when a word is immediate, it needs to be a word that can RUN on the host. 2023-01-19 12:30:31 But if it's a word that leads to a modification to the target code stream, it needs to be a target word. 2023-01-19 12:30:40 So things get murky and you just have to be very careful. 2023-01-19 12:31:00 that's mainly why making an interpreter is the easiest way 2023-01-19 12:31:01 Like IF. 2023-01-19 12:31:11 What if IF is implemented differently on the target than it is on the host? 2023-01-19 12:31:13 making a transpiler or a compiler it's a bit more trouble 2023-01-19 12:31:34 When you find IF in a definition for the taret, what do you do? 2023-01-19 12:31:56 but I hope this serves me as an introduction, I wanted to make a transpiler several times and never felt courageous enough 2023-01-19 12:32:01 It needs to do target things to the target code stream, but it needs to USE host resources to do that, since that's what can actually RUN right now. 2023-01-19 12:32:18 and it's mostly fine as I have half interpreter 2023-01-19 12:32:22 ACTION always cheating 2023-01-19 12:32:26 So the cross compile IF is NOT the same word that will fun ON THE TARGET later when it compiles an IF. 2023-01-19 12:32:43 KipIngram, because I don't want to make Arduino part of computer. It's going to be there only to debug while it's built but not as the final part. Otherwise Atmega is powerful enough to emulate 8080 or z80 2023-01-19 12:33:56 Yeah, I do understand. It just means you're not going to be able to dodge designing a bit of hardware. 2023-01-19 12:34:30 But hey, there's nothing wrong with that. 2023-01-19 12:34:42 I was just impressed with how simple your v0 setup looked, that's all. 2023-01-19 12:34:50 actually a pretty sweet little arrangement. 2023-01-19 12:35:21 You are, in fact, wanting to be purist about it, and I can respect that totally. 2023-01-19 12:35:31 I'm the same way in a lot of ways. 2023-01-19 12:35:45 I've avoided linking ANY library code of any sort into my Forth. 2023-01-19 12:35:51 KipIngram, case insensitivity is not such a good thing if you consider unicode/utf-8 and then case conversion becomes very non-trivial task. But I think it would make sense to make forth case-sensitive but have duplicates for all builtins in upper and lower case, so say, DUP and dup will both work, but not Dup or dUp 2023-01-19 12:35:52 the IF should mangle the target stuff, the thing is you always have the last word defined and somehow immediate words can push stuff into the word being defined 2023-01-19 12:35:57 It uses a small number of OS syscalls, and otherwise I've written eveyr byte of it. 2023-01-19 12:36:55 I do not have that feature anymore 2023-01-19 12:37:01 I know, but my point is that on the one hand we've got the otion that when we are compiling a target definition to the target dictionary, we must only include addresses of TARGET words in it. But on the other hand we've got the notion that target words can't run on the host. 2023-01-19 12:37:05 It's a crosswire. 2023-01-19 12:37:08 still now they should push a string of code 2023-01-19 12:37:36 What you have to have is an IF that can run on the host but knows that it's MAKING target code stream content. 2023-01-19 12:37:46 And that's different for your host system's native IF. 2023-01-19 12:37:52 Which makes host code stream stuff. 2023-01-19 12:38:11 It's not something that can't be resolved - the point is just that it's delicate and you have to keep things clear. 2023-01-19 12:38:30 My reading (but not my experience yet) has indicated that things get a little easier if you separate the interpreter and compilier loops. 2023-01-19 12:38:39 haha the 23431 time I rewrite this it will become clear 2023-01-19 12:39:02 but I like a lot that now it does "compile" 2023-01-19 12:39:12 even if it's transpiling code into the same lang 2023-01-19 12:40:09 with the other implementations which I'll call a 'word interpreter' the more words you use the worse the efficiency 2023-01-19 12:40:38 in a loop for example it's not what the word does, but the number of words you're executing xD 2023-01-19 12:41:15 now they'll be 'compiled' somehow 2023-01-19 12:41:52 I hope this means I won't have a loop that lasts 3 seconds and another that lasts 14 just cause I've added more words 2023-01-19 12:42:38 still the nice thing would be to target C I suppose, but meh 2023-01-19 12:42:46 I'll try to avoid C as much as I can 2023-01-19 12:43:27 what I need is to be able to abuse colon word definitions 2023-01-19 12:43:37 this is mainly why I like forth 2023-01-19 12:44:01 in forth you're expected to abuse colon definitions 2023-01-19 12:44:22 a thing you call 'factoring' xD 2023-01-19 12:44:46 factoring in my word interpreters just make the words slower :/ 2023-01-19 12:46:02 Stalevar: This one: 2023-01-19 12:46:40 Wait - never mind. 2023-01-19 12:46:58 I'm looking at a dual 16-bit counter with 3-state outputs, but the problem is it doesn't give you all 16 bits at once. 2023-01-19 12:47:02 You bank select the output. 2023-01-19 12:47:06 And that's problematic for you. 2023-01-19 12:47:35 That's the only style I'm immediately seeing, though. 2023-01-19 12:50:17 This thread discusses your very issue: 2023-01-19 12:50:19 https://forum.arduino.cc/t/16-bit-counter-chip/332033/10 2023-01-19 12:50:30 And the expert conclusion appears to be that you will almost certainly have to chain two chips. 2023-01-19 12:51:05 You want to be able to load it, so that's 16 input pins, and you want 16 output pins, so you're looking at a 40-pin or so package, and honestly this just isn't much silicon. 2023-01-19 12:51:13 May just not be available. 2023-01-19 12:52:15 The good news is that the chips I see do generally have three-state outputs, so that works for you. 2023-01-19 12:52:51 It will almost certainly mean that, or at least it does in real Forth. 2023-01-19 12:53:01 Like I said - night and day. 2023-01-19 12:53:07 ^^ vms14 2023-01-19 12:58:52 well I do not intend to stick to the forth way, but colon words is what I love from forth 2023-01-19 12:59:16 and the fact they're super expensive in my lang makes me cry 2023-01-19 12:59:48 anyways I do see a lot of progress since when I started 2023-01-19 13:00:08 maybe with some years it will resemble a bit more to a real forth 2023-01-19 13:00:54 mainly what I do is to try stuff randomly, I do it on my own way. Also using a scripting lang like perl or js makes stick to the forth way a bit counterproductive 2023-01-19 13:01:46 still when I see forth code, I kind of envy it xD 2023-01-19 13:01:55 KipIngram, by the way, Altair and Imsai also have set of eight CPU status bits each, and as far as I understand they are multiplexed with other bus signals, so... they might need clock-counted input buffer too? 2023-01-19 13:03:15 KipIngram, I think it should be some 8 bit chips, not 16 bit 2023-01-19 13:03:30 Since upper togglers can be software-sensed 2023-01-19 13:04:21 This means that they are on a separate chip, which can be made to send data to the address bus or to the data bus. The same goes to first half of switches,they should be able to send data to data or address bus 2023-01-19 13:10:19 how would a lang inspired in forth implemented in a high level language be? 2023-01-19 13:10:48 like a language having garbage collector, a call stack, etc 2023-01-19 13:12:22 I know there are even ANS compliant implementations in high level langs, but sticking to forth forces to implement features you already had from the start 2023-01-19 13:14:13 vms14: Well, the first thing I want to add is a typed stack that I can put any sort of data item on. 2023-01-19 13:14:37 integers, floats, complex, vectors, matrices, strings, etc. - anything I design support for. 2023-01-19 13:15:14 And that means that there needs to be some dynamic RAM pool, because that's where those entities will actually live - the system needs to be able to create and get rid of them on its own, and what will be on the stack will be pointers to the data itself. 2023-01-19 13:15:43 And it seems like perhaps it should be possible to put a definition on the stack too - not sure about that. 2023-01-19 13:16:07 I'm going to build the dynamic memory support using ropes. 2023-01-19 13:16:35 I've toyed with the idea that ints could continue to live directly on the stack, but I'm not sure that's wise 2023-01-19 13:16:42 Might be cleaner to just be wholly uniform. 2023-01-19 13:16:51 being "on the ropes" may not be a good sign 2023-01-19 13:16:56 also, I might want to add a programmable peripheral controller to my simple computer, so to support some IO, do you have any suggestions? 2023-01-19 13:17:32 No, not familiar enough with the offerings on that these days. 2023-01-19 13:18:19 I just want to know which works best with z80 2023-01-19 13:19:36 One of the link pages I sent you earlier had pointers to a bunch of support chips for your processor. 2023-01-19 13:19:42 Almost the first link I sent this morning. 2023-01-19 13:19:56 I didn't look much at them, because at the time I was looking for data on the processor itself. 2023-01-19 13:19:57 in my case the stack is already able to get any kind of data, and definitions can be represented as arrays 2023-01-19 13:20:16 I already have garbage collection, so no ALLOT and alike 2023-01-19 13:20:49 the dictionary does not need to be used as a secondary storage for data 2023-01-19 13:21:12 variables could be used for that, or even words, also the stack itself 2023-01-19 13:21:44 but just those things make the lang differ a lot from forth 2023-01-19 13:23:11 anyways, I don't pretend to make a forth, but a concat lang. I just steal concepts I like, for example colon words, the rpn and the stack 2023-01-19 13:23:50 having gc and no memory allocation does not let me do things like a forth would do, unless I make some way to fake memory allocation 2023-01-19 13:24:30 also having gc and alike frees me for having to use the dictionary in some ways forth does 2023-01-19 13:24:44 but at the same time I won't have those features 2023-01-19 13:24:55 or they'll be quite different 2023-01-19 13:25:38 still I'm not really familiar with forth, so I wonder how a forthwright would make a lang inspired in forth using a high level language with gc and alike 2023-01-19 13:26:22 I assume he wouldn't fake memory allocation just to do some stuff in the forth way 2023-01-19 13:28:20 also wonder how would he make a lang resembling forth as much as possible without having to provide features he already has in the high level lang 2023-01-19 13:28:38 if you have no memory allocation the whole concept of the dictionary changes a lot 2023-01-19 13:29:34 if you have a call stack, why would you provide a call stack. Would the forthwright use the call stack on the high level lang? 2023-01-19 13:32:24 I'll go off for a while, then see how I'll handle immediate words while code generation 2023-01-19 13:32:54 I think I'll fallback to a compiling state flag or have immediate words with alternate behavior 2023-01-19 13:33:19 see you forthwrights :D 2023-01-19 23:57:25 So, I've been thinking a lot about calculator interfaces still. When you enter a program into a calculator, usually you can't enter "just anything you want." You don't actually type out command names. You hit a key, or you choose them from a catalog - the common feature being that there is an existing set of things you can add to your program. It occurred to me that a Forth system could implement that 2023-01-19 23:57:27 quite easily. For example, when you type a word, it could require that what ever you typing be *allowed*. Obviously numbers can go anytime, same on the calculator. But word names could be checked as soon as you started to type them. As soon as you defined a new word, it could be added to the list of what's allowed after that. 2023-01-19 23:57:29 Thoughts?