Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
mg_notes:general:hardware_probing [2018/10/30 15:36]
M.G. [Recommendations for Slot Card Designers]
mg_notes:general:hardware_probing [2021/10/30 23:38]
M.G. [How to Probe for Hardware]
Line 43: Line 43:
 To probe for the Z80, set up a routine at $0FFD (Z80 FFFDH) with the following code: To probe for the Z80, set up a routine at $0FFD (Z80 FFFDH) with the following code:
  
-  FFFD:  ld ($Es00),​a ​  ; s=slot being probed turn off Z80, next PC is $0000 +  FFFD:   ​ld ($Es00),​a ​  ; s=slot being probed turn off Z80, next PC is $0000 
-  0000:  ld a,$01 +  0000:   ​ld a,$01 
-         ​ld (flag),a +          ld (flag),a 
-         ​jp FFFD +          jp FFFD 
-  flag:  .byte $00 +  flag:   ​.byte $00 
-   + 
-The reason for the instruction at $FFFD is to overcome the Softcard'​s inability to reset the Z80 any other way than through the RESET signal on the bus.  This probe will leave the Z80 in a state resembling the reset state while it is off, ready to execute the instruction at $0000. ​ Note that for the same reason, if the Z80 has already been accessed via another method (such as booting CP/M first), this probe will fail and the machine will probably crash.+For the 6502 part of the equation: 
 + 
 +          lda #$C7      ; start at slot 7 
 +          sta startz+1 
 +          lda #$E7      ; same, from Z80 view 
 +          sta $FFFE 
 +  ​loop:   lda #$00 
 +          sta flag 
 +  startz: sta $Cs00 
 +          lda flag 
 +          bne foundz 
 +          dec startz+1 
 +          dec $FFFE 
 +          lda startz+1 
 +          cmp #$C0 
 +          bcs loop 
 +  noz:    ; Z80 not found 
 +  ... 
 +  foundz: ; Z80 found 
 + 
 +The reason for placing ​the ld ($Es00),​a ​instruction at $FFFD is to overcome the Softcard'​s inability to reset the Z80 any other way than through the RESET signal on the bus.  This probe will leave the Z80 in a state resembling the reset state while it is off, ready to execute the instruction at $0000. ​ Note that for the same reason, if the Z80 has already been accessed via another method (such as booting CP/M first) ​without a reset, this probe will fail and the machine will probably crash.
  
 Finally, the Mockingboard and clones don't have slot firmware, instead having two or more 6522 VIAs present in the space normally used for slot firmware. ​ For a two-VIA card, the VIAs are at $Cs00 and $Cs80 and have 16 registers each.  Cards exist with more VIAs present on further $10-byte divisions. Finally, the Mockingboard and clones don't have slot firmware, instead having two or more 6522 VIAs present in the space normally used for slot firmware. ​ For a two-VIA card, the VIAs are at $Cs00 and $Cs80 and have 16 registers each.  Cards exist with more VIAs present on further $10-byte divisions.