00:00:00 --- log: started retro/14.12.06 07:48:17 --- join: mnemnion (~mnemnion@c-98-210-219-91.hsd1.ca.comcast.net) joined #retro 10:27:05 --- quit: Sgeo_ (Read error: Connection reset by peer) 11:07:21 --- join: Sgeo (~quassel@ool-44c2aebc.dyn.optonline.net) joined #retro 12:35:04 --- quit: mnemnion (Remote host closed the connection) 15:16:16 --- join: FreeFull (~freefull@defocus/sausage-lover) joined #retro 15:17:09 I've been developing an implementation of the Ngaro Virtual Machine based on http://retroforth.org/docs/The_Ngaro_Virtual_Machine.html 15:17:13 It's not ready to use yet 15:18:00 hey! welcome, FreeFull :) 15:18:02 rust? 15:18:08 Heya tangentstorm 15:18:09 Yes 15:18:36 I'll need to test if I implemented the CPU correctly, but I need to implement IO first to do that 15:19:18 What is the expected behaviour when a stack is empty, but an instruction calls for popping a value off it? 15:19:27 if you implement saving the vm back to disk, there's a test script written in python that you can use 15:19:35 --- join: mnemnion (~mnemnion@c-98-210-219-91.hsd1.ca.comcast.net) joined #retro 15:19:39 Thanks 15:19:40 ngaro crashes 15:19:54 Ok, I probably should do that too 15:19:56 (and then once you have those working, there's another test suite written in retro that runs on the vm) 15:20:31 --- join: SkyTheLeafeon (ae3d85bd@gateway/web/freenode/ip.174.61.133.189) joined #retro 15:20:33 Right now the implementation I've got just keeps going, which probably isn't a good thing 15:20:37 I should make it at least stop 15:20:58 test/ngaro/ngarotest.py 15:21:00 --- part: SkyTheLeafeon left #retro 15:21:18 I'll try to get keyboard and text working first 15:21:21 it's pretty much undefined behavior. the c implementation just happens to crash. 15:22:19 hey docl's here too. long time no see. 15:22:53 I haven't looked at any other implementation, that document is the only thing I've been using =P 15:23:22 fair enough :) 15:25:22 Why is the text output described as a "Character Generator"? 15:26:43 i think a character generator is a hardware device that renders characters graphically. (like the text mode on an ibm pc) not sure. 15:33:37 Ok 15:42:49 Doesn't say if it should be ASCII or such 15:43:10 nope. characters are 32-bit values 15:44:47 I mean, for display 15:45:04 Unless I should only display numbers =P 15:47:18 the encoding you use just depends on how you implement the terminal 15:47:52 if it's graphical, then you can just have a sparse array of bitmaps for all 2^32 possible character values. 15:48:19 or if you're outputting to a conventional terminal, you could utf-8 encode it on the fly or whatveer. 15:48:23 lemme see what i did. 15:50:40 hrm. i just assumed everything was a byte and utf-8 just magically worked. :) 15:50:47 I mean, is there a predefined bitmat for each character? 15:50:51 nope 15:51:01 Ok 15:51:13 I'll just output the u8 value to stdout for now 15:57:12 Are things like keyboard arrows meant to work? 15:57:29 undefined. 15:57:58 Too bad 15:58:01 They are really useful =P 15:58:44 you can configure your keyboard device to send whatever codes you want. 15:59:16 Yes, but that's useless if the software doesn't know what they mean =P 15:59:56 yeah but it doesn't not know what they mean either. 16:00:15 in retro, you can say getc and press any key and it'll read that character. 16:00:47 there's no line buffering so every keypress is handled directly. 16:01:15 Yeah, I know that 16:01:18 so if you tell your keyboard implementation to send it as one character, you can do that. 16:01:35 But I'd have to specifically modify/write the software to take advantage of the special codes 16:01:59 yep. 16:02:07 welcome to retro. :) 16:03:08 actually there is already a hook in retro for single-character keyboard macros. you could probably chain those together without too much trouble. 16:03:10 Why not just add a "standard" set of arrow codes to the standard? 16:03:29 i dunno. i guess nobody's needed arrow codes before. 16:03:31 Say, 257 is left, etc 16:03:51 i think the text editor uses vim keybindings. 16:06:24 i'm not sure, but i suspect my pascal implementation will send a two-character sequence for arrow keys. 16:08:52 Mine will end up sending whatever escape sequence the terminal uses 16:09:07 that'll work 16:13:44 * crc probably should standardize special (e.g., non-alphanumeric) keys someday 16:14:14 heya crc 16:14:22 hi tangentstorm 16:14:53 Hi crc 16:15:03 hi FreeFull 16:15:09 I'm getting close to having basic IO working 16:15:23 what language are you writing your implementation in? 16:15:24 Then I can try to test my code 16:15:26 Rust 16:15:36 cool :) 16:43:36 Ok, I think I have all the bare essentials in place now 16:43:40 Now to actually get it to work =P 16:45:21 I've had it print out the IP, and it seems to be looping at the very least 17:00:45 I've made some changes, and now the instruction pointer is stuck with a value of 7 17:01:46 :) 17:02:05 is the VM_JUMP opcode working? you shouldn’t ever hit 7 (that’s in the start of the default text input buffer IIRC) 17:02:54 Oops, I accidentally got rid of the line that incremented it 17:02:57 So it got stuck on a NOP 17:04:17 Aaand now my vm crashes with a data stack underflow 17:06:10 ... during a POP instruction... 17:06:43 Wait, no STORE 17:06:45 That makes more sense 17:08:40 Debugging this will be hard ): 17:15:22 I think I figured it out. My JUMP instruction does the wrong thing 17:17:07 I have found that once jumps, calls, and basic i/o are working, the rest becomes functional quickly 17:19:39 Does retroImage require a canvas device? 17:21:12 no 17:21:15 canvas is entirely optional 17:21:31 Ok 17:21:53 It seems to be stuck in a loop involving port 5 17:22:03 the only things required to get it working are the keyboard, terminal output, and queries 17:22:43 port 5 is the capabilities query 17:22:52 Yes 17:23:13 it queries: 17:23:19 i: run-on-boot ( - ) 17:23:19 -1 # query memory # !, ( Memory Size ) 17:23:19 -2 # query fb # !, ( Canvas Present? ) 17:23:19 -3 # query fw # !, ( Canvas Width ) 17:23:19 -4 # query fh # !, ( Canvas Height ) 17:23:20 -11 # query cw # !, ( Console Width ) 17:23:20 -12 # query ch # !, ( Console Height ) 17:23:20 boot ; 17:23:29 Yep, that's it 17:23:33 so, -1, -2, -3, -4, -11, and -12 are needed 17:23:51 It's stuck in a loop just querying these over and over 17:24:15 I'm assuming 0 for false, 1 for true? 17:25:19 I probably should implement -11 and -12 thhen 17:25:19 -1 for true 17:25:23 Ah 17:25:36 does your vm_in instruction clear the port after returning the value? 17:25:50 Yes 17:26:04 ok 17:26:16 Actually, wait 17:26:26 It doesn't! I must have missed it 17:27:33 Thanks 17:27:55 no problem 17:28:47 Now it seems to get stuck in something that doesn't involve ports 17:32:10 Or rather, looping and jumping around 17:34:13 I'm not sure how to debug this 17:34:54 debugging is painful :( 17:35:31 I did a lot of trial and error, and lots of printf() (or equiv) in the implementations I wrote 17:36:01 I think I'll write a function that translates opcodes into instruction names 17:36:05 * crc has intended to put together smaller images for testing specific instructions, but hasn’t done this yet :( 17:36:53 That'd be nice to have 17:46:20 https://dpaste.de/nKGs/raw This isn't very meaningful, is it? 17:46:32 As a debug output 17:47:49 it’s not much different than what I had while working on a lot of the implementations 17:48:21 I think I also displayed the stack depth and top few items 17:48:34 I'll do that 17:50:17 Address Depth seems to keep growing 17:50:40 How high does it usually get? 17:51:26 Data Stack depth grows too, but slower 17:52:01 for the latest image, it gets to 16 to reach the interpreter level, higher when running code 17:52:16 data stack should be zero once it reaches the interpreter 17:52:48 IP: 1753 Instr: Some(DEC) Data Depth: 704 Address Depth: 2574 17:52:53 (the c implementation reports a max depth of 8 for data, 16 for address, when exectuting ‘bye’ immediately after reaching the interpreter' 17:53:09 so something there isn’t working. 17:53:17 Definitely 17:53:20 is the code online anywhere? 17:53:42 I'll put it up 17:53:54 Do you want just the code for the cpu part, or all of it? 17:54:18 just the cpu (I don’t have rust installed anywhere, but I should be able to look for bugs in that) 17:54:36 Ok 17:56:12 https://gist.github.com/FreeFull/0d22991aa75a38f09bf4 Instruction implementations start at line 147 17:57:25 Also, thank you for helping me out just like that 18:10:30 I’m happy to help where I can 18:10:48 nothing jumps out after a quick read of the code :( 18:11:33 Oh well ): 18:29:52 You know what 18:30:01 The implicit call never actually does the jump 18:30:16 Oh, wait, nevermind, it does 18:31:48 Oh, oh, I think I know 18:32:15 The way cond_stack_jump is written, the address ends up being executed as an instruction 18:32:25 If the condition isn't fulfilled 18:34:16 Now it waits for keyboard input! \o/ 18:34:24 :) 18:34:48 And the output seems to work 18:35:02 Unfortunately, it crashes as soon as I give it any input 18:35:07 Still, progress 18:38:36 Seems there is a STORE instruction that tries to store outside of the memory bounds 18:51:59 It seems to be to some negative address 20:21:53 --- quit: beretta (Quit: Leaving) 23:29:08 --- quit: mnemnion (Remote host closed the connection) 23:44:23 --- quit: crc (Ping timeout: 272 seconds) 23:59:59 --- log: ended retro/14.12.06