Commit Graph
239 Commits
Author SHA1 Message Date
AnachronautandClaude Opus 5 b36d438132 Add the CosmOS README, brought up to date with today's changes
Written by Anachronaut and not previously committed. Three things in it had
gone stale between writing and now, and are corrected here rather than
committed knowingly wrong:

  - the shell command table still described dump, which the monitor
    supersedes, so it now describes monitor mode and its commands
  - the service table listed four services, and there are nine
  - the application list did not mention Files

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 18:20:20 -04:00
AnachronautandClaude Opus 5 3e87a67809 Edit: use the system's services instead of carrying the filesystem
The editor included sbfs.asm and console.asm, which was 3235 of its 4941
bytes. Both come out: reading and writing a file, printing and reading a
line are services now, and sbfsMount goes entirely because the system has
already mounted the disk. Only text.asm remains, at 357 bytes, because
textSame and textNumber own nothing and touch no device - sharing those is
a linker's job rather than an operating system's.

4941 bytes to 1983, a little better than predicted because dropping the
mount and the blocks-and-tail arithmetic went with the library rather than
being translated.

ConsoleEndOfInput went with console.asm, so the end of input is now read
from the console status port. That is better than what it replaced: the
port is there whether or not the system is.

Nothing it does changed, and that is checked rather than asserted. The
recorded output of the cosmosEdit test does not move by a single byte
across this commit - a test written days before the rewrite, checking a
property rather than an output, and therefore able to verify a change it
knew nothing about.

One thing is lost and worth naming: there is no way to ask whether a disk
is present, so the editor's "there is no disk" message is gone. On a
diskless machine it now opens an empty document and fails at w instead. The
shell already refuses to load without a disk, so the editor cannot normally
be reached that way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 18:19:51 -04:00
AnachronautandClaude Opus 5 0b6d2be43f CosmOS: a service interface for the disk and console, and the monitor in the shell
Two changes that arrived together because both live in cosmos.asm.

THE SERVICES. A loaded program that wanted a file had to include the whole
filesystem, carrying two and a half kilobytes of a private copy of code the
system already had running, and then mount a disk that was already mounted.
Five services are added at pinned numbers 20 to 24: osFileRead, osFileSave,
osFileDelete, osFileRename and osPrintNumber.

The sizes fit the registers exactly in both directions. A file that can be
read into Data Memory is under 64K by definition, so its length is sixteen
bits: coming back it is DP3, going out it is A and B together, and neither
direction needs a record in memory whose shape both sides must agree on.

There is deliberately no service to mount a disk. The system mounts one
before its first prompt, and a program mounting it again was only ever a
consequence of owning a second copy of the library, so that call disappears
rather than moving. Apps/Files.asm writes, reads, renames and deletes a file
in 645 bytes and includes nothing but the service names.

THE MONITOR. Previously an application, now part of the shell, because an
application occupies the one region a loaded application is given: a monitor
that was an application could never examine another one, since loading the
thing to be inspected would replace the thing doing the inspecting.

"monitor" turns it on and the prompt becomes "*". It is a mode rather than a
sub-prompt, and it persists: because the mode is a variable the prompt reads
rather than a second loop, and every path back to the prompt goes through one
place including osExit, a program started with "g" that gives the machine back
arrives at the monitor prompt it was started from. Examining a program and
running it therefore do not interrupt each other. "exit" leaves whatever you
are in.

It supersedes dump, and adds disassembly, writing bytes, and jumping to an
address. Its instruction table is generated from the assembler's own list by
Tests/instructiontable.py rather than typed again, and Tests/docs.sh checks
both that the system's copy matches the generator and that the lengths that
table implies are the ones the manual's Bytes column prints. A disassembler
that disagreed about a length would not print one line wrong, it would lose
its place and print everything after it wrong.

Also here: b refuses a bank that is not registered, since asking the
controller for one is refused and a refusal nobody catches stops the machine;
g records the Stack the way run does, without which a program returning
through osExit restored whatever the last run had left; and make cosmos-disk
now depends on the system as well as the image.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 18:19:15 -04:00
AnachronautandClaude Opus 5 301716e869 sbfs: give sbfsMatchEntry a counter of its own
sbfsFind counts a block's eight entries in SbfsCount and calls
sbfsMatchEntry for each one, and sbfsMatchEntry used the same variable for
its own twenty two byte comparison. A name differing at its first byte
returned without decrementing, leaving 22 in the entry counter, so the
search then walked twenty two entries through a buffer holding eight: off
the end of it, into whatever data happened to follow, matching against
rubbish and reporting a file that is not there as found.

It had always been there. What decided whether it looked like it worked
was the bytes after SbfsBuffer, so it stayed hidden until unrelated data
was added and changed them. It showed up as "dir" followed by any failed
"load" reporting that the file could not be read rather than that it does
not exist.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 18:18:12 -04:00
AnachronautandClaude Opus 5 be402cc9be Assembler: a string that spells an instruction is no longer assembled as one
A token is classified after its quotes have been stripped, so a string
literal reading "ADD" looked exactly like the ADD instruction and was
assembled as one. It failed with "attempting to assemble outside the
Program Segment", a message about a mistake nobody had made.

The literal and label checks were already guarded against strings and the
instruction check was not. Mnemonics match without regard to case, so
"or" and "and" were caught by this too, and those are ordinary enough
words to want in a message.

Third of its family, after a string beginning with '0' being read as a
malformed number and a string in the Program Segment being silently
discarded. All three have the same root.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 18:17:39 -04:00
AnachronautandClaude Opus 5 ca34e077ad Add sbex.h, which was never committed
The loadable program format's header has been in the working tree since
the loader was written and has never been in the repository: the gitignore
rules matched Source/Assembler as a directory, so it was silently
untracked. Anything cloning this repository could not build it, because
secondPass.c includes this file.

This is the failure the previous commit describes, having already happened
once without being noticed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 18:17:28 -04:00
AnachronautandClaude Opus 5 51601545ae Anchor the gitignore patterns to the repository root
Without a leading slash a pattern matches at any depth, so the rules for
the three built binaries also matched directories: "Assembler" ignored
Source/Assembler. The files already in it stayed tracked, which is why
nothing had gone wrong yet, but a new source file added there would have
been silently untracked and left out of a commit.

Found by git refusing to stage a change to Source/Assembler/firstPass.c.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 18:16:06 -04:00
Anachronaut c4b59acc68 Infrastructure for system services through software interrupts. 2026-08-19 15:16:30 -04:00
Anachronaut e3100b4718 Fixed assembler bug that caused crash on IR array resize. Added line editor app. 2026-08-17 23:26:21 -04:00
Anachronaut 1d1a14318c Programs can now list and share vectors. 2026-08-17 21:39:27 -04:00
Anachronaut a842c884e8 Added assembler check for string outside Data Segment. 2026-08-17 20:10:33 -04:00
Anachronaut 9e3425d34b Programs can now pin specific routines to specific vectors in SplitBit assembly. Added snake game. 2026-08-17 19:12:42 -04:00
Anachronaut 08624925fe Interrupt on keypress mode 2026-08-17 16:02:44 -04:00
Anachronaut 91c9d49d1b CosmOS pre-alpha and launchable application versions of old programs. 2026-08-17 15:31:49 -04:00
Anachronaut eff6902bcf Block device peripheral and SBFS file system implemented. 2026-08-16 14:03:29 -04:00
Anachronaut 04dfcd707b Memory controller implemented. 2026-08-15 20:43:53 -04:00
Anachronaut c4b2c27a2d Device table added to IO Port 0xFF. 2026-08-15 01:01:21 -04:00
Anachronaut 6d1966d500 Interrupt system implemented, some new programs. 2026-08-15 00:44:13 -04:00
Anachronaut 638b68b25c Long standing assembler bugs fixed, new path system. Make compatibility update. 2026-08-14 16:53:28 -04:00
Anachronaut 94b3a7af28 New SplitBit programs. 2026-08-13 23:42:55 -04:00
Anachronaut c2440ae5fa Various bug fixes to assembler, added more data pointers. 2026-08-13 23:41:22 -04:00
Anachronaut b50210d127 Fixed use-after-free in Assembler
Use after free occurred in main() in the case that a program being assembled was longer than the initially allocated intermediate array.
2026-04-27 16:58:43 -04:00
Anachronaut 49fd342135 Clarified Carry Flag behavior. 2024-11-20 17:54:05 -05:00
Anachronaut 4eedc20b04 Formatting updates. 2024-11-20 17:45:23 -05:00
Anachronaut 3bb42eaba4 Uploaded unfinished libraries. 2024-11-20 14:01:14 -05:00
Anachronaut 5e854ee7f9 Updated test programs.
Test programs now work correctly with the latest CPU core changes.
2024-11-20 13:59:40 -05:00
Anachronaut e763a3e4de CPU Core Updates.
Overflowing/Underflowing A or B with increment or decrement instructions now sets the Carry Flag.
An increment or decrement of A or B that doesn't result in an overflow/underflow now clears the Carry Flag.
Q is no longer saved and restored in subroutine calls, allowing it to be used to return a one byte result.
Documentation updated with more detail.
2024-11-20 13:57:57 -05:00
Anachronaut bf7beec8ec More Programs
Added math library WIP.
Added some other stuff.
2024-11-18 19:38:38 -05:00
Anachronaut fc2955cc21 Fixed typo. 2024-11-18 13:11:07 -05:00
Anachronaut d59a91aa38 Removed Duplicate instructions.
LDA and LDB are now Data Operations only. Minor reshuffling of instructions.
Fixed typo in the programming manual.
2024-11-18 13:10:02 -05:00
Anachronaut b1639ca56b Merge pull request #1 from agbrooks/flake
Add rudimentary flake
2024-11-01 22:16:18 -04:00
albatross 967a7032b8 Add rudimentary flake 2024-11-01 21:08:54 -05:00
Anachronaut 2a691ba199 Fixed bugs. 8 bit prime Sieve demo. 2024-11-01 20:53:48 -04:00
Anachronaut 30eebbd9df Delete Programs/print.asm 2024-11-01 16:42:38 -04:00
Anachronaut c512f07305 Fixed input bugs.
Input from stdin now works as expected in the emulator.
New program to demo input from the command line.
2024-11-01 16:41:25 -04:00
Anachronaut 67eea181b8 Delete Programs/printDigitTest.asm 2024-11-01 12:14:16 -04:00
Anachronaut f1bad6853d Delete Programs/printDecimalTest.asm 2024-11-01 12:14:06 -04:00
Anachronaut f4c78e68ba DP offset instructions, new demo programs.
Added DPUP and DPDN, which take a one byte operand specifying how far up or down to offset the Data Pointer.
Three Fibonacci generators using the print.asm library.
 - 8 bit values printing in decimal representation.
- 16 bit values printing in hexadecimal representation.
- 32 bit values printing in hexadecimal representation.
2024-11-01 12:13:13 -04:00
Anachronaut e5241beb51 Update SplitBit Programming Manual.md 2024-10-31 13:30:55 -04:00
Anachronaut 228cf0593a Added stuff. Fixed bug.
Data Pointer value now properly displayed in debug mode.
Added conditional calls to match conditional branches.
2024-10-31 13:30:15 -04:00
Anachronaut f8848adf8c Update SplitBit Assembler Manual.md 2024-10-30 21:54:41 -04:00
Anachronaut f0d4a9b0f3 Update SplitBit Assembler Manual.md 2024-10-30 21:50:43 -04:00
Anachronaut 52a44ed094 Update SplitBit Assembler Manual.md 2024-10-30 16:09:26 -04:00
Anachronaut 470327a0d5 Update SplitBit Assembler Manual.md 2024-10-30 16:09:04 -04:00
Anachronaut c64f097810 Added bit shift instructions.
SHL and SHR treat A and B as a 16 bit circular shift register and rotates them either left or right.
2024-10-30 16:06:33 -04:00
Anachronaut a58fb3d694 Added new instructions.
Added CCF - Clear Carry Flag
Added BRC - Branch on Carry Flag
Improved CALL and RET - All registers but status now saved and restored.
2024-10-29 21:04:03 -04:00
Anachronaut f9308338c4 Update print.asm 2024-10-27 20:55:29 -04:00
Anachronaut 26e6233f8a Update print.asm 2024-10-27 20:54:21 -04:00
Anachronaut 2fc0986ac8 Update printHello.asm 2024-10-27 20:15:15 -04:00
Anachronaut f27b290b44 Update printHello.asm 2024-10-27 20:14:55 -04:00