I've been playing around with the anti-emulator loop (on a real SAM) getting
rid of all the IX stuff and replacing it with a simple counter, but keeping
the number of t-states the main loop takes unchanged (80).  At the end of it
HL returns 0x5d8, which agrees with what IX was returning before.  I then
varied the number of NOPs to see the effect...
               DI
               LD    A,128
               OUT   (BORD),A
               LD    B,8               ;FRAME int bitmask
               LD    HL,0              ;Counter
clear_vbl:
               IN    A,(STAT)
               AND   B
               JP    Z,clear_vbl       ;Wait for VBL to finish
start_vbl:
               IN    A,(STAT)
               AND   B
               JP    NZ,start_vbl      ;Wait for VBL to start
clear_vbl_1:
               IN    A,(STAT)
               AND   B
               JP    Z,clear_vbl_1     ;Wait for VBL to finish
count_ticks:
               INC   HL                ;8
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               NOP                     ;4
               IN    A,(STAT)          ;12
               AND   B                 ;4
               JP    NZ,count_ticks    ;12
                                       ;--
                                       ;80
               LD    A,0
               OUT   (BORD),A
               EI
               RET

NOPs removed   HL on exit (sometimes varies by 1 between calls)
0/1            5d8
2/3            67e
4/5            74e
6/7            859
8/9            9bd
10/11          bb0

Hopefully you can use this to help you track down where the error is :)
(You mentioned you can't use your Sam at the moment).

Going back to the bit you mentioned about screen contention being applied
across the whole line rather than just two thirds - how about reducing the
number of lines contended to 128 (2/3 of 192), so the overall slow down over
a frame is correct.  This might be an acceptable bodge in the meantime...?

Anyway, hope some of that helps, and good luck :-)

David Laundon

Reply via email to