User Tools

Site Tools


wswan:wwitch

wwitch

The WonderWitch is an official homebrew development environment provided by Qute Corporation. Because of the awkward licensing terms and legacy nature of the original software, a decision has been made to try and implement the target from scratch, using gcc-ia16’s modern compiler like in the WonderSwan target. Unfortunately, this poses some challenges:

  • While most of the WonderWitch’s programming interface is abstracted away via FreyaBIOS (WonderSwan-side system software) interrupt calls, some (such as WonderSwan Color routines, dynamic libraries, and file access) are not.
  • Under the WonderWitch environment, the data segment points to SRAM (segment 0x1000), while the stack segment points to console RAM (segment 0x0000). DS != SS is a somewhat less common thorn in 16-bit 8086 C development and, as such, has limited support. Importantly, unlike many of the compilers that came before it, gcc-ia16 is capable of emitting errors when a near stack-originating pointer is mistakenly used as a near data-originating pointer, and vice versa.

An important advantage of libww (Wonderful’s reimplementation of the WonderWitch libraries) is that it is capable of inlining ASM calls to FreyaBIOS interrupt calls, saving the cost of call and ret instructions on them as a result, as well as allowing the compiler to allocate and reorder register usage accordingly.

The current status of the WonderWitch target is experimental. It is capable of compiling some non-trivial programs (such as WWTerm), but not all components of the original libraries are appropriately supported, and miscompilations/compiler ICEs may occasionally happen.

wswan/wwitch.txt · Last modified: 2024/02/17 10:57 by asie