A89: Mandelbrot Set Viewer


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

A89: Mandelbrot Set Viewer



I'm in the process of porting Jimmy Mardell's mandelbrot set viewer from Fargo to the TI-89 and I had to totally rewrite the input functions.  I have not tested all of them but I know that when I try the ESC key to exit, the program returns to the home screen but the busy indicator stays on.  The calc will respond to pushing the 2nd, alpha, and shift keys but other than that it is frozen.  First of all, can I use util::idle_loop() instead of reading the port directly?  Or will that not work since I'm using gray4lib?  Second, what is wrong with my current code?  Does the rts at the end simply return to the last branch and not actually exit the program?  Thanks for the help.
 
;above this is the stuff that actually draws the fractal
WaitKey:
 move.w  d4,oldx1
 move.w  d5,oldy1
 move.w  d6,oldx2
 move.w  d7,oldy2
WK:
 clr.l  d3
 move.b  #%0111111,($600019)
 nop
 nop
 nop
 nop
 move.b  ($60001b),d0
 btst.b  #0,d0                                ;check ESC
 beq Quit
 move.b  #%1111101,($600019)
 nop
 nop
 nop
 nop
 move.b  ($60001b),d0
 btst.b  #6,d0                                 ;check clear
 beq Pause
 btst.b  #4,d0                                 ;check /
 beq IterDec
 btst.b  #3,d0                                 ;check *
 beq IterInc
 btst.b  #2,d0                                 ;check -
 beq DecBox
 btst.b  #1,d0                                 ;check +
 beq IncBox
 btst.b  #0,d0                                 ;check enter
 beq ZoomIn
 move.b  #%1111011,($600019)
 nop
 nop
 nop
 nop
 move.b  ($60001b),d0
 btst.b  #6,d0                                 ;check backspace
 beq ZoomOut
 btst.b  #4,d0                                 ;check T
 beq Show
;check arrows
 move.b  #%11111110,($600019)
 nop
 nop
 nop
 nop
 move.b  ($60001b),d0
 btst.b  #1,d0                                 ;check left arrow
 bne CheckRight
 subq    #1,d4
 subq    #1,d6
 st      d3
CheckRight:
 btst.b  #3,d0
 bne CheckUp
 addq    #1,d4
 addq    #1,d6
 st      d3
CheckUp:
 btst.b  #0,d0
 bne CheckDown
 subq    #1,d5
 subq    #1,d7
 st      d3
CheckDown:
 btst.b  #2,d0
 bne CheckChange
 addq    #1,d5
 addq    #1,d7
 st      d3
CheckChange:
 tst     d3
 beq WK
 tst.w   d4
 bmi OutOfRange
 tst.w   d5
 bmi OutOfRange
 cmp.w   #240,d6
 bcc OutOfRange
 cmp.w   #120,d7
 bcc OutOfRange
 cmp.w   d6,d4
 bcc OutOfRange
 movem.l d4-d7,-(a7)
 move.w  oldx1,d4
 move.w  oldy1,d5
 move.w  oldx2,d6
 move.w  oldy2,d7
 bsr DrawBox
 movem.l (a7)+,d4-d7
 bsr DrawBox
 bra WaitKey
 
;Here are the functions like DecBox that act on the input
 
Quit:
 jsr gray4lib::off
 rts