Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; doctorxyz 2018.05.20
- ; Patch p/ Carmen Sandiego
- ; Objetivo: O mouse funcionar na porta 1 do Zemmix (MSX 2+) e no Sony HB-FS1 (MSX 2)
- ; compilador online via http://clrhome.org/asm/
- ; codigo asm baseado em https://www.msx.org/wiki/Mouse/Trackball
- ; (Direct usage of mouse) para porta 1
- ; injetar no endereço $4166 do CARMEM.COM ou $EC66 do DSK
- ; padrão para achar via XVI32 -> 2A 47 CE 11 01 00 B7 ED 52 C2 8A 41
- .org $416F
- JP NZ, GTMOUSP2
- GTMOUSP1:
- LD D,$93 ; Values for a mouse in port 1
- LD E,$10
- JP GTMOUS
- GTMOUSP2:
- LD D,$EC ; Values for a mouse in port 2
- LD E,$20
- JP GTMOUS
- GTMOUS:
- PUSH BC
- LD B, 30 ; Long delay for first read
- CALL GTOFS2 ; Read bit 7-4 of the x-offset
- AND 0FH
- RLCA
- RLCA
- RLCA
- RLCA
- LD C,A
- CALL GTOFST ; Read bit 3-0 of the x-offset
- AND $0F
- OR C
- ld ($C976), a ; Store combined x-offset
- CALL GTOFST ; Read bit 7-4 of the y-offset
- AND $0F
- RLCA
- RLCA
- RLCA
- RLCA
- LD C,A
- CALL GTOFST ; Read bit 3-0 of the y-offset
- AND $0F
- OR C
- ld ($C975), a ; Store combined y-offset
- POP BC
- JP $41DB
- GTOFST:
- LD B, 10 ; Short delay
- GTOFS2:
- LD A,15 ; Read psg register 15 voor mouse
- OUT ($A0),A
- LD A,D
- OUT ($A1),A
- XOR E
- LD D,A
- WAIT:
- DJNZ WAIT ; Extra delay because the mouse is slow.
- LD A,14
- OUT ($A0),A
- IN A,($A2)
- RET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement