src/mess/machine/a2themill.c
| r15065 | r15066 | |
| 4 | 4 | |
| 5 | 5 | Implementation of the Stellation Two The Mill 6809 card |
| 6 | 6 | |
| 7 | | OS9 requires this add-on be implemented: |
| 8 | | http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Interface%20Cards/CPU/Stellation%20Two%20The%20Mill%20-%206809/Photos/Stellation%20Two%20The%20Mill%20OS9%20ROM%20Interface%20Rev.%20A%20-%20Front.jpg |
| 7 | The OS9 add-on changes the address mapping as follows: |
| 8 | 6809 0x0000-0xafff -> 6502 0x1000-0xbfff |
| 9 | 6809 0xb000-0xdfff -> 6502 0xd000-0xffff |
| 10 | 6809 0xe000-0xefff -> 6502 0xc000-0xcfff |
| 11 | 6809 0xf000-0xffff -> 6502 0x0000-0x0fff |
| 9 | 12 | |
| 10 | | but the chip numbers are unclear, and it may also require a ROM. |
| 13 | (reference: http://mirrors.apple2.org.za/ground.icaen.uiowa.edu/MiscInfo/Hardware/mill.6809 ) |
| 11 | 14 | |
| 12 | | Excel Flex requires a ROM in the on-board socket which is not dumped :( |
| 13 | | |
| 15 | ProDOS "Stellation The Mill Disk.po" requires Mill in slot 2; boot |
| 16 | the disc and type "-DEMO1" and press Enter to launch the simple demo. |
| 17 | |
| 18 | The OS9 disk image available around the internet seems to be bad - the |
| 19 | 6809 boot vector is 0x4144 which maps to 6502 0x5144 and there's all |
| 20 | zeros from 6502 1000-7fff. There is valid 6809 code from 9000-BFFF |
| 21 | at the point where it wants to boot the 6809, but I don't know what |
| 22 | is supposed to be the entry point. |
| 23 | |
| 14 | 24 | *********************************************************************/ |
| 15 | 25 | |
| 16 | 26 | #include "a2themill.h" |
| r15065 | r15066 | |
| 86 | 96 | set_a2bus_device(); |
| 87 | 97 | |
| 88 | 98 | save_item(NAME(m_bEnabled)); |
| 89 | | save_item(NAME(m_FirstBoot)); |
| 90 | 99 | save_item(NAME(m_flipAddrSpace)); |
| 100 | save_item(NAME(m_6809Mode)); |
| 91 | 101 | save_item(NAME(m_status)); |
| 92 | 102 | } |
| 93 | 103 | |
| r15065 | r15066 | |
| 95 | 105 | { |
| 96 | 106 | m_bEnabled = false; |
| 97 | 107 | m_6502space = NULL; |
| 98 | | m_FirstBoot = true; |
| 99 | 108 | m_flipAddrSpace = false; |
| 109 | m_6809Mode = false; |
| 100 | 110 | m_status = 0xc0; // OS9 loader relies on this |
| 101 | 111 | device_set_input_line(m_6809, INPUT_LINE_HALT, ASSERT_LINE); |
| 102 | 112 | device_set_input_line(m_6809, INPUT_LINE_RESET, ASSERT_LINE); |
| r15065 | r15066 | |
| 235 | 245 | { |
| 236 | 246 | if (m_6502space) |
| 237 | 247 | { |
| 238 | | if (m_flipAddrSpace) |
| 248 | if (m_6809Mode) |
| 239 | 249 | { |
| 240 | | return m_6502space->read_byte(offset^0x8000); |
| 250 | if (offset <= 0xafff) |
| 251 | { |
| 252 | return m_6502space->read_byte(offset+0x1000); |
| 253 | } |
| 254 | else if (offset <= 0xbfff) |
| 255 | { |
| 256 | return m_6502space->read_byte((offset&0xfff) + 0xd000); |
| 257 | } |
| 258 | else if (offset <= 0xcfff) |
| 259 | { |
| 260 | return m_6502space->read_byte((offset&0xfff) + 0xe000); |
| 261 | } |
| 262 | else if (offset <= 0xdfff) |
| 263 | { |
| 264 | return m_6502space->read_byte((offset&0xfff) + 0xf000); |
| 265 | } |
| 266 | else if (offset <= 0xefff) |
| 267 | { |
| 268 | return m_6502space->read_byte((offset&0xfff) + 0xc000); |
| 269 | } |
| 270 | else // 6809 Fxxx -> 6502 ZP |
| 271 | { |
| 272 | return m_6502space->read_byte(offset&0xfff); |
| 273 | } |
| 241 | 274 | } |
| 242 | 275 | else |
| 243 | 276 | { |
| 244 | | return m_6502space->read_byte(offset); |
| 277 | if (m_flipAddrSpace) |
| 278 | { |
| 279 | return m_6502space->read_byte(offset^0x8000); |
| 280 | } |
| 281 | else |
| 282 | { |
| 283 | return m_6502space->read_byte(offset); |
| 284 | } |
| 245 | 285 | } |
| 246 | 286 | } |
| 247 | 287 | |
| r15065 | r15066 | |
| 257 | 297 | { |
| 258 | 298 | if (m_6502space) |
| 259 | 299 | { |
| 260 | | if (m_flipAddrSpace) |
| 300 | if (m_6809Mode) |
| 261 | 301 | { |
| 262 | | m_6502space->write_byte(offset^0x8000, data); |
| 302 | if (offset <= 0xafff) |
| 303 | { |
| 304 | m_6502space->write_byte(offset+0x1000, data); |
| 305 | } |
| 306 | else if (offset <= 0xbfff) |
| 307 | { |
| 308 | m_6502space->write_byte((offset&0xfff) + 0xd000, data); |
| 309 | } |
| 310 | else if (offset <= 0xcfff) |
| 311 | { |
| 312 | m_6502space->write_byte((offset&0xfff) + 0xe000, data); |
| 313 | } |
| 314 | else if (offset <= 0xdfff) |
| 315 | { |
| 316 | m_6502space->write_byte((offset&0xfff) + 0xf000, data); |
| 317 | } |
| 318 | else if (offset <= 0xefff) |
| 319 | { |
| 320 | m_6502space->write_byte((offset&0xfff) + 0xc000, data); |
| 321 | } |
| 322 | else // 6809 Fxxx -> 6502 ZP |
| 323 | { |
| 324 | m_6502space->write_byte(offset&0xfff, data); |
| 325 | } |
| 263 | 326 | } |
| 264 | 327 | else |
| 265 | 328 | { |
| 266 | | m_6502space->write_byte(offset, data); |
| 329 | if (m_flipAddrSpace) |
| 330 | { |
| 331 | m_6502space->write_byte(offset^0x8000, data); |
| 332 | } |
| 333 | else |
| 334 | { |
| 335 | m_6502space->write_byte(offset, data); |
| 336 | } |
| 267 | 337 | } |
| 268 | 338 | } |
| 269 | 339 | } |