Search results

  1. Crutch

    ThinkC Dividing two unsigned long int to double?

    This is legit weird. I just tried it too. Cast to double first should work, but you tried that (and I tried it too). Very oddly, if I change “unsigned long” to just “long”, it works. Are you including #stdio.h and not just getting an automatically generated prototype for printf? I assume...
  2. Crutch

    ThinkC How to detect of QuickDraw Color is available?

    True, but if you just want the deepest pixel-depth device you can simply skip all that and call GetMaxDevice(). That’s exactly what it’s for. To elaborate a bit: 1. If you want to know the main device’s current color depth, check (**(**MainDevice).gdPMap).pixelSize as I said above. 2. If you...
  3. Crutch

    ThinkC How to detect of QuickDraw Color is available?

    Yep, though you are answering a different question @eric, namely “does this system support Color QuickDraw.” The answer to that question will be “yes” in many cases (e.g., an SE/30 with no external display) where there is currently no capacity to actually display color. For that, you need...
  4. Crutch

    Macintosh II - SE/30 ROM Documentation Project

    How is what you are looking for different from this? https://github.com/elliotnunn/mac-rom/blob/72f4af952310df94362d70d1e0259aef65ab814f/OS/StartMgr/StartInit.a
  5. Crutch

    ThinkC How to detect of QuickDraw Color is available?

    Sorry fixed typo above … that’s <LoMem.h> not <LowMem.h> !
  6. Crutch

    ThinkC How to detect of QuickDraw Color is available?

    MainDevice is a low-memory global. #include <LoMem.h> or just call GetMainDevice() to access it, as you suggest.
  7. Crutch

    ThinkC How to detect of QuickDraw Color is available?

    You mean in code right? 😀 If you want to know if it’s possible to get colors, use HasDepth(MainDevice, …) (or you could loop thru all the devices with GetNextDevice and check them all). If you want to know if it’s currently showing colors, check (**(**MainDevice).gdPMap).pixelSize > 1.
  8. Crutch

    ThinkC How to measure time taken to execute a task?

    Are you using 16-bit ints? If you are using 16-bit ints, this will easily overflow: colPix.red = (int)((float)colModel.red * dpLight); since colModel.red is an unsigned int (if more than 50% pure red, > 32767) which, when casting to a float, is still > 32767. If you are then (say) multiply...
  9. Crutch

    ThinkC How to measure time taken to execute a task?

    Right. @pfuentes69 : the clock() function in time.h is just calling TickCount(), FYI (THINK C includes all sources for the standard library so you can check this yourself in time.c: the definition is literally “clock_t clock(void) {return TickCount();}”). So you would get the same result...
  10. Crutch

    ThinkC How to measure time taken to execute a task?

    clock_t is defined as unsigned long in time.h, but (pretty sure this is the issue) you are telling printf to display it as a signed short (‘%d’). Try changing the printf format specifier to ‘%lu’
  11. Crutch

    ThinkC 3D Viewer App project

    That’s really gorgeous! Well done!
  12. Crutch

    [HELP NEEDED] Changing the long mini DB8 cable to connect from Mac to IW II printer

    Are people actually claiming AirTalk results in slow printing? Cheesestraws indeed stated that AirTalk is slower than wired LocalTalk, but if you’re printing to an ImageWriter II the print speed ends up being like 1000x slower than the speed for network traffic so I would be surprised if print...
  13. Crutch

    ThinkC How to draw a "rubber band line" (XOR)?

    Right. If you want to get fancy, you can do a MacPaint-style “marching ants” marquee rectangle (instead of a Finder-style static-pattern rectangle) by xor’ing a sequence of striped patterns sequentially shifted by one pixel on a timer. One of the Scott Knaster books includes example code for...
  14. Crutch

    Mystic Options

    That’s what text looked like on a real Apple II. Green and purple tinges on the edges. I never knew why, would love an explanation of that, but I always assumed the IIe Card was just trying to replicate the full experience!
  15. Crutch

    ThinkC [Study Group 1] Drawing on the Macintosh

    Huh, I probably stand corrected, I thought SystemTask checked for an FKEY press (for a screenshot) but looks like you need GetNextEvent or WaitNextEvent for that. Thanks for making me check myself. Your snip is totally fine except I think you should really pass a pointer to an EventRecord in...
  16. Crutch

    BlueSCSI SD Transfer Utility - Alpha Testers Wanted!

    BlockMoveData() was added in the ‘90s … it guarantees that the bytes being moved don’t contain any code so obviates the need for instruction cache flushing etc. and improves performance on 030/040 and perhaps PPC processors. It’s documented in (I think) the mid-90s version of “Inside Macintosh...
  17. Crutch

    ThinkC [Study Group 1] Drawing on the Macintosh

    Yes - or just call SystemTask(), which yields time to the system if you don’t care about getting an event (or, in an older app/pre-MultiFinder system, where you call _GetNextEvent instead _WaitNextEvent).
  18. Crutch

    ThinkC [Study Group 1] Drawing on the Macintosh

    You can of course include math.h (or is it stdlib.h?) and call abs() as long as you have included the ANSI library in your project. Not including/calling abs() is not because it’s difficult, it’s just an optimization to save memory and skip function call overhead. I would typically just do...
  19. Crutch

    BlueSCSI SD Transfer Utility - Alpha Testers Wanted!

    Continuing the sidebar, the history of StuffIt as a format that kept changing silently under the hood with no visibility, no changes in file extension, and no backward compatibility was frustrating in the ‘90s and remains very frustrating for vintage hobbyists. In the ‘90s, the answer was to...
  20. Crutch

    ThinkC QuadWindows - going a bit beyond [Study Group 1] with event detection

    Ha! Love it! Happy to help, glad it worked.