home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------------------------------------------------------------------------------
- ;1999/03/06
- ;Arie_Benichou@Hotmail.com
- ;-------------------------------------------------------------------------------------------------
- include doorsos.h
- include graphlib.h
- ;-------------------------------------------------------------------------------------------------
- xdef _ti89
- xdef _main
- xdef _comment
- ;-------------------------------------------------------------------------------------------------
- Laps equ 100
- MaskRow1 equ %11111101
- MaskRow5 equ %11011111
- MaskRow6 equ %10111111
- ;-------------------------------------------------------------------------------------------------
- DispValue: MACRO
- clr.l d2
- move.w \1,d2
- bsr String
- PxlText a0,\2,\3,\4,\5
- ENDM
- ;-------------------------------------------------------------------------------------------------
- Int1_OFF: MACRO
- clr.l d0
- move.w #$0700,d0
- trap #1
- bclr.b #2,($600001)
- move.l \1,($64)
- bset.b #2,($600001)
- trap #1
- ENDM
- ;-------------------------------------------------------------------------------------------------
- Int1_ON: MACRO
- clr.l d0
- move.w #$0700,d0
- trap #1
- bclr.b #2,($600001)
- move.l ($64),\1
- move.l \2,($64)
- bset.b #2,($600001)
- trap #1
- ENDM
- ;-------------------------------------------------------------------------------------------------
- PxlText: MACRO
- SetFont \5
- move.w \4,-(a7)
- move.l \1,-(a7)
- move.w \2,-(a7)
- move.w \3,-(a7)
- jsr doorsos::DrawStrXY
- lea 10(a7),a7
- ENDM
- ;-------------------------------------------------------------------------------------------------
- _main: Int1_ON oldint1,#NewInt1
- jsr graphlib::clr_scr
- ;-------------------------------------------------------------------------------------------------
- CLEAR: PxlText #time,#44,#48,#4,#2
- clr.w timer
- clr.w seconds
- clr.w minutes
- clr.w hours
- ;-------------------------------------------------------------------------------------------------
- KeyBoard: cmp.w #360,timer
- ble \MaskRow
- bsr CheckTime
-
- \MaskRow move.w #MaskRow1,d0
- bsr GetKey
- btst.b #6,d0
- beq CLEAR
- move.w #MaskRow5,d0
- bsr GetKey
- btst.b #0,d0
- beq APPS
- move.w #MaskRow6,d0
- bsr GetKey
- btst.b #0,d0
- beq ESC
-
- bra KeyBoard
- ;-------------------------------------------------------------------------------------------------
- APPS: trap #4
- bra KeyBoard
- ;-------------------------------------------------------------------------------------------------
- ESC: Int1_OFF oldint1
- Return rts
- ;-------------------------------------------------------------------------------------------------
- CheckTime: clr.w timer
- add.w #1,seconds
- cmp.w #60,seconds
- bne \DispTime
- clr.w seconds
- add.w #1,minutes
- cmp.w #60,minutes
- bne \DispTime
- clr.w minutes
- add.w #1,hours
- cmp.w #24,hours
- bne \DispTime
- clr.w hours
-
- \DispTime DispValue seconds,#44,#96,#4,#2
- DispValue minutes,#44,#72,#4,#2
- DispValue hours,#44,#48,#4,#2
- rts
- ;-------------------------------------------------------------------------------------------------
- GetKey: move.w d0,$600018
- move.w #Laps,d0
- \delay dbra d0,\delay
- move.b $60001b,d0
- rts
- ;-------------------------------------------------------------------------------------------------
- NewInt1: add.w #1,timer
- rte
- ;-------------------------------------------------------------------------------------------------
- String: move.l #str+8,a0
- clr.b (a0)
- clr.l d3
-
- \str_loop add.l #1,d3
- divu #10,d2
- swap d2
- add.b #48,d2
- move.b d2,-(a0)
- clr.w d2
- swap d2
- tst.w d2
- bne \str_loop
- cmp.l #1,d3
- bne Return
- clr.l d2
- add.b #48,d2
- move.b d2,-(a0)
- rts
- ;-------------------------------------------------------------------------------------------------
- _comment: dc.b "Time by Arie",0
- ;-------------------------------------------------------------------------------------------------
- time: dc.b "00:00:00"
-
- BSS
- str: ds.b 8
- timer: ds.w 1
- seconds: ds.w 1
- minutes: ds.w 1
- hours: ds.w 1
- oldint1: ds.l 1
- ;-------------------------------------------------------------------------------------------------
- end