Re: A89: Stron89, again!!!


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

Re: A89: Stron89, again!!!




I explained this befor, and I do it again, I see you have som new qustions, so
lets get going :)

S43R80@aol.com wrote:
> 
> Phew...FINALS ARE OVER!!!...That means I have a whole month off from school to
> finally do some more assembly...So I am going to refer back to some of my old
> questions that I didn't quite understand the first time around...However, I do
> have less questions than last time :)
> ---------------------------Program begins here-----------------------------
> 
>  kbd_arrows     EQU             %111111110
>  kbd_column5    EQU             %111111101
>  kbd_column4    EQU             %111111011
>  kbd_column3    EQU             %111110111
>  kbd_column2    EQU             %111101111
>  kbd_column1    EQU             %111011111
>  kbd_exitkey    EQU             %110111111
> 
>  dir_left       EQU             0
>  dir_up         EQU             1
>  dir_right      EQU             2
>  dir_down       EQU             3
> 
>  _main:
>         bsr             WaitKBD
> 
> So basically what equ does it let a variable equal something?
>    like storing something in a mem. position?

No. What equ does is an alias for
 
> 
>  ; ** Wait for all buttons to be released
>  WaitKBD:
>         move.w  #$00,d0                                 ; set keymask to read all keys
>         bsr             ReadKBD
>         cmp.b   #$ff,d0                                 ; check to see if any key is pressed
>         bne             WaitKBD                                 ; if so, start over
>         rts
> 
> Now i'm not sure why d1 is "saved" if nothing was put in d1 yet???
> oh i think i got it...this is so the same routine can be used later on by a
> new mask to check for a different key press...right???
> the first time the routine is executed it is to check if anything is pressed
> right?
> ahhh...i'm starting to see the light!!!
> 
>  ReadKBD:
>         move.w  d1,-(a7)
>         move.w  d0,d1
>         move.w  #$700,d0                    ; Disable interrupts, saving old in mask
>  in d0
>      trap    #1
> 
>         move.w  d1,($600018)                    ; set keymask
>         nop                                                             ; pause so TI89 has
>  time to apply the mask
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         nop
>         clr.w   d1
>         move.b  ($60001b),d1                    ; get keys hit
>         trap    #1
>         move.w  d1,d0
>         move.w  (a7)+,d1
>         rts
> 
> Someone gave me a small explanation of the trap command before but It didn't
> quite help me :(
> regarding trap:
> 1.  Why is $700 put in d0?
> 2.  What does moving $700 in d0 have to do with trap:Is there documentation on
> all trap uses?
> 3.  It says "Disable interrupts, saving old in mask".  What interrupts are
> being disabled?
> 4.  What is the "old in mask"
> 
> So 0 is put into ($600018) because thats the address of the keyboard?  so your
> basically resetting it to later check what new value is stored there?
> 
> nop gives it time to detect a key press?
> 
> now a new value (if a key was pressed) is put into ,($60001b).
> 
> again with the trap 1 thing...but why is there not a value put in d0 again
> like $700...like last time???
> 
> now rtsing back to waitkbd...
> 
>  WaitKBD:
>         move.w  #$00,d0                                 ; set keymask to read all keys
>         bsr             ReadKBD
>         cmp.b   #$ff,d0                                 ; check to see if any key is pressed
>         bne             WaitKBD                                 ; if so, start over
>         rts
> 
> if 0 was put in (600018) before then how will it contain $ff if nothing was
> pressed?
> 
> did the author actually mean" if not, start over" instead of if so, start
> over?
> 
> wow...asm is really hard...I hope there is hope for even the very
> inexperienced...well i'll know at the end of the month...
> 
> -THANKS-
>      -Steve-


References: