diff --git a/src/memu/mfx.c b/src/memu/mfx.c index 3391395..2610572 100644 --- a/src/memu/mfx.c +++ b/src/memu/mfx.c @@ -543,14 +543,16 @@ void mfx_out (word port, byte value) taddr = (((word) value) << 8 ) | (taddr & 0xFF); break; case 0x32: + diag_message (DIAG_MFX_TEXT, "Character = '%c' (0x%02X)", ((value >= 0x20) && (value < 0x7F)) ? value : '.', value); chr = value; break; case 0x33: + diag_message (DIAG_MFX_TEXT, "Character attribute = 0x%02X", value); atr1 = value; break; case 0x34: diag_message (DIAG_MFX_TEXT, "Character repeat = 0x%02X", value); - for (int i = 0; i < value; ++i) + for (int i = 0; i <= value; ++i) { mfx_tupdate (); ++taddr; @@ -607,6 +609,7 @@ void mfx_out (word port, byte value) diag_message (DIAG_MFX_PAL, "Palette entry %d: Blue = 0x%X", palidx, value & 0x0F); break; case 0x3F: + diag_message (DIAG_MFX_TEXT, "Character attribute 2 = 0x%02X", value); atr2 = value; break; } diff --git a/src/memu/sdcard.c b/src/memu/sdcard.c index a291272..0940d2e 100644 --- a/src/memu/sdcard.c +++ b/src/memu/sdcard.c @@ -33,9 +33,10 @@ static byte cmdbuf[LEN_CMD]; static byte crc = 0; static bool bAppCmd = false; static byte respbuf[LEN_RESP]; +static byte sd_stat[2] = {0, 0}; static int nrbt = 0; static enum {ctSDv1, ctSDv2, ctSDHC} cdtyp = ctSDHC; -static enum {st_idle, st_r1, st_r3, st_r7, st_rd_ack, st_rm_ack, st_wr_ack, +static enum {st_idle, st_r1, st_r2, st_r3, st_r7, st_rd_ack, st_rm_ack, st_wr_ack, st_read, st_rmrd, st_rmnxt, st_wr_wait, st_write} sd_state = st_idle; static bool bSDHC = false; static byte databuf[LEN_BLK]; @@ -124,8 +125,10 @@ static void sd_data_out (byte b) { diag_message (DIAG_SDXFDC_HW, "Failed to save sector"); respbuf[0] = 0x0D; + sd_stat[0] = 0; + sd_stat[1] = 0x04; } - nrbt = -2; + nrbt = -1; sd_state = st_r1; ncbt = 0; } @@ -180,6 +183,14 @@ static void sd_data_out (byte b) sd_state = st_idle; break; + case 13: // Get status + diag_message (DIAG_SDXFDC_HW, "SD CMD13 - Get status"); + sd_state = st_r2; + nrbt = -2; + respbuf[0] = sd_stat[0]; + respbuf[1] = sd_stat[1]; + break; + case 17: // Read single block case 18: // Read multiple blocks if ( cmdbuf[0] == 17 ) @@ -212,6 +223,8 @@ static void sd_data_out (byte b) iPos = ( cmdbuf[1] << 24 ) | ( cmdbuf[2] << 16 ) | ( cmdbuf[3] << 8 ) | cmdbuf[4]; if ( bSDHC ) iPos <<= 9; pf = sd_seek (iPos); + sd_stat[0] = 0; + sd_stat[1] = 0; if ( pf != NULL ) { respbuf[0] = 0x00; @@ -263,6 +276,7 @@ static byte sd_data_in (void) switch (sd_state) { case st_r1: + case st_r2: case st_r3: case st_r7: case st_rd_ack: @@ -295,6 +309,9 @@ static void sd_data_adv (void) case st_r1: if ( nrbt == 1 ) sd_state = st_idle; break; + case st_r2: + if ( nrbt == 2 ) sd_state = st_idle; + break; case st_r3: if ( nrbt == 5 ) sd_state = st_idle; break; diff --git a/src/memu/vdeb.c b/src/memu/vdeb.c index 740149c..05793d3 100644 --- a/src/memu/vdeb.c +++ b/src/memu/vdeb.c @@ -101,7 +101,7 @@ int vld_brk (int wk) int vld_cond (int wk) { if ( ( wk >='a' ) && ( wk <= 'z' ) ) wk -= 32; - if ( strchr ("0123456789ABCDEFHLN'=", wk) != NULL ) return wk; + if ( strchr ("0123456789ABCDEFHILNXY'=", wk) != NULL ) return wk; return -1; }