home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of Mecomp Multimedia 1
/
Mecomp-CD.iso
/
amiga
/
tools
/
cd
/
indexcd
/
bin
/
sources.lha
/
sources
/
SizeAG.s
< prev
Wrap
Text File
|
1980-01-04
|
4KB
|
191 lines
bra _main
dc.b "$VER: "
Title: dc.b " SizeAGv1.0 (11-05-1996) © di Claudio Buraglio",10,0
_main: lea XOrig,a1
bsr ReadArg
lea YOrig,a1
bsr ReadArg
lea XSize,a1
bsr ReadArg
lea YSize,a1
bsr ReadArg
tst.l YSize
beq rts
lea XOrig,a0
bsr StringToBin
move.w d0,XOrig
lea YOrig,a0
bsr StringToBin
move.w d0,YOrig
lea XSize,a0
bsr StringToBin
move.w d0,XSize
lea YSize,a0
bsr StringToBin
move.w d0,YSize
OpenDos: moveq #0,d0
lea DosName,a1
move.l 4,a6
jsr -552(a6) ; OpenLibrary
tst.l d0
beq rts
move.l d0,DosBase
Open: move.l #AGEnv,d1
move.l #1004,d2 ; ReadWrite
move.l DosBase,a6
jsr -30(a6) ; Open
tst.l d0
beq CloseDosBase
move.l d0,FileHandle
WriteXOrig: cmp.w #1000,XOrig
bge WriteYOrig
tst.w XOrig
beq WriteYOrig
move.l FileHandle,d1 ; File Handle
move.l #$4,d2 ; Posizion
move.l #-1,d3 ; OFFSET_BEGINNING
move.l DosBase,a6
jsr -66(a6) ; Seek
move.l FileHandle,d1 ; File Handle
move.l #XOrig,d2 ; Buffer
move.l #2,d3 ; Lenght
move.l DosBase,a6
jsr -48(a6) ; Write
WriteYOrig: cmp.w #1000,YOrig
bge WriteX
tst.w YOrig
beq WriteX
move.l FileHandle,d1 ; File Handle
move.l #$6,d2 ; Posizion
move.l #-1,d3 ; OFFSET_BEGINNING
move.l DosBase,a6
jsr -66(a6) ; Seek
move.l FileHandle,d1 ; File Handle
move.l #YOrig,d2 ; Buffer
move.l #2,d3 ; Lenght
move.l DosBase,a6
jsr -48(a6) ; Write
WriteX: cmp.w #1000,XSize
bge WriteY
tst.w XSize
beq WriteY
move.l FileHandle,d1 ; File Handle
move.l #$8,d2 ; Posizion
move.l #-1,d3 ; OFFSET_BEGINNING
move.l DosBase,a6
jsr -66(a6) ; Seek
move.l FileHandle,d1 ; File Handle
move.l #XSize,d2 ; Buffer
move.l #2,d3 ; Lenght
move.l DosBase,a6
jsr -48(a6) ; Write
WriteY: cmp.w #1000,YSize
bge CloseFile
tst.w YSize
beq CloseFile
move.l FileHandle,d1 ; File Handle
move.l #$a,d2 ; Posizion
move.l #-1,d3 ; OFFSET_BEGINNING
move.l DosBase,a6
jsr -66(a6) ; Seek
move.l FileHandle,d1 ; File Handle
move.l #YSize,d2 ; Buffer
move.l #2,d3 ; Lenght
move.l DosBase,a6
jsr -48(a6) ; Write
CloseFile: move.l FileHandle,d1
move.l DosBase,a6
jsr -36(a6) ;Close
CloseDosBase: movea.l DosBase,a1
move.l 4,a6
jsr -414(a6) ; CloseLibrary
moveq.l #0,d0
rts: rts
;--------------------------------------------------------------------------
StringToBin: moveq #0,d0
moveq #0,d1
.Loop: move.b (a0)+,d0
sub.b #$30,d0
tst.b (a0)
beq .Fine
add.l d0,d1
mulu #10,d1
bra .Loop
.Fine: add.l d1,d0
rts
;--------------------------------------------------------------------------
ReadArg: cmp.b #$0a,(a0) ; se Line Feed...
beq .Exit ; esce.
cmp.b #$00,(a0) ; se Nullo...
beq .Exit ; esce.
cmp.b #'"',(a0) ; Se incontra le virgolette "
beq .Virg ; usa l'apposita routine
cmp.b #"'",(a0) ; Se incontra le virgolette '
beq .Virg ; usa l'apposita routine
cmp.b #" ",(a0) ; Cerca inizio testo
bne .loop ; se si loop
addq #1,a0
bra ReadArg ; se no, cicla.
.loop: cmp.b #$0a,(a0) ; se Line Feed
beq .Exit
cmp.b #$20,(a0) ; o un'altro spazio
beq .Exit ; esce
move.b (a0)+,(a1)+ ; copia lettera
bra .loop ; e cicla
.Virg: addq.l #1,a0
.V: cmp.b #$0a,(a0) ; se Line Feed
beq .Exit
cmp.b #'"',(a0) ; o un'altra virgoletta
beq .ExV ; esce
cmp.b #"'",(a0)
beq .ExV
move.b (a0)+,(a1)+ ; copia lettera
bra .V ; e cicla
.ExV: addq #1,a0
.Exit: rts
;-------------------------------------------------------------
DosBase: ds.l 1
FileHandle: ds.l 1
Lock: ds.l 1
XOrig: ds.l 4
YOrig: ds.l 4
XSize: ds.l 4
YSize: ds.l 4
DosName: dc.b "dos.library",0
AGEnv: dc.b "ENV:AmigaGuide/Workbench",0