| 
   
 PC-9821 - The Japanese 8086 PC
    While the West had the IBM PC's, Japan decided to go a different route!
 Starting with the PC-8800 (PC-88) series and 8086 processors, and leading
      on into the PC-9800 series (PC-98) the Japanese market produced x86 based
      non IBM compatible computers.
 
 While these machines may run DOS and Windows, they do not use IBM
      compatible hardware (The Dos/Windows software are special versions
      designed to work with the hardware), so games and software from the west
      will not work on these machines
 
 MsDos calls such as keyboard reading and text writing may work, so a
      program that only uses MS-Dos functions may work correctly,
 however the video hardware is completely different to western machines,
      with the text and bitmap graphics appearing as separate layers, the Bios
      calls for keyboard access are also different, so western programs that use
      the Bios Keyboard access (rather than MS-Dos ones) will not work.
 
      
        
          | The PC-98 series ranges over more
            than a decade, with a wide variety of features, but the ones we'll
            focus on are based on the later models shown below. 
 
 
              
                
                  | 
 | PC9821 |  
                  | Cpu | Various (Up to Pentium) |  
                  | OS | MS Dos 3-6.2 Windows 3.1
 Windows 95
 Windows 98
 (Special PC98 OS versions required)
 |  
                  | Ram | Various (32MB+) |  
                  | Resolution | 640x200 16 color (4096k color palette) 640x400 16 color (4096k color palette)
 640x400 256 color (16.7 Million color palette)
 |  
                  | Sound | PCM FM add on boards (YM2608)
 |  
 |  
 |     Resources PC-9801 Programmers
        Bible - Best tech manualPC9800
        TechnicalDataBook - HARDWARE 1993 - Not as good, but still very
      useful
 PC-9800
        TechnicalDataBook BIOS 1992 - Bios call reference (INTs) Note, these
      are different to IBM Pc's!
 Japanese MS-Dos Handbook
      - Though dos calls should be the same as western systems
 Memory map
 
      
        
          | 20 bit address | Purpose |  
          | $0 0000 | Ram |  
          | $1 0000 | Ram |  
          | $2 0000 | Ram |  
          | $3 0000 | Ram |  
          | $4 0000 | Ram |  
          | $5 0000 | Ram |  
          | $6 0000 | Ram |  
          | $7 0000 | Ram |  
          | $8 0000 | 
 |  
          | $9 0000 | 
 |  
          | $A 0000 | Text
              Characters (2 bytes per char) |  
          | $A 2000 | Text
              Attributes %GRBVUrbs (V=vertline U=Underline r=reverse b=blink s=secret
              (1=show / 0 = hide))
 |  
          | $A 4000 | CG Window 4k |  
          | $A 5000 | 
 |  
          | $A 8000 | GVRAM0 Plane
              0 B |  
          | $A BE80 | GVRAM0 Plane
              1 B |  
          | $A FD00 | 
 |  
          | $B 0000 | GVRAM1 Plane
              0 R |  
          | $B 3E80 | GVRAM1 Plane
              1 R |  
          | $B 8000 | GVRAM2 Plane
              0 G |  
          | $B BE80 | GVRAM2 Plane
              1 G |  
          | $B FD00 | 
 |  
          | $C 0000 | EMS Memory
              Window 32k x 4 |  
          | $D 0000 | Kanji Ram |  
          | $D 4000 | Dictionary
              Rom |  
          | $D 8000 | KGC Rom |  
          | $D C000 | 
 |  
          | $E 0000 | GVRAM3 Plane
              0 I |  
          | $E 3E80 | GVRAM3 Plane
              1 I |  
          | $E 8000 | Bios, Basic
              Rom 128k |  
          | $F 0000 | Bios, Basic
              Rom 128k |  Ports
 
      
        
          | Port | Data | Details |  
          | 60h | %GGGGGGGG | GDC Parameter |  
          | 62h | %GGGGGGGG | GDC Command |  
          | 64h | 
 | CRTC
              Interrupt |  
          | 68h | %----001T | Monochrome
              mode (1=Mono 0=Color) |  
          | 68h | %----010T | Text
              Resolution (1=320x200 0=640x200) |  
          | 68h | %----011F | Font (0=6x8
              1=7x13) |  
          | 68h | %----100L | Screen Lines
              (0=400 1=200) |  
          | 6Ah | %-------M | Color Mode
              (0=8 color 1=16 color) (see other 9821 options below) |  
          | 6Ch | %IGRB0000 | Border color
              RGB Intensity |  
          | 7Ch | %CR--3210 | C=CG mode
              R=RMW Mode 3210=Plane 3210 enable (1=no 0=yes) |  
          | A0h | %GGGGGGGG | GDC Parameter |  
          | A2h | %GGGGGGGG | GDC Command |  
          | A4h | %-------P | Select
              Display graphics plane |  
          | A6h | %-------P | Select Write
              graphics plane |  
          | A8h | %----PPPP | Select
              Palette |  
          | AAh | %----GGGG | Set palette
              Green (all 8 bits in 256 col mode) |  
          | ACh | %----RRRR | Set palette
              Red (all 8 bits in 256 col mode) |  
          | AEh | %----BBBB | Set palette
              Blue (all 8 bits in 256 col mode) |  
          | &0188
                (Varies) | %RRRRRRRR | FM Port 1
              Regselect |  
          | &018A
                (Varies) | %DDDDDDDD | FM Port 2
              Data |  
 
      
        
          | Port
                68h Extended options |  
          | 00h 
 | ATR4 batch
              call line |  
          | 01h | ATR4 simple
              graph |  
          | 02h | Color
              Graphics mode |  
          | 03h | Monocrome
              graphics mode |  
          | 04h | 80 char mode |  
          | 05h | 40 char mode |  
          | 06h | Chars 6x8 |  
          | 07h | Chars 7x13 |  
          | 08h | 400 line
              hires |  
          | 09h | 200 lines |  
          | 0Ah | Code access
              mode |  
          | 0Bh | Bitmap mode |  
          | 0Ch | Disable
              writing to undefined memory |  
          | 0Dh | Enable
              writing to undefined memory |  
          | 0Eh | Disable
              screen |  
          | 0Fh | Enable screen |  
 
      
        
          | Port
                6Ah Extended options |  
          | 00h | 8 color |  
          | 01h | 16 color |  
          | 04h | GRCC mode |  
          | 05h | EGC mode |  
          | 06h | Extended mode
              off |  
          | 07h | Extended mode
              on |  
          | 20h | Normal
              Graphics mode |  
          | 21h | Extended
              graphics (256 color) |  
          | 26h | Normal
              Display |  
          | 27h | Full screen
              reverse |  
          | 28h | Normal
              combine |  
          | 29h | Mathematic
              combine |  
          | 2Ah | Normal
              Palette write |  
          | 2Bh | Fast Palette
              write |  
          | 2Ch | Overscan
              color off |  
          | 2Dh | Overscan
              color on |  
          | 40h | CRT mode |  
          | 41h | Plasma
              display mode |  
          | 62h | plane format
              vram |  
          | 63h | packed pixel
              vram |  
          | 68h | Front back
              plane separate |  
          | 69h | Front back
              plane continuous |  
          | 6Ch | first pixel
              left |  
          | 6Dh | first pixel
              right |  
          | 84h | GDC 2.5mhz |  
          | 83h
                / 85h | GDC 5mhz |  
 
      
        
          | GDC
                Commands (Port 60h / 62h) |  
          | Command | Function | Data | 
 |  
          | %00000000 | Reset | 8 bytes | 
 |  
          | %01101011 | Start | Show Text | 
 |  
          | %00001101 | Start | Show Text
              (Alternate ver) | 
 |  
          | %00001100 | Stop | Hide Text | 
 |  
          | %0111RRRR | Scroll | R=Parameter
              type | 
 |  
          | %01001011 | CSR Form | Cursor
              Settings | %C00LLLLL
              %BBDCCCCC %CCCCCBBB |  
          | %01000111 | Pitch | Vram width
              setting | %PPPPPPPP |  
          | %01001001 | CSRW | Write Cursor
              p0s | %LLLLLLLL
              %000HHHHH |  
          | %11100000 | CSRR | Read Cursor | %LLLLLLLL
              %000HHHHH %???????? %???????? %???????? |  INT interrupts 
      
        
          | Interrupts | PC-9821 | IBM PC
                (Not this system!) 
 |  
          | 05h
                (varies) | Sound | 
 |  
          | 10h | 
 | Video |  
          | 11h | 
 | Determine
              Config |  
          | 12h | 
 | Determine
              Memory size |  
          | 13h | 
 | Disk |  
          | 14h | 
 | Serial |  
          | 15h | 
 | Cassette (AT) |  
          | 16h | 
 | Keyboard |  
          | 17h | 
 | Parallel |  
          | 18h | Keyboard /
              CRT / Graphics | Call ROM
              Basic |  
          | 19h | Rs232 | Boot Process |  
          | 1Ah | Printer | Date and Time |  
          | 1Bh | Hard Disk | Break Key |  
          | 1Ch | Timer | Periodic
              Interrupt |  
          | 1Dh | Graphics | Video Table |  
          | 1Eh | 
 | Drive Table |  
          | 1Fh | 
 | Character
              Table |  
          | 20h | MS Dos
              Terminate | MS Dos
              Terminate |  
          | 21h | MS Dos Call | MS Dos Call |  
          | 22h | Terminate
              address | Terminate
              address |  
          | 23h | Ctrl-C | Ctrl-C |  
          | 24h | Critical
              error handler | Critical
              error handler |  
          | 25h | Absolute Disk
              Read | Absolute Disk
              Read |  
          | 26h | Absolute Disk
              Write | Absolute Disk
              Write |  
          | 27h | Terminate and
              stay resident | Terminate and
              stay resident |  
          | 2Fh | XMS Memory | Print Spooler |  
          | 33h | Mouse | Mouse |  
          | 67h | Memory | EMS |  
          | A0h | Graphics LIO
              Init | 
 |  
          | A1h | GScreen
              Graphics mode | 
 |  
          | A2h | GView | 
 |  
          | A3h | GColor | 
 |  
          | A4h | GColor2 | 
 |  
          | A5h | GCLS | 
 |  
          | A6h | GPset | 
 |  
          | A7h | Gline | 
 |  
          | A8h | Gcircle | 
 |  
          | A9h | Gpaint1 | 
 |  
          | AAh | Gpaint2 | 
 |  
          | ABh | GGET | 
 |  
          | ACh | GPUT1 | 
 |  
          | ADh | GPUT2 | 
 |  
          | AEh | Groll | 
 |  
          | AFh | Gpoint | 
 |  
          | CEh | Gcopy | 
 |  INT 21 dos calls
 
      
        
          | INT
                21h - Dos calls |  
          | 00h 
 | End Program |  
          | 01h | Read Keyboard
              Input and echo |  
          | 02h | Print
              Character |  
          | 03h | Aux Input |  
          | 04h | Aux Output |  
          | 05h | Print to
              printer |  
          | 06h | Direct
              Console I/O |  
          | 07h | Direct
              Console Input |  
          | 08h | Direct
              Console input - No echo |  
          | 09h | Print String |  
          | 0Ah | Buffered
              keyboard input |  
          | 0Bh | Keyboard
              status check |  
          | 0Ch | Clear
              keyboard buffer |  
          | 0Dh | Disk reset |  
          | 0Eh | Select Drive |  
          | 0Fh | File open |  
          | 10h | File Close |  
          | 11h | Find first
              directory entry |  
          | 12h | Find next
              directory entry |  
          | 13h | Delete file |  
          | 14h | Read
              Sequential |  
          | 15h | Write
              Sequential |  
          | 16h | Create file |  
          | 17h | Rename file |  
          | 19h | Get current
              drive |  
          | 1Ah | Set Disk
              transfer address |  
          | 1Bh | Get Default
              drive |  
          | 1Ch | Get Drive
              Data |  
          | 21h | Read Random |  
          | 22h | Write Random |  
          | 23h | Calculate
              file size |  
          | 24h | Set record
              field |  
          | 25h | Set Interrupt
              vector |  
          | 26h | Create New
              PSP (Program Segment Prefix) |  
          | 27h | Read Random
              Block |  
          | 28h | Write Random
              Block |  
          | 29h | Examine file
              name |  
          | 2Ah | Read Date |  
          | 2Bh | Set Date |  
          | 2Ch | Read Time |  
          | 2Dh | Set Time |  
          | 2Eh | Set Verify
              Flag |  
          | 2Fh | Get Disk
              transfer address |  
          | 30h | Read DOS
              Version Number |  
          | 31h | Terminate and
              stay resident |  
          | 33h | Break Check
              setting |  
          | 35h | Read
              Interrupt Vector |  
          | 36h | Read Free
              space |  
          | 38h | Read/Set
              Country info |  
          | 39h | Create
              Subdirectory |  
          | 3Ah | Delete
              Subdirectory |  
          | 3Bh | Change
              current directory |  
          | 3Ch | Create a file |  
          | 3Dh | File Open |  
          | 3Eh | File Close |  
          | 3Fh | Read
              File/Device |  
          | 40h | Write
              File/Device |  
          | 41h | Delete File |  
          | 42h | Move file
              pointer |  
          | 43h | Change File
              Attributes |  
          | 44h | Device I/O
              Control |  
          | 45h | Copy File
              Handle |  
          | 46h | Copy to
              specified file handle |  
          | 47h | Read Current
              Directory |  
          | 48h | Allocate
              Memory block |  
          | 49h | Release
              Memory block |  
          | 4Ah | Change Memory
              block size |  
          | 4Bh | Load and
              Execute program |  
          | 4Ch | End process |  
          | 4Dh | Read Child
              process return code |  
          | 4Eh | Find File |  
          | 4Fh | Find next
              File |  
          | 54h | Read Verify
              Flag |  
          | 56h | Move
              Directory Entry |  
          | 57h | Read or Set
              File Date/Time |  Keyboard Keycodes
 
      
        
          | 
 | 
 | Top bits |  
          | 
 | 
 | 0-h | 1-h | 2-h 
 | 3-h | 4-h 
 | 5-h 
 | 6-h 
 | 7-h 
 |  
          | B o
 t
 t
 o
 m
 
 b
 i
 t
 s
 
 | -0h 
 | Esc | Q | F | , | - | . | Stop | Shift |  
          | -1h | 1 | W | G | . | / | Nfer | Copy | Caps |  
          | -2h | 2 | E | H | / | 7 | VF1 | F1 | Kana |  
          | -3h | 3 | R | J | _ | 8 | VF2 | F2 | Grph |  
          | -4h | 4 | T | K | Space | 9 | VF3 | F3 | Ctrl |  
          | -5h | 5 | Y | L | Xfer | * | VF4 | F4 | 
 |  
          | -6h | 6 | U | ; | RlUp | 4 | VF5 | F5 | 
 |  
          | -7h | 7 | I | : | RlDn | 5 | 
 | F6 | 
 |  
          | -8h | 8 | O | ] | Ins | 6 | 
 | F7 | 
 |  
          | -9h | 9 | P | Z | Del | + | 
 | F8 | 
 |  
          | -Ah | 0 | @ | X | Up | 1 | 
 | F9 | 
 |  
          | -Bh | - | [ | C | Down | 2 | 
 | F10 | 
 |  
          | -Ch | ^ | Enter | V | Left | 3 | 
 | 
 | 
 |  
          | -Dh | \ | A | B | Right | = | 
 | 
 | 
 |  
          | -Eh | Bkspc | S | N | HmClR | 0 | 
 | 
 | 
 |  
          | -Fh | Tab | D | M | Help | , | 
 | 
 | 
 |  Keycode Groups (INT 18h AH=04h)
   
      
        
          | 
 | 
 | Bits |  
          | 
 | 
 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |  
          | K e
 y
 c
 o
 d
 e
 
 G
 r
 o
 u
 p
 | 0 
 | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 |  
          | 1 | 8 | 9 | 0 | - | ^ | \ | Bkspc | Tab |  
          | 2 | Q | W | E | R | T | Y | U | I |  
          | 3 | O | P | @ | [ | Enter | A | Stop | D |  
          | 4 | F | G | H | J | K | L | + | * |  
          | 5 | ] | Z | X | C | V | B | N | M |  
          | 6 | , | . | / | _ | Space | Xfer | RlUp | RlDn |  
          | 7 | Ins | Del | Up | Down | Left | Right | HmClr | Help |  
          | 8 | - | / | 7 | 8 | 9 | * | 4 | 5 |  
          | 9 | 6 | + | 1 | 2 | 3 | = | 0 | , |  
          | A | . | Nfer | VF1 | VF2 | VF3 | VF4 | VF5 | 
 |  
          | B | 
 | 
 | 
 | 
 | 
 | 
 | Home | 
 |  
          | C | Stop | Copy | F1 | F2 | F3 | F4 | F5 | F6 |  
          | D | F7 | F8 | F9 | F10 | 
 | 
 | 
 | 
 |  
          | E | Shift | Caps | Kana | Grph | Ctrl | 
 | 
 | 
 |    
 
      
        
          | INT
                18h calls |  
          | AH
                value | Function | Input | Output |  
          | 00h | Read key data | 
 | AH=Keycode
              AL=Keydata |  
          | 01h | Read
              keybuffer status | 
 | AH=Keycode
              AL=Keydata BH=Bufferstatus (1=data 0=empty) |  
          | 02h | Inspect shift
              status | 
 | AL=% - - -
              Ctrl Grph Kana Caps Shift |  
          | 03h | Reset
              Keyboard interface status | 
 | 
 |  
          | 04h | Inspect Key
              input status | AL=Keycode
              Group | AH=Keygroup
              key status |  
          | 05h | Read a key
              from the keybuffer | AH=Keycode | AL=Keydata
              BX=Status (1=success 0=fail) |  
          | 06h | Reset buffer | 
 | 
 |  
          | 07h | Read Shift
              Keys + Key data | 
 | AH=Keycode
              AL=Keydata BL=% - - - Ctrl Grph Kana Caps Shift |  
          | 08h | Inspect Shift
              Keys + Key data | 
 | AH=Keycode
              AL=Keydata BL=% - - - Ctrl Grph Kana Caps Shift |  
          | 09h | Create Key
              data | AL=Keycode
              BL=Shifts | AH=Keycode
              AL=Keydata |  256 colors mode In 256 color mode, the VRAM is accessed through two 32k 'windows', one is
      at A8000h (defined by address E0004h) , the other is at B0000h (defined by
      address E0006h)   
      
        
          | $A 8000 | VRAM Window 0
              (Defined by E0004h) |  
          | $B 0000 | VRAM Window 1
              (Defined by E0006h) |  
          | $B 8000 | Unused |  
          | $C 0000 | EMS Memory
              Window 32k x 4 |  
          | $D 0000 | Kanji Ram |  
          | $D 4000 | Dictionary
              Rom |  
          | $D 8000 | KGC Rom |  
          | $D C000 | 
 |  
          | $E 0000 | 256 color
              VRAM selection registers |  
          | $E 8000 | Bios, Basic
              Rom 128k |  
          | $F 0000 | Bios, Basic
              Rom 128k |  Calculating VRAM destination:
 VRAM = Yline *640 + Xpixel
 BankOffset = A8000h + (VRAM & 7FFFh)Bank = VRAM >> 15
 Write Bank to E0004h Write Bank+1 to E0006h
   
      
        
          | 24 Bit | 16
                Bit | 8
                Bit |  
          | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | F | E | D | C | B | A | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |  
          | - | - | - | - | - | B | B | B | B | O | O | O | O | O | O | O | O | O | O | O | O | O | O | O |  
   
      
        
          | 256
                color bank registers (In ram) |  
          | E0004h | Word | VRAM bank
              window 0 (Bank: 0000-000F) |  
          | E0006h | Word | VRAM bank
              window 1 (Bank: 0000-000F) |  
          | E0100h | Byte | Mode
              (00=Packed pixel 01=Planar) |  
          | E0102h | Word | Enable VRAM
              at F00000h (0000=no 0001=yes) |  
 SSG Registers (AY type)
 
      
        
          | Register | Meaning | Bit Meaning | Details |  
          | 0 | Tone Pitch L - Channel A (Left) | LLLLLLLL | Lower value = Higher pitch |  
          | 1 | Tone Pitch H - Channel A (Left) | ----HHHH | Lower value = Higher pitch |  
          | 2 | Tone Pitch L - Channel B (Center) | LLLLLLLL | Lower value = Higher pitch |  
          | 3 | Tone Pitch H - Channel B (Center) | ----HHHH | Lower value = Higher pitch |  
          | 4 | Tone Pitch L - Channel C (Right) | LLLLLLLL | Lower value = Higher pitch |  
          | 5 | Tone Pitch H - Channel C (Right) | ----HHHH | Lower value = Higher pitch |  
          | 6 | Noise Generator | ---NNNNN | Higher value = Faster noise |  
          | 7 | Mixer + IO | BANNNTTT | N=Noise T=Tone (Channel --CBACBA 1=mute 0=normal) BA=Port B/A direction (1=out 0=in)
 |  
          | 8 | Amplitude - Channel A (Left) | ---EVVVV | E=Envelope (1=Enabled) VVVV=Volume |  
          | 9 | Amplitude - Channel B (Center) | ---EVVVV | E=Envelope (1=Enabled) VVVV=Volume |  
          | 10 | Amplitude - Channel C (Right) | ---EVVVV | E=Envelope (1=Enabled) VVVV=Volume |  
          | 11 | Envelope L (Volume over time) | LLLLLLLL | Lower value=Faster Envelope |  
          | 12 | Envelope H (Volume over time) | HHHHHHHH | Lower value=Faster Envelope |  
          | 13 | Envelope Selection | ----EEEE | Envelope number (See PDF) |  
          | 14 
 | IO Port A | DDDDDDDD | IO Data port A (joy select) |  
          | 15 
 | IO Port B | DDDDDDDD | IO Data port B (Joy data) |  FM Sound with the YM2608 Get the YM2608
        PDF for all the info!
 The FM chip uses 2 pairs of ports, ???????? and ????  select the
      address of the register we want to change, ???? and ????? write the new
      data, but after each write, we need to check if the FM chip is busy,To check if the FM chip is busy, read in from port ?????, and check bit 7
      - it will return 0 when not busy.
 This data is copied from the Genesis 
      
        
          | Reg 
 | Purpose | Chn/Op 
 | Bits | Details |  
          | $24 | Timer A low | ALL | TTTTTTTT | Timer bits
              10-2 |  
          | $25 | Timer A high | ALL | ------TT | Timer bits
              1-0 |  
          | $26 | Timer B | ALL | TTTTTTTT | Timer B |  
          | $27 | Ch3 CSM Mode
              & Ch3 Multi-Mode & Enable Timers | ALL | 33RROOSS | 3= Chn 3 mode
              / R=timer resets / O= Timer overflows / S = Timer StartStop |  
          | $28 | Individual
              Operator Key On/Off | ALL | OOOO-CCC | O=operator
              (%4321----) / C=Channel (%000=chn 1 %110=chn6) |  
          | $29 | SCH, IRQ
              Enable | ALL | S--IIIII | S=Sixchannel
              / I=IRQ Enable |  
          | $2A | DAC Write | ALL | DDDDDDDD | D=Data |  
          | $2B | DAC Enable | ALL | E------- | E=enable |  
          | $30 | Multiplier
              & Detune | Ch1 Op1 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $31 | Multiplier
              & Detune | Ch2 Op1 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $32 | Multiplier
              & Detune | Ch3 Op1 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $34 | Multiplier
              & Detune | Ch1 Op2 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $35 | Multiplier
              & Detune | Ch2 Op2 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $36 | Multiplier
              & Detune | Ch3 Op2 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $38 | Multiplier
              & Detune | Ch1 Op3 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $39 | Multiplier
              & Detune | Ch2 Op3 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $3A | Multiplier
              & Detune | Ch3 Op3 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $3C | Multiplier
              & Detune | Ch1 Op4 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $3D | Multiplier
              & Detune | Ch2 Op4 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $3E | Multiplier
              & Detune | Ch3 Op4 | -DDDMMMM | D=Detune /
              M=Multiplier |  
          | $40 | Total Level | Ch1 Op1 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $41 | Total Level | Ch2 Op1 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $42 | Total Level | Ch3 Op1 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $44 | Total Level | Ch1 Op2 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $45 | Total Level | Ch2 Op2 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $46 | Total Level | Ch3 Op2 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $48 | Total Level | Ch1 Op3 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $49 | Total Level | Ch2 Op3 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $4A | Total Level | Ch3 Op3 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $4C | Total Level | Ch1 Op4 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $4D | Total Level | Ch2 Op4 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $4E | Total Level | Ch3 Op4 | -TTTTTTT | T=Total Level
              (0=largest) |  
          | $50 | Attack Rate
              & Rate Key Scaling | Ch1 Op1 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $51 | Attack Rate
              & Rate Key Scaling | Ch2 Op1 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $52 | Attack Rate
              & Rate Key Scaling | Ch3 Op1 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $54 | Attack Rate
              & Rate Key Scaling | Ch1 Op2 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $55 | Attack Rate
              & Rate Key Scaling | Ch2 Op2 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $56 | Attack Rate
              & Rate Key Scaling | Ch3 Op2 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $58 | Attack Rate
              & Rate Key Scaling | Ch1 Op3 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $59 | Attack Rate
              & Rate Key Scaling | Ch2 Op3 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $5A | Attack Rate
              & Rate Key Scaling | Ch3 Op3 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $5C | Attack Rate
              & Rate Key Scaling | Ch1 Op4 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $5D | Attack Rate
              & Rate Key Scaling | Ch2 Op4 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $5E | Attack Rate
              & Rate Key Scaling | Ch3 Op4 | RR-AAAAA | R=Rate
              Scaling / A = Attack rate |  
          | $60 | Decay Rate
              & AM Enable | Ch1 Op1 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $61 | Decay Rate
              & AM Enable | Ch2 Op1 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $62 | Decay Rate
              & AM Enable | Ch3 Op1 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $64 | Decay Rate
              & AM Enable | Ch1 Op2 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $65 | Decay Rate
              & AM Enable | Ch2 Op2 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $66 | Decay Rate
              & AM Enable | Ch3 Op2 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $68 | Decay Rate
              & AM Enable | Ch1 Op3 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $69 | Decay Rate
              & AM Enable | Ch2 Op3 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $6A | Decay Rate
              & AM Enable | Ch3 Op3 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $6C | Decay Rate
              & AM Enable | Ch1 Op4 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $6D | Decay Rate
              & AM Enable | Ch2 Op4 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $6E | Decay Rate
              & AM Enable | Ch3 Op4 | A--DDDDD | A=Amplitude
              Mod Enable / D= Decay rate |  
          | $70 | Sustain Rate | Ch1 Op1 | ---SSSSS | S=Sustain
              Rate |  
          | $71 | Sustain Rate | Ch2 Op1 | ---SSSSS | S=Sustain
              Rate |  
          | $72 | Sustain Rate | Ch3 Op1 | ---SSSSS | S=Sustain
              Rate |  
          | $74 | Sustain Rate | Ch1 Op2 | ---SSSSS | S=Sustain
              Rate |  
          | $75 | Sustain Rate | Ch2 Op2 | ---SSSSS | S=Sustain
              Rate |  
          | $76 | Sustain Rate | Ch3 Op2 | ---SSSSS | S=Sustain
              Rate |  
          | $78 | Sustain Rate | Ch1 Op3 | ---SSSSS | S=Sustain
              Rate |  
          | $79 | Sustain Rate | Ch2 Op3 | ---SSSSS | S=Sustain
              Rate |  
          | $7A | Sustain Rate | Ch3 Op3 | ---SSSSS | S=Sustain
              Rate |  
          | $7C | Sustain Rate | Ch1 Op4 | ---SSSSS | S=Sustain
              Rate |  
          | $7D | Sustain Rate | Ch2 Op4 | ---SSSSS | S=Sustain
              Rate |  
          | $7E | Sustain Rate | Ch3 Op4 | ---SSSSS | S=Sustain
              Rate |  
          | $80 | Release Rate
              & Sustain Level | Ch1 Op1 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $81 | Release Rate
              & Sustain Level | Ch2 Op1 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $82 | Release Rate
              & Sustain Level | Ch3 Op1 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $84 | Release Rate
              & Sustain Level | Ch1 Op2 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $85 | Release Rate
              & Sustain Level | Ch2 Op2 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $86 | Release Rate
              & Sustain Level | Ch3 Op2 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $88 | Release Rate
              & Sustain Level | Ch1 Op3 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $89 | Release Rate
              & Sustain Level | Ch2 Op3 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $8A | Release Rate
              & Sustain Level | Ch3 Op3 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $8C | Release Rate
              & Sustain Level | Ch1 Op4 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $8D | Release Rate
              & Sustain Level | Ch2 Op4 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $8E | Release Rate
              & Sustain Level | Ch3 Op4 | SSSSRRRR | S=Sustain
              Level / Release Rate |  
          | $90 | SSG-Envelope
              Generator | Ch1 Op1 | ----EEEE | E=Envelope
              Gen |  
          | $91 | SSG-Envelope
              Generator | Ch2 Op1 | ----EEEE | E=Envelope
              Gen |  
          | $92 | SSG-Envelope
              Generator | Ch3 Op1 | ----EEEE | E=Envelope
              Gen |  
          | $94 | SSG-Envelope
              Generator | Ch1 Op2 | ----EEEE | E=Envelope
              Gen |  
          | $95 | SSG-Envelope
              Generator | Ch2 Op2 | ----EEEE | E=Envelope
              Gen |  
          | $96 | SSG-Envelope
              Generator | Ch3 Op2 | ----EEEE | E=Envelope
              Gen |  
          | $98 | SSG-Envelope
              Generator | Ch1 Op3 | ----EEEE | E=Envelope
              Gen |  
          | $99 | SSG-Envelope
              Generator | Ch2 Op3 | ----EEEE | E=Envelope
              Gen |  
          | $9A | SSG-Envelope
              Generator | Ch3 Op3 | ----EEEE | E=Envelope
              Gen |  
          | $9C | SSG-Envelope
              Generator | Ch1 Op4 | ----EEEE | E=Envelope
              Gen |  
          | $9D | SSG-Envelope
              Generator | Ch2 Op4 | ----EEEE | E=Envelope
              Gen |  
          | $9E | SSG-Envelope
              Generator | Ch3 Op4 | ----EEEE | E=Envelope
              Gen |  
          | $A0 | Frequency low
              (Write Second) | Ch1 | PPPPPPPP | P=Frequency
              Position L |  
          | $A1 | Frequency low
              (Write Second) | Ch2 | PPPPPPPP | P=Frequency
              Position L |  
          | $A2 | Frequency low
              (Write Second) | Ch3 | PPPPPPPP | P=Frequency
              Position L |  
          | $A4 | Frequency
              high & Octave (Write first) | Ch1 | --OOOPPP | O=Octive /
              P=Position H |  
          | $A5 | Frequency
              high & Octave (Write first) | Ch2 | --OOOPPP | O=Octive /
              P=Position H |  
          | $A6 | Frequency
              high & Octave (Write first) | Ch3 | --OOOPPP | O=Octive /
              P=Position H |  
          | $A8 | Frequency low
              during Multi-Mode | Ch3 Op2 | PPPPPPPP | P=Frequency
              Position L |  
          | $A9 | Frequency low
              during Multi-Mode | Ch3 Op3 | PPPPPPPP | P=Frequency
              Position L |  
          | $AA | Frequency low
              during Multi-Mode | Ch3 Op4 | PPPPPPPP | P=Frequency
              Position L |  
          | $AC | Frequency
              high & Octave during Multi-Mode | Ch3 Op2 | --OOOPPP | O=Octive /
              P=Position H |  
          | $AD | Frequency
              high & Octave during Multi-Mode | Ch3 Op3 | --OOOPPP | O=Octive /
              P=Position H |  
          | $AE | Frequency
              high & Octave during Multi-Mode | Ch3 Op4 | --OOOPPP | O=Octive /
              P=Position H |  
          | $B0 | Algorithm
              & Feedback | Ch1 | --FFFAAA | F=Feedback /
              A=Algorithm |  
          | $B1 | Algorithm
              & Feedback | Ch2 | --FFFAAA | F=Feedback /
              A=Algorithm |  
          | $B2 | Algorithm
              & Feedback | Ch3 | --FFFAAA | F=Feedback /
              A=Algorithm |  FM Algorithm (&B1/B2)The algorithm number is one of 8 - each one defines how the different
      operations build up to build a sound:
 
 FM Sound over timeThe sound created is affected over time by the various registers, we can
      see a simple representation below:
 
 
 NEC PC9821 V13
      
        
          | I recently purchased a cheap PC-9821 V13, which worked great, but
            came without hard-drive, so I had to figure out how to get it set up
            and work out what it could do! Here I'll document my findings for
            anyone else who may have the same issues / questions 
 Note, As these machines are Japanese, you'll have to use Japanese
              Dos/Windows with them, as western versions will not support the
              custom hardware. Useful Resources 
 nw150doswin98
              - A disk image with Dos Windows pre-installed. I flashed this to a
              2GB CF2 card, and used it with a PATA converter as my main hard
              drive. It worked great, though I re-installed Windows 98 to get
              the drivers working easily (Windows installer included in image)PC98 Wikipedia
                article - More details on the PC98
 TGP-VR4 - Drivers for the 3D card
              the machine came with, I had a hell of a time finding these, so I
              uploaded them here!
 |  |  
 
DOS! Dos works fine, The machine uses MSDOS 6.2, but although it looks like
      regular dos, normal (western) dos apps almost certainly won't work - even
      MS-DOS EDIT is missing! I tried an old XT game 'RearGard'
      - The graphics appeared corrupted, and as a second layer over the text! It
      seems the 'CGA' vram is in the same address range as the PC98 VRAM,
      however it's clearly in a completely different incompatible format, and it
      seems the text / graphics screens are different layers! Also the game
      seems to have crashed... which happens to most western dos stuff! Amusingly ELIZA seems to work fine! I assume this is
      because it's text input / screen output is all done via DOS calls, not
      accessing hardware directly. 
 Western games aside, I tried some of the pre-installed Japanese games on
      the hard drive image, and I didn't have much luck there either! I saw a
      lot of graphical issues, and the PC-88 version of Xenon 2
      instantly crashed! Windows! Results on Windows were very different to DOS! Whereas dos was pretty
      much useless on this machine for my western games, Windows worked very
      well! I tried out some of my old games on the machine! I was able to install 'Virtua Cop' - it worked fine (bit
      slow on the P133 cpu), I was impressed that my western copy's setup
      routine seemed to support Japanese, and even came with the PC98 Directx
      install!! Die hard Trilogy also seemed to install and work ok,
      though it's slow and refused to support my 3D accelerator (even though
      DirectX recognized it) The Windows Version of 'The 7th guest' worked, though
      while speech worked, there was no music. That's no surprise as the
      internal sound card does not have FM synthesis, it's PCM only!The Windows Version of 'The 11th hour' did not work, It
      complained I had no 'XMIDI' sound, and refused to load.
 Black
        Dahlia installed fine, and worked well, but it seems to access the
      keyboard directly via hardware keycodes, as the keys pressed did not
      appear in game as I expected. I had to practice with save game names to
      figure out how to use the keyboard when needed in games. Leisure Suit
        Larry 7 (Love for Sail) - Installed fine, but Windows95 version
      crashed, Windows 3.1 version worked fine (didn't have any keyshift
      problems either)... I didn't try the Dos version, as it would have
      certainly crashed!... How amazing is this game to have different versions
      supporting THREE operating systems! 
  Key shifts The hardware key codes do not match a western keyboard, but I was able to
      play Blach dahlia fine once I knew the 'shifts' I had to make to
      compensate for the difference. Numbers row, shifted 1 key right (2 presses 1 .... 1 presses esc)Q row, Shifted 0 keys right (Q presses Q)
 A row, Shifted 1 keys right (S presses A)
 Z row, Shifted 3 keys right (V presses Z)
 Space presses .
 Del presses Space
 
 Screenshots 
      
        
          |  The boot screen!
 |  RearGard Graphics are corrupt!
 The VRAM is at a similar address, but the format is totally
            different.
 Notice the Text/Graphics are separate layers.
 |  
          |  Western Eliza works fine!
 This is because it's Text+Keys only, and using MS-DOS calls
 This game was copied from my old PC1512 back in the 80s!
 |  Even the Japanese games are struggling!
 Some interlacing/ screen mode problem!
 |  
          |  Japanese Windows 98 works well, and many western games work fine,
            though my machine has no FM/MIDI card.
 Note, first HDD is A:, and floppy is C: !!
 | 
 |  
          | 
 | 
 |  
          | 
 | 
 |  
   
 
 |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Buy my Assembly programming book
 on Amazon in Print or Kindle!
 
 
  
 
  
 
  
 Available worldwide!
 Search 'ChibiAkumas' on
 your local Amazon website!
 Click here for more info!
 
 
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Buy my Assembly programming book
 on Amazon in Print or Kindle!
 
 
  
 
  
 
  
 Available worldwide!
 Search 'ChibiAkumas' on
 your local Amazon website!
 Click here for more info!
 
 
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Buy my Assembly programming book
 on Amazon in Print or Kindle!
 
 
  
 
  
 
  
 Available worldwide!
 Search 'ChibiAkumas' on
 your local Amazon website!
 Click here for more info!
 
 
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 |