home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
335.lha
/
MouseCoords
/
MouseCoords.s
< prev
next >
Wrap
Text File
|
1990-01-10
|
5KB
|
314 lines
****************************************************************************
*
* MouseCoords © Copyright 1989 by Jonathan Potter
*
* Freely redistributable, not public domain
*
* Assembled with DevPac v2.14
*
****************************************************************************
opt c+
incdir "devinclude:"
include exec/exec_lib.i
include exec/memory.i
include intuition/intuition.i
include intuition/intuitionbase.i
include intuition/intuition_lib.i
include graphics/graphics_lib.i
include libraries/dos_lib.i
include libraries/dos.i
move.l #0,d0
lea intname,a1
CALLEXEC OpenLibrary
move.l d0,_IntuitionBase
move.l #0,d0
lea grafname,a1
CALLEXEC OpenLibrary
move.l d0,_GfxBase
move.l #0,d0
lea dosname,a1
CALLEXEC OpenLibrary
move.l d0,_DOSBase
move.l #80,d0
move.l #MEMF_CHIP,d1
CALLEXEC AllocMem
move.l d0,NextImageData_chip
move.l NextImageData_chip,NextImage+10
lea NextImageData,a0
move.l NextImageData_chip,a1
move.l #80,d0
CALLEXEC CopyMem
move.l _IntuitionBase,a0
move.l ib_FirstScreen(a0),newwindow+30
openup:
lea newwindow,a0
CALLINT OpenWindow
tst.l d0
beq exit
move.l d0,MyWindow
move.l MyWindow,a0
lea NextGadget,a1
move.l #1,d0
move.l #1,d1
move.l 0,a2
CALLINT AddGList
lea NextGadget,a0
move.l MyWindow,a1
move.l 0,a2
move.l #1,d0
CALLINT RefreshGList
move.l MyWindow,a2
move.l wd_RPort(a2),rp
move.l wd_WScreen(a2),a2
move.l a2,MyScreen
move.l rp,a1
move.l #1,d0
CALLGRAF SetAPen
move.l #RP_JAM2,d0
CALLGRAF SetDrMd
forever:
move.l #1,d1
CALLDOS Delay
move.l rp,a1
move.l #30,d0
move.l #7,d1
CALLGRAF Move
lea xstring,a0
move.l #2,d0
CALLGRAF Text
move.l rp,a1
move.l #70,d0
move.l #7,d1
CALLGRAF Move
lea ystring,a0
move.l #3,d0
CALLGRAF Text
move.l MyScreen,a2
move.l sc_MouseX(a2),d0
cmp.l ox,d0
beq doy
move.l d0,ox
lea sc_MouseX(a2),a1
lea string,a3
jsr sprintf
move.l rp,a1
move.l #46,d0
move.l #7,d1
CALLGRAF Move
lea string,a0
move.l #3,d0
CALLGRAF Text
doy:
move.l MyScreen,a2
move.l sc_MouseY(a2),d0
cmp.l oy,d0
beq checkport
move.l d0,oy
lea sc_MouseY(a2),a1
lea string,a3
jsr sprintf
move.l rp,a1
move.l #94,d0
move.l #7,d1
CALLGRAF Move
lea string,a0
move.l #3,d0
CALLGRAF Text
checkport:
move.l MyWindow,a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
tst.l d0
beq forever
move.l d0,Msg
move.l d0,a1
CALLEXEC ReplyMsg
move.l Msg,a1
move.l im_Class(a1),d1
cmp.l #CLOSEWINDOW,d1
beq exit
move.l MyScreen,a0
move.l (a0),newsc
tst.l newsc
beq forever
move.l sc_Width(a0),d0
cmp.l #196,d0
blt forever
move.l MyScreen,a0
CALLINT ScreenToBack
move.l newsc,MyScreen
move.l MyScreen,a0
CALLINT ScreenToFront
move.l MyScreen,newwindow+30
move.l MyWindow,a0
CALLINT CloseWindow
bra openup
exit:
move.l MyWindow,d0
tst.l d0
beq exit1
move.l MyWindow,a0
CALLINT CloseWindow
exit1:
move.l NextImageData_chip,a1
move.l #80,d0
CALLEXEC FreeMem
move.l _DOSBase,a1
CALLEXEC CloseLibrary
move.l _GfxBase,a1
CALLEXEC CloseLibrary
move.l _IntuitionBase,a1
CALLEXEC CloseLibrary
rts
sprintf:
lea formstring,a0
lea.l stuffChar(pc),a2
CALLEXEC RawDoFmt
rts
stuffChar:
move.b d0,(a3)+
rts
_IntuitionBase
dc.l 0
_GfxBase
dc.l 0
_DOSBase
dc.l 0
MyWindow
dc.l 0
MyScreen
dc.l 0
newsc
dc.l 0
rp
dc.l 0
intname
INTNAME
grafname
GRAFNAME
dosname
DOSNAME
string
dc.b 0,0,0,0,0
formstring
dc.b '%03d',0,0
ox
dc.l 0
oy
dc.l 0
xstring
dc.b 'X:'
ystring
dc.b ' Y:',0
; Image-Ed Image generation
; Start of Image data
NextImageData:
; Plane 0
dc.w $ffff
dc.w $ff00
dc.w $82d0
dc.w $4100
dc.w $eed5
dc.w $5d00
dc.w $eed5
dc.w $5d00
dc.w $eed5
dc.w $4100
dc.w $eed7
dc.w $5f00
dc.w $eed7
dc.w $5f00
dc.w $aed7
dc.w $5f00
dc.w $8e17
dc.w $5f00
dc.w $ffff
dc.w $ff00
; Plane 1
dc.w $0000
dc.w $0000
dc.w $7d2f
dc.w $be00
dc.w $112a
dc.w $a200
dc.w $112a
dc.w $a200
dc.w $112a
dc.w $be00
dc.w $1128
dc.w $a000
dc.w $1128
dc.w $a000
dc.w $5128
dc.w $a000
dc.w $71e8
dc.w $a000
dc.w $0000
dc.w $0000
; End of Image data
NextImageData_chip
dc.l 0
NextImage
dc.w 0,0 ; LeftEdge, TopEdge
dc.w 24,10 ; Width, Height
dc.w 2 ; Depth
dc.l NextImageData ; ImageData
dc.b 3,0 ; PlanePick, PlaneOnOff
dc.l 0 ; Next Image
; End of Image-Ed Image generation
NextGadget
dc.l 0
dc.w 119,0,24,10
dc.w GADGHCOMP|GADGIMAGE,RELVERIFY|TOPBORDER,BOOLGADGET
dc.l NextImage,0,0,0,0,1,0
newwindow
dc.w 0,0,196,10
dc.b 0,1
dc.l CLOSEWINDOW|GADGETUP
dc.l RMBTRAP|SMART_REFRESH|NOCAREREFRESH|WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG
dc.l 0,0,windowtitle,0,0
dc.w 0,0,0,0,CUSTOMSCREEN
windowtitle
dc.b 'MouseCoords',0
Msg
dc.l 0