home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 89 / asm / source / button.asm next >
Encoding:
Assembly Source File  |  2001-07-01  |  2.9 KB  |  50 lines

  1.  include "tios.h" ;The include file for the TI-OS in the calculator.
  2.  include "util.h" ;Utilities include file
  3.  xdef _main       ;Label to jump to when the program starts
  4.  xdef _comment    ;Pointer to the comment that appears in Doors OS/Plusshell
  5.  xdef _ti89       ;This program is designed for the TI89
  6.  
  7. WriteStr macro    ;A macro. This does not save bytes. Every time this macro is called, it is included in the program again.
  8.  move.w \3,-(a7)  ;Set the font to display the words in. Can be white on black, black on white, "xor" (inversed), and some other stuff.
  9.  pea \4(pc)       ;Point to the string to display
  10.  move.w \2,-(a7)  ;Where to start the string vertically
  11.  move.w \1,-(a7)  ;Where to start the string horizontally
  12.  jsr tios::DrawStrXY  ;call tios and put the string on the screen
  13.  lea 10(a7),a7    ;Fix the stack pointer. (I have no idea why I must do this, e-mail me if you do.)
  14.  endm             ;End the macro.
  15.  
  16. _main:                        ;Defines the _main label. The main loop of the program.
  17.  jsr util::clr_scr            ;Clear the screen, using the util library.
  18.  WriteStr #1,#1,#1,message    ;Put string "message" at 1,1 on the screen
  19.  WriteStr #1,#9,#1,messageb   ;Put string "messageb" at 1,9 on the screen
  20.  WriteStr #1,#17,#1,messagec  ;Put string "messagec" at 1,17 on the screen
  21.  WriteStr #1,#25,#1,messaged  ;Put string "messaged" at 1,25 on the screen
  22.  jsr util::idle_loop          ;Wait for a keypress, store keypress in d0
  23.  cmp #51,d0                   ;See if keypress is key #51, or the button marked 3 w/o 2nd, diamond, shift, or alpha
  24.  beq _exit                    ;If the key truly is the 3 key, go to the label _exit
  25.  jsr util::clr_scr            ;Use the util libary to clear the screen.
  26.  WriteStr #1,#1,#1,messagee   ;Put messagee at 1,1 on the screen
  27.  jsr util::idle_loop          ;Wait for a keypress, store keypress in d0
  28.  jmp _main                    ;Go back to label _main
  29.  
  30. _exit:                        ;Label this secion _exit
  31.  jsr util::clr_scr            ;Clear the screen using util
  32.  WriteStr #1,#1,#1,messagef   ;Put messagef on the screen at 1,1
  33.  WriteStr #1,#9,#1,messageg   ;Put messageg on the screen at 1,9
  34.  jsr util::idle_loop          ;Wait for a keypress, store keypress in d0
  35.  rts                          ;Exit the program!
  36.  
  37. ;This is the data section. The entire data section is comprised of strings, which have been displayed in the above program.
  38. ;Note to newbies: make sure you always have dc.b and ,0! :)
  39.  
  40. _comment: dc.b "Mogsoft's Secret Button 1.0",0
  41. message: dc.b "Welcome! You cannot exit",0
  42. messageb: dc.b "this program until you",0
  43. messagec: dc.b "find the secret key.",0
  44. messaged: dc.b "(Hint: It's not 3!)",0
  45. messagee: dc.b "Incorrect. Try again.",0
  46. messagef: dc.b "Wow! How'd you figure that",0
  47. messageg: dc.b "out?! You're psychic!",0
  48.  
  49.  end ;End the source. In your programs, MAKE SURE THERE'S A BLANK LINE AT THE END! :)
  50.