mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Implements the C010 read value.
This commit is contained in:
parent
558b96bc05
commit
3aeb4213fe
@ -85,6 +85,7 @@ template <bool is_iie> class ConcreteMachine:
|
|||||||
std::vector<uint8_t> rom_;
|
std::vector<uint8_t> rom_;
|
||||||
std::vector<uint8_t> character_rom_;
|
std::vector<uint8_t> character_rom_;
|
||||||
uint8_t keyboard_input_ = 0x00;
|
uint8_t keyboard_input_ = 0x00;
|
||||||
|
bool key_is_down_ = false;
|
||||||
|
|
||||||
Concurrency::DeferringAsyncTaskQueue audio_queue_;
|
Concurrency::DeferringAsyncTaskQueue audio_queue_;
|
||||||
Audio::Toggle audio_toggle_;
|
Audio::Toggle audio_toggle_;
|
||||||
@ -149,17 +150,12 @@ template <bool is_iie> class ConcreteMachine:
|
|||||||
2000 to 4000 : the graphics screen, which can be configured to write to auxiliary RAM
|
2000 to 4000 : the graphics screen, which can be configured to write to auxiliary RAM
|
||||||
c100 to d000 : can be used to page an additional 3.75kb of ROM, replacing the IO area
|
c100 to d000 : can be used to page an additional 3.75kb of ROM, replacing the IO area
|
||||||
c300 to c400 : can contain the same 256-byte segment of the ROM as if the whole IO area were switched, but while leaving cards visible in the rest
|
c300 to c400 : can contain the same 256-byte segment of the ROM as if the whole IO area were switched, but while leaving cards visible in the rest
|
||||||
|
c800 to d000 : can contain ROM separately from the region below c800
|
||||||
|
|
||||||
If dealt with as individual blocks in the inner loop, that would therefore imply mapping
|
If dealt with as individual blocks in the inner loop, that would therefore imply mapping
|
||||||
an address to one of 12 potential pageable zones. So I've gone reductive and surrendered
|
an address to one of 13 potential pageable zones. So I've gone reductive and surrendered
|
||||||
to paging every 6502 page of memory independently. It makes the paging events more expensive,
|
to paging every 6502 page of memory independently. It makes the paging events more expensive,
|
||||||
but hopefully is clear.
|
but hopefully more clear.
|
||||||
|
|
||||||
Those 12 block, for the record:
|
|
||||||
|
|
||||||
0000 to 0200; 0200 to 0400; 0400 to 0800; 0800 to 2000;
|
|
||||||
2000 to 4000; 4000 to c000; c000 to c100; c100 to c300;
|
|
||||||
c300 to c400; c400 to d000; d000 to e000; e000+
|
|
||||||
*/
|
*/
|
||||||
uint8_t *read_pages_[256]; // each is a pointer to the 256-block of memory the CPU should read when accessing that page of memory
|
uint8_t *read_pages_[256]; // each is a pointer to the 256-block of memory the CPU should read when accessing that page of memory
|
||||||
uint8_t *write_pages_[256]; // as per read_pages_, but this is where the CPU should write. If a pointer is nullptr, don't write.
|
uint8_t *write_pages_[256]; // as per read_pages_, but this is where the CPU should write. If a pointer is nullptr, don't write.
|
||||||
@ -614,8 +610,7 @@ template <bool is_iie> class ConcreteMachine:
|
|||||||
|
|
||||||
// On the IIe, reading C010 returns additional key info.
|
// On the IIe, reading C010 returns additional key info.
|
||||||
if(is_iie && isReadOperation(operation)) {
|
if(is_iie && isReadOperation(operation)) {
|
||||||
// TODO!
|
*value = (key_is_down_ ? 0x80 : 0x00) | (keyboard_input_ & 0x7f);
|
||||||
*value = 0;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -732,20 +727,26 @@ template <bool is_iie> class ConcreteMachine:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_pressed) {
|
// If no ASCII value is supplied, look for a few special cases.
|
||||||
// If no ASCII value is supplied, look for a few special cases.
|
if(!value) {
|
||||||
if(!value) {
|
switch(key) {
|
||||||
switch(key) {
|
case Key::Left: value = 0x08; break;
|
||||||
case Key::Left: value = 0x08; break;
|
case Key::Right: value = 0x15; break;
|
||||||
case Key::Right: value = 0x15; break;
|
case Key::Down: value = 0x0a; break;
|
||||||
case Key::Down: value = 0x0a; break;
|
case Key::Up: value = 0x0b; break;
|
||||||
case Key::Up: value = 0x0b; break;
|
case Key::BackSpace: value = 0x7f; break;
|
||||||
case Key::BackSpace: value = 0x7f; break;
|
default: return;
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
keyboard_input_ = static_cast<uint8_t>(toupper(value) | 0x80);
|
value = static_cast<char>(toupper(value));
|
||||||
|
if(is_pressed) {
|
||||||
|
keyboard_input_ = static_cast<uint8_t>(value | 0x80);
|
||||||
|
key_is_down_ = true;
|
||||||
|
} else {
|
||||||
|
if((keyboard_input_ & 0x7f) == value) {
|
||||||
|
key_is_down_ = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user