User Tools

Site Tools


sd:sd-8516_programmer_s_reference_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sd:sd-8516_programmer_s_reference_guide [2026/03/07 04:05] appledogsd:sd-8516_programmer_s_reference_guide [2026/03/30 12:07] (current) appledog
Line 18: Line 18:
 === Key Specifications === Key Specifications
 * 16-bit architecture with 16 general-purpose registers * 16-bit architecture with 16 general-purpose registers
-32-bit and 64-bit register pairing system +24-bit addressing with register pairing system
-* Clock speed: **125 MIPS** on a Geekbench 6 baseline system (ex. i7-12700K)+
 * Memory: 256KB addressable via 4-bank system * Memory: 256KB addressable via 4-bank system
-* ~20× performance improvement over legacy 8510 design+* ~40× performance improvement over legacy 8510 design
  
-=== Measured Performance (Geekbench 6 baseline i7-2600k):+=== Default Performance:
 * Standard clock speed: 4MHz (1.28 MIPS) * Standard clock speed: 4MHz (1.28 MIPS)
-* Overclocked: max speed ~400 MHz (125 MIPS) +* Overclocked: 10 MHz (MIPS) 
-* Memory bandwidth: ~540 MB/s+* Memory bandwidth: 16 MB/s
 * Sound system overhead: < 5% CPU time * Sound system overhead: < 5% CPU time
 * Video refresh: 60 Hz (16.67ms frame time) * Video refresh: 60 Hz (16.67ms frame time)
 * BASIC execution speed: 1,891 lines/sec. * BASIC execution speed: 1,891 lines/sec.
 +* Forth: 360,000 words/sec
  
 === Technical Implementation === Technical Implementation
Line 38: Line 38:
 * **Video Backend:** 9 mode Text and Graphics pixel-perfect render engine * **Video Backend:** 9 mode Text and Graphics pixel-perfect render engine
  
-== 4. PEEK and POKE Memory Map+== 4. Advanced PEEK and POKE
 Commands such as DEFCHAR and DRAWCHAR are merely glorified PEEK and POKE commands. At 2,000 lines of BASIC per second on a 4 MHz system, large numbers of PEEK and POKE commands become very useful to control the computer. They are not slow at all! Commands such as DEFCHAR and DRAWCHAR are merely glorified PEEK and POKE commands. At 2,000 lines of BASIC per second on a 4 MHz system, large numbers of PEEK and POKE commands become very useful to control the computer. They are not slow at all!
  
-Common PEEK locations:+=== WAIT 
 +In fact, if you were to write a MIDI player or graphics application in BASIC, you may find the need to time your programs accurately or slow things down -- perhaps for animation. To do this you can use the WAIT command: 
 + 
 +    WAIT 50 : REM THIS WILL WAIT FOR 50 MILLISECONDS 
 + 
 +=== PEEK Memory Map
  
 ^ BANK ^ LOCATION ^ DESCRIPTION ^ ^ BANK ^ LOCATION ^ DESCRIPTION ^
Line 57: Line 62:
 | BANK 1 | PEEK(63488) | COLOR 0,0 in mode 2 | | BANK 1 | PEEK(63488) | COLOR 0,0 in mode 2 |
  
 +=== POKE memory map
 You can also POKE to various locations to affect the sound system. You can also POKE to various locations to affect the sound system.
 | BANK 1 | POKE 61312,0 | Set low byte of voice 1 frequency (length: 3 bytes) | | BANK 1 | POKE 61312,0 | Set low byte of voice 1 frequency (length: 3 bytes) |
Line 64: Line 70:
  
 For more information on the sound system see [[Appendix 5 Sound System]]. For more information on the sound system see [[Appendix 5 Sound System]].
- 
- 
- 
  
  
Line 146: Line 149:
  
 === LOAD and SAVE for Assembly === LOAD and SAVE for Assembly
-HEXMON is equipped with three commands that help you load, save and publish machine language programs.+HEXMON is equipped with several commands that help you load, save and publish machine language programs.
  
 ^ Command ^ Function ^ ^ Command ^ Function ^
-| ''L'' | Load a machine language file using the address in the file header. | +| ''L'' | Load a machine language file using the address in the file header.\\ This only works with programs saved using W (see below), not S. | 
-| ''####L'' | Load a machine language file explicitly at the address given.\\ This ignores the address in the program header. | +| ''####L'' | Load a machine language file explicitly at the address given.\\ This ignores the address in the program header, if there is one. | 
-| ''####.####S'' | Save machine code in range to file.\\ You can use this to save your programs to disk. |+| ''####.####S'' | Save bytes in range to file.\\ You can use this to save data or code you will load using the ####L command. | 
 +| ''####.####W'' | Save machine code in range to file.\\ You can use this to save your programs to disk, because it will include a header allowing it to be loaded back into the same location |
 | ''####.####P'' | Publish. This will create a file with a publishable listing including checksum data. | | ''####.####P'' | Publish. This will create a file with a publishable listing including checksum data. |
 +
 +The important distinction is between the S and W command. S saves bytes only, W includes a header. If you want to be able to click on the Load button or just "L,filename" in MON, then you must save the machine code with W to include the address header.
 +
 +For more information on HEXMON see: [[HEXMON]].
  
 === ASSEMBLY FROM BASIC === ASSEMBLY FROM BASIC
Line 175: Line 183:
 </codify> </codify>
  
-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+If you enter this like you would a STELLAR BASIC V1.0 computer program and type **RUN**, the system will assemble your program at memory address $030100. You can view your program yourself, by typing
  
 <codify armasm> <codify armasm>
Line 194: Line 202:
  
 * $00C000:   00 34 **10 C0 00** ; 00 is LD, 34 is BLX (00 34 is LD BLX) -- and $C010 in little endian * $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+* $030100:   00 34 **10 01 00** ; different address!
  
 Otherwise they are all the exact same program, whether you enter it in machine code or in BASIC assembly! Otherwise they are all the exact same program, whether you enter it in machine code or in BASIC assembly!
Line 324: Line 332:
  
 == Appendix 4. Instruction Set Architecture == Appendix 4. Instruction Set Architecture
- +Moved to: [[Appendix 4 Instruction Set Architecture]]
-=== Load/Store Instructions +
- +
-^ Byte ^ Code ^ Example ^ Description | +
-| 00 | LD_IMM   | LDA $5         | Load register with immediate value | +
-| 01 | LD_MEM   | LDA [$5]       | Load register from memory location | +
-| 02 | LD_REG   | LDA [X]        | load register from memory location | +
-| 03 | LD_REG24 | LDA [X:Y]      | Load register from memory location using [low_byte:word] | +
-| 04 | LD_IMM24 | LDA [$1:$C000] | Load byte from memory location [bank:addr] | +
-| 05 | ST_MEM   | STA [$10]      | Store register in memory location | +
-| 06 | ST_REG   | STA [X]        | Store A in memory location using register as pointer | +
-| 07 | ST_REG24 | STA [X:Y]      | Store A in memory using [low_byte:word] registers. | +
-| 08 | ST_IMM24 | STA [$0:$A0]   | Store register in memory location [bank:addr] | +
- +
-=== Data Movement Instructions of the Caribbean +
-^ Byte ^ Code ^ Example ^ Description | +
-| 09   | MOV        | MOV Y, A                    | Copy A up on Y | +
-| 0A   | XCHG       | XCHG X, Y                   | Swap dem two -- X an Y trade place, quick quick | +
- +
-=== Pirate Stack Operations +
-^ Byte ^ Code ^ Example ^ Description | +
-| 0B   | PUSH       | PUSH A                      | Push A onto stack -- ye scurvy dog! | +
-| 0C   | POP        | POP Y                       | Pull stack value an' hand it over to register | +
-| 0D   | PUSHA      | PUSHA                       | Save all registers in ye treasure chest | +
-| 0E   | POPA       | POPA                        | Get the registers back | +
-| 0F   | PUSHF      | PUSHF                       | Push "pirate" flags/status | +
-| 10   | POPF       | POPF                        | Pop "pirate" flags back | +
- +
-=== Boring, Normal increment operations +
-|= Byte |= Code              |= Example              |= Description +
-| 15   | INC                | INC X                 | Increment register by 1 (any size: byte/word/etc.) +
-| 16   | DEC                | DEC Y                 | Decrement register by 1 (any size) +
- +
-=== Arithmetic Operations +
-| 1E   | ADD                | ADD X, Y              | Add X = X + Y | +
-| 1F   | SUB                | SUB X, Y              | Subtract X = X - Y | +
-| 20   | MUL                | MUL X, Y              | Multiply X:Y = X * Y **//(result may be 32-bit wide)//** | +
-| 21   | DIV                | DIV X, Y              | Divide X = X / Y **//and Y = X % Y (for free)//** +
-| 22   | MOD                | MOD X, Y              | Modulo X = X % Y +
-| 23   | ADD_REG_IMM        | ADD X, $1234          | Add immediate word value; X = X + immediate +
-| 24   | SUB_REG_IMM        | SUB X, $ABCD          | Subtract immediate; X = X - immediate +
-| 25   | MUL_REG_IMM        | MUL X, $100           | Multiply by immediate; X:Y = X immediate +
-| 26   | DIV_REG_IMM        | DIV X, $10            | Divide by immediate; X = quotient, Y = remainder +
-| 27   | MOD_REG_IMM        | MOD X, $FF            | Modulo by immediate; X = X % immediate +
-| 28   | ADDC               | ADDC X, Y             | Add with carry; X = X + Y + carry flag +
-| 29   | SUBC               | SUBC X, Y             | Subtract with borrow; X = X - Y - borrow +
-| 30   | ADDC_REG_IMM       | ADDC X, $5            | Add imm w/carry; X = X + imm + carry +
-| 31   | SUBC_REG_IMM       | SUBC X, $1            | Subtract w/carry X = X - imm - borrow +
- +
-FIXME +
- +
-more to come! +
- +
-**Examples:** +
-<codify armasm> +
-; 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 +
-</codify> +
- +
-=== 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) == Appendix 5. Sound System (SD-450)
Line 476: Line 347:
 |= Mode |= Resolution |= Colors |= Description | |= Mode |= Resolution |= Colors |= Description |
 | 1 | 40×25 text | 16 | Character mode, COLORDORE palette | | 1 | 40×25 text | 16 | Character mode, COLORDORE palette |
-| 2 | 80×25 text | 16 | High-res text, CGA 5153 palette |+| 2 | 80×25 text | 16 | 80 column mode, CGA 5153 palette |
 | 3 | 320×200 | 16 | Packed pixels (4-bit) | | 3 | 320×200 | 16 | Packed pixels (4-bit) |
 +| //4// | //320×200// | //256// | Supercolor mode (8bpp) |
 | //5// | //256×224// | //256// | N-Type "MODE 5" graphics (not implemented yet) | | //5// | //256×224// | //256// | N-Type "MODE 5" graphics (not implemented yet) |
 +| 6 | 80×25 text | 16 | DYNATERM 8800 mode (C) 1984 Stellar Dynamics |
 | //8// | //128×128// | //16// | Low-res "Cart Mode" (not implemented yet) | | //8// | //128×128// | //16// | Low-res "Cart Mode" (not implemented yet) |
  
Line 519: Line 392:
 }}} }}}
  
-== KERNAL Functions +== Appendix 7. 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).+Moved to it's own section; 
 + 
 +* [[VC-3 System Interrupt Table]] 
 +* [[Appendix 7 Kernal Functions]] 
  
  
sd/sd-8516_programmer_s_reference_guide.1772856302.txt.gz · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki