A gift (Hardware MSX Forum)MSX Resource Center MSXdev 2008 - MSX1 development bonanza!              
              
English Nederlands Español Português Russian         
 News
   Frontpage
  News archive
  News topics

 Resources
   MSX Forum
  Articles
  Reviews
  Fair reports
  Photo shoots
  Fairs and meetings
  Polls
  Links
  Search

 Software
   Downloads
  Webshop

 MRC
   Who we are
  Join our team
  Donate
  Policies
  Contact us
  Link to Us
  Statistics

 Search
 
  

  

 Login
 

Username

Password




Don't you have an account yet? Become an MSX-friend and register an account now!.


 Statistics
 

There are 128 guests and 2 MSX friends online

You are an anonymous user.
 

MSX Forum


MSX Forum

Hardware - A gift

Goto page ( Previous Page 1 | 2 | 3 Next Page )
Author

A gift

flyguille
msx master
Posts: 1182
Posted: November 03 2005, 01:08   
and it is in the msx standard?

I asks because now i thinks there is the answer to connect a mouse!
Sonic_aka_T

msx guru
Posts: 2261
Posted: November 03 2005, 11:48   
(O_o( "Are you saying what I think you're saying?"
flyguille
msx master
Posts: 1182
Posted: November 03 2005, 17:34   
)-_O) "what you mean, Sonic?"
wolf_
online

msx legend
Posts: 4629
Posted: November 03 2005, 18:39   
(^_^( "now now, let's behave here!"
)o_O) "It's a bloody shame that we, ubersmileys, are abused like this!"
flyguille
msx master
Posts: 1182
Posted: November 03 2005, 19:08   
Quote:

(^_^( "now now, let's behave here!"
)o_O) "It's a bloody shame that we, ubersmileys, are abused like this!"





tfh
msx addict
Posts: 492
Posted: November 03 2005, 21:23   
Yes.. The joystickport can send data.
I remember The Pretender Of FONY made a small program to send text through the joystick port. We made it work between two MSX's and an MSX with an Atari (800XL??). Worked quite nicely, but VERY slow!
flyguille
msx master
Posts: 1182
Posted: November 03 2005, 22:25   
so, again , how to control the STB lines in assembler?
AuroraMSX

msx master
Posts: 1227
Posted: November 03 2005, 23:07   
This is my mouse routine for hitech C. Hitech C passes parameters as offsets to IX. 1st parameter in (IX+6), 2nd in (IX+8) etc etc.

wacht1  EQU   7               ; Wait count
wacht2  EQU   40              ; more wait

        global csv,cret
        global _gtmous

        psect text

; void gtmous(char port, int *dx, int *dy)
_gtmous:
        call    csv
        push    ix
        push    iy

        ld      a,(ix+6)
        cp      1
        jr      nz,port2
port1:
        ld      de,0BF10h
        jr      go
port2:
        cp      2
        jr      nz,noport
        ld      de,0FF20h
        jr      go
noport:
        pop     iy
        pop     ix
        jp      cret

go:
        di
        ld      b,wacht2
        call    gtofs2          ; Read bit 7-4 of X-offset
        rlca
        rlca
        rlca
        rlca
        ld      c,a
        call    gtofst          ; Read bit 3-0 of X-offset
        or      c
        ld      l,a             ; Keep X-offset in L

        call    gtofst          ; Read bit 7-4 of Y-offset
        rlca
        rlca
        rlca
        rlca
        ld      c,a
        call    gtofst          ; Read bit 3-0 of Y-offset
        or      c
        ld      c,a             ; save Y-offset in C
        ld      b,l             ; save X-offset in B

        pop     iy
        pop     ix
        ld      l,(ix+8)
        ld      h,(ix+9)
        ld      a,b
        call    save
        ld      (hl),a
        ld      l,(ix+10)
        ld      h,(ix+11)
        ld      a,c
        call save
        ei
        jp      cret

save:
        ld      (hl),a        ; Store Y-offset
        and     080h
        rlca
        ld      a,0             ; don't clear flags
        sbc     a,0             ; subtract Carry flag
        inc     hl
        ld      (hl),a
        ret

gtofst: ld      b,wacht1
gtofs2: ld      a,15          ; Write E to PSG reg. 15
        out     (0A0h),a
        ld      a,d
        out     (0A1h),a
        xor     e             ; Get next nibble
        ld      d,a           ;
wacht:  djnz    wacht         ; Wait a bit - slow mousey
        ld      a,14          ; Read PSG reg. 14
        out     (0A0h),a
        in      a,(0A2h)
        and     0Fh            ;only bits 3-0 are valid
        ret



Sorry for the dutch labels. Actually the routine isn't even mine. I just dunno anymore where I copied it from.
Ehm, the info you're looking for is in there, somewhere. Forgive me for being lazy
HansO
msx addict
Posts: 375
Posted: November 03 2005, 23:10   
The circuit diagrams are now inserted into one pdf.

http://www.hansotten.com - MSX Whats New
flyguille
msx master
Posts: 1182
Posted: November 04 2005, 00:56   
interesting mouse rountine.... if i got time , i will do the encapsulation for include it as a driver.
arnold_m
msx lover
Posts: 81
Posted: November 04 2005, 08:50   
AuroraMSX wrote
Quote:

This is my mouse routine for hitech C. Hitech C passes parameters as offsets to IX. 1st parameter in (IX+6), 2nd in (IX+8) etc etc.

wacht1  EQU   7               ; Wait count
wacht2  EQU   40              ; more wait

        global csv,cret
        global _gtmous

        psect text

; void gtmous(char port, int *dx, int *dy)
_gtmous:
        call    csv
        push    ix
        push    iy


No need to push ix and iy here, you do not change these registers. Register iy is saved by csv anyway.
Register ix must indeed be preserved, but functions provided with or compiled by HiTech-C will take care of that, so ix is only a concern when you write wrapper functions for other routines.
Quote:

[...]
 save:
        ld      (hl),a        ; Store Y-offset
        and     080h
        rlca
        ld      a,0             ; don't clear flags
        sbc     a,0             ; subtract Carry flag


;       and   080h ; not needed
        rlca
        sbc    a,a    ; faster way to sign-extend

Quote:

        inc     hl
        ld      (hl),a
        ret
[...]



Beware of interrupts, the standard interrupt routine checks the firebuttons, and screws up the synchronisation in the process. Come to think of it, it mayu make sense to put the mouse routine in custom interrupt routine.
AuroraMSX

msx master
Posts: 1227
Posted: November 04 2005, 09:39   
Quote:

AuroraMSX wrote
Quote:

This is my mouse routine for hitech C. [...]



Beware of interrupts, the standard interrupt routine checks the firebuttons, and screws up the synchronisation in the process.



That's why I do that DI near the start of the routine and EI at the end
Thanx for the comments; I'll incorporate them into my code!

flyguille
msx master
Posts: 1182
Posted: November 04 2005, 15:12   
ok, how this routine reads the buttons of the mouse?
AuroraMSX

msx master
Posts: 1227
Posted: November 05 2005, 12:48   
Quote:

ok, how this routine reads the buttons of the mouse?


It doesn't

There's no difference between mouse buttons and joystick buttons; any routine for reading joystick buttons works for mouse buttons, too
flyguille
msx master
Posts: 1182
Posted: November 05 2005, 18:14   
aha
 
Goto page ( Previous Page 1 | 2 | 3 Next Page )
 







(c) 1994 - 2008 MSX Resource Center Foundation. MSX is a trademark of MSX Licensing Corporation.