home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #3
/
amigamamagazinepolishissue1998.iso
/
blabla
/
ssic
/
showsomeiffchunks.e
next >
Wrap
Text File
|
1998-01-24
|
3KB
|
135 lines
/*
Show Some IFF Chunks v0.001
This little pice of shit was written by
Kordi/ mainly of blahblah
EnJoy! (If there is sth to enjoy ;-)
*/
MODULE 'dos/dos'
DEF s[10]:STRING
DEF form_id,ilbm_id[4]:STRING
ENUM NO_ERR, NO_ARGS, NO_MEM, NO_FILE, NO_IFF
PROC main() HANDLE
DEF mem:PTR TO CHAR,open,n,v,var,kk,l,camg,resolution,lock,colors
DEF file[20]:STRING
DEF get_answer[4]:STRING
StrCopy(form_id,'FORM')
StrCopy(ilbm_id,'ILBM')
IF arg[]=0 THEN Raise(NO_ARGS)
IF (mem:=New(500))=NIL THEN Raise(NO_MEM)
StrCopy(file,arg,StrLen(arg)-1)
IF (open:=Open(file,1005))=NIL THEN Raise(NO_FILE)
lock:=Lock(file,ACCESS_READ)
Read(open,mem,500)
IF ((Long(mem)<>Long(form_id)) OR (Long(mem+8)<>Long(ilbm_id))) THEN Raise(NO_IFF)
StrCopy(s,'CAMG')
var:=search(mem,s)
camg:=Long(mem+var+5)
SELECT camg
CASE $4080
resolution:='Lowres (EHB)'
CASE $C000
resolution:='Hires'
CASE $C004
resolution:='Hires Interlace'
CASE $4000
resolution:='Lowres'
CASE $6000
resolution:='Lowres'
CASE $0800
resolution:='HAM'
CASE $4800
resolution:='HAM'
CASE $4084
resolution:='EHB + Lace'
DEFAULT
resolution:='???'
ENDSELECT
IF var=0 THEN resolution:='Probably Lowres, but I''m not sure...'
WriteF('\nPicture width : \d\n',Int(mem+20))
WriteF('Picture height : \d\n',Int(mem+22))
WriteF('X position : \d\n',Int(mem+24))
WriteF('Y position : \d\n',Int(mem+26))
WriteF('Bitplanes : \d\n',Char(mem+28))
WriteF('Masking : \d\n',Char(mem+29))
WriteF('Compression : \d\n',Char(mem+30))
WriteF('Pad1 : \d\n',Char(mem+31))
WriteF('TransparentColour : \d\n',Int(mem+32))
WriteF('X aspect : \d\n',Char(mem+34))
WriteF('Y aspect : \d\n',Char(mem+35))
WriteF('Page width : \d\n',Int(mem+36))
WriteF('Page height : \d\n',Int(mem+38))
WriteF('Viewport mode : \s\n\n',resolution)
stdout:=Output()
WriteF('Wanna see colours values? [Y if yes] ')
ReadStr(stdout,get_answer)
UpperStr(get_answer)
IF StrCmp(get_answer,'Y')=FALSE THEN Raise(NO_ERR)
StrCopy(s,'CMAP')
n:=search(mem,s)
l:=0
colors:=Long(mem+n+1)/3
n:=n+5
FOR v:=0 TO colors-1
WriteF('Color \z\d[2]: $',v)
FOR kk:=0 TO 2
WriteF('\h',Char(mem+n+l)/$10)
INC l
ENDFOR
WriteF('\n')
ENDFOR
Raise(NO_ERR)
EXCEPT
Dispose(mem)
IF open
Close(open)
UnLock(lock)
ENDIF
IF exception
SELECT exception
CASE NO_ARGS
WriteF('Usage: SSIC picture_name\n')
CASE NO_MEM
WriteF('Can''t allocate 500 bytes of memory! Sth wrong with your Amiga?\n')
CASE NO_FILE
WriteF('Can''t find file \s\n',arg)
CASE NO_IFF
WriteF('This is not an IFF ILBM file.\n')
ENDSELECT
ENDIF
WriteF('\nYou were using \e[1;33mShowSomeIFFChunks\e[0m by Kordi/DuckRed & blabla.\n')
WriteF('SSIC is one of the \e[4mblabla\e[0m productions (see doc).\n')
ENDPROC
PROC search(mem:PTR TO CHAR,ptr:PTR TO CHAR)
-> Szukamy w pamici ciagu s.
DEF ptr1:PTR TO CHAR,v,k
ptr1:=ptr
k:=0
FOR v:=0 TO 499
IF Char(mem)=Char(ptr)
ptr++
INC k
IF k=EstrLen(s) THEN JUMP end1
JUMP next
ENDIF
IF k<>0
k:=0
ptr:=ptr1
ENDIF
next:
mem++
ENDFOR
end1:
ENDPROC v