What HardWareMan says is confirmed by the MC68000 User Manual. There are a number of tables in section 8 that give total execution time and the number of read and write cycles. Doing a move.b or move.w with an immediate source and a 32-bit constant address takes 20 cycles total with 4 read and 1 write operation.
Depending on how you do the read, you might not even need any nops. For SLO I use the following code:
Code: Select all
move.b #$FF, $a10003 ;set TH for controller A
move.b $a10003, d7 ;CBRLUD
andi.b #$3F, d7
move.b #0, $a10003
move.b $a10003, d6 ;SA00UD
andi.b #$30, d6
lsl.b #2, d6
or.b d6, d7 ;SACBRLUD
move.b $a10003, d7 should take 16 cycles so depending on exactly when things latch, that's somewhere between 12 and 16 cycles worth of delay. For what it's worth, no one has reported any problems with the controller support in SLO and I've tested it with a number of 3 and 6-button controllers (all 1st party ones though, 3rd party pads could be a problem I suppose).
If you were to do something like this though:
Code: Select all
lea $a10003, a0
move.b #$FF, (a0) ;set TH for controller A
move.b (a0), d7 ;CBRLUD
andi.b #$3F, d7
move.b #0, (a0)
move.b (a0), d6 ;SA00UD
andi.b #$30, d6
lsl.b #2, d6
or.b d6, d7 ;SACBRLUD
You would likely need to add in a nop or two as move.b (a0), d7 should only take 8 cycles. Presumably a decent C compiler would produce something more like the second example rather than the first, but you should check the output if you want to be sure.