This is an old revision of the document!
Table of Contents
SD-8516 Programmer's Reference Guide
Introduction
The Stellar Dynamics SD-8516 represents a categoretroical reimagining of microprocessor architecture. This 16-bit CPU, implemented in AssemblyScript for the VC-3 computer system, delivers performance exceeding conventional silicon constraints through advanced cross-boundary resonance microcascades.
The SD-8516 is intended to be an easy to learn architecture which remains era-authentic.
- SD-8516: 56 opcodes
- 6809: 59 opcodes “the most elegant 8 bit CPU ever designed”
- 8086: 117 opcodes “standard of the era”
- 6502: 151 opcodes “standard of the era”
- Z80: 158 opcodes (instruction mnemonics)
- 8080: 244 opcodes
- * NOTE: There are 83 distinct opcodes. However, the assembler allows you to just type LDA and it will determine which individual addressing mode is needed to assemble the instruction.
Key Specifications
- 16-bit architecture with 16 general-purpose registers
- 32-bit and 64-bit register pairing system
- Clock speed: 125 MIPS on a Geekbench 6 baseline system (ex. i7-12700K)
- Memory: 256KB addressable via 4-bank system
- ~20× performance improvement over legacy 8510 design
Measured Performance:
- Clock speed: 10 MHz base, up to 100 MHz
- Sustained MIPS: 70 MIPS (i7-12700k)
- Memory bandwidth: ~540 MB/s
- Sound system overhead: < 5% CPU time
- Video refresh: 60 Hz (16.67ms frame time)
Technical Implementation
- Architecture: WebAssembly-based virtual CPU
- Languages: AssemblyScript (CPU core), JavaScript (I/O systems)
- Memory Model: 4 banks of 64k RAM
- Audio Backend: SD-450 4 voice polyphonic 5 waveform Audio System
- Video Backend: 9 mode Text and Graphics pixel-perfect render engine
Lore
Since the days of the first minicomputers, Stellar Dynamics has been at the forefront of microarchitecture design. The SD-8516 is not simply an iteration upon its predecessors; it is a categorical reimagining of what a “processor” can be when unshackled from quantum locality.
While our earliest designs struggled with resonance cascade instability, the SD-8516 delivers stable, predictable cross-boundary resonance microcascades at clock rates exceeding the theoretical limits of conventional silicon.
These advancements position the Stellar Dynamics SD-8516 as the definitive architecture for next-generation computation: a bridge between classical logic engines and the emergent technologies of multidimensional processing.
This SD-8516 PROGRAMMER'S REFERENCE GUIDE has been developed as a working tool and reference source for those of you who want to maximize your use of the built-in capabilities of your VC-3 Computer System. This manual contains the information you need for your programs, from the simplest example all the way to the most complex. The PROGRAMMER'S REFERENCE GUIDE is designed so that everyone from the beginning BASIC programmer to the professional experienced in SD-8516 machine language can get information to develop his or her own creative programs. At the same time this book shows you how clever your SD-8516 really is.
This REFERENCE GUIDE is not designed to teach the BASIC programming language or the SD-8516 machine language. There is, however, an extensive glossary of terms and a “semi-tutorial” approach to many of the sections in the book. If you don't already have a working knowledge of BASIC and how to use it to program, we suggest that you study the SD-8516 USER'S GUIDE that came with your computer. The USER'S GUIDE gives you an easy to read introduction to the BASIC programming language. If you still have difficulty understanding how to use BASIC then turn to the back of this book (or Appendix N in the USER'S GUIDE) and check out the Bibliography.
The SD-8516 PROGRAMMER'S REFERENCE GUIDE is just that; a reference. Like most reference books, your ability to apply the information creatively really depends on how much knowledge you have about the subject. In other words if you are a novice programmer you will not be able to use all the facts and figures in this book until you expand your current programming knowledge.
What you can do with this book is to find a considerable amount of valuable programming reference information written in easy to read, plain English with the programmer's jargon explained. On the other hand the programming professional will find all the information needed to use the capabilities of the SD-8516 effectively.
WHAT'S INCLUDED?
Our complete “BASIC dictionary” includes Stellar BASIC 1.0 language commands, statements and functions listed in alphabetical order. We've created a “quick list” which contains all the words and their abbreviations. This is followed by a section containing a more detailed definition of each word along with sample BASIC programs to illustrate how they work. If you need an introduction to using machine language with BASIC programs our layman's overview will get you started. A powerful feature of all VC systems is called the KERNAL. It helps insure that the programs you write today can also be used on the VC-3 system of tomorrow. The Input/Output Programming section gives you the opportunity to use your computer to the limit. It describes how to hook-up and use everything from disk drives, to telecommunication devices called modems. You can explore the world of SPRITES, programmable characters, and high resolution graphics for the most detailed and advanced animated pictures in the microcomputer industry. You can also enter the world of music synthesis and create your own songs and sound effects with the best built-in synthesizer available in any personal computer. If you're an experienced programmer, the soft load language section gives you information about the SD-8516's ability to run C and other high level languages. This is in addition to BASIC.Think of your SD-8516 PROGRAMMER'S REFERENCE GUIDE as a useful tool to help you and you will enjoy the hours of programming ahead of you.
CPU Architecture
Register Set
The SD-8516 features sixteen 16-bit registers:
| Register | Name | Primary Use |
|---|---|---|
| R0 | A | Accumulator |
| R1 | B | Accumulator |
| R2 | X | Index/General |
| R3 | Y | Index/General |
| R4 | I | Loop/General |
| R5 | J | Loop/General |
| R6 | K | Loop/General |
| R7 | T | Temporary/General |
| R8 | M | Memory Pointer |
| R9 | D | Memory Pointer |
| R10 | E | Extra/General |
| R11 | C | Counter/General |
| R12 | F | Function Register |
| R13 | G | General Purpose |
| R14 | L | General Purpose |
| R15 | Z | General Purpose |
Register Encoding
Byte Access
Each register's high and low bytes are individually addressable using H/L suffixes: AH/AL, BH/BL, XH/XL, etc.
32-bit Pairs
Adjacent registers can be combined for certain 32-bit operations using concatenated names: - AB = A (high) + B (low) - CD = C (high) + D (low) - EF, GI, JK, LM, TY, XZ
This is simulated 32 bit access; changing the value of a 32 bit pair will corrupt the underlying 16 bit registers, and so forth. Secondly, access is only marginally faster than 16 bit access; for memory loads, stores and compares it is usually faster to use native 16-bit mode.
24-bit Pointers
Memory addressing uses a bank byte plus 16-bit offset. The naming convention is `[low-byte][offset]`: - BLX = BL (bank) + X (address) - ELM = EL (bank) + M (address) - FLD = FL (bank) + D (address) - GLK = GL (bank) + K (address)
Eight bank registers (BL, EL, FL, GL, IL, JL, LL, TL) each pair with eight address registers (A, C, D, K, M, X, Y, Z), yielding 64 possible 24-bit pointer combinations.
Register Overlap
As with their 32-bit counterparts, 24-bit pointers share components. ELM and ELD both use the EL bank byte. FLD and GLD both use the D address register. Modifying one affects the other – a common source of bugs. Always verify pointer independence when using multiple pointers simultaneously.
Flags Register
The 16-bit FLAGS register contains:
Arithmetic Flags (Byte 1):
- Bit 0: Z (Zero) - Result was zero
- Bit 1: N (Negative) - Result was negative (bit 15 set)
- Bit 2: C (Carry) - Unsigned overflow/borrow
- Bit 3: V (Overflow) - Signed overflow
- Bits 4-7: Reserved
Control Flags (Byte 2):
- Bit 8: H (Halt) - CPU stopped, waiting for interrupt
- Bit 9: T (Trace) - Single-step debugging mode
- Bit 10: B (Breakpoint) - Breakpoint mode active
- Bit 11: E (Exception) - Sticky error flag
- Bit 12: P (Protected) - Protected mode enabled
- Bit 13: I (Interrupt) - Interrupt enable/disable
- Bit 14: S (Sound) - Sound System Interrupt enable
- Bit 15: Reserved
Layout: Z N C V - - - - H T B E P I S -
Memory Architecture
Bank Addressing
The SD-8516 supports 4 banks of 64KB each (256KB total) through special addressing modes:
; ld/st example
LDA [I:J] ; Load from bank I, offset J
STA [2:$1000] ; Store to bank 2, offset $1000
Bank allocation:
- Bank 0: User Programming Space
- Bank 1: KERNAL and Operating System
- Bank 2: Primary video framebuffer + palette
- Bank 3: Secondary video buffer (high-resolution modes)
Banks 2 and 3 are free for use in text mode and bank 3 is usually free in the lower-resolution video modes.
System Variables
| Address | Description |
|---|---|
| $EF00 | Video mode register |
| $EF01 | Column count (40 or 80) |
| $EF02 | Row count (25) |
| $EF03 | Character width (8) |
| $EF04 | Character height (8) |
| $EF05-$EF08 | Hardware clock (32-bit milliseconds) |
| $EF09 | Default character color |
| $EF0A | Cursor color |
| $EF0B | Color palette mode (0=COLORDORE, 1=CGA 5153) |
| $EF10 | Cursor X position |
| $EF11 | Cursor Y position |
| $EF12 | Cursor blink state |
| $EF20 | Keyboard status flags |
| $EF21 | Keyboard buffer count |
| $EF22-$EF31 | Keyboard buffer (16 bytes) |
Memory Map
| BANK 0 - User RAM & System Variables | |||
|---|---|---|---|
| Address | Size (Bytes) | Name | Description |
| $000000-$00FFFF | 65,536 | USER_RAM | Free user RAM |
| BASIC Program Storage | |||
| $000100-$00FF00 | 65,024 | BASIC_START | BASIC program area |
| BANK 1 - KERNAL ROM & Hardware | |||
|---|---|---|---|
| Address | Size | Name | Description |
| $010000-$0100FF | 256 | BOOTSTRAP | Kernal zero page (reserved) |
| $010100-$013FFF | ~16KB | KERNAL_CODE | Soft Reset entry point |
| $014000-$01DBFF | 40,960 | RESERVED | Future kernal expansion |
| $01DB00-$01DBFF | 256 | PATB_TBUF | ROM BASIC tokenizer scratch |
| $01DC00-$01DFFF | 1,024 | STACK | Stack space (grows down from $01DFFF) |
| $01E000-$01E7FF | 2,048 | VM1_CHAR_ROM | PETSCII font data |
| $01E800-$01E8FF | 256 | KERNAL_WORK | Kernal workspace |
| $01E900-$01EBFF | 768 | INT_VECTOR_TABLE | Interrupt vectors (256 × 3 bytes) |
| $01EC00-$01ECFF | 256 | SCRATCH_BUFFER | General-purpose scratch space |
| $01ED00-$01EDFF | 256 | INPUT_BUFFER | Input line buffer / Kernal variables |
| Video System | |||
| $01EF00 | 1 | VIDEO_MODE | Current video mode |
| $01EF01 | 1 | VIDEO_COLUMNS | Number of columns (40) |
| $01EF02 | 1 | VIDEO_ROWS | Number of rows (25) |
| $01EF03 | 1 | VIDEO_CHAR_WIDTH | Character width in pixels (8) |
| $01EF04 | 1 | VIDEO_CHAR_HEIGHT | Character height in pixels (8) |
| $01EF05-$01,EF08 | 4 | VIDEO_HW_CLOCK | Hardware clock (32-bit milliseconds) |
| $01EF09 | 1 | VIDEO_CHAR_COLOR | Default character color |
| $01EF0A | 1 | VIDEO_CURSOR_COLOR | Cursor color |
| $01EF0B | 1 | VIDEO_COLOR_MODE | Color palette mode |
| = Cursor System | |||
| $01EF0C | 1 | CURSOR_BLINK | Cursor blink state |
| $01EF0D | 1 | CURSOR_STATE | Cursor on/off |
| $01EF0E | 1 | CURSOR_X | Cursor column |
| $01EF0F | 1 | CURSOR_Y | Cursor row |
| = Keyboard System | |||
| $01EF10 | 1 | KBD_BUFFER_COUNT | Number of keys in buffer |
| $01EF11-$01,EF30 | 32 | KBD_BUFFER | Key buffer (16 pairs) |
| = Input Mode System | |||
| $01EF31 | 1 | INPUT_MODE | Input mode flag (0=normal, 1=input) |
| $01EF32 | 1 | INPUT_LENGTH | Current input length |
| $01EF33 | 1 | SYSCALL_STATUS | Execute SYS on next opportunity |
| $01EF34-$01,EF36 | 3 | SYSCALL_ADDR | SYS call address |
| $01EF37-$01,EF39 | 3 | KBPC | BASIC code pointer |
| = Random Number Generator | |||
| $01EF40-$01,EF41 | 2 | RND_SEED | PRNG seed |
| = Sound System - Voice 0 | |||
| $01EF80-$01,EF81 | 2 | SOUND0_FREQUENCY | Voice 0 frequency |
| $01EF82 | 1 | SOUND0_GATE | Voice 0 gate/waveform |
| $01EF83 | 1 | SOUND0_VOLUME | Voice 0 volume |
| $01EF84 | 1 | SOUND0_ATTACK | Voice 0 attack |
| $01EF85 | 1 | SOUND0_DECAY | Voice 0 decay |
| $01EF86 | 1 | SOUND0_SUSTAIN | Voice 0 sustain |
| $01EF87 | 1 | SOUND0_RELEASE | Voice 0 release |
| $01EF88-$01,EF89 | 2 | SOUND0_DATA | Voice 0 data |
| = Sound System - Voice 1 | |||
| $01EF90-$01,EF91 | 2 | SOUND1_FREQUENCY | Voice 1 frequency |
| $01EF92 | 1 | SOUND1_GATE | Voice 1 gate/waveform |
| $01EF93 | 1 | SOUND1_VOLUME | Voice 1 volume |
| $01EF94 | 1 | SOUND1_ATTACK | Voice 1 attack |
| $01EF95 | 1 | SOUND1_DECAY | Voice 1 decay |
| $01EF96 | 1 | SOUND1_SUSTAIN | Voice 1 sustain |
| $01EF97 | 1 | SOUND1_RELEASE | Voice 1 release |
| $01EF98-$01,EF99 | 2 | SOUND1_DATA | Voice 1 data |
| = Sound System - Voice 2 | |||
| $01EFA0-$01,EFA1 | 2 | SOUND2_FREQUENCY | Voice 2 frequency |
| $01EFA2 | 1 | SOUND2_GATE | Voice 2 gate/waveform |
| $01EFA3 | 1 | SOUND2_VOLUME | Voice 2 volume |
| $01EFA4 | 1 | SOUND2_ATTACK | Voice 2 attack |
| $01EFA5 | 1 | SOUND2_DECAY | Voice 2 decay |
| $01EFA6 | 1 | SOUND2_SUSTAIN | Voice 2 sustain |
| $01EFA7 | 1 | SOUND2_RELEASE | Voice 2 release |
| $01EFA8-$01EFA9 | 2 | SOUND2_DATA | Voice 2 data |
| = Sound System - Voice 3 | |||
| $01EFB0-$01EFB1 | 2 | SOUND3_FREQUENCY | Voice 3 frequency |
| $01EFB2 | 1 | SOUND3_GATE | Voice 3 gate/waveform |
| $01EFB3 | 1 | SOUND3_VOLUME | Voice 3 volume |
| $01EFB4 | 1 | SOUND3_ATTACK | Voice 3 attack |
| $01EFB5 | 1 | SOUND3_DECAY | Voice 3 decay |
| $01EFB6 | 1 | SOUND3_SUSTAIN | Voice 3 sustain |
| $01EFB7 | 1 | SOUND3_RELEASE | Voice 3 release |
| $01EFB8-$01EFB9 | 2 | SOUND3_DATA | Voice 3 data |
| = Video Memory | |||
| $01F000-$01F3E7 | 1,000 | VM1_TEXT_BASE | Text mode character map |
| $01F800-$01FBE7 | 1,000 | VM1_COLOR_BASE | Text mode color map |
| = BANK 2 & 3 - User RAM | |||
| $020000-$02FFFF | 65,536 | USER_RAM | Free user RAM (Bank 2) |
| $030000-$03FFFF | 65,536 | USER_RAM | Free user RAM (Bank 3) |
Instruction Set Architecture
Load/Store Instructions
| Opcode | Mnemonic | Description | Bytes |
|---|---|---|---|
| 00 | LD_IMM | Load immediate word | 3 |
| 01 | LD_IMMB | Load immediate byte | 2 |
| 02 | LD_IMMW | Load immediate word | 3 |
| 03 | LD_MEM | Load from memory (indirect) | 3 |
| 04 | LD_MEMB | Load byte from memory | 3 |
| 05 | LD_MEMW | Load word from memory | 3 |
| 06 | LD_RI | Load from register indirect | 2 |
| 07 | LD_RIB | Load byte from register indirect | 2 |
| 08 | LD_RIW | Load word from register indirect | 2 |
| 09 | ST_MEM | Store to memory | 5 |
| 0A | ST_MEMB | Store byte to memory | 5 |
| 0B | ST_MEMW | Store word to memory | 5 |
Examples:
; ld/st example
LDA #$1234 ; Load immediate $1234 into A
LDAL #$42 ; Load immediate byte $42 into AL
LDA [$F000] ; Load word from address $F000
STA [2:$1000] ; Store A to bank 2, offset $1000
Arithmetic Operations
| Instruction | Description | Flags Affected |
|---|---|---|
| ADD | Add | Z, N, C, V |
| SUB | Subtract | Z, N, C, V |
| MUL | Multiply (result in AB) | Z, N |
| DIV | Divide (quotient in A, remainder in B) | Z, N |
| MOD | Modulo | Z, N |
| INC | Increment | Z, N |
| DEC | Decrement | Z, N |
Logic Operations
| Instruction | Description | Flags Affected |
|---|---|---|
| AND | Bitwise AND | Z, N |
| OR | Bitwise OR | Z, N |
| XOR | Bitwise XOR | Z, N |
| NOT | Bitwise NOT | Z, N |
| TEST | Bitwise AND (no write) | Z, N |
Shift/Rotate Operations
| Instruction | Description | Flags Affected |
|---|---|---|
| SHL | Shift left | Z, N, C |
| SHR | Shift right | Z, N, C |
| ROL | Rotate left | Z, N, C |
| ROR | Rotate right | Z, N, C |
Comparison & Branching
| Instruction | Description | Flags Affected |
|---|---|---|
| CMP | Compare (subtract, discard result) | Z, N, C, V |
| JMP | Unconditional jump | None |
| JZ | Jump if zero | None |
| JNZ | Jump if not zero | None |
| JC | Jump if carry set | None |
| JNC | Jump if carry clear | None |
Subroutine Operations
| Instruction | Description |
|---|---|
| CALL | Call subroutine (push IP, jump) |
| RET | Return from subroutine (pop IP) |
| PUSH | Push register to stack |
| POP | Pop from stack to register |
| PUSHA | Push all registers |
| POPA | Pop all registers |
| INT | Software interrupt |
Flag Operations
| Instruction | Description |
|---|---|
| SSI | Enable Sound System Interrupts |
| CSI | Clear Sound System Interrupts |
| SEC | Set carry flag |
| CLC | Clear carry flag |
| SEZ | Set zero flag |
| CLZ | Clear zero flag |
| SEN | Set negative flag |
| CLN | Clear negative flag |
| SEV | Set overflow flag |
| CLV | Clear overflow flag |
Other
| Instruction | Description |
|---|---|
| TSX | Transfer SP to register* |
| TXS | Transfer register to SP* |
- (*) these opcodes were suggested by stackminer from the Fantasy Console 2.0 discord. Thank you, stackminer!
System Operations
| Instruction | Description |
|---|---|
| CART | Cartridge trigger, used for Cartridge BASIC and others. |
| YIELD | Poll UI, System Clock, Sound Chip, Video Chip, and others |
| NOP | No operation |
| HALT | Halt CPU (set H flag) |
Sound System (SD-450)
The SD-8516 is paired with the SD-450 sound subsystem; named for featuring 4 independent voices with 5 waveforms available, each with a programmable ADSR envelope.
Voice Architecture
Each voice occupies 16 bytes of memory in Bank 1:
| Offset | Register | Description |
|---|---|---|
| +$00 | FREQ_LO | Frequency low byte |
| +$01 | FREQ_HI | Frequency high byte |
| +$02 | GATE | Waveform/gate control |
| +$03 | VOLUME | Volume (0-255) |
| +$04 | ATTACK | Attack time |
| +$05 | DECAY | Decay time |
| +$06 | SUSTAIN | Sustain level |
| +$07 | RELEASE | Release time |
| +$08 | DATA1 | Pulse width / noise type |
| +$09-$0F | Reserved | Future expansion |
Voice base addresses:
- Voice 0:
$1ED00 - Voice 1:
$1ED10 - Voice 2:
$1ED20 - Voice 3:
$1ED30
Waveforms
Gate register values:
- 0: Silent (gate off)
- 1: Square wave
- 2: Triangle wave
- 3: Sawtooth wave
- 4: Sine wave
- 5: Pulse wave (variable width via DATA1)
- 6: White/pink/brown noise (type via DATA1)
ADSR Envelope
The Attack-Decay-Sustain-Release envelope shapes each note:
- Attack: Time to reach peak volume (0-255 × 10ms)
- Decay: Time to decay to sustain level (0-255 × 10ms)
- Sustain: Held volume level (0.0-1.0 of peak)
- Release: Time to fade to silence after gate off (0-255 × 10ms)
Example:
; Play middle C on voice 0
LDA $112B ; C4 frequency (262 Hz / 0.0596)
STA [$1ED00] ; FREQ_LO/HI
LDAL $01 ; Square wave
STAL [$1ED02] ; GATE
LDAL $4D ; ~30% volume
STAL [$1ED03] ; VOLUME
Video System
Video Modes
The VC-3 supports both text and graphics modes:
| Mode | Resolution | Colors | Description |
|---|---|---|---|
| 1 | 40×25 text | 16 | Character mode, COLORDORE palette |
| 2 | 80×25 text | 16 | High-res text, CGA 5153 palette |
| 3 | 320×200 | 16 | Packed pixels (4-bit) |
| 4 | 256×224 | 256 | SNES-style mode |
| 8 | 128×128 | 16 | Low-res mode |
Text Mode Architecture
Mode 1 (40×25):
- Character buffer:
$F000-$F3E7(1000 bytes) - Color buffer:
$F800-$FBE7(1000 bytes) - Character ROM:
$E800-$E8FF(256 characters × 8 bytes)
Color byte format: (bg_color << 4) | fg_color
Mode 2 (80×25):
- Same layout, 2000 bytes each
- Scanline doubling for 640×400 output
Graphics Mode Architecture
Mode 3 (320×200×16):
- Framebuffer: Bank 2,
$00000-$07CFF(32,000 bytes) - Palette: Bank 2,
$F000-$F02F(16 colors × 3 bytes RGB) - Pixel packing: 2 pixels per byte (high/low nibbles)
Pixel addressing:
offset = (y × 160) + (x ÷ 2) address = Bank 2 + offset
Mode 4 (256×224×256):
- Framebuffer: Bank 2,
$00000-$DFFFF(57,344 bytes) - Palette: Bank 2,
$F000-$F2FF(256 colors × 3 bytes RGB) - 1 byte per pixel (256 colors)
Palette Format
Each palette entry is 3 bytes (RGB):
Offset +0: Red (0-255)
Offset +1: Green (0-255)
Offset +2: Blue (0-255)
KERNAL Functions
The KERNAL ROM provides system services via an INT-accessible jumptable. The general format is to load AH with the function number and call the specified interrupt handler via INT (ex. INT 10h).
Appendix: Planned Features
KERNAL Functions (In Development)
- print_byte - Display 16-bit number at cursor
- print_char_at - Single character without moving cursor
- clear_screen - Fill screen with spaces
- print_at - Positioned string output
- string_compare - String equality test
- string_to_upper - Case conversion
- wait_key - Blocking key wait
- random_range - Bounded random numbers
- draw_box - Border rendering
- scroll_region - Partial screen scrolling
- save_screen/restore_screen - Screen buffer management
Graphics Enhancements
- Bresenham line drawing (implemented)
- Sprite system with hardware acceleration
- Tilemap support for scrolling backgrounds
- Bitmap font rendering
Sound Enhancements
- PCM streaming for voice/SFX
- Additional waveforms (filtered noise, PWM variants)
- Other sample playback (Opus/Ogg compressed)
- LFO and vibrato effects
—
SD-8516 Technical Manual - Revision 1.0
Copyright © 2025 Appledog Hu
All specifications subject to change as quantum resonance research continues.
