fixed apple keys, kbd, unreadable memory

This commit is contained in:
Steven Hugg 2018-08-23 20:53:37 -04:00
parent 8bb67e5610
commit 1f32eee70c
5 changed files with 32 additions and 4 deletions

View File

@ -0,0 +1,16 @@

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
int main (void)
{
printf("\nKeyboard Test\n");
while (1) {
char ch = cgetc();
printf("%3d ($%2x) = %c\n", ch, ch, ch);
}
return EXIT_SUCCESS;
}

View File

@ -9,6 +9,7 @@ declare var jt; // 6502
const APPLE2_PRESETS = [
{id:'sieve.c', name:'Sieve'},
{id:'keyboardtest.c', name:'Keyboard Test'},
{id:'mandel.c', name:'Mandelbrot'},
{id:'tgidemo.c', name:'TGI Graphics Demo'},
{id:'siegegame.c', name:'Siege Game'},
@ -170,11 +171,17 @@ const _Apple2Platform = function(mainElement) {
kbdlatch = (code | 0x80) & 0xff;
} else if (key) {
switch (key) {
case 16: return; // shift
case 17: return; // ctrl
case 18: return; // alt
case 37: key=8; break; // left
case 39: key=21; break; // right
case 38: key=11; break; // up
case 40: key=10; break; // down
}
if (key >= 65 && key < 65+26) {
if (flags & 5) key -= 64; // ctrl
}
kbdlatch = (key | 0x80) & 0xff;
}
}
@ -242,8 +249,8 @@ const _Apple2Platform = function(mainElement) {
}
}
}
readAddress(addr) {
return bus.read(addr);
readAddress(addr : number) {
return ((addr & 0xf000) != 0xc000) ? bus.read(addr) : null; // ignore I/O space
}
loadState(state) {

View File

@ -170,7 +170,7 @@ function refreshWindowList() {
return new Views.DisassemblerView();
});
}
if (platform.readAddress && platform_id != 'vcs') {
if (platform.readAddress) {
addWindowItem("#memory", "Memory Browser", function() {
return new Views.MemoryView();
});

View File

@ -528,6 +528,7 @@ export class ListingView extends DisassemblerView implements ProjectView {
///
// TODO: make it use debug state
// TODO: make it safe (load/restore state?)
export class MemoryView implements ProjectView {
memorylist;
dumplines;
@ -613,7 +614,7 @@ export class MemoryView implements ProjectView {
for (var i=n1; i<n2; i++) {
var read = platform.readAddress(offset+i);
if (i==8) s += ' ';
s += ' ' + (read>=0?hex(read,2):'??');
s += ' ' + (read!==null?hex(read,2):'??');
}
for (var i=n2; i<16; i++) s += ' ';
if (sym) s += ' ' + sym;

View File

@ -97,6 +97,10 @@ function testPlatform(platid, romname, maxframes, callback) {
for (var i=0; i<maxframes; i++) {
if (callback) callback(platform, i);
platform.nextFrame();
if (i==10) {
for (var j=0; j<0x10000; j++)
platform.readAddress(j);
}
}
platform.pause();
assert.equal(maxframes, rec.numFrames());