home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_progs
/
shells
/
publicmn.lha
/
publictools
/
SetPubModes.s
< prev
next >
Wrap
Text File
|
1992-06-26
|
3KB
|
146 lines
; Setpubmode put in the Public Domain
; written in 1992 by Michael Watzl
;
; Syntax: Setpubmode -sx -px
;
; -s SHANGHAI
; -p POPPUBSCREEN
; x=0 deaktivates this mode
; x=1 switches this mode on
;
; this has been written for the devpac V2.16
; Needs Kick 2! (Public screens)
; lazy includes
OpenLib = -552
CloseLib = -414
SetPubModes = -546
PutStr = -948
TAB = 09
CR = 10
; MAIN
******************************************
** **
** MAIN **
** **
******************************************
pea (a0) ; save the argument pointer
lea DosName,a1 ; open the libs
move.l 4.w,a6
moveq #36,d0 ; version
jsr OpenLib(a6) ; open dos.library
tst.l d0
beq quit
move.l d0,_DosBase
lea IntName,a1
move.l 4.w,a6
moveq #36,d0 ; I think V36 should work
jsr OpenLib(a6)
move.l d0,_IntBase
******************************************
** **
** Parse **
** **
******************************************
Parse moveq #0,d0 ; Modes to d4.w
move.l _IntBase,a6
jsr SetPubModes(a6)
move.w d0,d4
jsr SetPubModes(a6)
move.l (sp)+,a0 ; fetch argument pointer
cmp.b #CR,(a0)
beq usage
loop cmp.b #" ",(a0)
beq.s increase
cmp.b #"-",(a0)
beq.s foundopt
cmp.b #CR,(a0)
beq.s endofargs
bra.s usage none of the expected chars!
increase adda.l #1,a0
bra.s loop
foundopt adda.l #1,a0
cmp.b #"s",(a0)
beq.s shang
cmp.b #"S",(a0)
beq.s shang
cmp.b #"p",(a0)
beq.s pop
cmp.b #"P",(a0)
beq.s pop
bra.s usage
shang adda #01,a0
cmp.b #"1",(a0)
beq.s shang1
cmp.b #"0",(a0)
beq.s shang0
bra.s usage
shang1 bset #0,d4 ; Set SHANGHAI
bra.s increase
shang0 bclr #0,d4
bra.s increase
pop adda #1,a0
cmp.b #"1",(a0)
beq.s pop1
cmp.b #"0",(a0)
beq.s pop0
bra.s usage
pop1 bset #1,d4 ; set POPPUBSCREEN
bra.s increase
pop0 bclr #1,d4
bra.s increase
endofargs move.w d4,d0
move.l _IntBase,a6
jsr SetPubModes(a6)
bra.s quit
usage move.l #usage.txt,d1
move.l _DosBase,a6
jsr PutStr(a6)
******************************************
** **
** QUIT **
** **
******************************************
quit move.l 4.w,a6
move.l _DosBase,d0 if(DOSBase)
tst.l d0
beq.s next1
movea.l d0,a1
jsr CloseLib(a6) Close
next1 move.l _IntBase,d0 if(IntuitionBase)
tst.l d0
beq.s next2
movea.l d0,a1
jsr CloseLib(a6) Close
moveq #0,d0
move.w d4,d0 -> Modes as RC!
next2 rts "My only friend, the end" (Doors...)
DosName dc.b "dos.library" ; this order saves 2 bytes (Wow!)
_DosBase dc.l 0
IntName dc.b "intuition.library"
_IntBase dc.l 0
usage.txt dc.b "Usage:",TAB,"SetPubModes -sx -px",CR,TAB,TAB,"-s",TAB,"SHANGHAI",CR,TAB,TAB,"-p",TAB,"POPPUBSCREEN",CR,TAB,"x=0 deaktvate this mode",CR,TAB,"x=1 switch it on",CR
dc.b "The return code tells you which mode is active...",CR
dc.b 27,"[32mWritten by Michael Watzl in 1992 (PD!)",27,"[31m",CR,0