home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d438
/
toollib
/
examples
/
clock.s
< prev
next >
Wrap
Text File
|
1991-01-17
|
4KB
|
134 lines
*
* clock.s
*
* Just a little demo of how to program with the "tool.library"
*
* Please change, destruct, molest it for it's PUBLIC DOMAIN
*
*
* YES NICO, I HAVE BOUGHT POWERPACKER V3.0a ! (P.S. IT'S GREAT !!!)
*
INCDIR SYS:Devpac_INC/
INCLUDE tool.i
INCLUDE intuition/intuition.i
INCLUDE tool_lib.i
INCLUDE exec/exec_lib.i
INCLUDE intuition/intuition_lib.i
INCLUDE graphics/graphics_lib.i
INCLUDE misc/easystart.i
*
* open up the "tool.library" V7++
*
lea.l tool_name(pc),a1
moveq #TOOL_VERSION,d0
CALLEXEC OpenLibrary
move.l d0,_ToolBase
beq NoTOOL
*
* extract the IntuitionBase and GfxBase poiters
* so I can use them to call uppon routines of the
* intuition and graphics.library.
*
move.l d0,a0
move.l tb_IntuitionBase(a0),_IntuitionBase
move.l tb_GfxBase(a0),_GfxBase
*
* open the clock window, extract rastport
*
lea.l CL_nw(pc),a0
CALLINT OpenWindow
move.l d0,CWindow
beq NoWINDOW
move.l d0,a0
move.l wd_RPort(a0),RPort
*
* set up a "TimeDelay" structure which puts the task to
* sleep for a 1/2 second.
*
move.l wd_UserPort(a0),a0
move.l a0,WDPort
moveq #0,d0
move.l #500000,d1
CALLTOOL CreateTimeDelay
move.l d0,TimeDel
beq NoDELAY
*
* set graphics pens and mode
*
move.l RPort,a1
moveq #2,d0
CALLGRAF SetAPen
move.l RPort,a1
moveq #1,d0
CALLGRAF SetBPen
move.l RPort,a1
moveq #RP_JAM2,d0
CALLGRAF SetDrMd
*
* main clock loop
*
*
* get the current system date.
*
Loop: suba.l a0,a0
lea.l TBuf(pc),a1
moveq #ALL,d0
CALLTOOL GetDate
*
* set the rastport coordinates and print the date
*
move.l RPort,a1
moveq #28,d0
moveq #7,d1
CALLGRAF Move
move.l RPort,a1
lea.l TBuf(pc),a0
moveq #MINDATE-2,d0
CALLGRAF Text
*
* put the task to sleep for 1/2 second. everytime this
* half a second passed it will update the display.
*
move.l TimeDel,a0
CALLTOOL DoTimeDelay
tst.l d0
beq Loop
*
* "DoTimeDelay" returned true which means that a message
* came to the window it's userport. Since only CLOSEWINDOW
* can be the message it cleans up and exits the program.
*
move.l WDPort,a0
CALLEXEC GetMsg
move.l d0,a1
CALLEXEC ReplyMsg
move.l TimeDel,a0
CALLTOOL DeleteTimeDelay
NoDELAY: move.l CWindow,a0
CALLINT CloseWindow
NoWINDOW: move.l _ToolBase,a1
CALLEXEC CloseLibrary
NoTOOL: moveq #0,d0
rts
_ToolBase: dc.l 0
_IntuitionBase: dc.l 0
_GfxBase: dc.l 0
CWindow: dc.l 0
RPort: dc.l 0
WDPort: dc.l 0
TimeDel: dc.l 0
CL_nw: dc.w 100,0,270,10
dc.b 0,1
dc.l CLOSEWINDOW
dc.l WINDOWCLOSE!WINDOWDRAG!SIMPLE_REFRESH!NOCAREREFRESH!RMBTRAP
dc.l 0,0,0,0,0
dc.w 0,0,0,0,WBENCHSCREEN
tool_name: dc.b 'tool.library',0
even
TBuf: dcb.b MINDATE,0