Expanding Windows drives

Granted this isn’t fun. But it’s virtual. We live in an era of exciting expandable disks!

first off start with a full disk. That’s great. In this case the host was proxmox. It doesn’t matter. You apparently have to shut down the VM to expand the disk. Other virtualizers don’t need that. But whatever.

now for the predictable fun. That recovery partition is in the way. Not sure why NTFS needs to be contiguous but here we are.

So now we are stuck. You Google how to expand NTFS drive, how to move recovery partition, how to make disk bigger!! All in vain as everyone is pushing these nifty partition mover programs that don’t run on server. Do you just nuke the partition and hope for the best?

No, we can back it up, delete it, expand our disk and recreate it!

Capture the partition

Dism /Capture-Image /ImageFile:C:\my-system-partition.wim /CaptureDir:S:\ /Name:"My system partition"
Microsoft DiskPart version 10.0.19041.3636

Copyright (C) Microsoft Corporation.
On computer: KOMPUTER

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          250 GB   200 GB

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             50 MB  1024 KB
  Partition 2    Primary             49 GB    51 MB
  Partition 3    Recovery           522 MB    49 GB

DISKPART> select partition 3

Partition 3 is now the selected partition.

DISKPART> delete partition OVERRIDE

DiskPart successfully deleted the selected partition.

restore the partition

dism /Apply-Image /ImageFile:c:\my-system-partition.wim /Index:1 /ApplyDir:w:\

Then tag the partition back to being a Recovery partition.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             50 MB  1024 KB
  Partition 2    Primary            249 GB    51 MB
  Partition 3    Primary            600 MB   249 GB

DISKPART> select partition 3

Partition 3 is now the selected partition.

DISKPART> set id=27

DiskPart successfully set the partition ID.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             50 MB  1024 KB
  Partition 2    Primary            249 GB    51 MB
* Partition 3    Recovery           600 MB   249 GB

DISKPART>

depending on the version the command may fail setting type 27, so try:

set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" 

and there we go!

One big happy drive! 🎉

Qemu / GCC / Tiger aka assumptions on GCC v3 performance

Well this took a shocking turn;

I’d always seen on Windows that Qemu built with GCC 3.4.5 was not only faster, but more stable than GCC 4.x when regarding version 0.10 (I’m not even going to entertain later versions, as this is about old software).

I’ll have to post more, but I’ve basically learned nothing from all my other Pentium 4 / i915 chipset disasters, and now have my 8th system up and running!

by default it has GCC 4.0.0 for i386, and a GCC 3.x for PowerPC building. Natrually, with assumption in hand, how do you build GCC 3 for Intel?

Thankfully, the question was asked on Mac OS X Hints a few decades ago:

https://web.archive.org/web/20070610073818/http://www.macosxhints.com/article.php?story=20060423105014540

And it was saved in the wayback machine, because, preserving the past is hard.

The steps are pretty simple:

$ tar -zxf gcc_os-1819.tar.gz

3. Fix a line that causes it to not compile: in the file gcc_os-1819/gcc/gcc.c, on line 5883, change the line to look like this:

(char ) v[q - vt] = 0;

4. Make a build directory and run configure. I installed my compiler in /opt/gcc3, and I only built the C compiler. This would not work for building C++ or Cocoa applications.
$ mkdir build
$ cd build
$ ../gcc_os-1819/configure --prefix=/opt/gcc3 --enable-languages=c

Which was great except where on earth am I going to find this old GCC?

In retrospect there are 2 places, naturally, archive.org kept a copy of the Apple pages, the other being github.

For the 2-3 people who will be interested in this kind of thing 20 years from now I went ahead and did the single patch, and built binaries and put them on github over at gcc_os-1819_Marklar.

For testing, I’m using a VMDK with MS-DOS 5.00 no config.sys and DooM v1.1 running the timedemo both with no sound. (gametics/realtics)*35=fps. and in this case, demo1 of DooM v1.1 is 1077 gameticks.

GCC 3.5     gcc version 3.5.0 20041003 (Apple Computer, Inc. build 3506)
GCC 4.0     gcc version 4.0.0 (Apple Computer, Inc. build 5026)

no draw (ticks)

GCC 3.5       6/7/7
GCC 4.0       6/7/6

draw-16bit screen depth (ticks)

GCC 3.5       1074/1074/1077
GCC 4.0       948/947/949

And now for the bad news, it turns out that GCC 4.0 is just slightly faster than GCC 3.3

I couldn’t believe it either.

For anyone that cares, DOSbox SVN builds more or less okay on Tiger with some small fix to the MIDI compatibility code (#ifdef stuff, the MIDI works fine!) and it’s timings are for no draw

DOSBox          566/560/565

and drawing on a 32bit screen (16bit is incompatible)

DOSBox          22/26/25

The takeaway is that the CPU is much faster on Qemu, but screen rendering is much faster with DOSBox. DOSBox uses SDL, so let’s go one further, and rebuild Qemu with SDL instead of it’s Cocoa support! So how we doing in the tick department?

GCC 3.5       1005/999/1000
GCC 4.0       885/886/882

The real killer would of course be trying a newer version of GCC. Which I tried several, but Apple had done something really strange to them, where they product self-modifying code by default. And the assembler in 10.4.1 can’t handle that.

unknown section attribute: self_modifying_code

No really, it’s a thing!

Obviously, I updated my cc-tools to 622.9, and guess what?

I tried :

  • gcc-5247
  • gcc-5250
  • gcc-5370

All give the following:

Illegal instruction

Is this some DTK Pentium 4 thing? Or a Tiger 10.4.1 thing?

verbose output for the curious:

Viglen:~/tmp2 jsteve$ gcc -v hi.c -o hi
Using built-in specs.
Target: i686-apple-darwin8.1.0
Configured with: ../gcc-5247/configure --prefix=/opt/gcc-5247 --enable-languages=c
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5247)
 /opt/gcc-5247/libexec/gcc/i686-apple-darwin8.1.0/4.0.1/cc1 -quiet -v -D__DYNAMIC__ hi.c -fPIC -quiet -dumpbase hi.c -auxbase hi -version -o /var/tmp//ccq5CJ5D.s
ignoring nonexistent directory "/opt/gcc-5247/lib/gcc/i686-apple-darwin8.1.0/4.0.1/../../../../i686-apple-darwin8.1.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /opt/gcc-5247/include
 /opt/gcc-5247/lib/gcc/i686-apple-darwin8.1.0/4.0.1/include
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
GNU C version 4.0.1 (Apple Computer, Inc. build 5247) (i686-apple-darwin8.1.0)
        compiled by GNU C version 4.0.0 (Apple Computer, Inc. build 5026).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8944321fb1b2a413196eb995bbfd7ab0
hi.c: In function 'main':
hi.c:3: warning: return type of 'main' is not 'int'
 as -arch i386 -force_cpusubtype_ALL -o /var/tmp//ccFyDIlr.o /var/tmp//ccq5CJ5D.s
 /opt/gcc-5247/libexec/gcc/i686-apple-darwin8.1.0/4.0.1/collect2 -dynamic -arch i386 -weak_reference_mismatches non-weak -o hi -lcrt1.o /opt/gcc-5247/lib/gcc/i686-apple-darwin8.1.0/4.0.1/crt2.o -L/opt/gcc-5247/lib/gcc/i686-apple-darwin8.1.0/4.0.1 -L/opt/gcc-5247/lib/gcc/i686-apple-darwin8.1.0/4.0.1/../../.. /var/tmp//ccFyDIlr.o -lgcc -lSystem
Viglen:~/tmp2 jsteve$ ./hi
Illegal instruction

I’m not entirely sure.

I need a Snow Leopard machine.

Also DosBox SVN wasn’t too hard to build, and runs great.

Happy 2025!

With large language models being all the rage, I found this tweet (x?) on twitter (x?), from Alex Cheema, discussing Andrej Karpathy’s port of a LLM, to C llma2.c, and then converting it to build with Borland C v5 as llma98.c .

Well naturally I had to take that source code, and make it more C89 happy!

I found this magical sed recipe over on stack overflow:

  sed -e 'sX// *\(.*[^ ]\) *$X/*  */X' < oldfile > newfile 

Thanks Preston Crow!

llamma 89 on OS/2 6.78

So, with some really minor hacking, and my port of GCC 1.40 to OS/2, I was shockingly up and running in no time! I should add again that I do kind of enjoy the much older GCC since it was capable of being built with ‘vendor’ tools, in this case the December 1991 Windows NT pre-release C compiler.

I didn’t bother ‘fixing’ the timing code, as honestly it doesn’t matter, running this on my PS/2 Model 60 with the SLC50 upgrade card is incredibly slow.

Seriously, this is me running the llama for 3 hours!

At best it’s about a word every two minutes, getting this far was over 3 hours of runtime.

I have a feeling much like MP3, where the ideas are significantly older than when they found mainstream success, there is a lesson here to the impatient ones, that just because something doesn’t work today, or seem incredibly unwieldy, it doesn’t mean decades later it’ll be incredibly popular.

For anyone wondering, I also built one that uses the TNT extender, and it seems to require 4MB of RAM. Absolute beast of a 32bit machine for 1987, but here we are.

So yeah, Happy 2025!