00:00:38 What's the difference, then? 00:01:05 static variables are not deallocated when the function returns, but kept the same for all invocations 00:01:11 fizzie: That'd be 640k, not 64k. 00:01:53 What if the function calls itself? 00:02:05 ihope; You get a new instance of the automatic variable. 00:02:13 pikhq; 64k is a very common limit, too, since it's a single memory page. 00:02:16 If it's a static variable? 00:02:28 only one version 00:02:39 pikhq; Er, I mean, segment. 00:02:58 a static variable is like a global variable, except that it doesn't clutter the global namespace 00:03:19 fizzie: I thought MS-DOS used the x86 CPU with what amounts to a flat memory model. 00:03:44 (I could be absolutely wrong, and in all probability am) 00:03:53 Err, no? Why would there be the 640k limit, then? 00:04:58 * pikhq uses his external brain attachment (Wikipedia) to sound like less of an idiot 00:05:14 DOS programs, of course, can run in protected mode, with a 32-bit flat memory model. 00:06:52 You're right. 00:07:05 I'm no assembly expert. ;) 00:07:33 * oerjan suddenly wonders whether wikipedia will cause us to develop a group mind... 00:07:58 * bsmntbombdood is working on hello world 00:08:02 oerjan: Probably. 00:08:19 At least, Wikipedia said so. 00:08:42 link please? :) 00:09:35 Find it yourself. 00:09:54 Anyway, compilers generating "16-bit executables" usually can use all kinds of memory models, and the "tiny", "small" and "medium" memory models all limit data pointers to a single segment. Which would mean no integer arrays larger than 64k bytes, or 32k elements. http://en.wikipedia.org/wiki/Memory_model 00:10:28 That's just stupid, IMO. 00:11:21 The whole segmented memory architecture doesn't really feel like a very bright idea. 00:11:33 Of course, I live in the roarin' 64 bit pointer 2000s. ;) 00:12:56 this is hards 00:13:04 Well, the 68k (which was a contemporary of 8086, I think) had a 24-bit flat memory model. 00:13:18 how do I jump if 0? 00:13:28 Subtract -1? 00:13:55 fizzie: The 8086 was like the 68k's retarded little brother. :p 00:13:56 right :) 00:14:25 So just how ugly is x86? 00:14:32 Is it composed entirely of cruft? 00:15:05 ihope: Cruft, rubber bands, bubble gum, and fairy dust. 00:15:33 At least it has the fairy dust, eh? 00:15:51 The fairy dust only is in the 64 bit variants, though. 00:15:57 Oh. 00:16:43 A single x86 opcode can be anything between one to 15 bytes, iirc. It does sound rather a bit overcomplicated, at least when compared to your standard "all instructions are alike" riscs. 00:17:22 Segmentation fault (core dumped) 00:17:46 fizzie: It comes from the bad ol' days when ASM coding was the standard way of doing anything. 00:18:12 Opcodes, opcodes, and more opcodes are the idea. 00:18:28 That reminds me of a wonderful comic; I wonder if I can still find the link. 00:19:02 http://juho.vaha-herttua.fi/Zilog.Z8000.1979.102646293.pdf 00:21:13 Specifically page 6 of the pdf. "It's not magic, readers! With dual environments, 418 op codes, and --". And page 17; "-- just a few, well-chosen op codes!* * Captain Zilog had 418 to choose from!" 00:25:03 "Holy cow, boss! Dis baby can use any of its registers as a stack pointer!" "None of the registers are designated! They're all general!" 00:25:27 All general? 00:25:42 Where's the trap register for each of 75 instructions? 00:25:50 Gimme an R, gimme an I, gimme an S, gimme a C! What does that spell? RISC! 00:25:55 Well, it's a little white lie. At least according to my reading of the Z8000 specification book. 00:26:08 ;) 00:26:38 can't figure out how to dereference a pointer 00:26:52 In your OISC? 00:26:55 yeah 00:27:08 *p 00:27:27 In fact, it even has one register sort-of designated as a stack pointer; there are many stack-manipulating instructions, including subroutine calls, which implicitly assume that register is the stack pointer. 00:27:47 Set a memory location to the address of the destination, then copy? 00:28:29 ? 00:29:15 you need to copy the pointer into the code 00:29:20 Can you do self-modifying code in your oisc, btw? Or are the instruction and data spaces separate? 00:29:26 Wait... 00:29:34 fizzie: they are the same 00:31:33 fizzie: Harvard architectures aren't exactly common. . . 00:32:10 Harvard architectures? 00:32:24 pikhq; Well, now, there's the MIPS. 00:32:28 An architecture with seperate instruction and data space. 00:32:48 if the pointer is in P, do a copy from P to Label+1, where Label is the address of an instruction 00:33:23 hmm 00:34:47 wait, i mean Label, not Label+1 00:35:53 crap, there's a bug in my assembler 00:38:05 And MIPS is common; I have a SGI Indy ("Indigo without the go") with its MIPS R4000 sitting right here on my desk. 00:40:42 lindi; To comment on something that appeared a long time ago in this discussion; due to the utterly low precedence of =, "if (b = b-a <= 0)" (and similarly the later "if (*b = *b-*a <= 0)") would read as "if (b = (b-a <= 0))", which is probably not what you intended. (And wouldn't it look better as "if ((b -= a) <= 0)" anyway?) 00:41:07 ok, that bug fixed 00:41:59 longer first, longer first 00:42:06 * bsmntbombdood repeats to himself 00:42:50 now back to hello world 00:43:10 * pikhq has seen the reason behind the Tcl style guide's recommendation for copious parentheses in expr expressions. . . 00:46:37 fizzie: oh right 00:48:24 -!- tgwizard has quit (Remote closed the connection). 00:50:55 Oh, right... schools need algae, and to get algae, my workers need to be able to swim, meaning I need a swimming pool. 00:52:21 And there we have it, a swimming pool indeed. 01:09:03 aargh 01:09:05 this is hard 01:09:39 I can't do hello world 01:09:59 Hah. 01:10:23 I got pointer dereferencing thoug 01:10:33 now it's not looping like it's supposed to 01:13:47 Conway's Game of Life... now there's a real esoteric thingy. 01:14:00 And it' 01:14:04 s nicely Turing complete. 01:14:09 Decimal output is very useful for debugging 01:14:14 It's full of puzzles beyond proving it Turing-complete. 01:14:25 Like making a 17c/45 spaceship. 01:14:53 The Caterpillar is one such spaceship, and it's pretty huge. 01:15:36 http://www.yucs.org/~gnivasch/life/article_cat/cat_picture.gif <- the Caterpillar, scale 1:40 01:17:28 Now, just imagine: if one were to remove a cell near the front, the whole thing would probably explode. 01:18:24 oh fuck, no wonder 01:20:06 We're still all waiting, though, for the spaceship generator, capable of making spaceships of any rational speed in both directions, as long as that speed is less than c/2. 01:21:47 Or any computable speed, if periodicity doesn't matter. 01:27:09 Just program a universal computer with that, and hook it up to a universal constructor, and there you go... 01:29:49 arghhhhhhh 01:30:38 * oerjan likes the Day and Night CA 01:32:01 complete symmetry between on and off cells, but still so complicated that it nearly has to be Turing-complete (but I don't think it has been proved) 01:33:04 I can't get it to work :( 01:33:28 the "Hello World"? what's the problem? 01:34:08 Can't figure out how to get the loop to terminate 01:34:54 one quitp QUIT 01:35:14 Loop? 01:35:33 ihope: To loop through the string 01:35:52 is the string zero-terminated? 01:35:58 Great hacks are needed to do the simplest of things? I like it. :-) 01:36:11 * ihope tries to run Life32 under Wine 01:36:13 oerjan: yeah 01:36:24 ihope: indeed 01:36:49 at some point you probably load the current character into some cell, right? 01:37:24 yeah 01:37:48 I guess I need Wine to do that. 01:37:53 that instruction will branch if and only if the character is zero 01:38:10 which is what I want 01:38:21 http://pastebin.ca/290491 01:38:44 Now, how easy would it be to write a Linux compatibility layer for Windows? 01:38:55 ihope: cygwin? 01:38:55 GregorR: In Plof, your "for" loop semantics are really different from C's. . . 01:39:11 That runs Linux binaries now? 01:39:11 ihope: CoLinux or UML for Cygwin. 01:39:24 Well, yeah, that. 01:39:27 ...Those. 01:39:38 How fast is CoLinux? 01:39:55 When I last used it, it was damned close to native. 01:40:22 That was a few years ago, though. 01:40:30 Err. 01:40:34 Maybe a year or two. 01:40:46 UML for Cygwin, I can't say anything about. 01:41:11 oerjan: I think i got it 01:41:11 But one has to admit that it's kind of funny that Linux has been ported to Windows. . . Literally. 01:41:49 Okay, Wine's all nice and installed. 01:42:46 Now how do I use it? 01:42:59 ...nevermind 01:43:41 GregorR: A patch is coming your way. 01:43:47 Cannot open /home/ns/Desktop/Life32/Life32.exe: No application suitable for automatic installation is available for handling this kind of file. 01:44:49 * pikhq hopes Gregor notices it 01:46:09 Now it doesn't terminate too early, it terminates too late 01:46:45 it prints "hello, world 0x00 0x00..." 01:48:33 Whoa! 01:48:37 It's ugly, but it works! 01:49:10 Pretty sweet, actually. 01:50:33 Then again, maybe it actually doesn't work. 01:50:51 hmm? 01:50:59 Life32 under Wine. 01:51:16 aah 01:52:51 Aha! It DOES work! 01:56:53 hello world doesn't :( 01:58:43 Can't you just zero a memory location and use it to test for positive? 01:59:09 can someone take a look? http://pastebin.ca/290503 01:59:39 i am taking a look, my attempt coming up 02:02:52 Why, I think the Caterpillar has loaded. 02:04:11 It's possibly even larger than I thought it would be. 02:06:02 try this: http://pastebin.ca/290507 02:06:52 It looks quite nice, actually. 02:07:35 This is what large Life patterns look like, then? 02:08:05 oerjan: workage 02:08:37 :) 02:09:12 * oerjan makes the V sign 02:12:16 odd 02:12:32 even? 02:12:41 -!- digital_me has joined. 02:13:25 nope, pretty odd 02:13:34 what is? 02:13:44 How your's worked 02:13:50 Mine did almost the same thing 02:14:46 i didn't completely understand yours, but it seemed to me that it did the quit test after printing the character so i expect at least an extra 0x00 02:15:00 *expected 02:15:55 Mine never quit the loop 02:17:48 what was the point of the quitp WRITE -1 anyhow? 02:17:57 debugging 02:18:46 right. i _think_ your problem is that you never managed to dereference the quitp pointer 02:19:37 so you actually tested the pointer itself rather than the character 02:19:37 line 12? 02:20:22 line 12 is a comment 02:20:41 13,14,15 02:21:04 it is essentially quitp = -pos, with no dereferencing 02:21:30 hrm 02:22:07 to dereference a pointer, you _must_ copy it into an actually running code part 02:22:38 like writepos:, or my quitpos: 02:23:18 oh, and in your's, line 16 needs to be NULL NULL -1 02:24:40 i don't think so, because NULL is not used again before NULL NULL CODESTART 02:27:37 oh, right 02:29:26 probably not good to leave NULL unzeroed though 02:31:04 well, you could rename it to temp... 02:35:06 yeah 02:39:55 I should work on a brainfuck interpreter 02:40:39 that would certainly kill some time... 02:40:45 Do it in Plof. 02:41:00 i assumed he meant in OISC :) 02:41:07 (Plof is in bad need of Esome) 02:41:37 oerjan: I think it would be pretty straighforward 02:41:43 except for [] 02:43:48 you could just compile into memory 02:44:10 for [] you need a stack of branch points 02:44:20 during the compilation 02:44:43 i believe Forth works in that way 02:45:09 [] is hard even in real languages 02:45:14 Not in Tcl. 02:45:26 Of course, my BF implementation in Tcl is a bit. . . Lazy. 02:45:51 Basically, I compile the Brainfuck code in-memory to Tcl, and then evaluate the compiled code. ;) 02:46:44 essentially what i suggest for OISC as well 02:47:06 because [] is _not_ particularly hard to compile 02:47:45 no, just a jump 02:47:46 It's only hard because one has to do it in OISC. . . And you're going to have to do that just to write the thing, anyways. 02:47:48 its only if try to run directly on the string interpretation it gets awkward 02:48:15 *representation 02:50:26 *it's only if you 02:53:10 hm... you could actually avoid a disjoint stack by keeping the stack _in_ the partially compiled code 02:53:41 then you avoid having to juggle two distinct growable memory areas 02:54:56 how? 02:55:11 so, when you get to a [, you compile it, except that the branch location points to the previous [ 02:55:39 and you have a global pointer to the topmost [ 02:56:54 when you get to ], you use that global pointer to compile the ] _and_ to patch the corresponding [, finally letting the new global pointer be the previous content of the [ 02:56:56 -!- ihope has quit ("Leaving"). 02:58:05 so the global pointer plus the pointers saved in each [ is the stack, pushing on a new [ and popping on a new ] 03:01:47 * bsmntbombdood writes cat in OISC 03:03:24 -!- pikhq has quit ("leaving"). 03:03:38 you might need a special EOF location 03:03:52 -1 03:03:57 ah 03:09:12 grar, I think there's a bug in my vm 03:09:47 READ char -1 03:09:47 char WRITE -1 03:09:47 NULL NULL CODESTART 03:09:57 doesn't do what it should 03:10:22 hm... make that char char CODESTART? 03:11:01 !?! 03:11:04 Huh? 03:11:12 oh, right 03:11:35 char doesn't get zeroed 03:13:14 actually, you probably need to test it for -1 first 03:13:34 which would have to go between READ and WRITE 03:13:56 I know 03:14:04 ah! 03:14:18 http://pastebin.ca/290546 03:16:04 there is a simpler way if you use READ char