User Tools

Site Tools


sd:sd-8516_programmer_s_reference_guide

SD-8516 Programmer's Reference Guide

1. 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.

CPU Opcodes Assembler Notes
SD-8516 56 opcodes 105 opcodes
6809 59 opcodes 154+ “the most elegant 8 bit CPU ever designed”
8086 117 opcodes 117 standard of the era
6502 151 opcodes 151 standard of the era
Z80 158 opcodes hundreds prefix machine–158 base opcodes
8080 244 opcodes

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

5. Machine Language

WHAT IS MACHINE LANGUAGE?

At the heart of every microcomputer is a central microprocessor. It is a very special microchip that acts as the “brain” of the computer. The SD-8516/VC-3 is no exception. Every microprocessor understands its own language of instructions. These instructions are called machine language instructions.

More precisely, machine language is the only programming language that your VC-3 understands. It is the native language of the machine.

If machine language is the only language that the 8516 understands, then how does it understand STELLAR BASIC? BASIC is not the machine language of the 8516. What, then, makes the 8516 understand BASIC instructions like `PRINT` and `GOTO`?

To answer this question, you must first see what happens inside your 8516. Apart from the microprocessor – which is the brain of the machine – there is also a machine language program stored in a special type of memory that cannot be changed. More importantly, it does not disappear when the 8516 is turned off, unlike a program that you may have written.

This machine language program is called the Operating System of the SD-8516. Your SD-8516 knows what to do when it is turned on because its Operating System program is automatically “run.”

WHAT DOES MACHINE CODE LOOK LIKE?

WHAT DOES MACHINE CODE LOOK LIKE? Machine code stored in computer memory as a series of numbers. The computer decides what to do based on those numbers. So, a simple program might look like this:

  C000: 00 34 10 C0 00 00 20 66
  C008: 86 05 00 20 64 86 05 85
  C010: 48 45 4C 4C 4F 20 57 4F
  C018: 52 4C 44 21 00 00 00 00

To enter and RUN this style of program you can use a program like 'wozmon' for the Apple I, MONITOR for the Commodore 128, or DEBUG for 8086 computers using MS-DOS. You could also write a simple BASIC program to help you enter the numbers.

HEXMON

HEXMON

Your SD-8516 comes with an entry program in ROM called HEXMON. To start HEXMON type “MON” at the ready prompt. For more information on HEXMON see: HEXMON.

If you enter the above program (just type the lines in) and then type:

  C000R

The program will run. C000 is the memory address and R is the traditional wozmon command to run code starting at that location. What does this program do? Try it now!

ASSEMBLY LISTINGS

ASSEMBLY LISTINGS

Another way to write the code above would be a full assembly/disassembly listing (a full, or complete program listing). Here's an example of the same program shown as a full listing:

   ADDR    BYTES          INSTRUCTION          COMMENT
  --------------------------------------------------------------------------------
  $C000:   00 34          LDBLX @msg           ; Load pointer to string into BLX
           10 C0 00                            ; (Bank 0, address $C0 10)
  $C005:   00 20 66       LDAH $66             ; IO_PRINT_STR function
  $C008:   86 05          INT $05              ; BASIC services library
  $C00A:   00 20 64       LDAH $64             ; IO_NEWLINE function
  $C00D:   86 05          INT $05              ; Call BASIC services
  $C00F:   85             RET                  ; Return to caller
  $C010:                  msg:                 ; String data label (equates to $C000 above)
  $C010:   48 45 4C 4C    .bytes "HELLO        ; H E L L
  $C014:   4F 20 57 4F           WORLD!", 0    ; O   W O
  $C018:   52 4C 44 21                         ; R L D !
  $C01C:   00                                  ; null terminator (zero terminated string)

This full listing can also be used to assemble the program in the monitor; just type in the program in the monitor as usual:

  $C000:   00 34 10 C0 00
  $C005:   00 20 66
  $C008:   86 05
  $C00A:   00 20 64
  $C00D:   86 05
  $C00F:   85
  $C010:   48 45 4C 4C
  $C014:   4F 20 57 4F
  $C018:   52 4C 44 21
  $C01C:   00

This is the exact same style of listing generated by the DUMP command, or the range examine command in HEXMON (ex. C000.C020). It's just broken up by instruction.

LOAD and SAVE for Assembly

HEXMON is equipped with three commands that help you load, save and publish machine language programs.

Command Function
L Load a machine language file using the address in the file header.
####L Load a machine language file explicitly at the address given.
This ignores the address in the program header.
####.####S Save machine code in range to file.
You can use this to save your programs to disk.
####.####P Publish. This will create a file with a publishable listing including checksum data.

ASSEMBLY FROM BASIC

STELLAR BASIC ASSEMBLE COMMAND

The above “hexmon” style machine language listings are convenient for print media, because they are compact. But they are not ideal for learning and study. Thankfully for learning and general programming purposes, one may use the STELLAR BASIC v1.0 ASSEMBLE command.

This system works because the VC-3 KERNAL does not tokenize basic. It keeps whatever you type in a string in memory, and the ASSEMBLE command uses this to pass the data to the assembler. The same sort of idea was used on the Atari-ST Assembler (please see: https://www.atarimania.com/documents/The-Atari-Assembler.pdf).

On the SD-8516, it works like this:

10 ASSEMBLE
    20 LDBLX @msg
    30 LDAH $66 ; BASIC IO_PRINT_STR
    40 INT $05
    50 LDAH $64 ; BASIC IO_NEWLINE
    60 INT $05
    70 RET
    80 msg:
    90 .bytes "HELLO WORLD!", 0

If you enter this like you would a STELLAR BASIC V1.0 computer program and type RUN, the system will assemble your prorgam at memory address $030100. You can view your program yourself, by typing

  DUMP 030100

Next try running the program by typing SYS. This will jump to $030100.

This is the exact same program as before with one exception; the automatically assembled version will begin with:

  $00C000:   00 34 **10 C0 00**  ; string is at Bank $00

but the mon-entered one will show:

  $030100:   00 34 **10 01 03**  ; string is at Bank $03

And the reason for this is that in the listing we typed in on the monitor we used the address 00 C0 00 (i.e. $C000) so the string began at $C010. But for the automatically assembled version, it begins at 03 01 00 so the string address is 03 01 10.

  • $00C000: 00 34 10 C0 00 ; 00 is LD, 34 is BLX (00 34 is LD BLX) – and $C010 in little endian
  • $030100: 00 34 10 01 00 ; this time with $0100 in little endian

Otherwise they are all the exact same program, whether you enter it in machine code or in BASIC assembly!

*NOTE: Because this program is listed in BASIC memory space, you can load and save it using the LOAD and SAVE commands.

HOW IT WORKS

ASSEMBLE is a full keyword. The interpreter checks for it just like it checks for PRINT:

  ; Check PRINT
  LDFLD @keyword_print
  CALL @match_keyword
  JZ @exec_line_print
  
  ; Check ASSEMBLE
  MOV ELM, GLK
  LDFLD @keyword_assemble
  CALL @match_keyword
  JZ @exec_line_assemble

This works because we don't tokenize BASIC on entry, we keep it in memory as a string.

The ASSEMBLE executor works like this:

PUSH A
    PUSH B

    ; Check if ASM is the first line
    LDAH $3A                    ; LINE_FIRST
    INT $05
    JC @asm_error               ; No program at all

    ; B = first line number
    ; ELM = first line text
    ; Check if first line starts with ASM
    LDFLD @keyword_assemble
    CALL @match_keyword
    JNZ @asm_invalid            ; First line is not ASM

    ; Print message
    LDBLX @asm_msg
    LDAH $66                    ; IO_PRINT_STR
    INT $05
    LDAH $64                    ; IO_NEWLINE
    INT $05

    ; Call system assembler
    CALL @PATB_assembler        ; crunching the numbers

    ; Stop BASIC program execution
    LDAH $01                    ; STOP_PROGRAM
    INT $05

    POP B
    POP A
    RET

asm_invalid:
    LDBLX @asm_invalid_msg
    LDAH $66
    INT $05
    LDAH $64
    INT $05

    ; Stop program
    LDAH $01
    INT $05

asm_error:
    POP B
    POP A
    RET

asm_msg:
    .bytes "ASSEMBLING...", 0

asm_invalid_msg:
    .bytes "?INVALID ASSEMBLE", 0

Appendix 1. 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 (See: Chapter 5).
  • 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.

Appendix 2. 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

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 -

Appendix 3. Memory Map

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)

Appendix 4. 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)

Appendix 5. 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

Appendix 6. 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).

SD-8516 Technical Manual - Revision 1.0
Copyright © 2025 Appledog Hu
All specifications subject to change as quantum resonance research continues.

sd/sd-8516_programmer_s_reference_guide.txt · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki