IDE, Memory control & video
===========#==#=======#===============================================#=====
----------------------|IDE Bus |-----
===========#==#=======#===============================================#=====
$FFF00000.W|RW|IDE_DAT|Data Register |
$FFF00005.B|RW|IDE_ERR|Read:Error / Write:Features Register |
$FFF00005 IDE_ERR Error Register (read) / Features (write)
READ - error register, valid when the error bit is set in the
status register at $FFF0001D:
Bit 7 Bad Block Mark
Bit 6 Uncorrectable Error
Bit 5 (reserved)
Bit 4 ID Field Not Found
Bit 3 (reserved)
Bit 2 Command Aborted
Bit 1 Track 0 Not Found
Bit 0 DAM (Data Address Mark) Not Found
WRITE - features register, command specific. Used mainly by
SET FEATURES to enable or disable drive options.
Bit assignments from the Atari Compendium, matching the
standard ATA error register layout.
$FFF00009.B|RW|IDE_SCC|Sector count |
$FFF0000D.B|RW|IDE_SNR|Sector number |
$FFF00011.B|RW|IDE_CYL|Cylinder low |
$FFF00011 and $FFF00015 Cylinder Low / Cylinder High
$FFF00011 Cylinder Low bits 7-0 of the cylinder number
$FFF00015 Cylinder High bits 9-8 of the cylinder number
Together these form the ten bit cylinder number used in CHS
addressing.
In LBA mode the same two registers carry LBA bits 23-8 instead,
with the full eight bits of each used.
From the Atari Compendium, matching the standard ATA layout.
$FFF00015.B|RW|IDE_CYH|Cylinder high |
$FFF00019.B|RW|IDE_H_D|Head/Drive Register |
$FFF00019 IDE_H_D Drive / Head Register
Bit 7 (always 1 on early ATA)
Bit 6 0 = CHS addressing, 1 = LBA addressing
Bit 5 (always 1 on early ATA)
Bit 4 Drive select: 0 = master, 1 = slave
Bits 3-0 Head number, 0-15
In LBA mode bits 3-0 carry LBA bits 27-24 instead of the head
number.
Drive select and head number from the Atari Compendium. The
addressing and reserved bits follow the standard ATA layout.
$FFF0001D.B|RW|IDE_S_C|Read:Status Register/Write:Command Register |
$FFF0001D IDE_S_C Status (read) / Command (write)
READ - status register:
Bit 7 BSY busy, drive owns the registers
Bit 6 DRDY drive ready
Bit 5 DF drive fault
Bit 4 DSC drive seek complete
Bit 3 DRQ data request, drive wants a transfer
Bit 2 CORR corrected data
Bit 1 IDX index
Bit 0 ERR error, see the error register at $FFF00005
Reading this register clears a pending interrupt. Read the
alternate status at $FFF00039 instead when polling, since that
does not clear the interrupt.
WRITE - command register. Writing starts a command using the
values already loaded into the other registers.
CONFLICT: EmuTOS bios/ide.c places status and command at this
offset. The Atari Compendium places them at $FFF0001F and
marks $FFF0001A to $FFF0001D as unused. Every other Compendium
IDE entry agrees with EmuTOS, so $FFF0001D is the more likely
value, but neither has been checked on hardware.
Bit assignments follow the standard ATA status register.
$FFF00039.B|RW|IDE_ALT|Read:Alt Status/Write:Device Control |
$FFF00039 IDE_ALT Alternate Status (read) / Device Control (write)
READ - alternate status. Returns exactly the same bits as the
status register at $FFF0001D, but reading it does NOT clear a
pending interrupt. This is the register to poll with.
WRITE - device control:
Bit 2 SRST software reset
Bit 1 nIEN 1 = disable the drive's interrupt
From the Atari Compendium, which names it Alternate Status on
read and Alternate Command on write, and the standard ATA
layout.
$FFF00042.B|RW| - |Add-on control, not present on stock hardware |*
$FFF00042 and $FFF00044 Add-on control registers
Not present on stock Atari hardware. These sit in the same
address space as the IDE interface above.
Known to be used by: TRUDIE.
TRUDIE also claims $FFF00000 to $FFF00038, which is the IDE
register range itself, and $FFFFFFFF.
Extended bit information is not currently available for these
registers. The addresses are documented; what each bit does is
not.
Checked against EmuTOS: its IDE driver uses a plain ATA
register structure based at $FFF00000 and touches only the
standard offsets. It does not reference $FFF00042 or $FFF00044,
and has no concept of add-on IDE hardware in this range.
$FFF00044.B|RW| - |Add-on control, not present on stock hardware |*
===========#==#=======#===============================================#=====
----------------------|Memory Controller, System Control |-----
===========#==#=======#===============================================#=====
$FFFF8001.B|RW|MEM_CTL|Memory Controller |
$FFFF8001 MEM_CTL Memory Controller Configuration
Bits 3-2 Bank 1 size
Bits 1-0 Bank 0 size
Size encoding, same for both banks:
00 = 128k
01 = 512k
10 = 2M
11 = reserved
A shadow copy of this byte is kept in the system variable
memcntlr at $00000424, validated by memval2 at $0000043A.
Bit assignments from the Atari Compendium.
$FFFF8006.W|RW|SYS_CTL|System Control %MM______ _RS_bB_C |F | | | Monitor Type (M0,M1)--------++ || || | |F | | | Monochrome Monitor----------00 || || | |F | | | RGB Monitor-----------------01 || || | |F | | | VGA Monitor-----------------10 || || | |F | | | TV--------------------------11 || || | |F | | | Reset 0:ignore resetvector------------+| || | |F | | | STE-compatible-I/O 0:off,1:on----------+ || | |F | | | Blitterflag 0:on,1:off-------------------+| | |F | | | Blitterspeed 0:half clock,1:full clock----+ | |F | | | CPUspeed 0:half clock,1:full clock----------+ |F
$FFFF8006 SYS_CTL System Control / Connected Monitor Type
Bits 15-14, monitor type:
0 = Atari monochrome
1 = Atari colour (RGB)
2 = VGA colour
3 = television
Bit 9 Reset: 0 = ignore reset vector
Bit 8 STE compatible I/O: 0 = off, 1 = on
Bit 6 Blitter flag: 0 = on, 1 = off
Bit 5 Blitter speed: 0 = half clock, 1 = full clock
Bit 3 CPU speed: 0 = half clock, 1 = full clock
Monitor bits confirmed by Atari TOS 4.04, which tests
(byte >> 6) & 3 == 0 to detect a monochrome monitor, and by
the Atari Compendium value table.
Falcon only. On earlier machines monitor detection is through
MFP GPIP bit 7 at $FFFFFA01.
$FFFF8007.B|RW|SYS_FBC|Falcon Bus Control %_SB_BS__ |F | | | Start type 0:cold,1:warm-------------+||||||| | | | | STe Bus emulation 0:on,1:off----------+|||||| | | | | Blitter control 0:on,1:off--------------+|||| | | | | Blitter speed 0:8MHz,1:16MHz-------------+||| | | | | CPU speed 0:8MHz,1:16MHz--------------------+ | | | | Verified: EmuTOS bios/machine.c documents all | | | | five bits and writes $25 (STe bus emulation | | | | off, 16MHz blitter and CPU). Atari TOS | | | | 3.06/4.04 bios/startup.S writes the same $25. |
$FFFF8007 SYS_FBC Falcon Bus Control
Bit 6 Start type: 0 = cold start, 1 = warm start
Bit 5 STe Bus emulation: 0 = on, 1 = off
Bit 3 Blitter control: 0 = on, 1 = off
Bit 2 Blitter speed: 0 = 8MHz, 1 = 16MHz
Bit 0 CPU speed: 0 = 8MHz, 1 = 16MHz
STe bus emulation has to be switched off for bus-error based
hardware detection to work on the Falcon.
EmuTOS bios/machine.c documents all five bits and writes $25,
setting STe bus emulation off with 16MHz blitter and CPU.
Atari TOS 3.06/4.04 bios/startup.S writes the same $25 and
tests bit 6.
Falcon only.
===========#==#=======#===============================================#=====
----------------------|DMA, VIDEL Controller |-----
===========#==#=======#===============================================#=====
$FFFF8201.B|RW|VDL_VBH|Video Base Hi |
$FFFF8201 / $FFFF8203 / $FFFF820D Video Base Address
Three byte registers holding the screen memory address:
$FFFF8201 bits 23-16, high
$FFFF8203 bits 15-8, middle
$FFFF820D bits 7-0, low (STE and Falcon only)
On the ST and Mega ST only the high and middle bytes exist, so
the screen base must be on a 256 byte boundary. The STE added
the low byte, allowing any even address.
Bit 0 of the low byte is ignored; the address is always even.
The current value is shadowed in the system variable
_v_bas_ad at $0000044E. Changing the base takes effect at the
next vertical blank, or immediately if written during one.
From the Atari Compendium.
$FFFF8203.B|RW|VDL_VBM|Video Base Mi |
$FFFF8205.B|Rw|VDL_VCH|Video Count Hi |
$FFFF8205 / $FFFF8207 / $FFFF8209 Video Address Counter
Three byte registers holding the address the shifter is
currently reading from:
$FFFF8205 bits 23-16, high
$FFFF8207 bits 15-8, middle
$FFFF8209 bits 7-0, low
The Atari Compendium marks all three read only, though the
wiki listing shows them as Rw. Writing them is not useful.
Reading these during display gives the shifter's position in
screen memory, which is how raster-timed effects work out where
the beam is. The three bytes are not read atomically, so the
counter can advance between reads.
From the Atari Compendium.
$FFFF8207.B|Rw|VDL_VCM|Video Count Mi |
$FFFF8209.B|Rw|VDL_VCL|Video Count Lo %xxxxxxx_ |
$FFFF820A.B|RW|VDL_SYM|Sync mode %______VS | | | | Vfrequency 0:60hz(NTSC),1:50Hz(PAL)--------+| | | | | Sync 0:internal,1:external------------------+ |
$FFFF820A VDL_SYM Video Shifter Sync Mode
Bit 1 Vertical frequency: 0 = 60Hz (NTSC), 1 = 50Hz (PAL)
Bit 0 Sync source: 0 = internal, 1 = external
Setting bit 0 stops the shifter generating its own sync and
makes it follow an external signal. This is the register used
for the classic sync-switching border removal tricks: writing
it at a precise point in the scanline makes the shifter miss
the border, opening the display area.
Bit assignments from the Atari Compendium.
$FFFF820D.B|RW|VDL_VBL|Video Base Lo %xxxxxxx_ |STE,F
$FFFF820E.B|RW|VDL_LOF|Line Offset |STE,F
$FFFF820E and $FFFF820F Line Offset and Line Width
$FFFF820E Line Offset. Number of extra words to skip at the
end of each scanline. STE and Falcon.
$FFFF820F Line Width, in words, minus one.
Together these let the shifter display a window onto a screen
buffer wider than the visible display, which is how the STE
does hardware horizontal scrolling.
On the Falcon the line width is a word value at $FFFF8210
instead, and is NOT minus one.
Note: writing the horizontal scroll low byte at $FFFF8265
clears the line width register. Set the width after the scroll,
not before.
$FFFF820E is not listed in the Atari Compendium; $FFFF820F is,
described as scanline width in words minus one.
$FFFF820F.B|RW| - |Line Width-1 |STE
$FFFF8210.W|RW|VDL_LWD|Line Width in Words %______xx xxxxxxxx |F
$FFFF8240.W|RW|VDL_STC|ST Palette Register 00 %____rRRR gGGGbBBB |
$FFFF8240 to $FFFF825E ST/STE Palette Registers 0-15
Word registers, one per palette entry.
ST layout: XXXX XRRR XGGG XBBB (3 bits per gun, 512
colours)
STE layout: XXXX RRRR GGGG BBBB (4 bits per gun, 4096
colours)
IMPORTANT: on the STE the four bits within each nibble are NOT
in natural order. The bit arrangement per nibble is 0-3-2-1.
The extra bit the STE adds is placed at the TOP of the nibble
rather than the bottom, so that an ST program writing only the
lower three bits still produces the same colour it would on an
ST. Reading an STE palette value as a plain 4 bit number gives
the wrong intensity.
Hatari masks writes to $0777 on an ST and $0FFF on an STE.
Some games write $FFFF and read the value back to detect
whether they are running on an STE.
These registers are simulated for compatibility on the TT and
Falcon, which have their own wider palettes at $FFFF8400 and
$FFFF9800.
Layout and nibble ordering from the Atari Compendium, masking
behaviour from Hatari src/video.c.
...........|RW| - |...................... |
$FFFF825E.W|RW| - |ST Palette Register 15 |
$FFFF8260.B|RW|VDL_SSM|ST-Shift-Mode %_____xxx | | | | 320*200*4---------------------------------000 | | | | 640*200*2---------------------------------001 | | | | 640*400*1---------------------------------010 |
$FFFF8260 VDL_SSM ST Video Shifter Mode
Bits 1-0 resolution
00 = 320x200, 4 planes (low)
01 = 640x200, 2 planes (medium)
10 = 640x400, 1 plane (high)
11 = reserved
The TT modes were previously listed here. Atari uses a separate
TT shifter register at $FFFF8262.
A shadow copy of the current value is kept in the system
variable sshiftmd at $0000044C.
Writing 11 is not a documented mode. On real hardware it
produces the same output as one of the other modes rather than
anything useful; neither Atari TOS nor EmuTOS ever writes it.
Bit assignments from the Atari Compendium and Atari TOS
bios/startup.S.
===========#==#=======#===============================================#=====
$FFFF8262.B|RW|VDL_TSM|TT-Shift-Mode %_____xxx |TT | | | ST low 320*200*4----------------------000 |TT | | | ST medium 640*200*2----------------------001 |TT | | | ST high 640*400*1----------------------010 |TT | | | (Falcon rez marker)-----------------------011 |TT | | | TT medium 640*480*4----------------------100 |TT | | | (unused)----------------------------------101 |TT | | | TT high 1280*960*1----------------------110 |TT | | | TT low 320*480*8----------------------111 |TT
$FFFF8262 VDL_TSM TT Video Shifter Mode
Word register. The byte at $FFFF8262 is the high half:
Bit 7 Special video mode
Bit 4 Special video mode
Bits 2-0 resolution
000 = 320x200, 4 planes ST low
001 = 640x200, 2 planes ST medium
010 = 640x400, 1 plane ST high
011 = (Falcon rez marker)
100 = 640x480, 4 planes TT medium
101 = (unused)
110 = 1280x960, 1 plane TT high
111 = 320x480, 8 planes TT low
The byte at $FFFF8263 is the low half and holds the ST Palette
Bank, selecting which 16 entry bank of the 256 entry TT palette
the ST compatible palette registers map onto.
The two special video mode bits are named Smear Mode and Hyper
Mono Mode by the Atari Compendium. CHECK: which name goes with
which bit is not certain from the available sources. Hatari
masks both together as 0x90 without naming them individually.
Atari TOS 3.06 bios/startup.S declares this register as
shift_tt and defines TTMED=4, TTHIGH=6, TTLOW=7. When the
resolution is 2 or lower, Hatari mirrors the value into
$FFFF8260 so the ST shifter register stays consistent.
Resolution values from Atari TOS source, bit positions from
Hatari src/video.c, names from the Atari Compendium.
===========#==#=======#===============================================#=====
$FFFF8264.B|RW|VDL_HSH|H-Scroll Hi %____xxxx |F
$FFFF8264 and $FFFF8265 Horizontal Scroll
$FFFF8264 Bits 3-0, scroll amount, no side effect
$FFFF8265 Bits 3-0, scroll amount, ALSO clears line width
Both hold a pixel scroll offset of 0 to 15. Writing $FFFF8265
additionally clears the line width register at $FFFF820F, so
the two must be written in the right order: scroll first, then
width.
$FFFF8264 exists to allow the scroll to be changed without
disturbing the width. It is Falcon only.
$FFFF8265 is documented in the Atari Compendium as the
Horizontal Scroll Register. $FFFF8264 is not listed there.
$FFFF8265.B|RW|VDL_HSL|H-Scroll Lo - clears Line Width %____xxxx |STE,F
$FFFF8266.W|RW|VDL_FSM|Falcon Shift Mode %_____2OT _HV8PPPP |F | | | 2 Color mode 0:off,1:on----------+|| ||||||| |F | | | Overlay mode 0:off,1:on-----------+| ||||||| |F | | | True(high) color 0:off,1:on--------+ ||||||| |F | | | Hsync 0:internal,1:external-----------+|||||| |F | | | Vsync 0:internal,1:external------------+||||| |F | | | 8 Bitplanes 0:off,1:on------------------+|||| |F | | | falcon Palette 16 of 256 colors----------++++ |F
$FFFF8266 VDL_FSM SPSHIFT / Falcon Shift Mode
Bit 10 Enable 2-colour mode
Bit 8 Enable truecolor mode
Bit 6 Use external HSYNC
Bit 5 Use external VSYNC
Bit 4 Enable bitplane mode (8 bitplanes)
Bits 3-0 Falcon palette bank, 16 of 256 colours
Bit 9 is the overlay mode bit.
Only one of the mode bits should be set at a time. Truecolor
mode takes the pixel value straight to the DAC and ignores the
palette entirely.
Atari TOS 4.04 (tos3x bios/vsetmode.c) writes $0100 to select
truecolor and $0010 to select 8 bitplane mode, confirming bits
8 and 4.
Bit meanings from the Atari Compendium, confirmed against
Atari TOS 4.04 and EmuTOS.
$FFFF827E.B|RW|STY_DSP|STACY Display State |STB | | | UNVERIFIED: Atari Compendium only. Not | | | | referenced by EmuTOS or any available TOS | | | | source. |
$FFFF827E STY_DSP STACY Display State
Bit 1 1 = backlight off
Bit 0 1 = display off
STACY only, the portable ST. Rare hardware.
UNVERIFIED: Atari Compendium only. Not referenced by EmuTOS,
Hatari or any available TOS source.
$FFFF8280.W|RW|VDL_HHC|Horizontal Hold Counter %_______x xxxxxxxx |F
$FFFF8280 to $FFFF82AC VIDEL Timing Registers
These define the video timing directly, replacing the fixed
timings the ST shifter used. All are word registers, Falcon
only.
Horizontal, in pixel clocks unless noted:
$FFFF8280 Horizontal Hold Counter
$FFFF8282 Horizontal Hold Timer
$FFFF8284 Horizontal Border Begin
$FFFF8286 Horizontal Border End
$FFFF8288 Horizontal Display Begin (bit 8 selects which
half line the display starts on)
$FFFF828A Horizontal Display End
$FFFF828C Horizontal Sync Start
$FFFF828E Horizontal FS
$FFFF8290 Horizontal EE
Vertical, in half lines:
$FFFF82A0 Vertical Frequency Counter
$FFFF82A2 Vertical Frequency Timer
$FFFF82A4 Vertical Border Begin
$FFFF82A6 Vertical Border End
$FFFF82A8 Vertical Display Begin
$FFFF82AA Vertical Display End
$FFFF82AC Vertical Sync Start
The FS and EE registers are only used when bit 3 of the video
control register is clear.
Atari TOS 4.04 (tos3x bios/vsetmode.c) and EmuTOS both write
this whole block as a table of values per video mode rather
than computing them, so the exact meaning of each field is
best understood from those mode tables.
Names from the Atari Compendium; register set confirmed
against Atari TOS 4.04 and EmuTOS bios/videl.c.
$FFFF8282.W|RW|VDL_HHT|Horizontal Hold Timer %_______x xxxxxxxx |F
$FFFF8284.W|RW|VDL_HBB|Horizontal Border Begin %_______x xxxxxxxx |F
$FFFF8286.W|RW|VDL_HBE|Horizontal Border End %_______x xxxxxxxx |F
$FFFF8288.W|RW|VDL_HDB|Horizontal Display Begin %______Hx xxxxxxxx |F
| | | 0:1.Halfline, 1:2.Halfline--------+ |F
$FFFF828A.W|RW|VDL_HDE|Horizontal Display End %_______x xxxxxxxx |F
$FFFF828C.W|RW|VDL_HSS|Horizontal Sync Start %_______x xxxxxxxx |F
$FFFF828E.W|RW|VDL_HFS|Horizontal FS %_______x xxxxxxxx |F
$FFFF8290.W|RW|VDL_HEE|Horizontal EE %_______x xxxxxxxx |F
$FFFF82A0.W|RW|VDL_VFC|Vertical Frequency Counter %_____xxx xxxxxxxx |F
$FFFF82A2.W|RW|VDL_VFT|Vertical Frequency Timer %_____xxx xxxxxxxx |F
$FFFF82A4.W|RW|VDL_VBB|Vertical Border Begin %_____xxx xxxxxxxx |F
$FFFF82A6.W|RW|VDL_VBE|Vertical Border End %_____xxx xxxxxxxx |F
$FFFF82A8.W|RW|VDL_VDB|Vertical Display Begin %_____xxx xxxxxxxx |F
$FFFF82AA.W|RW|VDL_VDE|Vertical Display End %_____xxx xxxxxxxx |F
$FFFF82AC.W|RW|VDL_VSS|Vertical Sync Start %_____xxx xxxxxxxx |F
$FFFF82C0.W|RW|VDL_VCT|Video Control %_______O BHVUSCMM |F | | | h-base-Offset 0:128cyc,1:64cyc-----+ |||||||| |F | | | Buswide 0:16bit,1:32bit--------------+||||||| |F | | | Hsync 0:negative,1:positive-----------+|||||| |F | | | Vsync 0:negative,1:positive------------+||||| |F | | | Use FS & EE 0:on,1:off------------------+|||| |F | | | 15 halfline hSyncs at VBB----------------+||| |F | | | video Clock 0:32Mhz,1:25.175Mhz-----------+|| |F | | | Monitor 0:Mono,1:RGB,2:VGA,3:TV------------++ |F | | | NAMING CHECK: TOS 4.04 (tos3x vsetmode.c) and |F | | | EmuTOS write video_control to $82C2 and |F | | | video_clock to $82C0 - the reverse of these |F | | | two labels. Addresses/bits correct either way.|F
$FFFF82C0 VDL_VCT Video Control
Bit 8 h-base offset: 0 = 128 cycles, 1 = 64 cycles
Bit 7 Bus width: 0 = 16 bit, 1 = 32 bit
Bit 6 HSYNC polarity: 0 = negative, 1 = positive
Bit 5 VSYNC polarity: 0 = negative, 1 = positive
Bit 4 Use FS and EE registers: 0 = on, 1 = off
Bit 3 15 half-line HSYNCs at vertical border begin
Bit 2 Video clock: 0 = 32MHz, 1 = 25.175MHz
Bits 1-0 Monitor: 0 = mono, 1 = RGB, 2 = VGA, 3 = TV
EmuTOS writes $0080 for monochrome, $0186 for VGA, and
$0181 or $0183 for RGB and television. Decoding those confirms
the monitor field, the clock bit set only for VGA, and the bus
width bit always set.
NAMING CHECK: Atari TOS 4.04 (tos3x bios/vsetmode.c) writes
video_control to $FFFF82C2 and video_clock to $FFFF82C0, and
EmuTOS uses the same naming. That is the reverse of the labels
used on this page. The addresses and bit layouts are confirmed
correct by both sources; only the names may be swapped.
This address is NOT listed in the Atari Compendium at all,
which only documents $FFFF82C2. That may itself be a clue to
the naming question.
Bit assignments confirmed against Atari TOS 4.04 and EmuTOS
bios/videl.c.
$FFFF82C2.W|RW|VDL_VMD|Video Mode %________ ____xxID |F | | | Pixclock:4,Divider:4(VGA)/16(STE)/4------00|| |F | | | Pixclock:2,Divider:2(VGA)/16(STE)/2------01|| |F | | | Pixclock:1,Divider:2(VGA)/16(STE)/1------10|| |F | | | (unused)---------------------------------11|| |F | | | Interlace 0:off,1:on-----------------------+| |F | | | Double Scan 0:off,1:on----------------------+ |F
$FFFF82C2 VDL_VMD VCO / Video Mode
Bit 3 Quarter pixel width
Bit 2 Halve pixel width
Bit 1 Interlace mode
Bit 0 Line doubling
Bits 3-2 together give the pixel clock divider:
00 = full width (divider 4 on VGA, 16 on STE)
01 = half width (divider 2 on VGA, 16 on STE)
10 = quarter width(divider 2 on VGA, 16 on STE)
11 = not used, never written by TOS or EmuTOS
Line doubling and interlace are mutually exclusive: line
doubling is used on VGA to display a 200 line mode at 400
lines, interlace on television output.
NAMING CHECK: Atari TOS 4.04 (tos3x bios/vsetmode.c) writes
video_control to $FFFF82C2 and video_clock to $FFFF82C0, and
EmuTOS uses the same naming. That is the reverse of the labels
used on this page. The addresses and bit layouts are confirmed
correct by both sources; only the register names may be the
wrong way round.
Bit assignments from the Atari Compendium, confirmed against
Atari TOS 4.04 and EmuTOS.
===========#==#=======#===============================================#=====
----------------------|TT Palette Registers |-----
===========#==#=======#===============================================#=====
$FFFF8400.W|RW|TT__PAL|TT Palette Register 000 |TT
$FFFF8400 to $FFFF85FE TT Palette Registers 0-255
Word registers, one per palette entry, 256 entries.
Layout: XXXX RRRR GGGG BBBB
Unlike the ST and STE registers at $FFFF8240, each nibble here
is in natural order, 3-2-1-0. There is no compatibility
reordering.
The ST compatible palette registers at $FFFF8240 map onto a
16 entry bank of this palette, selected by the ST Palette Bank
field in the low byte of $FFFF8262.
TT only.
Layout from the Atari Compendium.
...........|RW| - |....................... |TT
$FFFF85FE.W|RW| - |TT Palette Register 255 |TT
===========#==#=======#===============================================#=====
----------------------|VIDEL Palette Register |-----
===========#==#=======#===============================================#=====
$FFFF9800.L|RW|VDL_PAL|Palette Register 000 %RRRRRR__ GGGGGG__ |F
$FFFF9800 to $FFFF98FC VIDEL Palette Registers 0-255
Longword registers, one per palette entry, 256 entries.
Layout, across the four bytes of each longword:
Byte 0 RRRRRR-- red, 6 bits
Byte 1 GGGGGG-- green, 6 bits
Byte 2 -------- unused
Byte 3 BBBBBB-- blue, 6 bits
Six bits per gun, so 262144 possible colours, of which 256 can
be displayed at once. The low two bits of each byte are unused
and read back as zero.
Falcon only. Ignored entirely in truecolor mode, where the
pixel value goes straight to the DAC.
Layout from the Atari Compendium.
...........|RW| - |.................... ________ BBBBBB__ |F
$FFFF98FC.L|RW| - |Palette Register 255 |F
===========#==#=======#===============================================#=====
----------------------|DMA, Blitter |-----
===========#==#=======#===============================================#=====
$FFFF8A00.W|RW|BLT_HTR|Halftone-RAM 00 |BLT
$FFFF8A00 to $FFFF8A1E Blitter Halftone RAM
Sixteen word registers, one per halftone line.
Which word is used for a given blit line is chosen by the
halftone line number in bits 3-0 of the control register at
$FFFF8A3C, or by source bits 0-3 when the SMUDGE bit is set.
The halftone word feeds the halftone operation at $FFFF8A3A,
which in turn feeds the logical operation at $FFFF8A3B.
Verified against Hatari src/blitter.c.
...........|RW| - |............... |BLT
$FFFF8A1E.W|RW| - |Halftone-RAM 15 |BLT
$FFFF8A20.W|RW|BLT_SXI|Source X increment %xxxxxxxx xxxxxxx_ |BLT
$FFFF8A20 / $FFFF8A22 / $FFFF8A2E / $FFFF8A30 Increments
$FFFF8A20 Source X increment
$FFFF8A22 Source Y increment
$FFFF8A2E Destination X increment
$FFFF8A30 Destination Y increment
All four are signed word values in BYTES, added to the current
address as the blit proceeds.
X increment is added after each word within a line. Y increment
is added at the end of each line, and is applied INSTEAD of the
final X increment, not in addition to it.
Bit 0 is ignored in all four: the blitter works in words, so
increments are always even. Negative values are allowed and are
how downward or right-to-left blits are done, which matters for
overlapping copies.
Verified against Hatari src/blitter.c.
$FFFF8A22.W|RW|BLT_SYI|Source Y increment %xxxxxxxx xxxxxxx_ |BLT
$FFFF8A24.L|RW|BLT_SRC|Source Address %xxxxxxxx xxxxxxxx xxxxxxx_ |BLT
$FFFF8A24 and $FFFF8A32 Source and Destination Address
$FFFF8A24 Source address, longword
$FFFF8A32 Destination address, longword
Both are 24 bit addresses held in a longword. The Atari
Compendium notes that bits 7-0 of the first byte are bits
23-16 of the address, which is the usual 68000 24 bit layout.
Bit 0 is ignored; addresses are always even.
These registers ADVANCE during a blit. After the operation
completes they hold the address just past the last word
transferred, not the value originally written, so they must be
reloaded for each new blit.
Verified against Hatari src/blitter.c.
$FFFF8A28.W|RW|BLT_EM1|Endmask 1 |BLT
$FFFF8A28 / $FFFF8A2A / $FFFF8A2C Endmasks
$FFFF8A28 Endmask 1, applied to the FIRST word of each line
$FFFF8A2A Endmask 2, applied to all MIDDLE words
$FFFF8A2C Endmask 3, applied to the LAST word of each line
Each is a 16 bit mask. Where a mask bit is 1 the result is
written; where it is 0 the destination is left alone.
Endmask 2 is normally $FFFF. Endmasks 1 and 3 are used to clip
a blit to a pixel boundary within the first and last words.
IMPORTANT: whenever a mask is not all ones, the blitter must
read the destination before writing it, turning the operation
into a read-modify-write and roughly halving throughput. Atari
documentation states NFSR can also trigger this; Hatari's
authors state that is wrong and only the mask does.
If a line is only one word wide, endmask 1 and endmask 3 are
ANDed together and endmask 2 is not used.
Verified against Hatari src/blitter.c.
$FFFF8A2A.W|RW|BLT_EM2|Endmask 2 |BLT
$FFFF8A2C.W|RW|BLT_EM3|Endmask 3 |BLT
$FFFF8A2E.W|RW|BLT_DXI|Destination X increment %xxxxxxxx xxxxxxx_ |BLT
$FFFF8A30.W|RW|BLT_DYI|Destination Y increment %xxxxxxxx xxxxxxx_ |BLT
$FFFF8A32.L|RW|BLT_DST|Destination Adr. %xxxxxxxx xxxxxxxx xxxxxxx_ |BLT
$FFFF8A36.W|RW|BLT_WPL|Words per Line in BOB (0:65536)|BLT
$FFFF8A36 and $FFFF8A38 X Count and Y Count
$FFFF8A36 X count, words per line
$FFFF8A38 Y count, number of lines
A value of 0 means 65536, not zero.
Y count is the register the blitter decrements as it works.
When it reaches 0 the transfer is complete and the busy bit in
$FFFF8A3C clears. Reading Y count during a blit shows how many
lines remain.
X count is reloaded at the start of each line.
The Atari Compendium calls these BLiTTER X Count and Y Count.
This listing calls them Words per Line and Lines per BOB;
they are the same registers.
Quirk: with x count = 1 and NFSR set, real STE and Falcon
hardware produce results that depend on the sign of the source
X increment.
Verified against Hatari src/blitter.c.
$FFFF8A38.W|RW|BLT_LPB|Lines per BOB (0:65536)|BLT
$FFFF8A3A.B|RW|BLT_HTO|Halftone Operation %______xx |BLT | | | 0:set all Bits, 1:HTR, 2:SRC, 3:SRC & HTR |BLT
$FFFF8A3A BLT_HTO Halftone Operation, bits 1-0
0 all ones ($FFFF)
1 halftone RAM word
2 source word
3 source word AND halftone RAM word
HOP runs first, LOP second. The HOP result is what the logical
operation sees as its "source" input.
Verified against Hatari src/blitter.c.
$FFFF8A3B.B|RW|BLT_LGO|Logical Operation %____xxxx |BLT | | | (!S AND !D)------------------------------+||| |BLT | | | (!S AND D)-------------------------------+|| |BLT | | | ( S AND !D)--------------------------------+| |BLT | | | ( S AND D)---------------------------------+ |BLT
$FFFF8A3B BLT_LGO Logical Operation, bits 3-0
S = output of the halftone operation above
D = current destination word
$0 all zeros $8 NOT S AND NOT D (NOR)
$1 S AND D $9 NOT (S XOR D) (NXOR)
$2 S AND NOT D $A NOT D
$3 S $B S OR NOT D
$4 NOT S AND D $C NOT S
$5 D $D NOT S OR D
$6 S XOR D $E NOT (S AND D) (NAND)
$7 S OR D $F all ones
The register takes a value 0-15 selecting one of sixteen
operations, not just the four AND combinations shown above.
Verified against Hatari src/blitter.c.
$FFFF8A3C.B|RW|BLT_LNM|Line Number %BHS_xxxx |BLT | | | Busy (1:start Blitter)---------------+|| |||| |BLT | | | HOG (1:stop CPU when Busy)------------+| |||| |BLT | | | SMUDGE (use sourcebits 0-3 as HTR num)-+ |||| |BLT | | | Halftone-RAM number----------------------++++ |BLT
$FFFF8A3C BLT_LNM Control, %BHS_nnnn
Bit 7 BUSY write 1 to start the blitter. Reads 1 while a
transfer is in progress, cleared when y count
reaches 0.
Bit 6 HOG 0 = share the bus with the CPU, 1 = take the
bus for the whole transfer.
Bit 5 SMUDGE use source bits 0-3 as the halftone line
number instead of bits 3-0 of this register.
Bit 4 unused. Hardware masks this bit off on write.
Bits 3-0 halftone line number, 0-15.
In non-hog mode the blitter runs for 64 bus accesses, then
hands the bus to the CPU for 64. Writing 0 to bit 7 while the
CPU owns the bus pauses the blitter; writing 1 resumes it.
Pausing does not end the transfer, and busy still reads 1.
Quirk: in non-hog mode the blitter sometimes uses only 63 bus
accesses rather than 64, if the CPU makes a bus access during
the 4-cycle latency after the busy bit is set.
Verified against Hatari src/blitter.c.
$FFFF8A3D.B|RW|BLT_SKW|SKEW %FN__xxxx |BLT | | | FXSR (Force eXtra Source Read)-------+| |||| |BLT | | | NFSR (No Final Source Read)-----------+ |||| |BLT | | | SKEW (shift)-----------------------------++++ |BLT
$FFFF8A3D BLT_SKW Skew, %FN__nnnn
Bit 7 FXSR Force eXtra Source Read
Bit 6 NFSR No Final Source Read
Bits 5-4 unused
Bits 3-0 skew, 0-15 pixels
Read-modify-write happens whenever an endmask is not all ones.
Atari's own documentation states NFSR can also trigger this;
Hatari's authors state that is wrong and only the mask does.
Quirk: with x count = 1 and NFSR set, real STE and Falcon
hardware produce results that depend on whether the source X
increment is positive or negative.
Verified against Hatari src/blitter.c.