Building a W65C265S Operating System (?)
- rehsd

- Feb 14
- 3 min read
Updated: 2 days ago
As my W65C265S hardware build is coming along well, I would like to develop an operating system (OS) for it. While I have done miscellaneous 65xxx development over the years, my code has always been a mishmash of routines. The closest I have come to better understanding operating systems is implementing FreeDOS on my 286/386 builds, where I was adding core BIOS routines to support FreeDOS. So, can I hack my way through this and develop and operating system? Time will tell.
So what is an operating system?
I am going to work off this definition: An operating system is the software layer that sits between programs and the hardware, providing the essential services, abstractions, and control needed to run code safely, consistently, and efficiently.
Three fundamentals of an operating system:
Resource management: CPU, memory, I/O devices, storage.
Hardware abstraction: read files, draw a shape, etc.
Program execution environment: startup, system calls, memory layout, multitasking, error handling.
Roadmap
If I have any chance of success, I will need to continue to build my knowledge of 65816 development. I will also benefit from a plan of attack. Given that, I am thinking of working through OS development in the following general order (knowing that I will need to loop back at times as I learn).
Foundations
Reset, startup code
Set CPU to native mode
Configure M/X flags
Initialize stack
Set up Direct Page
Configure memory map
Initialize internal peripherals
Console and video drivers (ILI LCD, VGA)
TX/RX routines
Video primitives (pixels, lines, rectangles, circles) and character support
Basic interrupt handling
Kernel core
Timer driver
Syscall mechanism
COP handler
Syscall table
Memory management
Static memory map
Kernel heap
Device abstraction
Video functions
Block devices
Filesystem
Program loader
FAT16
OS Tools
Shell, monitor
Libraries, runtime
Multitasking
Graphic user interface
As with most of my posts, this will be a 'living' post that I will continue to update as I learn and progress on a '265 OS. More to come!
C Apps
My initial plan is to use my secondary flash to store applications. From my primary flash, I can jsl to an app. The app will get exclusive access to the extended SRAM (or a portion of it). The app will be able to leverage system hardware through syscall jump table. Ideally, these apps could be written in either 65816 assembly or C.
Steps I am working through:
Compile a simple app with Calypsi.
Create OS.h with syscall indices and CallOS stub.
Create CallOS.s with syscall address in OS flash and _CallOS.
Use CallOS to access operating system routines.
Store app on secondar flash ($40:0000 to $47:FFFF).
App will use extended SRAM ($01:0000 to $07:FFFF).
In the operating system flash, setup a syscall jump table and routines to be exposes to apps (OS_PrintChar, OS_PrintString, OS_DrawPixel). Routines use rtl.
Test it. Use jsl to load the app from the OS.
...more to come...
Code for the video above: microcontollers/W65C265S/Primary AV Boards/65265_Primary OS1 20260217 at main · rehsd/microcontollers · GitHub.
COP instruction for system calls, vertical scrolling, and PIB improvements
Code for the video above: microcontollers/W65C265S/Primary AV Boards/65265 assembly FULL 20260304 COP at main · rehsd/microcontollers · GitHub.
C Applications
Code for the video above: microcontollers/W65C265S/Primary AV Boards/65265 assembly FULL 20260308 - C at main · rehsd/microcontollers · GitHub.
Additional Info
Calypsi

Comments