home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d437
/
fmouse
/
fmouse.ass
< prev
next >
Wrap
Text File
|
1991-01-15
|
26KB
|
1,094 lines
; Source 55
;
;
;
; FMouse V1.01 / 28.th October 1990
;
;
;
;
; Copyright by : Roger Fischlin
; Steigerwaldweg 6
; 6450 Hanau 7
; Germany
;
;
;
; Assembler : DevPac 2 / Linker : Blink
;
;
;
; THIS PROGRAM IS FREEWARE ! It may be freely distributed if
; you do not gain any profit by using/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"
Section "Init",CODE
FM_PORTNAME macro
dc.b "FMouse.Port",0
even
endm
FM_Die equ 0
FM_BlankOn equ 1
FM_BlankOff equ 2
FM_Menu equ 3
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
;
START movem.l d0/a0,-(sp) ; startup code
sub.l a1,a1
CALLEXEC FindTask
move.l d0,a4
tst.l pr_CLI(a4)
beq.s .fromWorkbench
movem.l (sp)+,d0/a0 ; from cli
clr.b -1(a0,d0) ; terminate command string with $00 byte
bra.s .end_startup
.fromWorkbench lea pr_MsgPort(a4),a0
CALLEXEC WaitPort
lea pr_MsgPort(a4),a0
CALLEXEC GetMsg
move.l d0,.returnMsg
addq.l #8,sp
sub.l a0,a0
.end_startup bsr.s INSTALL ; main code
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
;
; Install FMouse
;
INSTALL move.l a0,a4
jsr GetLibs ; open libs
tst.l d0
beq .NoLibs
bsr GetWindow ; get output window
moveq.l #0,d0
cmp.l a4,d0 ; from CLI
beq .FromWB
tst.b (a4) ; empty string ?
beq Remove ; remove FMouse
cmp.b #"?",(a4)
bne .Install_it
lea.l .Info(pc),a0 ; print info text
bsr CLI_Text
bsr CloseWindow ; close window
.NoLibs jsr CloseLibs ; close libs
moveq.l #0,d0
rts
.FromWB lea.l .WBData(pc),a4
bra .Install_it
.WBData dc.b "s:FM.data",0 ; default data file if you run FMouse from WB
even
.Info dc.b $a," ",$9b,"1;31;40m",$9b,"4m"
dc.b " FMouse V1.01/ 28th October 1990 ",$a,$a
dc.b $9b,"0;33m"
dc.b " Copyright by : Roger Fischlin",$a
dc.b " Steigerwaldweg 6",$a
dc.b " 6450 Hanau 7",$a
dc.b " Germany",$a,$a
dc.b $9b,"0;32m"
dc.b " FMouse is a mouse accelerator, a screen blanker and a menu.",$a
dc.b " It may be freely distributed if you do NOT gain any profit",$a
dc.b " by using and/or distributing it.",$a,$a
dc.b $9b,"3;31m"
dc.b " Usage : FMouse <data file> to install FMouse",$a
dc.b " FMouse ? to get this text",$a
dc.b " FMouse to remove FMouse",$a,$a
dc.b $9b,"0;31;40m"
dc.b 0
even
.Install_it move.l a4,a0
bsr ReadData ; read data file
tst.l d0
bmi .Quit ; error ...
CALLEXEC Forbid ; FMouse already installed ?
lea.l FMousePortName,a1
CALLEXEC FindPort
tst.l d0
bne .Already
lea.l START-4,a0 ; create own task
move.l (a0),d3
clr.l (a0)
move.l #ProcessName,d1
moveq.l #0,d2
move.l #2000,d4
CALLDOS CreateProc
CALLEXEC Permit
lea.l .InstallText(pc),a0
bsr CLI_Text
bsr CloseWindow ; close window
rts
.InstallText dc.b $9b,"1;33m"
dc.b "FMouse V1.01"
dc.b $9b,"0;31m"," installed.",$a
dc.b "FMouse © Roger Fischlin. This program is FREEWARE !.",$a,0
.Already move.l d0,d5 ; msg for new data file
sub.l a1,a1 ; get task
CALLEXEC FindTask
move.l d0,d2
moveq.l #-1,d0 ; get signal
CALLEXEC AllocSignal
tst.l d0
bmi .Error
lea.l .Port(pc),a1 ; init port
move.b #PA_SIGNAL,MP_FLAGS(a1)
move.l d2,MP_SIGTASK(a1)
move.b d0,MP_SIGBIT(a1)
clr.l LN_NAME(a1)
move.b #NT_MSGPORT,LN_TYPE(a1)
lea.l .Message(pc),a1
move.w #FMM_SIZEOF-1,d1
.Loop1 clr.b (a1)+
dbra d1,.Loop1
lea.l .Message(pc),a1
move.b #NT_MESSAGE,LN_TYPE(a1)
lea.l .Port(pc),a0
move.l a0,MN_REPLYPORT(a1)
move.w #FMM_SIZEOF,MN_LENGTH(a1)
move.b #FM_NewNames,FMM_Command(a1)
move.l d5,a0
CALLEXEC PutMsg
lea.l .Port(pc),a0 ; wait for reply
CALLEXEC WaitPort
lea.l .Port(pc),a0
CALLEXEC GetMsg
lea.l .Port(pc),a1 ; free signal
moveq.l #0,d0
move.b MP_SIGBIT(a1),d0
CALLEXEC FreeSignal
.Error CALLEXEC Permit
.Quit bra CloseWindow ; close window
.Port dcb.b MP_SIZE,0
even
.Message dcb.b FMM_SIZEOF,0
even
;
; Remove FMOUSE
;
Remove CALLEXEC Forbid
lea.l FMousePortName,a1 ; FMouse installed ????
CALLEXEC FindPort
move.l d0,d5
beq .NotFound
sub.l a1,a1 ; get task
CALLEXEC FindTask
move.l d0,d2
moveq.l #-1,d0 ; get signal
CALLEXEC AllocSignal
tst.l d0
bmi .Error
lea.l .DiePort(pc),a1 ; init port
move.b #PA_SIGNAL,MP_FLAGS(a1)
move.l d2,MP_SIGTASK(a1)
move.b d0,MP_SIGBIT(a1)
clr.l LN_NAME(a1)
move.b #NT_MSGPORT,LN_TYPE(a1)
lea.l .Message(pc),a1
move.w #FMM_SIZEOF-1,d1
.Loop1 clr.b (a1)+
dbra d1,.Loop1
lea.l .Message(pc),a1
move.b #NT_MESSAGE,LN_TYPE(a1)
lea.l .DiePort(pc),a0
move.l a0,MN_REPLYPORT(a1)
move.w #FMM_SIZEOF,MN_LENGTH(a1)
move.b #FM_Die,FMM_Command(a1)
move.l d5,a0
CALLEXEC PutMsg
lea.l .DiePort(pc),a0 ; wait for reply
CALLEXEC WaitPort
lea.l .DiePort(pc),a0
CALLEXEC GetMsg
lea.l .DiePort(pc),a1 ; free signal
moveq.l #0,d0
move.b MP_SIGBIT(a1),d0
CALLEXEC FreeSignal
CALLEXEC Permit
lea.l .RemovedText(pc),a0
bsr CLI_Text
bra CloseWindow ; close window
.RemovedText dc.b "FMouse removed.",$a,0
even
.Error CALLEXEC Permit
lea.l .ErrorText(pc),a0
bsr CLI_Text
bra CloseWindow ; close window
.ErrorText dc.b "AllocSignal failed !!!!",$a,0
even
.NotFound CALLEXEC Permit
lea.l .NotFText(pc),a0
bsr CLI_Text
bra CloseWindow ; close window
.NotFText dc.b "FMouse not installed.",$a,0
even
.DiePort dcb.b MP_SIZE,0
even
.Message dcb.b FMM_SIZEOF,0
even
;
; write text (^a0)
;
CLI_Text move.l a0,d2
moveq.l #-1,d3 ; get length
.Label addq.l #1,d3
tst.b (a0)+
bne.s .Label
move.l CONWINDOW(pc),d1
bne.s .WB
CALLDOS Output ; get handle to CLI window
move.l d0,d1
.WB CALLDOS Write
rts
CONWINDOW dc.l 0
;
; GetWindow
;
GetWindow clr.l CONWINDOW
sub.l a1,a1 ; if we run from Workbench
CALLEXEC FindTask ; a RAW window muszt be opened
move.l d0,a0 ; otherwise we'll use the CLI window
tst.l pr_CLI(a0)
bne.s .fromCLI
lea.l .Name(pc),a0
move.l a0,d1
move.l #MODE_NEWFILE,d2
CALLDOS Open
move.l d0,CONWINDOW
.fromCLI rts
.Name dc.b "RAW:20/20/600/90/FMouse",0
even
;
; CloseWindow
;
CloseWindow move.l CONWINDOW(pc),d1
beq.s .fromCLI
lea.l .ExitText(pc),a0 ; wait for RETURN to close window
bsr CLI_Text
move.l CONWINDOW(pc),d1
lea.l .Buffer(pc),a0
move.l a0,d2
moveq.l #1,d3
CALLDOS Read
move.l CONWINDOW(pc),d1 ; if a RAWwindow was opened , close it !
CALLDOS Close
.fromCLI rts
.Buffer ds.b 2
even
.ExitText dc.b $a,"Press any key.",0
even
;
; read data file
;
ReadData move.l a0,d1
cmp.b #'"',(a0) ; file name in marks
bne.s .No
addq.l #1,a0
addq.l #1,d1
.Label1 move.b (a0)+,d0
beq.s .No
cmp.b #'"',d0
bne.s .Label1
clr.b -1(a0)
.No move.l #MODE_OLDFILE,d2
CALLDOS Open ; open data file
move.l d0,d4
beq.s .NotFound
move.l d0,d1
move.l #SPEED,d2
move.l #ENDE-SPEED,d3
CALLDOS Read ; read data
cmp.l d0,d3
bne.s .ReadError
move.l d4,d1
CALLDOS Close
CALLEXEC Forbid
lea.l FMousePortName,a1 ; FMouse installed ????
CALLEXEC FindPort ; if FMouse already exists
move.l d0,a0 ; new data must be copied
tst.l d0
beq .Label4
lea.l SPEED,a1
lea.l SPEED-FMousePort(a0),a0
move.w #ENDE-SPEED-1,d0 ; copy data
.Loop move.b (a1)+,(A0)+
dbra d0,.Loop
.Label4 CALLEXEC Permit
moveq.l #0,d0
rts
.ReadError move.l d4,d1
CALLDOS Close
lea.l .ReadErrorText(pc),a0 ; write error messages
.Label3 bsr CLI_Text
moveq.l #-1,d0
rts
.NotFound lea.l .NotFoundText(pc),a0
bra.s .Label3
.ReadErrorText dc.b "ERROR : Read error !",$a,0
even
.NotFoundText dc.b "ERROR : File not found !",$a,0
Even
;
; FMOUSE
;
Section "FMouse",CODE
FMOUSE clr.l Timer ; clear counter
clr.l ScreenPointer
sub.l a1,a1
CALLEXEC FindTask
lea.l ReplyPort(pc),a1 ; init port
move.l d0,MP_SIGTASK(a1)
lea.l IOReq(pc),a1 ; open input-device
lea.l Name(pc),a0
moveq.l #0,d0
moveq.l #0,d1
CALLEXEC OpenDevice
tst.l d0
bne CloseDevice
bsr InitPort ; get FMouse port
tst.l d0
bne CloseDevice
lea.l Interrupt(pc),a0
lea.l IR_Code(pc),a1
move.l a1,IS_CODE(a0)
move.b #51,LN_PRI(a0)
lea.l HandlerName(pc),a1
move.l a1,LN_NAME(a0)
clr.l IS_DATA(a0)
lea.l IOReq(pc),a1
move.l a0,IO_DATA(a1)
lea.l ReplyPort(pc),a0
move.l a0,MN_REPLYPORT(a1)
move.w #IND_ADDHANDLER,IO_COMMAND(a1)
CALLEXEC DoIO
WaitForMsg lea.l FMousePort(pc),a0
CALLEXEC WaitPort
lea.l FMousePort(pc),a0
CALLEXEC GetMsg
tst.l d0
beq.s WaitForMsg
move.l d0,a3
CALLEXEC Disable ; NO interruption now !
move.l a3,a1
moveq.l #0,d2
move.b FMM_Command(a1),d2
move.b #FM_Done,FMM_Command(a1)
CALLEXEC Enable
move.l a3,a1
CALLEXEC ReplyMsg ; reply msg
cmp.b #FM_NewNames,d2 ; which command
beq.s .DoNewNames
cmp.b #FM_Die,d2 ; which command
beq.s Die
cmp.b #FM_Menu,d2
beq .DoMenu
cmp.b #FM_BlankOn,d2
beq .DoBlankOn
cmp.b #FM_BlankOff,d2
beq .DoBlankOff
bra.s WaitForMsg
.DoMenu bsr _Menu ; execute command and return
bra WaitForMsg
.DoBlankOn bsr BlankOn
bra WaitForMsg
.DoBlankOff bsr BlankOff
bra WaitForMsg
.DoNewNames clr.l Timer
bra WaitForMsg
Die lea.l IOReq(pc),a1 ; bye, bye ....
lea.l Interrupt(pc),a0
move.l a0,IO_DATA(a1)
move.w #IND_REMHANDLER,IO_COMMAND(a1)
CALLEXEC DoIO
DeletePort bsr FreePort
CloseDevice lea.l IOReq(pc),a1
CALLEXEC CloseDevice
NoDevice bsr CloseLibs
moveq.l #0,d0
rts
ProcessName dc.b "FMouse.Task",0
even
;
; 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 move.l d2,-(sp)
moveq.l #0,d2 ; 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 move.l (sp)+,d2
rts
;
; Init FMousePort
;
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 FMousePort(pc),a1 ; init port
move.b #PA_SIGNAL,MP_FLAGS(a1)
move.l d2,MP_SIGTASK(a1)
move.b d0,MP_SIGBIT(a1)
lea.l FMousePortName(pc),a0
move.l a0,LN_NAME(a1)
move.b #NT_MSGPORT,LN_TYPE(a1)
CALLEXEC AddPort ; add port
moveq.l #0,d0
.Error rts
FMousePortName FM_PORTNAME
even
;
; Free Port
;
FreePort lea.l FMousePort(pc),a1 ; remove port
CALLEXEC RemPort
lea.l FMousePort(pc),a1 ; free signal
moveq.l #0,d0
move.b MP_SIGBIT(a1),d0
CALLEXEC FreeSignal
rts
;
; open Screen
;
BlankOn tst.l ScreenPointer
bne.s .Already
move.l a0,-(sp) ; open black screen as blank.
lea.l .ScreenData(pc),a0
CALL_INT OpenScreen
move.l d0,ScreenPointer
beq.s .NoScreen
move.l d0,a0
lea.l sc_ViewPort(a0),a0
move.l a0,a3
moveq.l #0,d0 ; set screen color to black
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
CALL_GRAF SetRGB4
move.l a3,a0
moveq.l #1,d0
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
CALL_GRAF SetRGB4
move.l a3,a0 ; set pointer color to black
moveq.l #17,d0
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
CALL_GRAF SetRGB4
move.l a3,a0
moveq.l #18,d0
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
CALL_GRAF SetRGB4
move.l a3,a0
moveq.l #19,d0
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
CALL_GRAF SetRGB4
.NoScreen move.l (sp)+,a0
.Already rts
.ScreenData dc.w 0,0
dc.w 64,20
dc.w 1
dc.b -1,-1
dc.w 0,CUSTOMSCREEN!SCREENQUIET
dc.l 0,0,0,0
ScreenPointer dc.l 0
;
; close Screen
;
BlankOff move.l ScreenPointer(pc),d0
beq.s .NoScreen
move.l a0,-(sp)
move.l d0,a0
CALL_INT CloseScreen
clr.l ScreenPointer
move.l (sp)+,a0
.NoScreen rts
Interrupt dcb.b IS_SIZE,0
even
Name dc.b "input.device",0
even
ReplyPort dcb.b MP_SIZE,0
even
IOReq dcb.b IOSTD_SIZE,0
even
Timer dc.l 0
;
; Handler code
;
IR_Code movem.l d0-d7/a0-a6,-(sp)
.Loop cmp.b #IECLASS_NULL,ie_Class(a0) ; skip emtpy event
beq .Next
cmp.b #IECLASS_RAWMOUSE,ie_Class(a0) ; mouse event !
beq.s .RawMouse
cmp.b #IECLASS_RAWKEY,ie_Class(a0) ; key event !
beq.s .RawKey
cmp.b #IECLASS_TIMER,ie_Class(a0) ; timer event !
bne .Screen ; else : remove blank
.Tick addq.l #1,Timer ; add timer
move.l Timer(pc),d0 ; reached time for blanking ?
cmp.l Time(pc),d0
bne .Next
moveq.b #FM_BlankOn,d0 ; send msg for blanking
bsr .MailMessage
bra .Next ; check next event
.RawMouse moveq.l #0,d0 ; RawMouse Event
move.w ie_X(a0),d0 ; increase mouse move
muls SPEED(pc),d0
move.w d0,ie_X(a0)
moveq.l #0,d0
move.w ie_Y(a0),d0
muls SPEED(pc),d0
move.w d0,ie_Y(a0)
bra.s .Screen ; remove blank
.RawKey cmp.w #$5f,ie_Code(a0) ; HELP key ?
bne.s .Screen
move.w ie_Qualifier(a0),d0
and.w #IEQUALIFIER_RCOMMAND,d0
cmp.w #IEQUALIFIER_RCOMMAND,d0
bne.s .Screen
move.w #IECLASS_NULL,ie_Class(a0) ; remove Input Event
moveq.b #FM_Menu,d0
bsr .MailMessage
.Screen clr.l Timer ; remove blank if there's one
tst.l ScreenPointer
beq.s .Next ; no blank !
moveq.b #FM_BlankOff,d0
bsr .MailMessage
.Next move.l ie_NextEvent(a0),a0 ; check next event
cmp.l #0,a0
bne .Loop
.Exit movem.l (sp)+,d0-d7/a0-a6
move.l a0,d0
rts
; prepare message
.MailMessage move.l a0,-(sp) ; clear structure
lea.l .Message(pc),a1
cmp.b #FM_Done,FMM_Command(a1) ; If last message wasn't used skip msgs
bne.s .Skip
moveq.l #FMM_SIZEOF-1,d1
.Label clr.b (a1)+
dbra d1,.Label
lea.l .Message(pc),a1 ; init structure
move.b #NT_FREEMSG,LN_TYPE(a1)
move.w #FMM_SIZEOF,MN_LENGTH(a1)
move.b d0,FMM_Command(a1)
lea.l FMousePort(pc),a0
CALLEXEC PutMsg ; mail message
.Skip move.l (sp)+,a0
rts
.Message dcb.b FMM_SIZEOF,FM_Done
even
HandlerName dc.b "FMouse.Handler",0
even
;
; Menu
;
_Menu CALL_INT WBenchToFront
bsr .RestoreGadgets ; restore gadget positions
lea.l .WindowData(pc),a0 ; open window
CALL_INT OpenWindow
move.l d0,.WindowPointer
beq .Error
bsr .AdjustGadgets ; adjust gadgets to border sizes
move.l .WindowPointer(pc),a0
lea.l .Gadget1(pc),a1
moveq.l #0,d0
moveq.l #10,d1
sub.l a2,a2
CALL_INT AddGList
.NewNames move.l .WindowPointer(pc),a1 ; set pen #1
move.l wd_RPort(a1),a1
move.l a1,a2
moveq.l #1,d0
CALL_GRAF SetAPen
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 .PrintNames ; write names
.wait CALLEXEC Forbid
move.l .WindowPointer(pc),a0 ; wait for messages
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg ; already msg ?
tst.l d0
beq.s .CheckPort2
move.l d0,d2
CALLEXEC Permit
move.l d2,d0
bra .WindowMsg2
; check 2nd port
.CheckPort2 lea.l FMousePort(pc),a0
CALLEXEC GetMsg ; already msg ?
tst.l d0
beq .WaitPorts
move.l d0,d2
CALLEXEC Permit
move.l d2,d0
bra.s .FMouseMsg2
.WaitPorts move.l .WindowPointer(pc),a0
move.l wd_UserPort(a0),a0
move.b MP_SIGBIT(a0),d1
move.b FMousePort+MP_SIGBIT(pc),d2
moveq.l #0,d0
moveq.l #0,d3
bset d1,d0
bset d2,d0
bset d2,d3
CALLEXEC Wait
cmp.l d0,d3 ; Which port : FMousePort ?
bne .WindowMsg
; Msg from FMouse
.FMouseMsg CALLEXEC Permit
lea.l FMousePort(pc),a0
CALLEXEC GetMsg
.FMouseMsg2 tst.l d0
beq .wait
move.l d0,a3
CALLEXEC Disable ; NO interruption now !
move.l a3,a1
moveq.l #0,d2
move.b FMM_Command(a1),d2
move.b #FM_Done,FMM_Command(a1)
CALLEXEC Enable
move.l a3,a1
CALLEXEC ReplyMsg ; reply msg
cmp.b #FM_NewNames,d2
beq .DoNewNames ; redraw window
cmp.b #FM_Die,d2 ; close window and remove handler
beq.s .DoDie
cmp.b #FM_BlankOn,d2 ; get blank
beq .DoBlankOn
cmp.b #FM_BlankOff,d2 ; remove blank
beq .DoBlankOff
bra .wait
.DoNewNames clr.l Timer
bra .NewNames
.DoBlankOn bsr BlankOn
bra .wait
.DoBlankOff bsr BlankOff
bra .wait
.DoDie move.l .WindowPointer(pc),a0 ; close window
CALL_INT CloseWindow ; and die ....
addq.l #4,SP ; skip return address
bra Die
; Msg from window port
.WindowMsg CALLEXEC Permit
move.l .WindowPointer(pc),a0 ; wait for message
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg ; get it !
.WindowMsg2 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
cmp.l #VANILLAKEY,d3
beq.s .Key
move.w gg_GadgetID(a2),d2 ; get GadgetID (contains equal ASCII code)
.Key cmp.b #"0",d2
bne.s .label6
add.b #10,d2
.label6 sub.b #"1",d2
cmp.b #9,d2 ; no number key ?
bhi .wait
bne.s .Load ; else execute file
.Exit move.l .WindowPointer(pc),a0 ; close window
CALL_INT CloseWindow
.Error rts
.Load move.l d2,d1 ; execute command
moveq.l #15,d0 ; get command string
and.l d0,d1
move.l d1,d2
lsl.w #5,d1 ; mulu (32+64)
lsl.w #6,d2
add.w d2,d1
lea.l LISTE+32(pc),a1
add.l a1,d1
move.l d1,d5
move.l .WindowPointer(pc),a0 ; close window
CALL_INT CloseWindow
lea.l .NILName(pc),a0 ; open NIL:
move.l a0,d1
move.l #MODE_NEWFILE,d2
CALLDOS Open
move.l d0,d2
move.l d0,d3
beq.s .NoNIL
move.l d5,d1
CALLDOS Execute ; execute command
move.l d3,d1
CALLDOS Close ; close NIL:
.NoNIL rts
.NILName dc.b "NIL:",0
even
.PrintNames lea.l LISTE(pc),a3 ; type names
move.l .WindowPointer(pc),a4
move.l wd_RPort(a4),a2
move.l a2,a1
moveq.l #0,d0
CALL_GRAF SetAPen ; set pen and draw mode
move.l a2,a1
moveq.l #RP_JAM1,d0
CALL_GRAF SetDrMd
moveq.l #0,d6
.Label1 move.l a2,a1 ; get x,y
move.l d6,d1
mulu #10,d1
moveq.l #4,d0
add.b wd_BorderLeft(a4),d0
add.b wd_BorderTop(a4),d1
add.w rp_TxBaseline(a1),d1
addq.l #1,d1
CALL_GRAF Move
move.l a3,a0 ; get length
moveq.l #-1,d0
.Label2 addq.l #1,d0
tst.b (a0)+
bne.s .Label2
.Label3 move.l a2,a1
tst.l d0
beq.s .Label4
move.l a3,a0
CALL_GRAF Text ; write text
.Label4 lea.l (32+64)(a3),a3 ; skip name and dos command
addq.l #1,d6
cmp.b #10,d6 ; window full ?
bne .Label1
rts
.AdjustGadgets moveq.l #9,d0
lea.l .Gadget1(pc),a0
move.l .WindowPointer(pc),a1
.Loop1 move.w gg_LeftEdge(a0),d1
add.b wd_BorderLeft(a1),d1
move.w d1,gg_LeftEdge(a0)
move.w gg_TopEdge(a0),d1
add.b wd_BorderTop(a1),d1
move.w d1,gg_TopEdge(a0)
move.w gg_Width(a0),d1
sub.b wd_BorderRight(a1),d1
sub.w gg_LeftEdge(a0),d1
move.w d1,gg_Width(a0)
move.l (a0),a0
dbra d0,.Loop1
rts
.RestoreGadgets ; restore default gadget position & size
moveq.l #0,d0
lea.l .Gadget1(pc),a0
.Loop2 move.w #0,gg_LeftEdge(a0)
move.w d0,gg_TopEdge(a0)
move.w #220,gg_Width(a0)
move.w #10,gg_Height(a0)
move.l (a0),a0
add.w #10,d0
cmp.w #10*10,d0
bne.s .Loop2
rts
.WindowData dc.w (640-220)/2,(200-(100+11+1))/2
dc.w 220,100+11+1+3
dc.b -1,-1
dc.l VANILLAKEY!CLOSEWINDOW!GADGETUP
dc.l WINDOWCLOSE!SMART_REFRESH!ACTIVATE!RMBTRAP!WINDOWDRAG
dc.l 0
dc.l 0
dc.l .Name
.Screen dc.l 0
dc.l 0
dc.w 160,100+11+1
dc.w 160,100+11+1
dc.w WBENCHSCREEN
.Name dc.b "Please select : ",0
even
.WindowPointer dc.l 0
FM_GADGET macro
dc.l \1
dc.w 4,\2*10
dc.w 220-1,10
dc.w GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w \3
dc.l 0
endm
.Gadget1 FM_GADGET .Gadget2,0,"1"
.Gadget2 FM_GADGET .Gadget3,1,"2"
.Gadget3 FM_GADGET .Gadget4,2,"3"
.Gadget4 FM_GADGET .Gadget5,3,"4"
.Gadget5 FM_GADGET .Gadget6,4,"5"
.Gadget6 FM_GADGET .Gadget7,5,"6"
.Gadget7 FM_GADGET .Gadget8,6,"7"
.Gadget8 FM_GADGET .Gadget9,7,"8"
.Gadget9 FM_GADGET .Gadget10,8,"9"
.Gadget10 FM_GADGET 0,9,"0"
;
; 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
FMousePort dcb.b MP_SIZE,0
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">