home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Der Mediaplex Sampler - Die 6 von Plex
/
6_v_plex.zip
/
6_v_plex
/
DISK2
/
MULTI_04
/
I2R.ZIP
/
IFF2RAW.ASM
next >
Wrap
Assembly Source File
|
1991-10-06
|
11KB
|
494 lines
;======================================================================
;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
;======================================================================
; IFF to RAW converter
; programmed by Darius Zendeh
; an XACT-Software Production
; 26.07.1990
;======================================================================
;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
;======================================================================
CGROUP GROUP CODE_SEG, DATA_SEG
ASSUME CS:CGROUP, DS:CGROUP
CODE_SEG SEGMENT PUBLIC
ORG 100h
;======================================================================
ILBMTORAW PROC NEAR
START: call GETNAME
call CHECKFILE
cmp ax,00
jnz START
call OPENCOL
call READCOL
CONTBODY: call READBODY
cmp SCREEN,0fa00h
jb CONTBODY
call SAVEGRAF
call RESVID
call CLOSEHANDLE
LEND: mov ax,4c00h
int 21h
ILBMTORAW ENDP
;======================================================================
;======================================================================
GETNAME PROC NEAR
call BUILDSCREEN
mov ah,0ch ;lösche Eingabepuffer
mov al,0ah ;dann String einlesen
lea dx,LBMNAM ;Sourcenamebuffer
mov bx,dx
mov cl,09h
mov es:[bx],cl ;maximal 8 Zeichen
int 21h
mov cl,es:[bx+1] ;hole Länge
cmp cl,00h
jz NONAME
add bx,02h ;filename.LBM
xor ch,ch
add bx,cx
mov cl,46 ;.
mov es:[bx],cl
mov cl,76 ;L
mov es:[bx+1],cl
mov cl,66 ;B
mov es:[bx+2],cl
mov cl,77 ;M
mov es:[bx+3],cl
mov es:[bx+4],ch ;13 (RETURN) durch 00 ersetzen
ret
NONAME: lea bp,NIEI ;Zeiger auf Text
call WRSTRING
jmp GETNAME
GETNAME ENDP
;======================================================================
BUILDSCREEN PROC NEAR
mov ah,0fh ;Videomodus lesen
int 10h
mov BSEITE,bh ;Bildschirmseite speichern
mov VMODE,al
xor ah,ah ;Clear Screen!
int 10h
mov cx,2eh ;Textlänge
mov dh,05h ;Zeile
mov dl,11h ;Spalte
mov bl,00011111b ;weiß auf dunkelblau
mov bh,BSEITE
lea bp,BIAU ;Zeiger auf Windowanfang
CNTBAU: mov al,255
cmp es:[bp],al ;Ende des Text-Windows?
je BOFF
mov ah,13h ;String ausgeben
mov al,01h
int 10h
add bp,2eh ;nächste Zeile
add dh,01h ; -- // --
jmp CNTBAU
BOFF: mov ah,02h ;setze Cursorposition (Reg. bh von oben!)
mov dh,0ch ;Zeile 12
mov dl,24h ;Spalte 36
int 10h
mov ah,01 ;Cursorgröße
mov ch,0 ;start
mov cl,0fh ;end
int 10h
ret
BUILDSCREEN ENDP
;======================================================================
GETKEY PROC NEAR
mov ah,0ch
mov al,01h
int 21h ;Warten auf Tastendruck
ret
GETKEY ENDP
;======================================================================
CHECKFILE PROC NEAR
clc
mov ah,3dh ;Datei1 .LBM öffnen (Handle)
mov al,80h ;nur lesen
lea dx,LBMNAM+2 ;Zeiger auf Dateiname
int 21h
jc CHERROR
mov HANDLE1,ax ;and store handle
xor ax,ax
ret
CHERROR: lea bp,OPENERR ;Error ausgeben
mov bx,2eh
mul bx
add bp,ax
call WRSTRING
ret
CHECKFILE ENDP
;======================================================================
WRSTRING PROC NEAR
mov ah,13h ;Zeichenkette ausgeben
mov al,01h ;Cursorpos. aktualisieren
mov cx,2ch ;26 Zeichen
mov dh,0eh ;Zeile
mov dl,12h ;Spalte
mov bl,10011100b ;ROT blinkend!
mov bh,BSEITE ;Bildschirmseite holen
int 10h
call GETKEY
ret
WRSTRING ENDP
;======================================================================
OPENCOL PROC NEAR
lea bx,LBMNAM+2
mov dx,bx ;Zeiger auf Dateiname
mov cl,es:[bx-1] ;Filename.COL
xor ch,ch
add bx,cx
mov cl,67 ;C
mov es:[bx+1],cl
mov cl,79 ;O
mov es:[bx+2],cl
mov cl,76 ;L
mov es:[bx+3],cl
mov ah,3ch ;Datei erstellen (Handle)
mov cx,00h ;nur lesen!!??
int 21h ;INTERRUPT!
jc CHERROR2
lea bx,HANDLE2 ;get handle-adress
mov es:[bx],ax ;and store handle
xor ax,ax
ret
CHERROR2: lea bp,INITERR ;Error ausgeben
mov bx,2eh
sub ax,02h
mul bx
add bp,ax
call WRSTRING
ret
OPENCOL ENDP
;======================================================================
CLOSEHANDLE PROC NEAR
mov cx,03h
lea dx,HANDLE1
DOCLOSE: mov bx,dx
mov bx,es:[bx]
cmp bx,00h
jz NOHAND
mov ah,3eh ;doit
int 21h
NOHAND: add dx,02h ;next Handle
loop DOCLOSE
ret
CLOSEHANDLE ENDP
;======================================================================
READCOL PROC NEAR
mov ah,3fh ;read header
mov bx,HANDLE1 ;until CMAP
mov cx,30h
lea dx,PUFFER
int 21h
mov ah,3fh ;read colors
mov cx,300h ;255*3
int 21h
mov cx,300h ;transfer 8BIT colorvalue
TRANSFCOL: lea bx,puffer ;into 6BIT
add bx,cx
mov ah,es:[bx]
shr ah,1
shr ah,1
mov es:[bx],ah ;store back
loop TRANSFCOL
mov ah,40h ;write colors on file.COL
mov bx,HANDLE2
mov cx,300h
int 21h
cli
xor ah,ah ;set videomode : 320x200/256
mov al,13h
int 10h
call COPYCOL ;and burst 256 colors into colegs
sti
REHEAD: mov ah,3fh ;read 4 BYTES
mov bx,HANDLE1
mov cx,04h
lea dx,PUFFER
int 21h
lea bx,PUFFER ;and test checksum (B+O+D+Y)
xor ah,ah
mov cx,04h
ICHKSUM: mov al,es:[bx]
add ah,al
add bx,01h
loop ICHKSUM
cmp ah,2eh
jne REHEAD ;until BODY found
mov ah,3fh ;read remaining length of datas
mov bx,HANDLE1
mov cx,04h
lea dx,GLEN
int 21h
ret
READCOL ENDP
;======================================================================
COPYCOL PROC NEAR
call VBLANC ;wait until vertical blanking
lea bx,PUFFER
xor cx,cx ;cl=start first color and counter
mov dx,03c8h ;dx=03c8 write pel address reg.
mov al,cl ;locate address
out dx,al ;write the following datas
inc dx ;dx=03c9 : pel data reg.
COLLOOP: mov al,es:[bx] ;R
out dx,al
mov al,es:[bx+1] ;G
out dx,al
mov al,es:[bx+2] ;B
out dx,al
add bx,03h
inc cl
jnz COLLOOP
ret
COPYCOL ENDP
;======================================================================
VBLANC PROC NEAR
mov dx,3dah ;input status reg. #1
VE1: in al,dx ;get data
test al,8 ;vert. retrace ?
je VE1
ret
VBLANC ENDP
;======================================================================
RESVID PROC NEAR
call GETKEY ;auf Taste warten
xor ah,ah ;auf Originalzustand
mov al,VMODE ;zurückschalten
mov bh,BSEITE
int 10h
ret
RESVID ENDP
;======================================================================
READBODY PROC NEAR
lea dx,GPUFF ;init adress
mov GADRESS,dx ;store it
mov COUNTER,00h ;init counter
BEBODY: lea dx,ONEPUFF ;zwischen buffer (1 Byte)
mov cx,01h ;lese 1 Byte
call READONE
mov bx,dx
mov al,es:[bx] ;hol Byte aus PUFFER
cmp al,00
jl ENTCOMP ;wenn <0 & >127!
mov dx,GADRESS ;wenn >0
xor ch,ch
mov cl,al
add cl,01h ;real number of bytes to read
add COUNTER,cx
call READONE
add GADRESS,cx
jmp CHECKLINE
ENTCOMP: neg al
mov cl,al
xor ch,ch
push cx
mov cx,01h
call READONE
mov bx,dx
mov ah,es:[bx]
pop cx
add cx,01
add COUNTER,cx
mov bx,GADRESS
FILLBYTES: sub GLEN,cx
mov es:[bx],ah
inc bx
loop FILLBYTES
mov GADRESS,bx
CHECKLINE: cmp COUNTER,140h
jl BEBODY
mov GCOUNT,00h
BEGSHIFT: mov SHIFTVAL,00h
mov CBUF2,08h
OSHIFT: add SHIFTVAL,01h
mov CBUF1,08h
lea bx,GPUFF ;140h datas = 1. Grafikzeile
add bx,GCOUNT ;offset
xor al,al
SHIFTY: mov ah,es:[bx]
mov cl,SHIFTVAL
sal ah,cl
jc SETPOINT
ror al,01h
jmp CHECKPOINT
SETPOINT: ror al,01h
add al,80h
CHECKPOINT: add bx,28h ;next Plane
sub CBUF1,01h
cmp CBUF1,00h
jg SHIFTY
mov bx,SCREEN
mov dx,0a000h
mov es,dx
mov es:[bx],al
mov bx,cs
mov es,bx
add SCREEN,01h
dec CBUF2
cmp CBUF2,00h
jg OSHIFT
add GCOUNT,01
cmp GCOUNT,28h
jl BEGSHIFT
ret
READBODY ENDP
;======================================================================
READONE PROC NEAR
mov ah,3fh ;read header
mov bx,HANDLE1
int 21h
ret
READONE ENDP
;======================================================================
SAVEGRAF PROC NEAR
lea bx,LBMNAM+2
mov dx,bx ;Zeiger auf Dateiname
mov cl,es:[bx-1] ;Filename.RAW
xor ch,ch
add bx,cx
mov cl,82 ;R
mov es:[bx+1],cl
mov cl,65 ;A
mov es:[bx+2],cl
mov cl,87 ;W
mov es:[bx+3],cl
mov ah,3ch ;Datei erstellen (Handle)
mov cx,00h ;nur lesen!!??
int 21h ;INTERRUPT!
mov HANDLE3,ax ;and store handle
mov bx,ax
push bx
mov ah,40h ;write file.RAW
mov cx,0fa00h
mov bx,0a000h
mov ds,bx
xor dx,dx
pop bx
int 21h
mov bx,cs
mov ds,bx
ret
SAVEGRAF ENDP
;======================================================================
;======================================================================
CODE_SEG ENDS
;======================================================================
;======================================================================
DATA_SEG SEGMENT PUBLIC ;Datasegment
LBMNAM db 15 dup (?)
NIEI db " >>> Nichts eingegeben! <<< "
OPENERR db " >>> fehlende File-Sharing-Software <<< "
db " >>> Datei nicht gefunden <<< "
db " >>> Datei existiert nicht! <<< "
db " >>> kein freies Handle mehr! <<< "
db " >>> Zugriff verweigert ! <<< "
INITERR db " >>> Pfad nicht gefunden! <<< "
db " >>> kein freies Handle <<< "
db " >>> Zugriff verweigert <<< "
BIAU db "╔════════════════════════════════════════════╗"
db "║ ILBM --> RAW ║"
db "║ V 1.0 ║"
db "║ (c) by Darius Zendeh ║"
db "╟────────────────────────────────────────────╢"
db "║ Name eingeben ( ohne Extension .LBM ! ) ║"
db "║ max. 8 Zeichen ║"
db "║ > < ║"
db "╠════════════════════════════════════════════╣"
db "║ ║"
db "╚════════════════════════════════════════════╝"
db 255
BSEITE db 0
VMODE db 0
GLEN dw 0
RLEN dw 0
COUNTER dw 0
HANDLE1 dw 0
HANDLE2 dw 0
HANDLE3 dw 0
SHIFTVAL db 0
CBUF1 db 0
CBUF2 db 0
GADRESS dw 0
SCREEN dw 0
GCOUNT dw 0
ONEPUFF db 0 ;statt PUFFER!
GPUFF db 0 ;140h dup (?)
PUFFER db 0
DATA_SEG ENDS
END ILBMTORAW