Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: scan codes + mouse
Posted by: ultra/cream Jan,12.2005-05:11 

yeps that's normal...

you can't access fc02 directly in your mainloop ...the ikbd sends message bundles...means it hat some special codes >$f8 or so to receive mouse x and y and buttons...and keycodes..means something like codes you have to receive...and if you receive that special code it means you have to save the following bytes that will be received to the mouse or button info...

when you access fc02 directly not in your 118 irq you will mixup the messages...maybe you even will miss some bytes from the ikbd...
that will not work...ok normally it works becuase you disable the mouse in your demo...

here isn an example how to do it...
setup a #118 irq to this routine and all will work fine when you access the variables...not fc02 directly of course ;) *i hope ;))

greets ultra ;)

ACIA_ROUT: PART
***********************************************************************
* KEYBOARD-ROUTINE *
* VERSION 3.00+ *
*---------------------------------------------------------------------*
* X- UND Y-KOORDINATEN --> 'X_MAUS'.w und 'Y_MAUS'.w *
* BORDERS --> 'X_MIN' , 'X_MAX', 'Y_MIN','Y_MAX'.w *
* BUTTON --> 'BUTTON'.b *
* ACCELERATION_TAB --> 'M_OFFSET'.w (16 w”rter lang !) *
* KEY --> BSR'GET_KEY' --> D0.L (SCAN/ASCII) *
* KEY REPEAT --> 'REPEAT'.w und 'REPEAT2'.w *
* *
* (C) cream 1991

ACIA_IRQ:
ACIA: MOVE #$2500,SR
MOVEM.L D0-D2/A0-A1,-(SP)
MOVEQ #0,D0
LEA ACIA_REG(PC),A1
ACIA_LOP:
MOVE.B $FFFFFC02,D0
TST.W 6(A1)
BNE.S GET_X_Y
CMP.B #$F8,D0
BLT.S GET_X_Y
CMP.B #$FB,D0
BGT.S GET_X_Y
MOVE.B D0,8(A1)
ADDQ.W #1,6(A1)
CLR.W 4(A1)
ACIA_OVR:
BTST #4,$FFFFFA01.w
BEQ.S ACIA_LOP
MOVEM.L (SP)+,D0-D2/A0-A1
BCLR #6,$FFFFFA11
RTE

ACIA_VR2: MOVE.B D0,$0A(A1)
BTST #4,$FFFFFA01
BEQ.S ACIA_LOP
MOVEM.L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D0
MOVE.B D1,D0
MOVEM.L (SP)+,D1-D3/A0
RTS
COUNT:
MOVE.L 8(A0),D2
C_LOOP:
MOVE.B 1(A0),D1
CMP.B (A0),D1
BEQ.S OK
BTST #7,(A0)
BEQ.S NEW_ONE
CLR.B (A0)
CLR.W 2(A0)
BRA.S AGAIN
OK:
SUBQ.L #1,D2
BNE.S C_LOOP
MOVE.W 6(A0),D3
AND.L #$FFFF,D3
MOVE.L D3,8(A0)

MOVE.B (A0),D0
BRA.S OUT_KEY

ACIA_REG:
X_MAUS: DC.W 0
Y_MAUS: DC.W 0
K_FLAG1: DC.W 0
K_FLAG2: DC.W 0
BUTTON: DC.W 0
ACIA_KEY: DC.B 0
KEY_BUFF: DC.B 0
REPT: DC.W 0
REPEAT: DC.W REP1
REAPEAT2: DC.W REP2
C_COUNT: DC.L 0

M_OFFSET: DC.W 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
SCAN_ASC:
DC.B $00
DC.B $1B,$31,$32,$33,$34,$35,$36,$37,$38,$39 ;$0A
DC.B $30,$9E,$27,$08,$09,$71,$77,$65,$72,$74 ;$14
DC.B $5A,$55,$49,$4F,$50,$9A,$2B,$0D,$00,$41 ;$1E
DC.B $53,$44,$46,$47,$48,$4A,$4B,$4C,$99,$8E ;$28
DC.B $00,$00,$00,$79,$78,$43,$56,$42,$4E,$4D ;$32
DC.B $00,$00,$00,$00,$00,$00,$20,$00,$00,$00 ;$3C
DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ;$46
DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ;$50
DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ;$5A
DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ;$64
DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ;$6E

EVEN
**************************************************************************

ENDPART








[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
scan codes + mouse RA/Paradox Jan,11.2005-12:21
  Re: scan codes + mouse gwem Jan,11.2005-13:17
    Re: scan codes + mouse RA/Paradox Jan,11.2005-13:58
      Re: scan codes + mouse tobe Jan,11.2005-15:15
      Re: scan codes + mouse gwem Jan,11.2005-16:41
        Re: scan codes + mouse RA/Paradox Jan,11.2005-17:15
          Re: scan codes + mouse ultra/cream Jan,12.2005-05:11
            Re: scan codes + mouse ultra ;) Jan,12.2005-05:20
                Re: scan codes + mouse RA/Paradox Jan,12.2005-09:55
                  Re: scan codes + mouse keyboard Jul,06.2006-19:45


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson