This solution provides two implementations in Centurion assembly, that being the assembly language for the Centurion minicomputer. The Centurion minicomputer is the topic of a series of videos on the YouTube channel UsagiElectric.
The Centurion minicomputer was built around the CPU6 board, which was a further development of the original CPU4 architecture. In turn, that architecture was at least heavily inspired by the Eldorado Electrodata Corporation EE200.
As it stands, there does not seem to be a comprehensive programmer's manual available for Centurion CPU6 assembly. The instruction set and the assembly syntax used in this solution have been deduced by combining the following sources:
- The EE200 documentation referred to earlier.
- A wiki page written by sjsoftware/gecho. The page covers their efforts towards disassembling the CPU6 microcode to fully document the CPU's opcode behavior.
- The output of the CPL compiler. CPL is a language for which a Primes solution is also available.
- Reverse engineering of XASSM, the Centurion assembler executable.
In fact, for those interested in the Centurion CPU6 instruction set and the assembler syntax, this solution may itself act as a source of information. For one, the source code included in this solution has been extensively documented.
This solution includes two implementations:
- An implementation to be run on top of the Centurion OS. It uses service calls for time keeping and I/O, and is kept in the file sieveo.asm.
- An implementation to be run on bare metal, that is directly on the Centurion hardware. It uses memory-mapped I/O (MMIO) to communicate with the console (CRT0), and is kept in the file sieveb.asm.
The sieve size for the implementations can be configured by uncommenting a triple of lines at the top of the assembly source files; details are included in the files themselves.
The maxmimum sieve size supported by the implementations is 65,535.
This solution's implementations can be assembled and executed on an actual Centurion minicomputer, or a sufficiently complete emulator. A list of known emulators can be found on the respective page on Nakazoto's CenturionComputer wiki on GitHub.
Use the following commands to edit, assemble and run the solution:
S.CED ZSIEVE 0 CRT0
P.ASM SIEVE 0 DUMMY X
.RUN XSIEVE
For the bare metal version, use the same commands to edit and compile, but don't use .RUN
to run the program. Instead, one needs to reboot the (emulated) Centurion and run it from the bootloader - those instructions are in the top of the sieveb.asm file.