X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=testpico%2Fasmtools.S;h=24b64585784f781aa26b38c74dcdde05505b92d9;hb=635f24506c5a883336e9028e0de7a4a5fb9b2226;hp=6be859ae1b0da67343c2ea5bc4ef54028f01efe8;hpb=438648dc884712056ad7cb0c02279c74f55f3c51;p=megadrive.git diff --git a/testpico/asmtools.S b/testpico/asmtools.S index 6be859a..24b6458 100644 --- a/testpico/asmtools.S +++ b/testpico/asmtools.S @@ -12,11 +12,11 @@ .global burn10 /* u16 val */ burn10: - ldarg 0, 0, d0 + ldargw 0, 0, d0 subq.l #1, d0 0: - dbra d0, 0b - rts + dbra d0, 0b /* 10|14 */ + rts /* 16 */ .global write16_x16 /* u32 a, u16 count, u16 d */ write16_x16: @@ -67,6 +67,16 @@ get_input: .endif rts +.global get_line +get_line: + movea.l #0xc00008, a0 + moveq.l #0, d0 +0: + move.b (a0), d0 /* 8 d2 = vcnt */ + cmp.b (a0), d0 /* 8 reread for super-rare corruption (torn read) */ + bne 0b + rts + .global write_and_read1 /* u32 a, u16 d, void *dst */ write_and_read1: ldarg 0, 0, a0 @@ -483,7 +493,7 @@ test_ym_ab_sync: ymwrite a0, a1, #0x27, #0x30 /* 30 disable, clear */ ymwrite a0, a1, #0x24, #0xfc /* 30 timer a */ - ymwrite a0, a1, #0x25, #0x01 /* 30 =15 - why 15? expected 16 */ + ymwrite a0, a1, #0x25, #0x01 /* 30 =15 */ ymwrite a0, a1, #0x26, #0xff /* 30 timer b shortest interval */ move.b #0x27, (a0) /* 12 addr prep */ nop @@ -496,15 +506,19 @@ test_ym_ab_sync: move.b (a0), d0 /* 8 */ and.b d1, d0 /* 4 */ beq 0b /* 10|8 */ -0: + move.b #0x3f, (a1) /* 12 start a, clear */ - move.w #(1800/10-1), d0 /* waste cycles */ -0: - dbra d0, 0b - ymwrite a0, a1, #0x24, #0x00 /* 30 show that rewriting count */ - ymwrite a0, a1, #0x25, #0x00 /* 30 does nothing */ - ymwrite a0, a1, #0x26, #0x00 /* 30 */ + move.w #(488/10), d0 /* waste cycles */ +0: dbra d0, 0b + + ymwrite a0, a1, #0x24, #0xf0 /* 30 show that rewriting count */ + ymwrite a0, a1, #0x25, #0x00 /* 30 does nothing until timer expires */ + + move.w #(488*2/10), d0 /* waste cycles */ +0: dbra d0, 0b + + ymwrite a0, a1, #0x26, #0xfc /* 30 same for timer b */ ymwrite a0, a1, #0x27, #0x0f /* 30 setting already set bits too */ moveq.l #0, d0 moveq.l #3, d1 @@ -515,4 +529,20 @@ test_ym_ab_sync: move.b (a0), d0 /* re-read, else very occasionally get 1 */ rts +.global test_ym_ab_sync2 +test_ym_ab_sync2: + movea.l #0xa04000, a0 + movea.l #0xa04001, a1 + +# move.b #0x3f, (a1) /* 12 clear */ + moveq.l #0, d0 + moveq.l #3, d1 + nop /* 4 need ~12c to clear */ +0: + move.b (a0), d0 /* 8 */ + and.b d1, d0 /* 4 */ + beq 0b /* 10|8 */ + move.b (a0), d0 /* re-read */ + rts + # vim:filetype=asmM68k:ts=4:sw=4:expandtab