home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 3
/
CDPDIII.bin
/
bbs
/
ff870.lha
/
SoftProtect
/
SoftProtect.s
< prev
Wrap
Text File
|
1991-03-10
|
6KB
|
312 lines
;SoftProtect.s . It is a software disk protection mechanism
;and when asked by the user prevents writes on a write-enabled disk
;assembled with Profimat Assembler.
;Copyright © kamran Karimi
ExecBase equ 4
FindTask equ -294
OpenLib equ -408
CloseLib equ -414
WaitPort equ -384
GetMsg equ -372
ReplyMsg equ -378
Delay equ -198
OpenWindow equ -204
CloseWindow equ -72
PrintIText equ -216
Start:
moveq #0,d7
movem.l d0/a0,-(a7) ;save command line parameters
move.l #20,d6 ;possible return code to DOS
move.l ExecBase,a6
movea.l #0,a1
jsr FindTask(a6)
move.l d0,a4
tst.l $ac(a4)
bne FromCLI
FromWorkBench: ;get workbench message
lea $5c(a4),a0
jsr WaitPort(a6)
lea $5c(a4),a0
jsr GetMsg(a6)
bra StackAdjust
FromCLI:
movem.l (a7)+,d0/a0 ;command line parameters
subq #1,d0
beq NoParam
LoopParam1:
cmpi.b #' ',(a0)+
bne Found
dbra d0,LoopParam1
bra NoParam
Found:
suba.l #1,a0
cmpi.b #'n',(a0)
beq FoundN
cmpi.b #'N',(a0)
bne NoParam
FoundN:
adda.l #1,a0
cmpi.b #'o',(a0)
beq FoundO
cmpi.b #'O',(a0)
bne NoParam
FoundO:
move.w #$86,SelAddr
moveq #1,d7
bra NoParam
StackAdjust:
movem.l (a7)+,d0/a0
NoParam:
moveq #0,d5 ;flag for In Effect/Not In Effect determination
lea DOSName,a1
jsr OpenLib(a6)
move.l d0,DOSBase
beq NoDOS
lea IntuitionName,a1
jsr OpenLib(a6)
move.l d0,IntBase
beq NoIntuition
move.l d0,a6
lea WindowParam,a0
jsr OpenWindow(a6)
move.l d0,WindowHandler
beq NoWindow
move.l WindowHandler,a0
move.l 50(a0),a0
lea MyName,a1
move.l #4,d0
move.l #12,d1
jsr PrintIText(a6)
move.l DOSBase,a6
move.l #100,d1
jsr Delay(a6)
move.l IntBase,a6
move.l WindowHandler,a0
jsr CloseWindow(a6)
move.l #MyGadget,GadAddr
lea WindowParam,a0
jsr OpenWindow(a6)
move.l d0,WindowHandler
beq NoWindow
move.l WindowHandler,a0
move.l 50(a0),a0
lea MyText,a1
move.l #4,d0
move.l #12,d1
jsr PrintIText(a6)
tst.l d7
bne Enforce
moveq #1,d5
move.l ExecBase,a6
WaitOn: ;this is the main loop
move.l WindowHandler,a0
move.l 86(a0),d4
move.l d4,a0
jsr WaitPort(a6)
move.l d4,a0
jsr GetMsg(a6)
move.l d0,a0
move.l 20(a0),d6
move.l d0,a1
jsr ReplyMsg(a6)
cmpi.l #$200,d6 ;Windowclose
beq Quit
GadgetChosen:
move.w SelAddr,d6
andi.w #$80,d6 ;SELECTED?
beq Allow
Enforce:
moveq #0,d5
ori.b #$c,$bfe201
andi.b #$f3,$bfe001
move.l DOSBase,a6
move.l #25,d1
jsr Delay(a6)
ori.b #$4,$bfe001
move.l #25,d1
jsr Delay(a6)
andi.b #$fb,$bfe201
move.l ExecBase,a6
Bra WaitOn
Allow:
moveq #1,d5
ori.b #$c,$bfe201
andi.b #$f3,$bfe001
move.l DOSBase,a6
move.l #25,d1
jsr Delay(a6)
ori.b #$4,$bfe001
move.l #25,d1
jsr Delay(a6)
andi.b #$f3,$bfe201
move.l ExecBase,a6
Bra WaitOn
Quit:
tst.l d5
bne NoProtect
ori.b #$c,$bfe201
andi.b #$f3,$bfe001
move.l DOSBase,a6
move.l #25,d1
jsr Delay(a6)
ori.b #$4,$bfe001
move.l #25,d1
jsr Delay(a6)
andi.b #$f3,$bfe201
NoProtect:
moveq #0,d6
move.l IntBase,a6
move.l WindowHandler,a0
jsr CloseWindow(a6)
NoWindow:
move.l ExecBase,a6
move.l IntBase,a1
jsr CloseLib(a6)
NoIntuition:
move.l ExecBase,a6
move.l DOSBase,a1
jsr CloseLib(a6)
NoDOS:
move.l d6,d0
rts
CODE
IntuitionName: dc.b 'intuition.library',0
DOSName: dc.b 'dos.library',0
WindowHandler: dc.l 0
IntBase: dc.l 0
DOSBase: dc.l 0
MyText: dc.b 1,0,1,0
dc.w 1,0
dc.l 0
dc.l Texte
dc.l 0
Texte: dc.b 'Allow Floppy Writes?',0,0
MyName: dc.b 2,0,1,0
dc.w 35,4
dc.l 0
dc.l Name1
dc.l MyName2
Name1: dc.b ' SoftProtect!',0
MyName2: dc.b 1,0,1,0
dc.w 35,16
dc.l 0
dc.l Name2
dc.l 0
Name2: dc.b 'By Kamran Karimi',0,0
WindowParam:
dc.w 10
dc.w 5
dc.w 200
dc.w 40
dc.b -1
dc.b -1
dc.l $220
dc.l $e
GadAddr:
dc.l 0
dc.l 0
dc.l WindowName
dc.l 0
dc.l 0
dc.w 0
dc.w 0
dc.w 0
dc.w 0
dc.w 1
WindowName: dc.b 'SoftProtect',0
MyGadget:
dc.l 0
dc.w 150
dc.w 23
dc.w 32
dc.w 13
SelAddr:
dc.w $6 ;Flags
dc.w $102 ;activation
dc.w 1
dc.l ImOK
dc.l ImNO
dc.l 0
dc.l 0
dc.l 0
dc.w 1
dc.l 0
DATA
ImOK:
dc.w 0,0,32,13
dc.w 1
dc.l ImOKData
dc.b 2,1
dc.l 0
ImOKData:
dc.l %00000000000000000000000000000000
dc.l %00001111111000000111100011100000
dc.l %00111000001110000011100011100000
dc.l %00111000001110000011100111000000
dc.l %00111000001110000011101110000000
dc.l %00111000001110000011111100000000
dc.l %00111000001110000011111100000000
dc.l %00111000001110000011100111000000
dc.l %00111000001110000011100011100000
dc.l %00111000001110000011100001110000
dc.l %00111000001110000011100001110000
dc.l %00001111111000000111100001110000
dc.l %00000000000000000000000000000000
ImNO:
dc.w 0,0,32,13
dc.w 1
dc.l ImNOData
dc.b 2,1
dc.l 0
ImNOData:
dc.l %00000000000000000000000000000000
dc.l %00111000000011100000111111100000
dc.l %00111100000011100011100000111000
dc.l %00111111000011100011100000111000
dc.l %00111011100011100011100000111000
dc.l %00111001110011100011100000111000
dc.l %00111000111011100011100000111000
dc.l %00111000011111100011100000111000
dc.l %00111000001111100011100000111000
dc.l %00111000000111100011100000111000
dc.l %00111000000011100011100000111000
dc.l %00111000000011100000111111100000
dc.l %00000000000000000000000000000000
end