|
My plan, if my emulation code gets fast enough that this even makes sense to work on, is to check after each tick of the emulator to see if it's time for an interrupt, instead of using a timer. This looks like the way the author of the tutorial did it, too. Good thing, too, because his code doesn't clear the "enable flags" until it's done some work, so would be subject to a race condition.
|
# ? Aug 20, 2018 19:59 |
|
|
# ? Dec 3, 2024 15:28 |
|
the number of cycles that each instruction takes to execute is documented, so just keep track of cycles. interrupts can't interrupt (heh) an executing instruction so you dont have to worry about it there
|
# ? Aug 20, 2018 20:00 |
|
i just really don't want to go back and add the number of cycles to all of my instructions.
|
# ? Aug 20, 2018 20:01 |
|
CRIP EATIN BREAD posted:this thread made me look into that emulator101.com page and now im designing UIs for a debugger in ANSI C. Why not implement a gdb remote debug interface
|
# ? Aug 20, 2018 20:04 |
|
MALE SHOEGAZE posted:i just really don't want to go back and add the number of cycles to all of my instructions. I didn't either, so I made sure to put it in right from the start! (I'm way overengineering this, by the way, but mostly as practice for using TDD. And making Eclipse melt my laptop.)
|
# ? Aug 20, 2018 20:05 |
|
Sapozhnik posted:Why not implement a gdb remote debug interface because i get an excuse to write a GUI, something i havent done in ages. CPColin posted:I didn't either, so I made sure to put it in right from the start! (I'm way overengineering this, by the way, but mostly as practice for using TDD. And making Eclipse melt my laptop.) mine is a hot mess of preprocessor token pasting and xmacros
|
# ? Aug 20, 2018 20:09 |
|
JawnV6 posted:if you get an interrupt and have a long-running instruction pending retirement, do you blow it out intending to re-execute or delay the interrupt until all pending instruction boundaries retire? what does the reference manual say the real CPU does
|
# ? Aug 20, 2018 20:10 |
|
Sapozhnik posted:Why not implement a gdb remote debug interface this is the pro tier solution, then you can even do things like use LLDB’s full-screen terminal UI
|
# ? Aug 20, 2018 20:13 |
|
eschaton posted:what does the reference manual say the real CPU does
|
# ? Aug 20, 2018 20:14 |
|
CRIP EATIN BREAD posted:because i get an excuse to write a GUI, something i havent done in ages. write a GUI around the gdb remote protocol
|
# ? Aug 20, 2018 20:14 |
|
CPColin posted:I didn't either, so I made sure to put it in right from the start! (I'm way overengineering this, by the way, but mostly as practice for using TDD. And making Eclipse melt my laptop.) see i over engineer everything, so i was like "hmm, i wonder if i should add the number of cycles to the instruction? nah, let's not over engineer this".
|
# ? Aug 20, 2018 20:23 |
|
yeah, just go back and add the number of cycles needed for an instruction to each instruction. building yet-another-z80-emulator or something like that is just grinding in significant part.
|
# ? Aug 20, 2018 20:31 |
|
dont you need the cycle count if you want an accurate clock?
|
# ? Aug 20, 2018 20:56 |
|
Space Invaders, the game being emulated in the tutorial, appears to drive its main loop via interrupts, so executing too fast might not actually matter, in this case.
|
# ? Aug 20, 2018 21:06 |
|
i get a kick out of the fact that the 8080 has no shift operations so for space invaders they used special hardware that you used the memory mapped I/O ports to do shifts
|
# ? Aug 20, 2018 21:25 |
|
the msp430 doesn't have variable-length shift ops, so the compiler jams in a shift sled and branches to the correct offset
|
# ? Aug 20, 2018 21:31 |
|
yet again m68k demonstrates its architectural superiority
|
# ? Aug 20, 2018 23:06 |
|
eschaton posted:yet again m68k demonstrates its architectural superiority Eschaton, how are things at home?
|
# ? Aug 20, 2018 23:38 |
|
question for low level devs: do you ever have to struggle picking the size of integers you'll use? Do you go like "hm will I ever need to multiply these numbers, better go for a bigger unit" or something or just go "gently caress it, we'll readjust if we need to later, let's just care about overflow behavior". I realized that I have not frequently needed to make these decisions at a conscious level and I have no good heuristic.
|
# ? Aug 20, 2018 23:58 |
|
as a low-level developer who often is wrong: * uint8_t or int8_t for bytes, typically from a hardware peripheral like UART or I2C, w/e * size_t or ssize_t for array indices * uint16_t or int16_t for things that are 16 bit data off of hardware, like PCM audio samples for example. No real point using these for the result of operations because it'll probably* be faster to use 32 bit or 64 bit on modern hardware anyway. * uint32_t or int32_t for 32-bit things from hardware, and most int operation results where overflow would not be expected * uint64_t or int64_t for 64-bit things from hardware (a timestamp in microseconds, for example), or if I know I'll need the width to store the result of an operation * I say probably because I'm not sure. e: according to this (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html) the so-called exact-width integer types, such as int32_t, are to have no padding bits, so i'm taking that to mean they are actually the exact width they say they are for all purposes. i think i got the width conflated with memory address alignment in my above wrong statement Hunter2 Thompson fucked around with this message at 03:17 on Aug 21, 2018 |
# ? Aug 21, 2018 00:34 |
|
MononcQc posted:question for low level devs: do you ever have to struggle picking the size of integers you'll use? Do you go like "hm will I ever need to multiply these numbers, better go for a bigger unit" or something or just go "gently caress it, we'll readjust if we need to later, let's just care about overflow behavior". table-stakes interview questions often include a timer that'll overflow 16 bits within hours/minutes, when i've been using a lot of arduino knowing that 2^32 milliseconds rolls over in 53 days comes up on seriously constrained platforms like the MSP (note that most "low level" folks consider themselves far above machines this anemic) it helps to keep things under the machine size. you can declare a uint64_t and it'll happily break out incrementing it into a SW routine and trash your perf. keeping things native is necessary to be performant sizes and memory layout come up more when writing structs than individual variables meatpotato posted:* size_t or ssize_t for array indices
|
# ? Aug 21, 2018 00:43 |
|
meatpotato posted:* uint16_t or int16_t for things that are 16 bit data off of hardware, like PCM audio samples for example. No real point using these for the result of operations because it'll probably* be faster to use 32 bit or 64 bit on modern hardware anyway. doesn't c have stuff like uint_fast16_t for this reason?
|
# ? Aug 21, 2018 01:21 |
|
Jabor posted:doesn't c have stuff like uint_fast16_t for this reason? Correct, it does. You can use those but it's a lot of typing. iirc most platforms i've used just alias the uint_fastx_t types to uintx_t (same goes for int_fastx_t and intx_t). e: might be getting confused with the (u)int_leastx_t types, or maybe they both do it? idk, i'm lazy
|
# ? Aug 21, 2018 01:29 |
|
here's some lines from my stdint.h on my piss-poor excuse of computer/usr/include/stdint.h posted:28 /* 7.18.1.2 Minimum-width integer types */
|
# ? Aug 21, 2018 01:34 |
|
my work experience is a little lacking, but i've never seen anybody using the fast and least versions irl
|
# ? Aug 21, 2018 01:34 |
|
I've used the fast versions a lot, but the least ones are for saving memory usage but keeping good performance so should be significantly more abundant on embedded platforms and esoteric data stores. I would guess many would just go with the default types though.
MrMoo fucked around with this message at 02:22 on Aug 21, 2018 |
# ? Aug 21, 2018 02:16 |
|
I got a Voodoo2 today and got the Glide headers hooked up to VC6 how the hell do I make a window full screen in win9x since the voodoo just replaces the video card’s output that means whatever window is up is what windows interacts with lol
|
# ? Aug 21, 2018 03:03 |
|
ah this article answers some good basic questions about the explicit stdint types https://matt.sh/howto-c
|
# ? Aug 21, 2018 03:05 |
|
jit bull transpile posted:Eschaton, how are things at home? wonderful just recycled a bunch of old audio and video cassettes and weeded our old CDs, and also got some old Macs from my parents’ house (both 68040 and PowerPC!)
|
# ? Aug 21, 2018 04:40 |
|
Luigi Thirty posted:I got a Voodoo2 today
|
# ? Aug 21, 2018 06:35 |
|
brap posted:yeah, just go back and add the number of cycles needed for an instruction to each instruction. you're not my dad! refactoring rust really blows. #1 worst part of the language for me.
|
# ? Aug 21, 2018 07:15 |
|
MALE SHOEGAZE posted:you're not my dad! But but my stong and stable types Why is this in your experience? Lifetimes? Lack of editor support? The language itself?
|
# ? Aug 21, 2018 07:27 |
|
gonadic io posted:But but my stong and stable types yeah I should clarify. refactoring is safe, and that's what matters most. it's just a massive chore due to: 1. verbosity of the language coupled with: 2. lack of editor support 3. proliferation of lifetimes, generic bounds, etc (but mostly lifetimes). 4. cleaning up what you thought to be the last compile error only to get owned by the next phase of compilation, whether it's the borrow checker or something else the most important thing i've done to make refactoring less painful is to do small vertical prototypes to make sure i'm not going to hit any borrow/lifetime issues. this is a good thing in general and i'm glad to be doing it, but it's not something i've needed to do in say, scala (which isn't a great comparison but it's the closest I've got). DONT THREAD ON ME fucked around with this message at 08:00 on Aug 21, 2018 |
# ? Aug 21, 2018 07:46 |
|
Luigi Thirty posted:I got a Voodoo2 today and got the Glide headers hooked up to VC6 if you want to go further i remember seeing full hw docs on at least one of the voodoo card generations published on the internet might have been the voodoo3 though, and who knows if they're still available
|
# ? Aug 21, 2018 08:24 |
|
it was free baby BobHoward posted:if you want to go further i remember seeing full hw docs on at least one of the voodoo card generations published on the internet yeah they’re pretty much all available if you know where to look ultimate goal: spin a cube, on my Voodoo2, in my 386 operating system I haven’t spun a cube in Windows yet because Glide doesn’t include things like “matrix transformations” that you get with modern systems but I did get some homemade affine rotation and perspective going, which lets me rotate polygons https://twitter.com/LuigiThirty/status/1031810992534171648 Luigi Thirty fucked around with this message at 08:42 on Aug 21, 2018 |
# ? Aug 21, 2018 08:39 |
|
well, that's not right: but hey it uh, it's doing something with the display buffer, and that's a big win.
|
# ? Aug 21, 2018 15:31 |
|
Progress!
|
# ? Aug 21, 2018 15:34 |
|
it took me two hours of debugging to find this:code:
things look much closer now:
|
# ? Aug 21, 2018 15:54 |
|
MononcQc posted:question for low level devs: do you ever have to struggle picking the size of integers you'll use? Do you go like "hm will I ever need to multiply these numbers, better go for a bigger unit" or something or just go "gently caress it, we'll readjust if we need to later, let's just care about overflow behavior". short answer: eh long answer: it depends
|
# ? Aug 21, 2018 16:25 |
|
|
# ? Dec 3, 2024 15:28 |
|
Luigi Thirty posted:how the hell do I make a window full screen in win9x if you haven’t already figured it out I’m pretty sure it’s just a send message call with the window handle and some constant telling it to get big. at least that’s what I recall from like 20 years ago
|
# ? Aug 21, 2018 20:42 |