Search the Community
Showing results for tags 'poor docs'.
Found 1 result
Reading joystick, keyboard via TOS in simple way This is certainly part for which TOS documentation is not well done, some necessary details just missing from avalable Atari DOCs. So, there is XBIOS 34 function Kbdvbase, which will return in d0 address of structure: long midivec long vkbderr long wmiderr long statvec long mousevec long clockvec long joyvec * pos 24 long midisys long ikbdsys Those ending with 'vec' are vector addresses, and SW can put there own rutine to transfer current status of those input devices. Atari DOC s(and Atari ProfiBuch auch, pardon too) says only this: "Address of packets will be in a0 and on stack too. Rutine must end with rts, and last not longer than 1 mS." And that's just not enough to use it. Despite that it is really simple. So, here is working example: * Setting joystick monitoring rutine : move.w #34,-(sp) *Kbdvbase trap #14 addq.l #2,sp move.l d0,a1 lea 24(a1),a1 * Joystick vector move.l (a1),joymorg *Save original one (which is just an rts) - for restoring at PRG end move.l #moni,(a1) * put there address of own code to pick joystick state ******* moni * Joystick monitoring, very simple: * it is at joyvec address set with XBIOS 34 addq.l #1,a0 *a0 is odd move.w (a0),joyc * first byte is for joy 0, second for joy 1 rts It activates every time when some joystick action is performed. And during ACIA interrupt - that's why must be fast. SW can now simply read when want values at variable joyc . Of course, it can be done different - so, for instance that joystick interrupt initiates something immediately. But normal usage is just reading joyc periodically. Bits for joystick status: 7 - fire, 0 - down, 1 - up, 2 - left , 3 - right Active when bit is set.