We can now autodetect the IDE controller by ROM (if you have the same ROM anyway
other identifiers may well be needed).
(Hopefully fixed)Seem to have had some disk corruption - how to reproduce/why ?
Display flicker of weird chars when scroll/clear bottom line ?
+We blow up with slot expanders early in boot (in find_ram). Seems to be a
+problem if the cartridge is in an expander.
In Progress
To do
Detection logic by ROM hash and find the sunrise etc
+Fix cursor interaction with fsck (don't xx bs flush but bs xx flush)
+Can we put find_ram etc in discard ?
+Do we need a font and should it move somewhere to make const space ?
Tune swap logic so we only read/write relevant pages
We badly need the cached path walk or some other optimizations on user copy
or the bank switch
we can label all other cases with a value meaning 'other' as we don't need
to worry about fastpaths that much
Given the MSX1 mess consider just writing JIT code for k-> u->k etc so non
-stupid machines are not too slow.
+stupid machines are not too slow. In particular if we see that RAM is not in
+the same slot as anything else we use we can set the subslots once and just
+bash 0xA8 like a sane computer.
+For machines with bussed I/O do we want a /dev/iobus or similar that has the
+info for a program to unpack (ROM hashes etc) ?
Target initial I/O devices
keyrepeat.first = 2 * ticks_per_dsecond;
keyrepeat.continual = 1 * ticks_per_dsecond;
- sunrise_probe(1,0xFF);
+ sunrise_probe();
}
tmpfree(devide_buf);
}
-void sunrise_probe(uint8_t slot, uint8_t subslot)
+static const uint16_t sunrise_roms[2] = {
+ 0x8FB3,
+ 0x0000
+};
+
+void sunrise_probe(void)
{
- uint8_t i = slot;
+ uint8_t slot, subslot;
+ uint8_t i;
- if (subslot != 0xFF)
- i |= 0x80 | (subslot << 2);
+ i = device_find(sunrise_roms);
+ if (i == 0xFF)
+ return;
/* Generate and cache the needed mapping table */
memcpy(&sunrise_k, map_slot1_kernel(i), sizeof(sunrise_k));
extern uint8_t do_ide_flush_cache(uint8_t drive) __z88dk_fastcall;
extern uint8_t do_ide_xfer(uint8_t drive) __z88dk_fastcall;
-extern void sunrise_probe(uint8_t slot, uint8_t subslot);
+extern void sunrise_probe(void);
#define IDE_DRIVE_COUNT 2
kprintf("User map %x %x %x %x %x %x\n",
*bp, bp[1], bp[2], bp[3], bp[4], bp[5]);
copy_vectors();
+ for (i = 0; i < 4; i++){
+ for (pp = 0; pp < 4; pp++) {
+ if (devtab[i][pp][1] & 0x8000)
+ kprintf("@0x4000: %d.%d: %x\n", i, pp, devtab[i][pp][1] & 0x7FFF);
+ }
+ }
+ for (i = 0; i < 4; i++){
+ for (pp = 0; pp < 4; pp++) {
+ if (devtab[i][pp][2] & 0x8000)
+ kprintf("@0x8000: %d.%d: %x\n", i, pp, devtab[i][pp][2] & 0x7FFF);
+ }
+ }
}
/*
uint8_t machine_type;
uint8_t vdptype;
uint8_t *bouncebuffer;
+uint16_t devtab[4][4][3];
void platform_idle(void)
{
at the end (probably FDFE-FFFE (FFFF being magic)) */
bouncebuffer = (uint8_t *)0xFD00; /* Hack for now */
}
+
+uint8_t device_find(const uint16_t *romtab)
+{
+ uint8_t slot, sub;
+ while(*romtab) {
+ for (slot = 0; slot < 4; slot++) {
+ for (sub = 0; sub < 4; sub++) {
+ if (*romtab == devtab[slot][sub][1]) {
+ if (subslots & (1 << slot))
+ return 0x80 | slot | (sub << 2);
+ else
+ return slot;
+ }
+ }
+ }
+ romtab++;
+ }
+ return 0xFF;
+}
extern uint8_t machine_type;
extern uint16_t infobits;
+extern uint8_t subslots;
#define MACHINE_MSX1 0
#define MACHINE_MSX2 1
extern uint8_t *map_slot1_kernel(uint8_t slotinfo) __z88dk_fastcall;
extern uint8_t *map_slot1_user(uint8_t slotinfo) __z88dk_fastcall;
-
+extern uint8_t device_find(const uint16_t *romtab);
extern void copy_vectors(void);
+extern uint16_t devtab[4][4][3];
extern uint8_t *bouncebuffer;
#endif
--- /dev/null
+/*
+ * Known ROM signatures
+ */
+
+#define MSXDOS2_1 (0x8000|0x08F2)
+#define PANASONIC_FS_CA1_1 (0x8000|0x7BA0)
+#define PHILIPS_NMS1205_1 (0x8000|0x6D77)
+#define SUNRISE_IDE_1 (0x8000|0x0FB3)
.globl _map_slot1_user
.globl find_ram
.globl _ramtab
+ .globl _devtab
.globl _kernel_map
.globl _user_map
.globl _current_map
;
find_ram:
ld ix,#0xFCC1
+ ld iy,#_devtab ; device scan table
ld b,#4
ld e,#0
next_slot:
; Recover our slot count
;
pop de
+ jr sub_done
not_sub:
+ ld bc,#18 ; move on correct table distance (3 x 6
+ ; bytes) as no subslots
+ add iy,bc
+sub_done:
;
; Recover the old slot map state
;
; A device ROM. Potentially interesting. Need to add code to checksum
; or otherwise identify them later
;
- ;FIXME
+ push de
+ push bc
+ xor a
+ ld l,a ; back to ROM start
+
+ ld d,a ; count
+ ld e,a
+ ld b,a ; 256 bytes
+ ld c,#8 ; 2K
+
+nextrombyte:
+ ld a,(hl)
+ inc hl
+ add e
+ ld e,a
+ jr nc,noinc
+ inc d
+noinc:
+ djnz nextrombyte
+ dec c
+ jr nz,nextrombyte
+
+ set 7,d ; ROM present flag
+ ld (iy),e ; 15 bit sum
+ ld 1(iy),d
+ pop bc
+ pop de
jr notram
writecheckd:
inc bc
ld a,d
ld (bc),a
- inc bc
- ret
+ jr incout
notram:
inc bc
+incout:
inc bc
+ inc iy
+ inc iy
ret
;
; Scan a slot/subslot for RAM