home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d437
/
fmouse
/
fmc.ass
< prev
next >
Wrap
Text File
|
1991-01-15
|
27KB
|
1,245 lines
; Source 17
;
; FMouse Menu Creator V1.00
;
;
; © Roger Fischlin
; Steigerwaldweg 6
; 6450 Hanau 7
; (West) Germany
;
;
; This program may be freely distributed if you do NOT gain any
; any profit by using or/and distributing it.
;
incdir "ram:include/"
include "exec/interrupts.i"
include "devices/inputevent.i"
include "devices/input.i"
include "exec/devices.i"
include "exec/exec_lib.i"
include "exec/exec.i"
include "exec/ports.i"
include "intuition/intuition_lib.i"
include "intuition/intuition.i"
include "graphics/graphics_lib.i"
include "libraries/dos_lib.i"
include "libraries/dos.i"
include "libraries/dosextens.i"
FM_PORTNAME macro
dc.b "FMouse.Port",0
even
endm
FM_NewNames equ 4
FM_Done equ -1
FM_Message rsreset
FMM_Message rs.b MN_SIZE
FMM_Command rs.b 1
FMM_Data rs.l 1
FMM_SIZEOF rs.b 0
CALL_INT macro
move.l _IntuitionBase(pc),a6
jsr _LVO\1(a6)
endm
CALL_GRAF macro
move.l _GfxBase(pc),a6
jsr _LVO\1(a6)
endm
CALL_DOS macro
move.l _DOSBase(pc),a6
jsr _LVO\1(a6)
endm
;
; startup code
;
sub.l a1,a1
CALLEXEC FindTask
move.l d0,a4
tst.l pr_CLI(a4)
bne.s end_startup
fromWorkbench lea pr_MsgPort(a4),a0
CALLEXEC WaitPort
lea pr_MsgPort(a4),a0
CALLEXEC GetMsg
move.l d0,returnMsg
end_startup bsr.s MAIN
tst.l returnMsg
beq.s exitToDOS
CALLEXEC Forbid
move.l returnMsg(pc),a1
CALLEXEC ReplyMsg
exitToDOS moveq.l #0,d0
rts
returnMsg dc.l 0
;
; MAIN
;
MAIN jsr GetLibs ; open libs
tst.l d0
beq .NoLibs
bsr FMouseMenu
.NoLibs jsr CloseLibs ; close libs
rts
;
; WINDOW
;
ID_ABOUT equ 0
ID_LOAD equ 1
ID_SAVE equ 2
ID_USE equ 3
ID_RESET equ 4
ID_QUIT equ 5
FMouseMenu lea.l WindowData(pc),a0 ; open window
CALL_INT OpenWindow
move.l d0,WindowPointer
beq Error
move.l d0,a1 ; set pen #2
move.l wd_RPort(a1),a1
move.l a1,a2
moveq.l #2,d0
CALL_GRAF SetAPen
lea.l FONT(pc),a0 ; open TOPAZ-80
CALL_GRAF OpenFont
move.l d0,TOPAZ_80 ; ????
beq NoFont
move.l d0,a0
move.l a2,a1
CALL_GRAF SetFont ; use font
move.l a2,a1 ; draw rectangle
move.l WindowPointer(pc),a0
moveq.l #0,d0
moveq.l #0,d1
move.w wd_Width(a0),d2
move.w wd_Height(a0),d3
subq.l #1,d2
subq.l #1,d3
add.b wd_BorderLeft(a0),d0
add.b wd_BorderTop(a0),d1
sub.b wd_BorderRight(a0),d2
sub.b wd_BorderBottom(a0),d3
CALL_GRAF RectFill
bsr Write
lea.l Gadget1(pc),a0
move.l WindowPointer(pc),a1
sub.l a2,a2
CALL_INT RefreshGadgets
bsr WriteText
bsr GetMenu ; read FMouse menu entries
WAIT move.l WindowPointer(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC WaitPort
move.l WindowPointer(pc),a0 ; wait for message
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg ; get it !
move.l d0,a1
move.w im_Code(a1),d2
move.l im_Class(a1),d3
move.l im_IAddress(a1),a2
CALLEXEC ReplyMsg ; reply it !
cmp.l #CLOSEWINDOW,d3 ; close window
beq.s Exit
move.b gg_GadgetID+1(a2),d2 ; get GadgetID
cmp.b #ID_ABOUT,d2
beq ABOUT
cmp.b #ID_LOAD,d2
beq LOAD
cmp.b #ID_SAVE,d2
beq SAVE
cmp.b #ID_USE,d2
beq USE
cmp.b #ID_RESET,d2
beq Reset
Exit move.l WindowPointer(pc),a0 ; close window
CALL_INT CloseWindow
move.l TOPAZ_80(pc),a1
CALL_GRAF CloseFont
Error rts
NoFont move.l WindowPointer(pc),a0 ; close window
CALL_INT CloseWindow
rts
WindowData dc.w 0,0
dc.w 640,200
dc.b -1,-1
dc.l CLOSEWINDOW!GADGETUP
dc.l WINDOWCLOSE!SMART_REFRESH!ACTIVATE!RMBTRAP!WINDOWDRAG!WINDOWDEPTH
dc.l Gadget1
dc.l 0
dc.l .Name
dc.l 0
dc.l 0
dc.w 160,100+11+1
dc.w 160,100+11+1
dc.w WBENCHSCREEN
.Name dc.b "FMouse Menu Creator V1.00 © 1990 by Roger Fischlin",0
even
WindowPointer dc.l 0
TOPAZ_80 dc.l 0
FONT dc.l fontname
dc.w TOPAZ_EIGHTY
dc.b FS_NORMAL
dc.b FPF_ROMFONT
even
fontname dc.b "topaz.font",0
even
FONT_BOLD dc.l fontname
dc.w TOPAZ_EIGHTY
dc.b FSF_BOLD
dc.b FPF_ROMFONT
even
FONT_ITALICS dc.l fontname
dc.w TOPAZ_EIGHTY
dc.b FSF_ITALIC
dc.b FPF_ROMFONT
even
FMC_GADGETS macro ; marco for Name and Exec Gadget
dc.l .Exec\@
dc.w 10,(\2*12)+40
dc.w 32*8,10
dc.w GADGHCOMP,0,STRGADGET
dc.l 0,0,0,0,.Info1\@
dc.w 0
dc.l 0
.Info1\@ dc.l LISTE+\2*(32+64)
dc.l .Buffer1\@
dc.w 0,32
dcb.b si_SIZEOF-12
.Buffer1\@ dcb.b 32
.Exec\@ dc.l \1
dc.w 280,(\2*12)+40
dc.w 640-280-10,10
dc.w GADGHCOMP,0,STRGADGET
dc.l 0,0,0,0,.Info2\@
dc.w 0
dc.l 0
.Info2\@ dc.l LISTE+\2*(32+64)+32
dc.l .Buffer2\@
dc.w 0,64
dcb.b si_SIZEOF-12
.Buffer2\@ dcb.b 64
endm
Gadget1 FMC_GADGETS Gadget2,0 ; gadgets (part 1)
Gadget2 FMC_GADGETS Gadget3,1
Gadget3 FMC_GADGETS Gadget4,2
Gadget4 FMC_GADGETS Gadget5,3
Gadget5 FMC_GADGETS Gadget6,4
Gadget6 FMC_GADGETS Gadget7,5
Gadget7 FMC_GADGETS Gadget8,6
Gadget8 FMC_GADGETS Gadget9,7
Gadget9 FMC_GADGETS Gadget10,8
FMC_GADGET2 macro ; marco for gadgets
dc.l \1
dc.w \2,-20
dc.w 60,15
dc.w GADGIMAGE!GADGHCOMP!GRELBOTTOM,RELVERIFY,BOOLGADGET
dc.l .Image1,0,.Text1,0,0
dc.w \3
dc.l 0
.Image1 dc.w 0,0,60,15,2
dc.l 0
dc.b 0,1
dc.l .Image2
.Image2 dc.w 2,1,60-4,15-2,2
dc.l 0
dc.b 0,3
dc.l 0
.Text1 dc.b 2,0,RP_JAM1,0
dc.w (60-(\5*8))/2,((15-8)/2)
dc.l FONT,.String,0
.String dc.b \4,0
even
endm
Gadget10 FMC_GADGET2 Gadget11,10+0*(60+52),ID_ABOUT,<"About">,5
Gadget11 FMC_GADGET2 Gadget12,10+1*(60+52),ID_LOAD,<"Load">,4
Gadget12 FMC_GADGET2 Gadget13,10+2*(60+52),ID_SAVE,<"Save">,4
Gadget13 FMC_GADGET2 Gadget14,10+3*(60+52),ID_USE,<"Use">,3
Gadget14 FMC_GADGET2 Gadget15,10+4*(60+52),ID_RESET,<"Reset">,5
Gadget15 FMC_GADGET2 Gadget16,10+5*(60+52),ID_QUIT,<"Quit">,4
Gadget16 dc.l Gadget17
dc.w 10+((32-8)*8),-45
dc.w 8*8,10
dc.w GADGHCOMP!GRELBOTTOM,LONGINT,STRGADGET
dc.l 0,0,0,0,.Info
dc.w 0
dc.l 0
.Info dc.l SpeedText
dc.l .Buffer
dc.w 0,8
dcb.b si_SIZEOF-12
.Buffer dcb.b 10
SpeedText dcb.b 10
Gadget17 dc.l 0
dc.w 640-10-(8*8),-45
dc.w 8*8,10
dc.w GADGHCOMP!GRELBOTTOM,LONGINT,STRGADGET
dc.l 0,0,0,0,.Info
dc.w 0
dc.l 0
.Info dc.l BlankText
dc.l .Buffer
dc.w 0,8
dcb.b si_SIZEOF-12
.Buffer dcb.b 10
BlankText dcb.b 10
;
; data section
;
Text_32 Macro
.label1\@ dc.b \1
.label2\@ ds.b 32-(.label2\@-.label1\@)
endm
Text_64 Macro
.label1\@ dc.b \1
.label2\@ ds.b 64-(.label2\@-.label1\@)
endm
even
Version dc.b "1.00"
dc.l 0
SPEED dc.w 4
Time dc.l 4*50
LISTE Text_32 <"1. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"2. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"3. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"4. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"5. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"6. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"7. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"8. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"9. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
ENDE Text_32 <"0. Exit">
;
; get libraries
;
GetLibs lea.l IntName(pc),a1 ; open libraries
moveq.l #33,d0
CALLEXEC OpenLibrary
move.l d0,_IntuitionBase
beq.s .Error
lea.l DosName(pc),a1
moveq.l #33,d0
CALLEXEC OpenLibrary
move.l d0,_DOSBase
beq.s .Error
lea.l GfxName(pc),a1
moveq.l #33,d0
CALLEXEC OpenLibrary
move.l d0,_GfxBase
.Error rts
_IntuitionBase dc.l 0
_GfxBase dc.l 0
_DOSBase dc.l 0
IntName INTNAME
DosName DOSNAME
GfxName GRAFNAME
;
; close libraries
;
CloseLibs moveq.l #0,d5 ; close Libraries
move.l _IntuitionBase(pc),a1
cmp.l a0,d5
beq.s .Skip1
CALLEXEC CloseLibrary
.Skip1 move.l _DOSBase(pc),a1
cmp.l a0,d5
beq.s .Skip2
CALLEXEC CloseLibrary
.Skip2 move.l _GfxBase(pc),a1
cmp.l a0,d5
beq.s .Skip3
CALLEXEC CloseLibrary
.Skip3 rts
;
; get menu entries
;
GetMenu CALLEXEC Forbid
lea.l PortName(pc),a1
CALLEXEC FindPort ; look for FMouse port
tst.l d0
beq.s .NotFound
move.l d0,a0
lea.l Version(pc),a1
lea.l MP_SIZE(a0),a0
move.w #ENDE-Version-1,d0 ; copy data
.Loop move.b (a0)+,(a1)+
dbra d0,.Loop
CALLEXEC Permit
bsr Write
lea.l Gadget1(pc),a0 ; refresh gadgets
move.l WindowPointer(pc),a1
sub.l a2,a2
CALL_INT RefreshGadgets
moveq.l #0,d0
rts
.NotFound CALLEXEC Permit
moveq.l #-1,d0
rts
;
; set menu entries
;
USE bsr Read
CALLEXEC Forbid
lea.l PortName(pc),a1
CALLEXEC FindPort ; look for FMouse port
tst.l d0
beq.s .NotFound
move.l d0,a0
move.l d0,a3
lea.l Version(pc),a1
lea.l MP_SIZE(a0),a0
move.w #ENDE-Version-1,d0 ; copy data
.Loop move.b (a1)+,(a0)+
dbra d0,.Loop
tst.l d0
bne.s .Error
lea.l Message(pc),a0
moveq.l #FMM_SIZEOF-1,d0 ; init structure
.Label2 clr.b (a0)+
dbra d0,.Label2
bsr InitPort ; get reply port
tst.l d0
bmi.s .Error
lea.l ReplyPort(pc),a0
lea.l Message(pc),a1
move.b #NT_MESSAGE,LN_TYPE(a1)
move.w #FMM_SIZEOF,MN_LENGTH(a1)
move.l a0,MN_REPLYPORT(a1)
move.b #FM_NewNames,FMM_Command(a1)
move.l a3,a0
CALLEXEC PutMsg ; tell FMouse that menu entries have been changed...
lea.l ReplyPort(pc),a0 ; wait for reply
CALLEXEC WaitPort
lea.l ReplyPort(pc),a0 ; get reply
CALLEXEC GetMsg
bsr FreePort
.Error CALLEXEC Permit
bra WAIT
.NotFound CALLEXEC Permit ; you must run FMouse ....
lea.l .Req(pc),a0
move.l WindowPointer(pc),a1
move.w wd_Width(a1),d0 ; put requester into
sub.w #340,d0 ; window centre
lsr.w #1,d0
move.w d0,rq_LeftEdge(a0)
move.w wd_Height(a1),d0
sub.w #50,d0
lsr.w #1,d0
move.w d0,rq_TopEdge(a0)
move.w #340,rq_Width(a0)
move.w #50,rq_Height(a0)
move.b #1,rq_BackFill(a0)
lea.l .Gadget(pc),a2
move.l a2,rq_ReqGadget(a0)
lea.l .Text1(pc),a2
move.l a2,rq_ReqText(a0)
CALL_INT Request
move.l WindowPointer(pc),a0 ; wait for user reply
move.l wd_UserPort(a0),a0
CALLEXEC WaitPort
move.l WindowPointer(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
move.l d0,a1
CALLEXEC ReplyMsg
bra WAIT
.Req dcb.b rq_SIZEOF,0
even
.Gadget dc.l 0
dc.w (340-60)/2,-20
dc.w 60,15
dc.w GADGHCOMP!GRELBOTTOM,RELVERIFY!ENDGADGET,BOOLGADGET
dc.l .Border,0,.GText,0,0
dc.w 0
dc.l 0
.Border dc.w 0,0
dc.b 3,0,RP_JAM1,5
dc.l .XY,0
.XY dc.w 0,0,59,0,59,14,0,14,0,0
.GText dc.b 2,0,RP_JAM1,0
dc.w (60-(2*8))/2,((15-8)/2)
dc.l FONT,.String,0
.String dc.b "OK",0
even
.Text1 dc.b 2,0,RP_JAM1,0
dc.w (340-(20*8))/2,10
dc.l FONT_BOLD,.String1,0
.String1 dc.b "FMouse not running !",0
even
rts
Message dcb.b FMM_SIZEOF,0
even
PortName FM_PORTNAME
;
; About
;
ABOUT lea.l .Req(pc),a0
move.l WindowPointer(pc),a1
move.w wd_Width(a1),d0 ; put requester into
sub.w #340,d0 ; window centre
lsr.w #1,d0
move.w d0,rq_LeftEdge(a0)
move.w wd_Height(a1),d0
sub.w #125,d0
lsr.w #1,d0
move.w d0,rq_TopEdge(a0)
move.w #340,rq_Width(a0)
move.w #125,rq_Height(a0)
move.b #1,rq_BackFill(a0)
lea.l .Gadget(pc),a2
move.l a2,rq_ReqGadget(a0)
lea.l .Text1(pc),a2
move.l a2,rq_ReqText(a0)
CALL_INT Request
move.l WindowPointer(pc),a0 ; wait for user reply
move.l wd_UserPort(a0),a0
CALLEXEC WaitPort
move.l WindowPointer(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
move.l d0,a1
CALLEXEC ReplyMsg
bra WAIT
.Req dcb.b rq_SIZEOF,0
.Gadget dc.l 0
dc.w (340-60)/2,-20
dc.w 60,15
dc.w GADGHCOMP!GRELBOTTOM,RELVERIFY!ENDGADGET,BOOLGADGET
dc.l .Border,0,.GText,0,0
dc.w 0
dc.l 0
.Border dc.w 0,0
dc.b 3,0,RP_JAM1,5
dc.l .XY,0
.XY dc.w 0,0,59,0,59,14,0,14,0,0
.GText dc.b 2,0,RP_JAM1,0
dc.w (60-(2*8))/2,((15-8)/2)
dc.l FONT,.String,0
.String dc.b "OK",0
even
.Text1 dc.b 2,0,RP_JAM1,0
dc.w (340-(28*8))/2,5
dc.l FONT_BOLD,.String1,.Text2
.String1 dc.b "FMouse & FMouse Menu Creator",0
even
.Text2 dc.b 0,0,RP_JAM1,0
dc.w (340-(28*8))/2,20
dc.l FONT,.String2,.Text3
.String2 dc.b "© 1990 by Roger Fischlin",0
even
.Text3 dc.b 0,0,RP_JAM1,0
dc.w (340-(28*8))/2,30
dc.l FONT,.String3,.Text4
.String3 dc.b " Steigerwaldweg 6",0
even
.Text4 dc.b 0,0,RP_JAM1,0
dc.w (340-(28*8))/2,40
dc.l FONT,.String4,.Text5
.String4 dc.b " D-6450 Hanau 7",0
even
.Text5 dc.b 0,0,RP_JAM1,0
dc.w (340-(28*8))/2,50
dc.l FONT,.String5,.Text6
.String5 dc.b " West Germany",0
even
.Text6 dc.b 3,0,RP_JAM1,0
dc.w (340-(41*8))/2,70
dc.l FONT_ITALICS,.String6,.Text7
.String6 dc.b "It may be freely distributed if you don't",0
even
.Text7 dc.b 3,0,RP_JAM1,0
dc.w (340-(41*8))/2,80
dc.l FONT_ITALICS,.String7,0
.String7 dc.b "gain any profit by using/distributing it!",0
even
;
; Load
;
LOAD lea .arpname(pc),a1 ; try to open arp
moveq.l #0,d0
CALLEXEC OpenLibrary
tst.l d0
beq .NoArp
move.l d0,a6
lea.l .FR(pc),a0
move.l WindowPointer(pc),12(a0)
jsr -294(a6) ; file requester
move.l d0,d5
move.l a6,a1
CALLEXEC CloseLibrary
tst.l d5
beq WAIT
lea.l .Dir(pc),a0
move.l a0,d1
moveq.l #ACCESS_READ,d2
CALL_DOS Lock
move.l d0,d1
beq .Error
CALL_DOS CurrentDir ; set current dir
move.l d0,d6
lea.l .File(pc),a0
move.l a0,d1
move.l #MODE_OLDFILE,d2
CALL_DOS Open ; open file
move.l d0,d5
beq.s .Error2
move.l d0,d1
move.l #SPEED,d2
move.l #ENDE-SPEED,d3
CALL_DOS Read ; read file
move.l d5,d1
CALL_DOS Close
move.l d6,d0 ; restore dir
CALL_DOS CurrentDir
CALL_DOS UnLock ; free lock
bsr Write
lea.l Gadget1(pc),a0
move.l WindowPointer(pc),a1
sub.l a2,a2
CALL_INT RefreshGadgets
bra WAIT
.Error2 move.l d6,d0 ; restore dir
CALL_DOS CurrentDir
CALL_DOS UnLock ; free lock
.Error lea.l .Req(pc),a0
move.l WindowPointer(pc),a1
move.w wd_Width(a1),d0 ; put requester into
sub.w #340,d0 ; window centre
lsr.w #1,d0
move.w d0,rq_LeftEdge(a0)
move.w wd_Height(a1),d0
sub.w #50,d0
lsr.w #1,d0
move.w d0,rq_TopEdge(a0)
move.w #340,rq_Width(a0)
move.w #50,rq_Height(a0)
move.b #1,rq_BackFill(a0)
lea.l .Gadget(pc),a2
move.l a2,rq_ReqGadget(a0)
lea.l .Text1(pc),a2
move.l a2,rq_ReqText(a0)
CALL_INT Request
move.l WindowPointer(pc),a0 ; wait for user reply
move.l wd_UserPort(a0),a0
CALLEXEC WaitPort
move.l WindowPointer(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
move.l d0,a1
CALLEXEC ReplyMsg
bra WAIT
.Req dcb.b rq_SIZEOF,0
even
.Gadget dc.l 0
dc.w (340-60)/2,-20
dc.w 60,15
dc.w GADGHCOMP!GRELBOTTOM,RELVERIFY!ENDGADGET,BOOLGADGET
dc.l .Border,0,.GText,0,0
dc.w 0
dc.l 0
.Border dc.w 0,0
dc.b 3,0,RP_JAM1,5
dc.l .XY,0
.XY dc.w 0,0,59,0,59,14,0,14,0,0
.GText dc.b 2,0,RP_JAM1,0
dc.w (60-(2*8))/2,((15-8)/2)
dc.l FONT,.String,0
.String dc.b "OK",0
even
.Text1 dc.b 2,0,RP_JAM1,0
dc.w (340-(28*8))/2,10
dc.l FONT_BOLD,.String1,0
.String1 dc.b "DOS error : file not found !",0
even
.arpname dc.b "arp.library",0
even
.FR dc.l .Title,.File,.Dir,0
dc.b 0,0
dc.l 0,0
.Title dc.b "Load FMouse data file : ",0
even
.Dir dcb.b 34,0
even
.File dcb.b 34,0
even
.NoArp lea.l .Req2(pc),a0
move.l WindowPointer(pc),a1
move.w wd_Width(a1),d0 ; put requester into
sub.w #340,d0 ; window centre
lsr.w #1,d0
move.w d0,rq_LeftEdge(a0)
move.w wd_Height(a1),d0
sub.w #70,d0
lsr.w #1,d0
move.w d0,rq_TopEdge(a0)
move.w #340,rq_Width(a0)
move.w #70,rq_Height(a0)
move.b #1,rq_BackFill(a0)
lea.l .GadgetOK(pc),a2
move.l a2,rq_ReqGadget(a0)
lea.l .Text2(pc),a2
move.l a2,rq_ReqText(a0)
CALL_INT Request
move.l WindowPointer(pc),a0 ; wait for user reply
move.l wd_UserPort(a0),a0
CALLEXEC WaitPort
move.l WindowPointer(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
move.l d0,a1
move.l im_IAddress(a1),a2
CALLEXEC ReplyMsg
move.w gg_GadgetID(a2),d0
bne WAIT
lea.l .FILE(pc),a0
move.l a0,d1
move.l #MODE_OLDFILE,d2
CALL_DOS Open ; open file
move.l d0,d5
beq .Error
move.l d0,d1
move.l #SPEED,d2
move.l #ENDE-SPEED,d3
CALL_DOS Read ; read file
move.l d5,d1
CALL_DOS Close
bsr Write
lea.l Gadget1(pc),a0
move.l WindowPointer(pc),a1
sub.l a2,a2
CALL_INT RefreshGadgets
bra WAIT
.Req2 dcb.b rq_SIZEOF,0
even
.GadgetOK dc.l .GadgetCancel
dc.w 20,-20
dc.w 60,15
dc.w GADGHCOMP!GRELBOTTOM,RELVERIFY!ENDGADGET,BOOLGADGET
dc.l .Border,0,.GTextOK,0,0
dc.w 0
dc.l 0
.GTextOK dc.b 2,0,RP_JAM1,0
dc.w (60-(2*8))/2,((15-8)/2)
dc.l FONT,.StringOK,0
.StringOK dc.b "OK",0
even
.GadgetCancel dc.l .STGadget
dc.w -60-20,-20
dc.w 60,15
dc.w GADGHCOMP!GRELBOTTOM!GRELRIGHT,RELVERIFY!ENDGADGET,BOOLGADGET
dc.l .Border,0,.GTextCancel,0,0
dc.w 1
dc.l 0
.GTextCancel dc.b 2,0,RP_JAM1,0
dc.w (60-(6*8))/2,((15-8)/2)
dc.l FONT,.StringCancel,0
.StringCancel dc.b "Cancel",0
even
.STGadget dc.l 0
dc.w 10,30
dc.w 320,10
dc.w GADGHCOMP,RELVERIFY!STRINGCENTER!ENDGADGET,STRGADGET
dc.l 0,0,0,0,.Info
dc.w 0
dc.l 0
.Info dc.l .FILE
dc.l .Buffer
dc.w 0,78
dcb.b si_SIZEOF-12
.Buffer dcb.b 80
.FILE dcb.b 80
.Text2 dc.b 2,0,RP_JAM1,0
dc.w (340-(21*8))/2,10
dc.l FONT_BOLD,.String2,0
.String2 dc.b "Load FMouse Data file",0
even
;
; Save
;
SAVE bsr Read
lea .arpname(pc),a1 ; try to open arp
moveq.l #0,d0
CALLEXEC OpenLibrary
tst.l d0
beq .NoArp
move.l d0,a6
lea.l .FR(pc),a0
move.l WindowPointer(pc),12(a0)
jsr -294(a6) ; file requester
move.l d0,d5
move.l a6,a1
CALLEXEC CloseLibrary
tst.l d5
beq WAIT
lea.l .Dir(pc),a0
move.l a0,d1
moveq.l #ACCESS_READ,d2
CALL_DOS Lock
move.l d0,d1
beq.s .Error
CALL_DOS CurrentDir ; set current dir
move.l d0,d6
lea.l .File(pc),a0
move.l a0,d1
move.l #MODE_NEWFILE,d2
CALL_DOS Open ; open file
move.l d0,d5
beq.s .Error2
move.l d0,d1
move.l #SPEED,d2
move.l #ENDE-SPEED,d3
CALL_DOS Write ; write file
move.l d5,d1
CALL_DOS Close
move.l d6,d0 ; restore dir
CALL_DOS CurrentDir
CALL_DOS UnLock ; free lock
bra WAIT
.Error2 move.l d6,d0 ; restore dir
CALL_DOS CurrentDir
CALL_DOS UnLock ; free lock
.Error lea.l .Req(pc),a0
move.l WindowPointer(pc),a1
move.w wd_Width(a1),d0 ; put requester into
sub.w #340,d0 ; window centre
lsr.w #1,d0
move.w d0,rq_LeftEdge(a0)
move.w wd_Height(a1),d0
sub.w #50,d0
lsr.w #1,d0
move.w d0,rq_TopEdge(a0)
move.w #340,rq_Width(a0)
move.w #50,rq_Height(a0)
move.b #1,rq_BackFill(a0)
lea.l .Gadget(pc),a2
move.l a2,rq_ReqGadget(a0)
lea.l .Text1(pc),a2
move.l a2,rq_ReqText(a0)
CALL_INT Request
move.l WindowPointer(pc),a0 ; wait for user reply
move.l wd_UserPort(a0),a0
CALLEXEC WaitPort
move.l WindowPointer(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
move.l d0,a1
CALLEXEC ReplyMsg
bra WAIT
.Req dcb.b rq_SIZEOF,0
even
.Gadget dc.l 0
dc.w (340-60)/2,-20
dc.w 60,15
dc.w GADGHCOMP!GRELBOTTOM,RELVERIFY!ENDGADGET,BOOLGADGET
dc.l .Border,0,.GText,0,0
dc.w 0
dc.l 0
.Border dc.w 0,0
dc.b 3,0,RP_JAM1,5
dc.l .XY,0
.XY dc.w 0,0,59,0,59,14,0,14,0,0
.GText dc.b 2,0,RP_JAM1,0
dc.w (60-(2*8))/2,((15-8)/2)
dc.l FONT,.String,0
.String dc.b "OK",0
even
.Text1 dc.b 2,0,RP_JAM1,0
dc.w (340-(25*8))/2,10
dc.l FONT_BOLD,.String1,0
.String1 dc.b "DOS error : open failed !",0
even
.arpname dc.b "arp.library",0
even
.FR dc.l .Title,.File,.Dir,0
dc.b 0,0
dc.l 0,0
.Title dc.b "Save FMouse data file : ",0
even
.Dir dcb.b 34,0
even
.File dcb.b 34,0
even
.NoArp lea.l .Req2(pc),a0
move.l WindowPointer(pc),a1
move.w wd_Width(a1),d0 ; put requester into
sub.w #340,d0 ; window centre
lsr.w #1,d0
move.w d0,rq_LeftEdge(a0)
move.w wd_Height(a1),d0
sub.w #70,d0
lsr.w #1,d0
move.w d0,rq_TopEdge(a0)
move.w #340,rq_Width(a0)
move.w #70,rq_Height(a0)
move.b #1,rq_BackFill(a0)
lea.l .GadgetOK(pc),a2
move.l a2,rq_ReqGadget(a0)
lea.l .Text2(pc),a2
move.l a2,rq_ReqText(a0)
CALL_INT Request
move.l WindowPointer(pc),a0 ; wait for user reply
move.l wd_UserPort(a0),a0
CALLEXEC WaitPort
move.l WindowPointer(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
move.l d0,a1
move.l im_IAddress(a1),a2
CALLEXEC ReplyMsg
move.w gg_GadgetID(a2),d0
bne WAIT
lea.l .FILE(pc),a0
move.l a0,d1
move.l #MODE_NEWFILE,d2
CALL_DOS Open ; open file
move.l d0,d5
beq .Error
move.l d0,d1
move.l #SPEED,d2
move.l #ENDE-SPEED,d3
CALL_DOS Write ; write data
move.l d5,d1
CALL_DOS Close
bra WAIT
.Req2 dcb.b rq_SIZEOF,0
even
.GadgetOK dc.l .GadgetCancel
dc.w 20,-20
dc.w 60,15
dc.w GADGHCOMP!GRELBOTTOM,RELVERIFY!ENDGADGET,BOOLGADGET
dc.l .Border,0,.GTextOK,0,0
dc.w 0
dc.l 0
.GTextOK dc.b 2,0,RP_JAM1,0
dc.w (60-(2*8))/2,((15-8)/2)
dc.l FONT,.StringOK,0
.StringOK dc.b "OK",0
even
.GadgetCancel dc.l .STGadget
dc.w -60-20,-20
dc.w 60,15
dc.w GADGHCOMP!GRELBOTTOM!GRELRIGHT,RELVERIFY!ENDGADGET,BOOLGADGET
dc.l .Border,0,.GTextCancel,0,0
dc.w 1
dc.l 0
.GTextCancel dc.b 2,0,RP_JAM1,0
dc.w (60-(6*8))/2,((15-8)/2)
dc.l FONT,.StringCancel,0
.StringCancel dc.b "Cancel",0
even
.STGadget dc.l 0
dc.w 10,30
dc.w 320,10
dc.w GADGHCOMP,RELVERIFY!STRINGCENTER!ENDGADGET,STRGADGET
dc.l 0,0,0,0,.Info
dc.w 0
dc.l 0
.Info dc.l .FILE
dc.l .Buffer
dc.w 0,78
dcb.b si_SIZEOF-12
.Buffer dcb.b 80
.FILE dcb.b 80
.Text2 dc.b 2,0,RP_JAM1,0
dc.w (340-(21*8))/2,10
dc.l FONT_BOLD,.String2,0
.String2 dc.b "Save FMouse Data file",0
even
;
; reset
;
Reset bsr GetMenu ; try to get FMouse menu
tst.l d0
beq.s .FMouse
lea.l Version(pc),a1
lea.l .Version(pc),a0
move.w #ENDE-Version-1,d0 ; copy data
.Loop move.b (a0)+,(a1)+
dbra d0,.Loop
bsr Write
.FMouse lea.l Gadget1(pc),a0 ; refresh gadgets
move.l WindowPointer(pc),a1
sub.l a2,a2
CALL_INT RefreshGadgets
bra WAIT
.Version dc.b "1.00"
dc.l 0
.SPEED dc.w 4
.Time dc.l 4*50
.LISTE Text_32 <"1. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"2. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"3. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"4. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"5. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"6. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"7. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"8. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
Text_32 <"9. NewShell">
Text_64 <"run ",62,"NIL: NewShell">
.ENDE Text_32 <"0. Exit">
;
; write Speed & Blank delay
;
Write moveq.l #0,d0
move.w SPEED(pc),d0
lea.l SpeedText(pc),a0
bsr MakeZahl
move.l Time(pc),d0
lea.l BlankText(pc),a0
MakeZahl moveq.l #6,d2
moveq.l #0,d3
lea.l .Potenzen(pc),a1
.MZ1 move.b #"0"-1,d1
.MZ2 addq #1,d1
sub.l (a1),d0
bcc.s .MZ2
add.l (a1)+,d0
tst.b d2
beq.s .MZ3
cmp.b #"0",d1
beq.s .MZ4
moveq.l #1,d3
bra.s .MZ3
.MZ4 tst.b d3
beq.s .MZ5
.MZ3 move.b d1,(a0)+
.MZ5 dbra d2,.MZ1
clr.b (a0)
rts
.Potenzen dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
;
; write Speed & Blank delay
;
Read lea.l SpeedText(pc),a0
bsr GetZahl
tst.w d0
bne.s .Label1
moveq.l #1,d0
.Label1 move.w d0,SPEED
lea.l BlankText(pc),a0
bsr GetZahl
move.l d0,Time
rts
GetZahl move.l a0,a1
lea.l .Potenzen-8(pc),a2
moveq.l #0,d0
.label7 addq.l #4,a2
tst.b (a0)+
bne.s .label7
subq.l #1,a0
.label8 move.b -(a0),d1
cmp.l a1,a0
bge.s .label9
rts
.label9 sub.b #"0",d1
tst.b d1
beq.s .label8
subq #1,d1
and.l #15,d1
.label11 add.l (a2),d0
dbra d1,.label11
bra.s .label8
.Potenzen dc.l 1
dc.l 10
dc.l 100
dc.l 1000
dc.l 10000
dc.l 100000
dc.l 1000000
dc.l 10000000
dc.l 100000000
dc.l 1000000000
;
; Init Port
;
InitPort sub.l a1,a1 ; get task
CALLEXEC FindTask
move.l d0,d2
moveq.l #-1,d0 ; get signal
CALLEXEC AllocSignal
tst.l d0
bmi.s .Error
lea.l ReplyPort(pc),a1 ; init port
move.b #PA_SIGNAL,MP_FLAGS(a1)
move.l d2,MP_SIGTASK(a1)
move.b d0,MP_SIGBIT(a1)
move.b #NT_MSGPORT,LN_TYPE(a1)
moveq.l #0,d0
.Error rts
;
; Free Port
;
FreePort lea.l ReplyPort(pc),a1 ; free signal
moveq.l #0,d0
move.b MP_SIGBIT(a1),d0
CALLEXEC FreeSignal
rts
ReplyPort dcb.b MP_SIZE,0
even
;
; write text
;
WriteText move.l WindowPointer(pc),a0
move.l wd_RPort(a0),a0
lea.l .Text1(pc),a1
moveq.l #0,d0
moveq.l #0,d1
CALL_INT PrintIText
rts
.Text1 dc.b 3,0,RP_JAM1,0
dc.w 10,25
dc.l FONT,.String1,.Text2
.String1 dc.b "Menu Entry :",0
even
.Text2 dc.b 3,0,RP_JAM1,0
dc.w 280,25
dc.l FONT,.String2,.Text3
.String2 dc.b "Execute :",0
even
.Text3 dc.b 3,0,RP_JAM1,0
dc.w 10,200-45
dc.l FONT,.String3,.Text4
.String3 dc.b "Mouse Acceleration :",0
even
.Text4 dc.b 3,0,RP_JAM1,0
dc.w 280,200-45
dc.l FONT,.String4,0
.String4 dc.b "Screen Blanker (50 = 1 sec) :",0
even