X68000
Contents
Sharp X68000
The Sharp X68000 is a home computer created by Sharp Corporation. It was first released in 1987 and sold only in Japan.
The initial model has a 10 MHz Motorola 68000 CPU, 1 MB of RAM, and lacks a hard drive. The final model was released in 1993 with a 25 MHz Motorola 68030 CPU, 4 MB of RAM, and optional 80 MB SCSI hard drive. RAM in these systems is expandable to 12 MB, though most games and applications do not require more than 2 MB.
The X68000 has graphics hardware similar to arcade video games of the late-1980s, with custom coprocessors supporting scrolling, tiled backgrounds, and large numbers of sprites. Sound is supplied through multiple sound chips supporting 8 channels of FM synthesis and one channel of adaptive differential pulse-code modulation audio, which are mixed down to 2 analog stereo channels via a DAC chip. As such, video gaming was a major use of the X68000.
The X68000 runs an operating system called Human68k which was developed for Sharp by Hudson Soft. An MS-DOS-workalike, Human68k features English-based commands very similar to those in MS-DOS;
Setting up
- Assembler: VASM
- Tools: NDC to create an XDF Disk Image containing the production
- Emulator(s): http://retropc.net/pi/xm6/index.html , https://www.retrostic.com/emulators/sharp-x68000/winx68030, https://mijet.eludevisibility.org/XM6%20Pro-68k/XM6%20Pro-68k.html
- Hardware: Original X68000 or the new X68000Z emulation systems.
Memory map
address vector Function
$000000 $00 SSP after reset
$000004 $01 PC after reset
$000008 $02 Bus error
$00000c $03 Address error
$000010 $04 Unknown instruction
$000014 $05 Division by 0
$000018 $06 CHK instruction
$00001c $07 TRAPV instruction, FTRAPcc instruction
$000020 $08 Privilege violation
$000024 $09 Trace exception
$000028 $0a Unsupported instruction line 1010 emulator (SX call)
$00002c $0b ? line 1111 emulator (DOS call, floating point operation)
$000030 $0c Unused
$000034 $0d FPU Protocol violation exception handling
$000038 $0e Formatting error exception handling
$00003c $0f Uninitialized Interrupt
$000040 $10 Unused
$000044 $11 ?
$000048 $12 ?
$00004c $13 ?
$000050 $14 ?
$000054 $15 ?
$000058 $16 ?
$00005c $17 ?
$000060 $18 Spurious Interrupt
$000064 $19 Level 1 Interrupt (auto vector)
$000068 $1a ?
$00006c $1b ?
$000070 $1c ?
$000074 $1d ?
$000078 $1e ?
$00007c $1f ?
$000080 $20 trap #0
$000084 $21 ? #1
$000088 $22 ? #2
$00008c $23 ? #3
$000090 $24 ? #4
$000094 $25 ? #5
$000098 $26 ? #6
$00009c $27 ? #7
$0000a0 $28 ? #8 (reserved for system)
$0000a4 $29 ? #9 (OS debugger)
$0000a8 $2a ? #10 (reset & power off)
$0000ac $2b ? #11 (BREAK key)
$0000b0 $2c ? #12 (COPY key)
$0000b4 $2d ? #13 (CTRL+C)
$0000b8 $2e ? #14 (error processing)
$0000bc $2f ? #15 (IOCS call)
$0000c0 $30 FPU BSUN
$0000c0 $30 FPU BSUN
$0000c4 $31 ? INEX1,INEX2
$0000c8 $32 ? DZ
$0000cc $33 ? UNFL
$0000d0 $34 ? OPERR
$0000d4 $35 ? OVFL
$0000d8 $36 ? SNAN
$0000dc $37 ???
$0000dc $37 Unused
$0000e0 $38 MMU
$0000e4 $39 ?
$0000e8 $3a ?
$0000ec $3b Unused
$0000fc $3f Unused
$000100 $40 MFP RTC Alarm/1Hz
$000104 $41 MFP External power OFF
$000118 $42 MFP Front switch OFF
$00010c $43 MFP FM Audio source
$000110 $44 MFP Timer-D (Used with BG processing)
$000114 $45 MFP Timer-C (Mouse/cursor/FDD control, etc.)
$000118 $46 MFP V-DISP
$00011c $47 MFP RTC Clock
$000120 $48 MFP Timer-B
$000124 $49 MFP Key serial output error
$000128 $4a MFP Key serial output empty
$00012c $4b MFP Key serial input error
$000130 $4c MFP Key serial input
$000134 $4d MFP Timer-A
$000138 $4e MFP CRTC*IRQ
$00013c $4f MFP H-SYNC
$000140 $50 SCC(B) Transmission buffer empty
$000144 $51 SCC(B) ''
$000148 $52 SCC(B) External/status changes
$00014c $53 SCC(B) ''
$000150 $54 SCC(B) Incoming character validity (Mouse 1 byte input)
$000154 $55 SCC(B) ''
$000158 $56 SCC(B) Special Rx condition
$00015c $57 SCC(B) ''
$000160 $58 SCC(A) Transmission buffer empty
$000164 $59 SCC(A) ''
$000168 $5a SCC(A) External status changes
$00016c $5b SCC(A) ''
$000170 $5c SCC(A) Incoming character validity (RS-232C 1 byte input)
$000174 $5d SCC(A) ''
$000178 $5e SCC(A) Special Rx Condition
$00017c $5f SCC(A) ''
$000180 $60 I/O FDC status interruption
$000184 $61 I/O FDC insertion/discharge interruption
$000188 $62 I/O HDC status interruption
$00018c $63 I/O Printer ready interruption
$000190 $64 DMAC #0 End (FDD)
$000194 $65 DMAC #0 Error ('')
$000198 $66 DMAC #1 End (SASI)
$00019c $67 DMAC #1 Error ('')
$0001a0 $68 DMAC #2 End (IOCS _DMAMOVE,_DMAMOV_A,_DMAMOV_L)
$0001a4 $69 DMAC #2 Error ('')
$0001a8 $6a DMAC #3 End (ADPCM)
$0001ac $6b DMAC #3 Error ('')
$000200 $6c SPC SCSI interruption (Internal SCSI)
$000204 $6d Unused
$0003d4 $f5 Unused
$0003d8 $f6 SPC SCSI interruption (SCSI board)
$0003dc $f7 Unused
$0003fc $ff Unused
0x000000 RAM area
$c00000 Graphics Vram � Page 0
$c80000 Graphics Vram � Page 1 (256/16 color only)
$d00000 Graphics Vram � Page 2 (16 color only)
$d80000 Graphics Vram � Page 3 (16 color only)
$e00000 Text Vram � Bitplane 0
$e20000 Text Vram � Bitplane 1
$e40000 Text Vram � Bitplane 2
$e60000 Text Vram � Bitplane 3
$e80000 1.w R00 Horizontal total
$e80002 1.w R01 Horizontal synchronization end position timing
$e80004 1.w R02 Horizontal display start position
$e80006 1.w R03 Horizontal display end position
$e80008 1.w R04 Vertical total
$e8000a 1.w R05 Vertical synchronization end position timing
$e8000c 1.w R06 Vertical display start position
$e8000e 1.w R07 Vertical display end position
$e80010 1.w R08 External synchronization horizontal adjust: Horizontal position tuning
$e80012 1.w R09 Raster number: Used for raster interruption
$e80014 1.w R10 Text Screen X coordinate
$e80016 1.w R11 Text Screen Y coordinate
$e80018 1.w R12 Graphics screen Scroll X0
$e8001a 1.w R13 Graphics screen Scroll Y0
$e8001c 1.w R14 Graphics screen Scroll X1
$e8001e 1.w R15 Graphics screen Scroll Y1
$e80020 1.w R16 Graphics screen Scroll X2
$e80022 1.w R17 Graphics screen Scroll Y2
$e80024 1.w R18 Graphics screen Scroll X3
$e80026 1.w R19 Graphics screen Scroll Y3
$e80028 1.w R20 Memory mode/Display mode control
$e8002a 1.w R21 Simultaneous access/Raster copy/Quick clear plane select
$e8002c 1.w R22 Raster copy action: Raster number
$e8002e 1.w R23 Text screen access mask pattern
$e80481 1.b Active Image capture/Quick clear/Raster copy control
$e82000 256.w Graphics palette
$e82200 16.w Text palette (Palette block 0)
$e82220 240.w Sprite palette ('' 1-15)
$e82400 1.w R0 (Screen mode initialization)
$e82500 1.w R1 (Priority control)
$e82600 1.w R2 (Special priority/screen display) - Layers On/Off
$e84000 DMAC (HD63450)
$e86000 Memory controller privileged access settings (OHM/ASA)
$e88000 MFP (MC68901)
$e8a000 RTC (RP5C15)
$e8c000 Printer port
$e8e001 #1 Contrast
$e8e003 #2 Display/3D Shutter Glasses (Bit 0=Right Eye / Bit 1 = Left Eye)
$e8e005 #3 Color image unit (bit 4-0)
$e8e007 #4 Keyboard/NMI/dot clock
$e8e009 #5 ROM/DRAM Wait
$e8e00b #6 MPU Classification/Operation clock
$e8e00d #7 SRAM Write
$e8e00f #8 Unit power OFF
$E90001 FM Synthesizer (YM2151) - Register Address Write port
$E90003 FM Synthesizer (YM2151) - Data R/W port
$E92000 ADPCM (MSM6258V)
$E94000 Floppy disk controller (FDC) (uPD72065)
$E94005 Floppy drive monitor (IOSC)
$E96000 SASI
$E98000 ESCC (Z8530)
$E9A000 PPI (82C55)
$E9C000 I/O selector (IOSC)
$E9E000 I/O expansion area (Sharp reserved)
$EB0000 Sprite register (CYNTHIA)
$EB8000 Sprite VRAM
$EC0000 I/O expansion area (User)
$ed0072 2.b SX-Window environment flag (While in use with "SX")
$ed0074 1.b Standard double-click time / 10
$ed0075 1.b Mouse speed / 2
$ed0076 1.b Text palette hue (HSV)
$ed0077 1.b
$ed0078 1.b Brightness palette 0-3 5bit???
$ed007b 1.b Printer drive (PRTD) ID
$ed007c 1.b SRAM info version#, screen status storage, start screen storage
$ed007d 1.b Desktop background (PICT) ID
$ed007e 1.b Screen mode
$ed007f 17.b Reserved for system use (X68030)
$ed0090 1.b Standard cache status (bit=0: off 1:on)
$ed0091 1.b OPM music during startup (0: OFF -1: ON)
$ed0092 1.b 10MHz Proper wait value
$ed0093 1.b 16MHz ''
$ed0094 108.b Reserved for system use
$ed0100 768.b Head SRAM program address
$ed0400 15KB Head SRAMDISK address
$ed3fff End of SRAM
$ed4000 Backup (64KB)
$ee0000 Unused (128KB)
$f00000 CGROM(768KB)
$fc0000 SCSI IOCS / IPL(8KB)
$fe0000 ROM Debugger
$ff0000 IPL / ROM IOCS
Setting up the Disk Image
To get up and running, you need to create a Human68k OS XDF disk image, which is a similar system to MS-DOS.
Add the following files to the disk image:
COMMAND.X
HUMAN.SYS
INTRO.R (This is the flat binary output for your intro)Optionally, like in DOS, you can add a AUTOEXEC.BAT that just launches your INTRO.R for auto-startup.
Setting the Supervisor
Like all 68000 systems, if you want to access registers, you need to set the supervisor mode first before doing anything else:
clr.l -(a7)
dc.w $ff20Video display
To get your video mode up and running, there are two call you need to make in a specific order
; Set CRT mode. Clears plane 0/1 on the text screen to set display mode.
; The graphics screen and sprite screen are put into silent mode without being cleared.
; The text palette is initialized.
moveq #10,d1
moveq #$10,d0
trap #15
; Enable graphics mode
; _G_CLR_ON Initializes the graphic screen and sets the display mode
; Clears the graphics screen and displays the palette. The page is set to 0.
move.w #$90,d0
trap #15
; Disable Text Cursor
moveq #$1f,d0
trap #15Here is a full list of all available graphics modes:
d1.w p.width resolution colors screens khz
===================================================
0 1024 512 x 512 16 1 31
1 V V V V 15
2 V 256 x 256 V V 31
3 V V V V 15
4 512 512 x 512 16 4 31
5 V V V V 15
6 V 256 x 256 V V 31
7 V V V V 15
8 V 512 x 512 256 2 31
9 V V V V 15
10 V 256 x 256 V V 31
11 V V V V 15
12 V 512 x 512 65536 1 31
13 V V V V 15
14 V 256 x 256 V V 31
15 V V V V 15
16 1024 768 x 512 16 1 31
17 V 1024 x 424 V V 24
18 V 1024 x 848 V V 24
19 V 640 x 480 V V 24
20 V 768 x 512 256 2 31
21 V 1024 x 848 V V 24
22 V 1024 x 424 V V 24
23 V 640 x 480 V V 24
24 V 768 x 512 65536 1 31
25 V 1024 x 848 V V 24
26 V 1024 x 424 V V 24
27 V 640 x 480 V V 24Vsync
waitVBlank:
move.w $e88000,d0
and.w #%00010000,d0 ;Wait for vblank to start
beq waitVBlank
waitVBlank2:
move.w $e88000,d0
and.w #%00010000,d0 ;Wait for Vblank to end
bne waitVBlank2
rtsClearing the screen
You can clear the active screen using the WIPE IOCS routine ($b5)
move.w #$b5,d0
trap #15Plotting to screen
When accessing using GRAM directly, you can fill the GVRAM directly in word (64k colors), byte (8 bit palette) or 4-bit 16 color mode.
lea GVRAM,a0
move.w #256,d7
drawloop:
move.w (a0)+,d0
dbra d7,drawloopSince GVRAM buffer widths can differ from the resolution you are using, make sure to skip enough words at the end of each line to make up for the difference.
IOCS Drawing routines
Alternatively you could make use of the IOCS functions for drawing primitives using TRAP #15. These are slow tom routines, compatible with all kinds of modes, All these make use of a parameter buffer in A1 that you need to fill yourself with the correct information, for example for _PSET this would contain X,Y,COLOR like so:
lea params,a1
move.w d2,(a1) ; x-coord
move.w d3,2(a1) ; y-coord
move.w #255,4(a1) ; color
move.l #_PSET,d0
trap #15Here is a full list of other IOCS drawing routines you are able to use.
_PSET equ $b6
_POINT equ $b7
_LINE equ $b8
_BOX equ $b9
_FILL equ $ba
_CIRCLE equ $bb
_PAINT equ $bcSound
The X68000 has a YM2151 FM Soundchip on board with 8 channels. Each channel's sound can be built up with 4 different 'slots. There are a total of 32 slots that can be turned on or off when the sound is triggered. For more information, check out the YM2151 specs at [1]
Alternatively, there is also an option to output digital PCM sound.
Additional Resources
- Assembly programming for the X68000
- [2] X68000 Technical data book
- [3] YM2151 Datasheet
- X68000 demoscene productions
- X68000 chapter in the book "The Book of CP-System"