Re: A89: getkey()?


[Prev][Next][Index][Thread]

Re: A89: getkey()?




i don't think that there is one.  you can always edit the function in
idle_loop to take out the "idle loop" part.  i think if you do that, it strips
it from like 20 lines to 1 line of code.  a lot of it is APD stuff and there's
also an ST_busy command in there.  here's a portion of code from Tetris89,
which I'm assuming is the all that is needed for the keyboard functions.  i'm
not exactly sure how it works, which is also why i added it.  could somebody
help me through the code, line by line?

GetKeyStat:
 movem.l d0-d1/a0,-(a7)        ;stores registers in stack
 lea	 keystat(PC),a0             ;loads relative address of keystat into a0
 move.w  #$FFFE,d0            ;what the?  why? 65534?
 moveq	 #9,d1                     ;moves 9 into d1 for impending FOR...NEXT
GetKeys:
 move.w  d0,$600018            ;move d0 into mem location $600018?  what for?
 nop                                    ;buncha nop's.  does it take that
long?
 move.b  $60001B,(a0)+        ;move stuff at $60001B into keystat and shift a
byte
 nop                                    ;buncha nop's.  does it take that
long?
 rol.w	 #1,d0                      ;rotate d0 one to the left.  why?
 dbra	 d1,GetKeys            ;do this 10 times?  why?  there are only 7 bytes
in the keyboard map.  in the last version it was 7 times, why 10 now?

 movem.l (a7)+,d0-d1/a0        ;restore registers
 rts