SE3K Survivors Experience 3000

PART I -- TECHNICAL REFERENCE MANUAL - Enhanced Edition

Sega SP-400 Plotter / Printer — part of the SE3K documentation library, also readable inside the emulator.

PART I -- TECHNICAL REFERENCE MANUAL - Enhanced Edition
------------------------------------------------------------------------------
Original Operation Manual by Sega Enterprises Ltd.
Technical addenda compiled from SC-3000 Hardware Reference (Vol. C) and
reverse-engineered ROM analysis of HD6805V1 and Intel 8035 firmware.
------------------------------------------------------------------------------

Preface to the Enhanced Edition

Preface to the Enhanced Edition
------------------------------------------------------------------------------
This document integrates the original SP-400 operation manual with technical
material from two additional sources:
1. SC-3000 Hardware Reference Manual (Vol. C) — Chapter 7 documents the
physical serial protocol used between the SC-3000 and the printer, including
the bit-level timing, signal encoding and ROM hook points.
2. ROM Disassembly — Full disassembly of both firmware chips extracted
from the SP-400 hardware. The HD6805V1 (4 KB) is the main mechanism
controller; the Intel 8035 (4 KB) handles the front-end serial receive.
ROM addresses cited in this document use the notation $XXXX for
HD6805V1 and $XXX for the 8035.
Technical sections are clearly marked [TECH] to distinguish them from the
original manual text.
------------------------------------------------------------------------------
Contents
------------------------------------------------------------------------------
1. General Description
2. Setting Up
3. Background Information
- 3.1 Text and Graphic Modes
- 3.2 Coordinate System
- [TECH] 3.3 Internal Hardware Architecture
- [TECH] 3.4 Serial Communication Protocol (SC-3000 side)
- [TECH] 3.5 SP-400 Serial Receive (firmware side)
4. Using the Plotter/Printer
- 4.1 Control Codes
- 4.2 Graphic Commands
- [TECH] 4.3 ROM Handler Addresses
5. Specifications
- [TECH] 5.1 Extended Hardware Specifications
Appendix A — Sample Programs
Appendix B — Graphic Commands Summary
Appendix C — ASCII Character Set
Appendix D — Programming Notice
[TECH] Appendix E — SC-3000 Serial Protocol Reference
[TECH] Appendix F — HD6805V1 Firmware ROM Map
[TECH] Appendix G — Character Stroke Data Format
[TECH] Appendix H — Intel 8035 Firmware Notes
------------------------------------------------------------------------------

1. General Description

1. General Description
------------------------------------------------------------------------------
The SP-400 is a four-colour ball-point pen plotter/printer for the SEGA SC-3000
personal computer.
Front Panel Controls:
#  Control         Function
1  Power Switch    Controls primary DC power.
2  PEN CHANGE      Moves pen holder to the far right for pen installation/removal.
3  COLOR SELECT    Rotates pen holder to the next pen position.
4  LINE FEED       Advances paper while held. Also activates self-test on power-up.
5  POWER Indicator Lit while AC power is on.
6  BUSY Indicator  Lit while the printer is processing a command.
7  Top Cover       Open for paper loading or pen changes.
Pen Positions and Colours (recommended sequence):
Pen #    Colour
1        Black
2        Blue
3        Green
4        Red
------------------------------------------------------------------------------

2. Setting Up

2. Setting Up
------------------------------------------------------------------------------
Rear Panel
..........
- DC Inlet Socket: DC 9 V / 1.2 A, centre (−).
- Serial Interface Connector: DB-9 pin (connects to SC-3000 via the
supplied cable — DB-9 on printer side, DIN-7 on SC-3000 side).
Connections
...........
1. Connect the DB-9 plug to the SP-400 serial interface.
2. Connect the DIN-7 plug to the SC-3000 printer port.
3. Always make cable connections with both units powered off.
Paper Loading
.............
1. Cut the leading edge of the paper roll square with scissors.
2. Insert the paper end into the slot at the bottom of the printer.
3. Insert the shaft through the roll; place the roll in the compartment.
4. Power on.
5. Raise the top cover.
6. Press LINE FEED to feed paper through the slot and around the platen.
Pen Installation
................
> Caution: Never rotate or move the Pen Holder manually.
> Always use the panel controls. You must always use four pens.
1. Raise the top cover.
2. Press COLOR SELECT to rotate to the desired pen position.
3. Press PEN CHANGE — the holder moves to the far right.
4. To remove a pen: gently hold it down, then press the Pen Ejection Lever.
5. Insert the new pen (ink tip first) into the Pen Guide Wheel hole;
match pen colour to the colour-coded wheel.
6. Press COLOR SELECT to advance to the next pen position and repeat.
7. Close the top cover.
8. Press LINE FEED to return the holder to the left margin.
------------------------------------------------------------------------------

3. Background Information

3. Background Information
------------------------------------------------------------------------------

3.1 Text and Graphic Modes

3.1 Text and Graphic Modes
..........................
The printer has two operating modes:
Text Mode (power-on default)
For word processing, program listings, and formatted output.
To return to Text Mode from Graphic Mode: LPRINT CHR$(17)
Graphic Mode
For graphs, diagrams, and drawings with full XY pen control.
To enter Graphic Mode: LPRINT CHR$(18)

3.2 Coordinate System

3.2 Coordinate System
.....................
In Graphic Mode the paper is treated as an XY plane:
- X axis: horizontal, positive = right, negative = left.
- Y axis: vertical, positive = up (paper retracts), negative = down.
- Origin: initially at the left margin under the pen.
Can be relocated with the I command.
- Step resolution: 0.2 mm per step; 480 steps across the full paper width
(96 mm / 3.8 inches).
Movements are specified in steps. Values range from −999 to +999.

3.3 [TECH] Internal Hardware Architecture

3.3 [TECH] Internal Hardware Architecture
.........................................
The SP-400 uses a dual-processor architecture:
Intel 8035 — Serial Front-End Controller
- ROM: 4 KB external EPROM (sp400_8035.bin)
- Role: Receives the serial byte stream from the SC-3000, decodes the
bit-banged protocol, and buffers incoming command bytes.
- Serial receive: bit-banged on port P2.6 (DATA_IN from SC-3000).
P2.5 is the clock/acknowledge output line.
- Packet size: collects up to 37 bytes per command frame, stores
them inverted (XOR 0xFF) in internal RAM from address 0x10.
- Reset vector: 0x000 → JMP 0x100 (main program).
- Key ROM addresses (8035):
Address             Function
$000                Reset vector → JMP to main code
$100                Main init (byte counter, RAM pointer setup)
$106                Serial sync loop (clock low, await start bit)
$12B                Main serial receive loop (8 bits × 37 bytes)
$199                End-of-transfer wait (await DATA_IN deassert)
$19E                Delay_Medium subroutine (~40 cycles)
$1A6                Delay_Long subroutine (~46 cycles)
$1AD                Delay_Short subroutine (~22 cycles)
Hitachi HD6805V1 — Mechanism Controller
- ROM: 4 KB external EPROM (sp400_hd6805v1.bin)
- Role: Full Alps stepper-motor control, character rendering,
graphic command parsing, panel button handling.
- CPU: Hitachi HD6805V1 (Motorola MC6805 compatible, 8-bit).
- Reset vector: $FFFE–$FFFF → $06B2 (RESET_ENTRY).
- Interrupt vectors:
Vector Address      Points to           Function
$FFFE–$FFFF         $06B2               RESET
$FFFC–$FFFD         $07CB               External IRQ (panel buttons)
$FFFA–$FFFB         $09E7               Timer overflow (motor timing, PWM)
$FFF8–$FFF9         $0A1F               SWI (software interrupt)
$FFF6–$FFF7         $0F80               Ext. INT alt
$FFF4–$FFF5         $0FE7               Timer overflow alt
$FFF2–$FFF3         $0FEC               Timer capture B
$FFF0–$FFF1         $0FEA               Timer capture A
HD6805V1 I/O Register Map:
Address             Name                Direction           Function
$00                 PORT_A_DDR          W                   Port A data direction
$01                 PORT_A              R/W                 Port A data (pen-carriage stepper phases)
$02                 PORT_B_DDR          W                   Port B data direction
$03                 PORT_B              R/W                 Port B data (paper-feed stepper phases)
$04                 PORT_C_DDR          W                   Port C data direction
$05                 PORT_C              R/W                 Port C data (pen solenoid, colour sensor)
$08                 TIMER_CTRL          W                   Timer control register
$09                 TIMER_STATUS        R/W                 Timer status / interrupt flags
$0A–$0B             TIMER_HI/LO         R/W                 Timer count (16-bit)
$0C–$0F             SCI registers       R/W                 Serial Communications Interface
Key RAM Variables (HD6805V1, address range $20–$5F):
Address             Name                Description
$26                 state_flags         Current mode and status flags
$2E                 serial_byte         Last received byte from SCI
$36                 dir_flag            Motor direction flag
$3C                 y_step_idx          Y magnitude index for current stroke
$3E                 x_step_idx          X magnitude index for current stroke
$40                 motor_state         Stepper motor phase state
$41                 pen_flags           Bit 1 = pen up
$48                 char_offset         Byte offset within character page
$49                 char_page           Page number of current character (0–3)
$50                 size_s              Current character size (0–63, from S command)
$51                 mode_flags          Text/Graphic mode, print direction
$53                 stroke_byte         Current stroke byte being processed
$5E                 pen_state           Physical pen up/down state
$5F                 color_sel           Active pen number (0–3)
Power-On Sequence (`RESET_ENTRY` at `$06B2`)
1. Configure Port A/B/C directions (steppers out, sensors in).
2. Configure SCI for 1200 baud 8N1 (matching SC-3000 output rate).
3. Clear all RAM working variables.
4. Arm the timer interrupt for motor phase timing.
5. Home the pen carriage: drive stepper X to the left stop.
6. Self-test ($061F): draw four small squares, one per pen colour.
7. Return pen to left margin, select pen #1 (Black).
8. Enter Text Mode and start the main receive loop (CHAR_DISPATCH).

3.4 [TECH] Serial Communication Protocol (SC-3000 Side)

3.4 [TECH] Serial Communication Protocol (SC-3000 Side)
.......................................................
This section is based on Chapter 7 of the SC-3000 Hardware Reference Manual
(Vol. C), compiled from ROM disassembly of the BASIC Level III-B cartridge.
Physical Connection
The printer uses the 7-pin DIN connector on the SC-3000 rear panel. Five
active signals are routed through the SC-3000's Intel 8255A PPI:
Signal              PPI Pin             Direction           Description
DATA                PC5                 SC→Printer          Serial data bit
/FEED               PC7                 SC→Printer          Line feed request
/RESET              PC6                 SC→Printer          Printer reset
BUSY                PB6                 Printer→SC          Printer busy (1 = not ready)
FAULT               PB5                 Printer→SC          Printer fault (1 = error)
DIN-7 pin assignments (Sega service manual):
Pin                 Signal              Direction
1                   FAULT (PB5)         Input to SC-3000
2                   BUSY (PB6)          Input to SC-3000
3                   DATA (PC5)          Output from SC-3000
4                   /RESET (PC6)        Output from SC-3000
5                   /FEED (PC7)         Output from SC-3000
6                   GND                 Ground
7                   NC                  Not connected
BASIC Interface
The SC-3000 BASIC routes LPRINT, LLIST, and HCOPY through a RAM pointer:
- PUTADR at RAM address $82A0 — normally points to the screen write
handler. When LPRINT is executing, BASIC sets PUTADR = $7008
(the ROM printer handler). The character to print is in register A.
To send a character from machine language:
`
LD  A, charcode
CALL $7008        ; ROM printer handler
`
Physical Wire Protocol
The DATA line888 (PC5) uses an inverted, LSB-first, synchronous-style encoding.
Per-character sequence (from ROM disassembly of $7008):
1. BUSY WAIT — poll PB6 until BUSY = 0 (printer ready).
Interrupts remain enabled during polling.
2. DI — disable Z80 interrupts for the entire bit stream.
3. PRE-STROBE (~12.8 µs)
DATA = HIGH. Signals start of transmission to the printer.
4. BIT STREAM — 8 bits, LSB first, inverted logic:
- Character bit = 1 → DATA LOW
- Character bit = 0 → DATA HIGH
- Each bit period ≈ 36 µs (→ ~27.8 kbit/s effective rate).
5. EOB STROBE (~27.9 µs) — DATA = LOW (end-of-byte marker).
6. EI — re-enable Z80 interrupts.
Timing summary per character (excluding BUSY wait):
Phase               Duration            DATA state
IDLE                —                   HIGH
PRE                 ~12.8 µs            HIGH
Bit 0 (LSB)         ~36 µs              HIGH if bit=0 / LOW if bit=1
Bit 1               ~36 µs              (same rule)
…                   …                   …
Bit 7 (MSB)         ~36 µs              (same rule)
EOB                 ~27.9 µs            LOW
Inter-char          printer-dep.        BUSY HIGH then LOW
Total wire time per character (no BUSY wait): ~329 µs (~3 045 chars/s max).
Example — character 'A' (0x41 = 0100 0001 binary):
`
Bits LSB-first:  b0=1  b1=0  b2=0  b3=0  b4=0  b5=0  b6=1  b7=0
Wire (inverted): b0=L  b1=H  b2=H  b3=H  b4=H  b5=H  b6=L  b7=H
Phase:   PRE   b0    b1  b2  b3  b4  b5    b6    b7   EOB
DATA:  ----   |___| ---------  -----  |___| ----- |___
HIGH   LOW   HIGH...         LOW    HIGH   LOW
`
Notes for Programming
- The SC-3000 BASIC 4-second BUSY timeout (see Appendix D) is enforced by
the BASIC interpreter: if BUSY remains high for more than ~4 seconds,
the error "Device Not Ready" is raised.
- Characters with ASCII code < 0x20 or > 0x7E are replaced with space
by ROM code at $702A before transmission.
- CHR$(13) (CR) is passed to the wire as a literal 0x0D byte. Some printer
commands (graphic mode command strings) rely on this.

3.5 [TECH] SP-400 Serial Receive (Firmware Side)

3.5 [TECH] SP-400 Serial Receive (Firmware Side)
................................................
The SP-400 processes the incoming serial stream in two stages:
Stage 1 — Intel 8035 (bit-banged receiver):
The 8035 monitors P2.6 (DATA_IN). It detects the PRE-STROBE (DATA HIGH),
then samples each of the 8 bits by waiting for the clock edge and reading
the data line. The 8 bits are assembled MSB-first into a byte, inverted
(XOR 0xFF to undo the wire inversion), and stored in the 8035's internal
RAM. This repeats until a complete command frame (37 bytes) is received.
The 8035 acknowledges each byte by toggling P2.5 (CLOCK output) as a
handshake signal, which the SC-3000 monitors to pace its transmission.
Stage 2 — HD6805V1 (command processor):
The HD6805V1 reads bytes from its SCI port (registers $0C–$0F), which
receives data forwarded from the 8035 over the internal bus. The
SERIAL_IN subroutine at $02B1 polls SCI_STATUS ($0E) and reads each
byte from SCI_DATA ($0F). The byte is then passed to CHAR_DISPATCH
($02DB) for processing.
------------------------------------------------------------------------------

4. Using the Plotter/Printer

4. Using the Plotter/Printer
------------------------------------------------------------------------------
Automatic Power-On Sequence
...........................
On power-up the printer executes a built-in start-up routine that:
1. Homes the pen carriage (stepper motor X drives to the left stop).
2. Draws four small squares, one in each pen colour, to verify ink flow.
3. Returns the pen to the left margin in Text Mode.
Manual Operation
................
- COLOR SELECT: advance pen holder to the next colour.
- LINE FEED: advance paper.
Program Control — Overview
..........................
All commands are sent from SC-3000 BASIC using LPRINT. Control codes
(CHR$( )) send printer instructions; printable ASCII sends characters in
Text Mode or text strings for the P graphic command.

4.1 Control Codes

4.1 Control Codes
.................
Code                CHR$                Function            ROM handler ($)
8                   CHR$(8)             Backspace (Text Mode)    —
10                  CHR$(10)            Line Feed           $05F1
11                  CHR$(11)            Reverse Line Feed (Text Mode)    —
13                  CHR$(13)            Carriage Return     $0626
17                  CHR$(17)            Select Text Mode (DC1)    $05AC
18                  CHR$(18)            Select Graphic Mode (DC2)    $0513
29                  CHR$(29)            Rotate Pen Holder / Next Colour (NC)    $04DD
CHR$(8) — Backspace (Text Mode)
Moves the pen one character width to the left. Useful for underlining.
`basic
10 LPRINT "A";
20 LPRINT CHR$(8);
30 LPRINT "_"
`
CHR$(11) — Reverse Line Feed (Text Mode)
Moves the paper backwards one line. Useful for superscripts.
`basic
10 LPRINT "2";
20 LPRINT CHR$(11);
30 LPRINT "2";
40 LPRINT CHR$(10)
`
CHR$(17) — Select Text Mode
Returns to Text Mode from Graphic Mode.
CHR$(18) — Select Graphic Mode
Enters Graphic Mode. All subsequent LPRINT output is interpreted as
graphic commands until CHR$(17) or the A command is received.
CHR$(29) — Next Colour (NC)
Advances the pen holder to the next pen position. Track the current
position manually in your program.

4.2 Graphic Commands

4.2 Graphic Commands
....................
> All graphic commands are single ASCII letters followed by parameters.
> They are only active in Graphic Mode (entered via CHR$(18)).
------------------------------------------------------------------------------
A — All Reset (Return to Text Mode)
`
A
`
Moves the pen to the left margin (pen up, no vertical movement), resets
the origin to the left margin, and returns to Text Mode.
`basic
10 LPRINT CHR$(18)    : REM enter graphic mode
20 LPRINT "A"         : REM return to text mode
30 LPRINT "A"         : REM now prints the letter A
`
------------------------------------------------------------------------------
C — Change Colour
`
C color      (color = 0 to 3; default 0)
`
Selects the active pen. With the recommended pen sequence:
0 = Black, 1 = Red, 2 = Green, 3 = Blue.
> Note (Appendix D): After C, insert a delay loop to allow
> the colour-change mechanism time to complete before the next command.
------------------------------------------------------------------------------
D — Draw (Absolute)
`
D x,y[,x2,y2,...]      (x,y in range -999 to 999)
`
Draws a line from the current pen position to the specified absolute
coordinate(s) with respect to the current origin. Multiple coordinate
pairs continue the line from point to point.
`basic
10 LPRINT CHR$(18)
20 LPRINT "D0,100,100,100,100,0,0,0"   : REM draws a 100×100 box
30 LPRINT "A"
`
------------------------------------------------------------------------------
H — Home
`
H
`
Moves the pen to the current origin without drawing.
------------------------------------------------------------------------------
I — Initialize Origin
`
I
`
Redefines the origin as the current pen position.
`basic
10 LPRINT CHR$(18)
20 LPRINT "D240,0"    : REM draw to centre
30 LPRINT "I"          : REM set centre as new origin
`
------------------------------------------------------------------------------
J — Draw (Relative)
`
J dx,dy[,dx2,dy2,...]    (dx,dy in range -999 to 999)
`
Draws a line from the current pen position, moving dx steps right and
dy steps up for each pair. All displacements are relative to the
preceding point.
`basic
10 LPRINT CHR$(18)
20 LPRINT "J0,100,100,0,0,-100,-100,0"  : REM same box as D example
`
------------------------------------------------------------------------------
L — Line Type
`
L type      (type = 0 to 15; default 0)
`
Value               Result
0                   Solid line
1                   Fine dotted
2–3                 Dotted
4                   Dash-dot
5–11                Various dashed styles
12–15               Long dashes
------------------------------------------------------------------------------
M — Move (Absolute)
`
M x,y      (x,y in range -999 to 999)
`
Moves pen to the absolute coordinate (x, y) without drawing.
------------------------------------------------------------------------------
P — Print Text Characters (Graphic Mode)
`
P characters
`
Prints a string of characters while remaining in Graphic Mode.
Characters can be any printable ASCII. Size is set by the S command.
`basic
10 LPRINT "PGRAPHIC PRINTER"
`
------------------------------------------------------------------------------
Q — Rotate Print Direction
`
Q direction      (direction = 0 to 3; default 0)
`
Value               Direction
0                   Left-to-right (normal)
1                   Top-to-bottom
2                   Right-to-left (upside down)
3                   Bottom-to-top
------------------------------------------------------------------------------
R — Move (Relative)
`
R dx,dy      (dx,dy in range -999 to 999)
`
Moves the pen dx steps right and dy steps up from the current position,
without drawing.
------------------------------------------------------------------------------
S — Character Size
`
S size      (size = 0 to 63; default 0)
`
Sets the size of characters printed by the P command.
- S 0 = smallest (80 chars per 480-step line)
- S 63 = largest (1 char per line)
Formula: chars_per_line = 80 / (size + 1)
> Note (Appendix D): Large character sizes require significant
> plotting time. Insert a delay after printing large characters to
> avoid SC-3000 BUSY timeout.
------------------------------------------------------------------------------
X — Draw Coordinate Axis
`
X axis, step, interval
axis     = 0 (Y axis) or 1 (X axis)
step     = distance between graduation marks (-999 to 999)
interval = number of graduation marks (1 to 255)
`
Draws a coordinate axis from the current pen position with evenly
spaced graduation marks.
`basic
10 LPRINT "X0,6,20"     : REM vertical axis, 20 marks × 6 steps
20 LPRINT "X1,-10,16"   : REM horizontal axis leftward, 16 marks × 10 steps
`

4.3 [TECH] ROM Handler Addresses (HD6805V1)

4.3 [TECH] ROM Handler Addresses (HD6805V1)
...........................................
The following table maps each graphic command to its entry point in the
HD6805V1 firmware (sp400_hd6805v1.bin):
Command / Function    ROM Address         Description
Main init           $0100               Hardware setup, port config, SCI init
Motor drive core    $0258               Alps stepper motor sequencer
Serial receive      $02B1               Poll SCI, read received byte
Command dispatcher    $02DB               Route byte to text/graphic handler
Draw character      $0365               Render one character via stroke table
Next character pos.    $0374               Advance pen to next char position
Motor X driver      $0386               Fire pen-carriage stepper phase
Motor Y driver      $038A               Fire paper-feed stepper phase
Motor step          $0393               Execute one micro-step
Pen solenoid        $03AD               Lower/raise active pen
S — Set size        $0466               Store scale factor
A/X — Axis          $046D               Draw coordinate axis
D/J — Draw          $0475               Absolute/relative draw
C — Colour          $04DD               Rotate pen holder
M/R — Move          $04E8               Absolute/relative move without draw
CHR$(18) — Graphic    $0513               Enter Graphic Mode
CHR$(17) — Text     $05AC               Enter Text Mode
CHR$(10) — LF       $05F1               Line feed / paper advance
CHR$(13) — CR       $0626               Carriage return
Self-test           $061F               Power-on four-colour box test
RESET entry         $06B2               Full hardware initialisation
IRQ handler         $07CB               Panel button service (PEN CHANGE etc.)
Timer ISR           $09E7               Motor ramp timing, solenoid PWM
Char lookup setup    $0AA0               Prepare character page/offset pointers
Char byte read      $0AA8               Read one byte from character stroke ROM
------------------------------------------------------------------------------

5. Specifications

5. Specifications
------------------------------------------------------------------------------
#                   Parameter           Value
1                   Printing system     Ball-point pen, 4 colour
2                   Plotting speed (horizontal)    52 mm/s (2.05 in/s)
Plotting speed (vertical)    73 mm/s (2.87 in/s)
3                   Printing speed      12 chars/s (max)
4                   Resolution          0.2 mm/step (0.00787 in)
5                   Effective plotting range    96 mm (3.804 in) X-axis — 480 steps
Y-axis: no practical limit
6                   Characters per line    38 (Text Mode)
7                   Accuracy (repetition)    0.2 mm max
Accuracy (movement)    0.3 mm max
Accuracy (distance X)    0.5% max
Accuracy (distance Y)    1.0% max
8                   Interface           SC-3000 only (TTL serial)
9                   Pen life            250 m (825 ft)
10                  Operating temperature    5–35 °C (41–95 °F)
11                  Storage temperature    −40–71 °C
12                  Humidity            10–80% relative, non-condensing
13                  Power supply        DC 9 V / 1.2 A (centre −)
14                  Dimensions          276 (W) × 174 (D) × 68 (H) mm
15                  Weight              760 g

5.1 [TECH] Extended Hardware Specifications

5.1 [TECH] Extended Hardware Specifications
...........................................
Parameter           Value
Main controller     Hitachi HD6805V1 (MC6805 compatible, 8-bit)
Serial front-end    Intel 8035 (MCS-48, no internal ROM)
Controller ROM      2 × 4 KB external EPROM
HD6805V1 clock      ~1 MHz (internal RC, derived from crystal)
Alps stepper — X    4-phase, pen carriage horizontal
Alps stepper — Y    4-phase, paper feed (vertical)
Pen solenoid        Driven by PWM on HD6805V1 Port C
Serial baud rate    1200 baud, 8N1, TTL levels
Character ROM       4 pages × 256 bytes ($0C00–$0F7F)
Character set       95 printable ASCII (0x20–0x7E) + extended
------------------------------------------------------------------------------

Appendix A — Sample Programs

Appendix A — Sample Programs
------------------------------------------------------------------------------
(1) DEMO1 PI GRAPH
10 REM *** PI GRAPH ***
20 DIM A$(5),DA(5),C(5),ST(5),D(5)
30 FOR I=1 TO 5
40 READ A$(I),DA(I),C(I),ST(I)
50 NEXT I
60 LPRINT CHR$(18):LPRINT "C0"
70 FOR JJ=0 TO 500:NEXT JJ
80 LPRINT "M0,-300":LPRINT "S2"
90 LPRINT "A"
100 LPRINT "  ****  PI    GRAPH";
110 LPRINT "  ****"
120 LPRINT CHR$(18):LPRINT "I"
130 LPRINT "S1"
140 LPRINT "M0,-100,100,-100"
150 LPRINT "I"
160 S=0
170 FOR I=1 TO 5
180 S=S+DA(I)
190 NEXT I
200 FOR I=1 TO 5
210 DA(I)=INT(DA(I)/S*10000)/100
220 NEXT I
230 FOR I=0 TO 100 STEP 2
240 S=I/100*PI*2
250 X=INT(SIN(S)*100)
260 Y=INT(COS(S)*100)
270 IF I=0 THEN LPRINT "M";X;",";Y
280 LPRINT "D";X;",";Y
290 NEXT I
300 S=0
310 FOR I=1 TO 5
320 S=S+DA(I)*PI*2/100
330 X=INT(SIN(S)*100)
340 Y=INT(COS(S)*100)
350 LPRINT "H":LPRINT"D";X;",";Y
360 NEXT I
370 P=0
380 FOR I=1 TO 5
390 LPRINT "C";C(I)
400 FOR JJ=0 TO 500:NEXT JJ
410 O=P:P=P+DA(I)
420 OS=O*PI*2/100
430 PS=P*PI*2/100
440 OX=INT(SIN(OS)*100)
450 OY=INT(COS(OS)*100)
460 PX=INT(SIN(PS)*100)
470 PY=INT(COS(PS)*100)
480 SA=100:ED=-100
490 IF OY>=0 AND PY>=0 THEN ED=0
500 IF OY<=0 AND PY<=0 THEN SA=0
510 FOR Y=SA TO ED STEP -ST(I)
520 J=0
530 ZA=SQR(10000-Y*Y)
540 IF Y=0 THEN ZS=PI/2:GOTO 570
550 ZS=ATN(ZA/Y)
560 IF ZS<0 THEN ZS=ZS+PI
570 IF OS>=ZS THEN 600
580 IF ZS>=PS THEN 600
590 D(J)=INT(ZA):J=J+1
600 ZS=PI*2-ZS
610 IF OY=0 THEN 690
620 X=OX/OY*Y
630 IF SGN(X)<>SGN(OX) THEN 690
640 IF SGN(Y)=0 THEN 660
650 IF SGN(OY)<>SGN(Y) THEN 690
660 ZT=SQR(X*X+Y*Y)
670 IF ZT>100 THEN 690
680 D(J)=INT(X):J=J+1
690 IF PY=0 THEN 770
700 X=PX*Y/PY
710 IF SGN(X)<>SGN(PX) THEN 770
720 IF SGN(Y)=0 THEN 740
730 IF SGN(PY)<>SGN(Y) THEN 770
740 ZT=SQR(X*X+Y*Y)
750 IF ZT>100 THEN 770
760 D(J)=INT(X):J=J+1
770 IF OS>=ZS THEN 800
780 IF ZS>=PS THEN 800
790 D(J)=INT(-ZA):J=J+1
800 IF Y<>0 THEN 820
810 IF J<>2 THEN D(J)=0:J=J+1
820 IF J<=2 THEN 900
830 FOR V=0 TO J-1
840 M=D(V):MN=V
850 FOR L=V+1 TO J-1
860 IF D(L)<M THEN M=D(L):MN=L
870 NEXT L
880 D(MN)=D(V):D(V)=M
890 NEXT V
900 V=0
910 IF J<2 THEN 970
920 K1=D(V+(ABS(Y) MOD 2))
930 LPRINT "M";K1;",";Y
940 K=D(V+((ABS(Y)+1) MOD 2))
950 LPRINT "D";K;",";Y
960 V=V+2:IF V<J-1 THEN 920
970 NEXT Y
980 NEXT I
990 LPRINT "M130,";(N-1*15)
1000 FOR I=1 TO 5
1010 LPRINT "I"
1020 LPRINT "C";C(I)
1030 FOR JJ=0 TO 500:NEXT JJ
1040 LPRINT "J0,20,30,0,0,-20,-30,0"
1050 J=0
1060 LPRINT "M0,";J:LPRINT "J30,0"
1070 J=J+ST(I):IF J<20 THEN 1060
1080 LPRINT "M40,0":LPRINT "P";A$(I)
1090 FOR K=1 TO 11-LEN(A$(I))
1100 LPRINT "P":NEXT
1110 LPRINT "P";DA(I);
1120 LPRINT "x"
1130 LPRINT "M0,-30"
1140 NEXT
1150 LPRINT "M0,-100":LPRINT "A"
1160 END
1170 DATA A INC,42500,1,3
1180 DATA B INC,25300,2,3
1190 DATA C INC,20100,3,3
1200 DATA D INC,11200,4,3
1210 DATA E INC,04600,1,5
(2) DEMO2 PLOTTING ABILITY
10 REM
20 DIM A(10,2)
30 REM *** PLOTTING ABILITY ***
40 LPRINT:LPRINT TAB(12);
50 LPRINT "PLOTTING ABILITY"
60 LPRINT CHR$(18);"L0"
70 LPRINT "M250,-180":LPRINT"I"
80 FOR I=0 TO 350 STEP 10
90 S=I/180*PI
100 X=SIN(S)*200.5
110 Y=COS(S)*200.5
120 X=INT(X):Y=INT(Y)
130 LPRINT "D";X;",";Y:LPRINT "H"
140 NEXT I
150 LPRINT "M0,-450"
160 LPRINT "I"
170 S=2*PI/11
180 FOR I=0 TO 10
190 A(I,1)=INT(SIN(I*S)*200.5)
200 A(I,2)=INT(COS(I*S)*200.5)
210 NEXT I
220 LPRINT "M";A(0,1);",";A(0,2)
230 C=2
240 FOR I=0 TO 4
250 K=0
260 C=C+1:IF C>3 THEN C=0
270 LPRINT "C";C:FOR WA=0 TO 1000
280 NEXT WA
290 FOR J=0 TO 10
300 K=K+I+1
310 IF K>10 THEN K=K-11:GOTO 310
320 LPRINT "D";A(K,1);",";A(K,2)
330 NEXT J
340 NEXT I
350 LPRINT "D";A(K,1);",";A(K,2)
360 LPRINT "M0,-200":LPRINT "C0"
370 LPRINT CHR$(17)
380 END
RUN
(3) DEMO3 GLOBE
10 REM *** GLOBE ***
20 LPRINT CHR$(18)
30 G=0:R=240
40 REM
50 LPRINT "C1"
60 FOR JJ=0 TO 500:NEXT JJ
70 FOR P=PI/31 TO PI STEP PI/31
80 G=0
90 FOR TH=0 TO PI*2 STEP PI/16
100 X=R*SIN(TH)*COS(P)
110 Y=R*COS(TH)
120 Z=R*SIN(TH)*SIN(P)
130 GOSUB 340
140 IF Z3<0 THEN G=0:GOTO 160
150 GOSUB 410
160 NEXT TH
170 NEXT P
180 REM
190 LPRINT"C2"
200 FOR JJ=0 TO 500:NEXT JJ
210 FOR Q=0 TO PI STEP PI/31
220 G=0
230 FOR TH=0 TO PI*2 STEP PI/16
240 X=R*SIN(TH)*SIN(Q)
250 Y=R*COS(Q)
260 Z=R*COS(TH)*SIN(Q)
270 GOSUB 340
280 IF Z3<0 THEN G=0:GOTO 300
290 GOSUB 410
300 NEXT TH
310 NEXT Q
320 LPRINT "A"
330 END
340 REM
350 Y3=Y*.877583-Z*.479425
360 Z1=Y*.479425+Z*.877583
370 X3=X*.825336-Z1*.564642
380 Z3=X*.564642+Z1*.825336
390 RETURN
400 REM
410 GX=240+X3:GY=-240+Y3
420 IF G=1 THEN 440
430 LPRINT "M"+STR$(GX)+","+STR$(GY)
440 LPRINT "D"+STR$(GX)+","+STR$(GY)
450 G=1
460 RETURN
(4) DEMO4 HILBERT
10 REM *** DEMO 4 HILBERT ***
20 LPRINT CHR$(18)
30 REM
40 H=384:X0=240:Y0=-X0
50 FOR I=1 TO 6
60 H=H/2
70 X0=X0+(H/2):Y0=Y0+(H/2)
80 C=(I-1) MOD 4
90 LPRINT "C"+STR$(C)
100 FOR JJ=0 TO 500:NEXT JJ
110 X=X0:Y=Y0
120 LPRINT "M"+STR$(X0)+","+STR$(Y0)
130 GOSUB 190
140 NEXT I
150 REM
160 LPRINT "A"
170 END
180 REM
190 IF I<=0 THEN 260
200 I=I-1
210 GOSUB 460:X=X-H:GOSUB 550
220 GOSUB 190:Y=Y-H:GOSUB 550
230 GOSUB 190:X=X+H:GOSUB 550
240 GOSUB 280
250 I=I+1
260 RETURN
270 REM
280 IF I<=0 THEN 350
290 I=I-1
300 GOSUB 370:Y=Y+H:GOSUB 550
310 GOSUB 280:X=X+H:GOSUB 550
320 GOSUB 280:Y=Y-H:GOSUB 550
330 GOSUB 190
340 I=I+1
350 RETURN
360 REM
370 IF I<=0 THEN 440
380 I=I-1
390 GOSUB 280:X=X+H:GOSUB 550
400 GOSUB 370:Y=Y+H:GOSUB 550
410 GOSUB 370:X=X-H:GOSUB 550
420 GOSUB 460
430 I=I+1
440 RETURN
450 REM
460 IF I<=0 THEN 530
470 I=I-1
480 GOSUB 190:Y=Y-H:GOSUB 550
490 GOSUB 460:X=X-H:GOSUB 550
500 GOSUB 460:Y=Y+H:GOSUB 550
510 GOSUB 370
520 I=I+1
530 RETURN
540 REM
550 LPRINT "D"+STR$(X)+","+STR$(Y)
560 RETURN
------------------------------------------------------------------------------

Appendix B — Graphic Commands Summary

Appendix B — Graphic Commands Summary
------------------------------------------------------------------------------
Command             Syntax              Function
Line Type           L p (p=0–15)        Set line style (0=solid, 1–15=dashed)
All Reset           A                   Pen to left margin, return to Text Mode
Home                H                   Move pen to current origin (no draw)
Initialize          I                   Set origin to current pen position
Draw                D x,y…              Draw to absolute coordinate(s)
Relative Draw       J dx,dy…            Draw relative from current position
Move                M x,y               Move to absolute coordinate (no draw)
Relative Move       R dx,dy             Move relative (no draw)
Colour Change       C n (n=0–3)         Select pen colour
Scale Set           S n (n=0–63)        Set character size
Alpha Rotate        Q n (n=0–3)         Set text print direction
Print               P chars             Print text in Graphic Mode
Axis                X p,q,r             Draw coordinate axis with graduations
------------------------------------------------------------------------------

Appendix C — ASCII Character Set

Appendix C — ASCII Character Set
------------------------------------------------------------------------------
`
0      1      2      3      4      5      6      7
0                  (sp)    0      @      P      `      p
1            DC1    !      1      A      Q      a      q
2            DC2    "      2      B      R      b      r
3                   #      3      C      S      c      s
4                   $      4      D      T      d      t
5                   %      5      E      U      e      u
6                   &      6      F      V      f      v
7                   '      7      G      W      g      w
8            BS     (      8      H      X      h      x
9                   )      9      I      Y      i      y
A            LF     *      :      J      Z      j      z
B           (VT/LU) +      ;      K      [      k      {
C                   ,      <      L      \      l      |
D     CR     NC     -      =      M      ]      m      }
E                   .      >      N      ^      n      ~
F                   /      ?      O      _      o    (DEL)
`
Control code legend:
Code                Name                Function
BS (0x08)           Back Space          Backspace
LF (0x0A)           Line Feed           Advance paper one line
VT/LU (0x0B)        Vertical Tab / Line Up    Reverse line feed
CR (0x0D)           Carriage Return     Return to left margin
DC1 (0x11)          Device Control 1    Select Text Mode
DC2 (0x12)          Device Control 2    Select Graphic Mode
NC (0x1D)           Next Colour         Rotate pen holder
------------------------------------------------------------------------------

Appendix D — Programming Notice

Appendix D — Programming Notice
------------------------------------------------------------------------------
1. BUSY timeout (4-second limit)
SC-3000 BASIC raises "Device Not Ready Error" if BUSY remains high for
more than 4 seconds. Insert a delay loop after operations that take time:
`basic
FOR N=1 TO 1000 : NEXT N     : REM ~delay
`
Operations requiring a delay:
- After C (colour change) in Text or Graphic Mode.
- After P with a large S value.
- After X (axis command).
- After D, J, M, R commands with long distances.
2. LPRINT / LLIST / HCOPY notes
- Graphic or special characters in LPRINT strings are replaced with space.
- Strings longer than 38 characters produce an extra line space.
3. Maximum string length in Graphic Mode
SC-3000 BASIC automatically inserts CR (CHR$(13)) after 38 characters in a
string, which interrupts the graphic command parser.
`basic
REM WRONG:
LPRINT "D100,110,120,130,140,150,160,170,180,190,200,210"
REM CORRECT (split into two LPRINT statements):
LPRINT "D100,110,120,130,140,150"
LPRINT "D160,170,180,190,200,210"
`
------------------------------------------------------------------------------

Appendix E [TECH] — SC-3000 Serial Protocol Reference

Appendix E [TECH] — SC-3000 Serial Protocol Reference
------------------------------------------------------------------------------
Signal Summary
..............
The SP-400 serial interface uses TTL-level signals routed through the
8255A PPI in the SC-3000:
Direction           Signal              PPI bit             DIN pin
SC-3000 → Printer    DATA                PC5                 3
SC-3000 → Printer    /RESET              PC6                 4
SC-3000 → Printer    /FEED               PC7                 5
Printer → SC-3000    BUSY                PB6                 2
Printer → SC-3000    FAULT               PB5                 1
Bit Encoding
............
Idle state: DATA = HIGH.
Each character is transmitted as:
`
[IDLE/HIGH] → [PRE ~12.8µs HIGH] → [b0 ~36µs] → [b1 ~36µs] →
→ ... → [b7 ~36µs] → [EOB ~27.9µs LOW] → [BUSY wait]
`
Wire logic is inverted: a character bit value of 1 produces DATA LOW;
a bit value of 0 produces DATA HIGH.
Bits are transmitted LSB first.
Timing Constants (from ROM `$7008`)
...................................
Parameter           Value
PRE duration        ~12.8 µs
Bit period          ~36 µs
EOB duration        ~27.9 µs
Total per char (no BUSY)    ~329 µs
Theoretical max rate    ~3 045 chars/s
Interrupts during transmission    DISABLED (DI…EI)
Checking Printer Status from Machine Language
.............................................
`asm
; Check BUSY (PB6):
IN   A, ($DD)
BIT  6, A
JR   NZ, not_ready    ; Z=0 → BUSY = 1 → printer not ready
; Check FAULT (PB5):
IN   A, ($DD)
BIT  5, A
JR   NZ, fault        ; Z=0 → FAULT = 1
`
PUTADR Hook for Custom ML Handlers
..................................
`asm
; Redirect LPRINT to custom handler:
LD   HL, my_handler
LD   ($82A0), HL
; Restore after use:
LD   HL, $7008
LD   ($82A0), HL
`
Emulator Interception
.....................
To capture LPRINT output in a JavaScript SC-3000 emulator, hook at $7008:
`javascript
const PRINTER_ENTRY = 0x7008;
let printerBuffer = '';
cpu.addBreakpoint(PRINTER_ENTRY, () => {
const ch = cpu.A & 0xFF;
if (ch >= 0x20 && ch <= 0x7E)
printerBuffer += String.fromCharCode(ch);
else if (ch === 0x0D)
printerBuffer += '\n';
cpu.PC = cpu.popWord();  // skip ROM routine
return true;
});
`
------------------------------------------------------------------------------

Appendix F [TECH] — HD6805V1 Firmware ROM Map

Appendix F [TECH] — HD6805V1 Firmware ROM Map
------------------------------------------------------------------------------
Full disassembly available in sp400_hd6805v1_dis.asm.
Address range       Contents
$0000–$007F         HD6805V1 I/O registers + internal RAM (stack, variables)
$0080–$008F         Motor configuration: step count, phase count
$0090–$00BF         Velocity / timing lookup tables (4 speeds × axis)
$00C0–$00CF         Signed X displacement vectors (16 direction entries)
$00D0–$00DF         Signed Y displacement vectors (16 direction entries)
$00E0–$00EF         X step magnitude table (8 font sizes × 2 scales)
$00F0–$00FF         Y step magnitude table (8 font sizes × 2 scales)
$0100–$02B0         Initialisation + main loop
$02B1–$02DA         SERIAL_IN — SCI receive
$02DB–$0364         CHAR_DISPATCH — command/character routing
$0365–$0465         DRAW_CHAR, MOTOR_DRIVE, MOTOR_X/Y, PENDOWN
$0466–$05F0         Graphic command handlers: S, A, D, C, M, G, T, X, Q, J, R, L, H, I
$05F1–$061E         CMD_LINEFEED
$061F–$06B1         Self-test (four-colour box)
$06B2–$07CA         RESET_ENTRY
$07CB–$09E6         IRQ_HANDLER (panel buttons, colour change, pen change)
$09E7–$0ABF         TIMER_OVF_HANDLER (motor acceleration ramp, solenoid PWM)
$0AC0–$0B5F         Character page table (160 × 1 byte; entry = page 0–3)
$0B60–$0BFF         Character offset table (160 × 1 byte; offset within page)
$0C00–$0CFF         Character stroke data — Page 0 (0x20 SPACE to 0x48 'H')
$0D00–$0DFF         Character stroke data — Page 1 (0x49 'I' to 0x79 'y')
$0E00–$0EFF         Character stroke data — Page 2 (0x7A 'z' and above)
$0F00–$0F7F         Character stroke data — Page 3 (extended characters)
$0F80–$0FEF         Additional interrupt service routines
$0FF0–$0FFF         Interrupt vector table
------------------------------------------------------------------------------

Appendix G [TECH] — Character Stroke Data Format

Appendix G [TECH] — Character Stroke Data Format
------------------------------------------------------------------------------
Lookup Mechanism
................
To locate a character's stroke data, the firmware performs the following
steps (HD6805V1 code at $02DB–$032E):
1. Receive the ASCII code from SERIAL_IN.
2. Subtract 0x20 to obtain a zero-based character index (0–94 for
printable ASCII 0x20–0x7E).
3. Read page  = ROM[$0AC0 + index] → page number 0–3.
4. Read offset = ROM[$0B60 + index] → byte offset within the page.
5. Compute the stroke data address: PAGE_BASE[page] + offset
where PAGE_BASE = {0:$0C00, 1:$0D00, 2:$0E00, 3:$0F00}.
6. Stream bytes from that address, passing each to the motor drive
routine, until a byte with bit 7 = 1 (end-of-character) is read.
Stroke Byte Encoding
....................
Each byte in the stroke data stream encodes one motor movement:
`
bit 7   : pen_up   (1 = move without drawing, 0 = draw)
bit 6-4 : Y magnitude index  (0–7 → look up in table at $0F0)
bit 3   : direction sign     (1 = negative direction)
bit 2-0 : X magnitude index  (0–7 → look up in table at $0E0)
`
The last byte of each character always has bit 7 = 1.
Step Magnitude Tables (at maximum size S = 63)
..............................................
X magnitudes (ROM[$0E0] through ROM[$0E7]):
Index               Steps               Description
0                   122                 Full character width diagonal
1                   88                  3/4 width
2                   20                  Short horizontal
3                   20                  Short horizontal
4                   60                  Half width
5                   43                  Medium diagonal
6                   9                   Tiny horizontal
7                   9                   Tiny horizontal
Y magnitudes (ROM[$0F0] through ROM[$0F7]):
Index               Steps               Description
0                   60                  Full character height
1                   60                  Full character height
2                   0                   No vertical movement
3                   0                   No vertical movement
4                   30                  Half height
5                   30                  Half height
6                   0                   No vertical movement
7                   0                   No vertical movement
For size S < 63, actual steps = table_value × (S + 1) / 64 (scaled
by the firmware before calling MOTOR_DRIVE).
Character Examples
..................
SPACE (0x20) — 1 byte: $E0
`
$E0 = 1 110 0000
pen_up=1, Y_idx=6→0steps, sign=0, X_idx=0→122steps
→ Pen UP, advance X by 122 steps (character spacing)
`
'A' (0x41) — 6 bytes: 01 0D 2F 49 4C 8C
`
$01 = 0 000 0001  pen_down, Y=60, POS, X=88   → diagonal up-right (left leg)
$0D = 0 000 1101  pen_down, Y=60, NEG, X=43   → diagonal down, shorter (right leg)
$2F = 0 010 1111  pen_down, Y=0,  NEG, X=9    → small left adjust
$49 = 0 100 1001  pen_down, Y=30, NEG, X=88   → back-position for crossbar
$4C = 0 100 1100  pen_down, Y=30, NEG, X=60   → crossbar stroke
$8C = 1 000 1100  pen_UP,   Y=60, NEG, X=60   → return to baseline [END]
`
------------------------------------------------------------------------------

Appendix H [TECH] — Intel 8035 Firmware Notes

Appendix H [TECH] — Intel 8035 Firmware Notes
------------------------------------------------------------------------------
Full disassembly available in sp400_8035_dis.asm.
Architecture
............
Property            Value
CPU                 Intel 8035 (MCS-48 family, 8-bit, no internal ROM)
ROM                 4 KB external EPROM (sp400_8035.bin)
RAM                 64 bytes internal
Clock               External crystal (~6 MHz typical for MCS-48)
Reset vector        $000 → JMP $100
The 4 KB binary is mirrored: the upper 2 KB ($800–$FFF) is an exact
copy of the lower 2 KB ($000–$7FF). Only the first 2 KB is active.
P2 Port Pin Assignment
......................
Bit                 Mask                Direction           Function
P2.5                0x20                Output              CLOCK / acknowledge to SC-3000
P2.6                0x40                Input               DATA_IN from SC-3000 serial line
Receive Protocol (bit-banged)
.............................
The 8035 implements the receiving side of the protocol described in
Appendix E. It samples DATA_IN (P2.6) to reconstruct each byte:
1. Wait for DATA to go LOW (start of PRE-STROBE).
2. Wait for PRE-STROBE to end (DATA goes HIGH).
3. For each of 8 bits (LSB first): wait for the bit period, sample DATA_IN,
shift the inverted value into the current byte register.
4. Pulse CLOCK (P2.5) as an ACK after each byte.
5. Repeat for 37 bytes (one command frame).
6. Bytes are stored XOR-inverted in internal RAM from address 0x10.
Key Subroutines
...............
Address             Function            Duration
$100                Main init           —
$106                Serial sync + clock loop    —
$12B                Main 8-bit receive loop    —
$19E                DELAY_MEDIUM (~40 cycles)    ~11 µs @6 MHz
$1A6                DELAY_LONG (~46 cycles)    ~13 µs @6 MHz
$1AD                DELAY_SHORT (~22 cycles)    ~6 µs @6 MHz
------------------------------------------------------------------------------
SEGA SP-400 Enhanced Technical Reference — compiled 2025
Original manual © Sega Enterprises Ltd.
Technical addenda from SC-3000 Hardware Reference (Vol. C) and ROM analysis.
==============================================================================

INTEL 8035 ROM DISASSEMBLY

                          INTEL 8035 ROM DISASSEMBLY
==============================================================================