Ok, here is once again something that you really don't need!
This program will read value from Z80 databus during one SINGLE interrupt. This means, that you can now safely monitor databus with any hardware without worry of your computer hanging.
This program might not be size optimized too well, but I'm pretty proud of the result anyway. Feel free to use it how ever you like, but what ever you do, do not ask how it works. :9
Good thing is, that this needs only about 5KB of memory because of very tight fitted self generating code.
; DATABUS.GEN Ver 2.0 for MSX homecomputers (Made By: NYYRIKKI) ; ; This program reads a value from databus when Z80 leaves databus control to peripherals. ; ; Usage from MSX-BASIC: ; ; BLOAD "DATABUS.BIN",R:PRINT USR(0) ; ; ; Ps. Unmodifyed MSX should give value #FF allways. (according to my knowledge) ; ; Changes: ; ; This new version will need only one interrupt. ; You can not hang your computer anymore by changeing databus value between interrupts. ;----------------------------------------------------------------------------------------- USR: EQU #F7F8 USR0: EQU #F39A DEFB #FE DEFW BEGIN DEFW END DEFW START ORG #B000 BEGIN: START: LD HL,CODE LD (USR0),HL RET CODE: DI LD HL,#BF00 LD BC,0 NEXT: LD A,C ADD A,B CP #10 JP NC,NOMORE LD (HL),A INC HL CP #F JP Z,SKIP LD (HL),B INC HL SKIP: INC C LD A,C CP #10 JP NZ,NEXT NOMORE: LD C,0 INC B LD A,B CP #10 JP NZ,NEXT LD (HL),#C0 LD HL,#BF00 LD DE,#BE00 LD BC,0 FIXL: LD A,(HL) LD C,A OR #C0 LD (HL),A INC HL LD A,(HL) RLCA RLCA RLCA RLCA OR C LD E,A EX DE,HL LD A,E DEC A LD (HL),A EX DE,HL DJNZ FIXL LD HL,#C0C0 LD DE,#C0C1 LD B,#F MAKEPROG: PUSH BC LD BC,#F PUSH HL PUSH DE LD (HL),4 ;INC B LDIR LD (HL),#CD ;CALL INC HL LD DE,CALCUT LD (HL),E INC HL LD (HL),D POP DE POP HL POP BC INC H INC D DJNZ MAKEPROG LD A,#BF LD I,A IM 2 EI NOP HALT ; Any interrupt will be accepted. IM 1 LD L,A LD H,#BE LD A,(HL) LD (USR),A XOR A LD (USR+1),A RET CALCUT: POP AF AND #F RLCA RLCA RLCA RLCA OR B XOR #F RETI END:
Login or register to post comments