home *** CD-ROM | disk | FTP | other *** search
-
- Offset2BODY dw 0 ;There will be stored offset to the BODY chunk
- Offset2CMAP dw 0 ;And there to CMAP
- CurrentSi dw 0 ;Save the si
- dw 'NU'
- Show2Sc:push es
- ;--------------------------------------: Searching for CMAP signature
- mov CurrentSi,si
- mov cx,5000 ;Test eventually 5000 bytes of IFF
- CMAP_S: lodsw
- cmp ax,'MC' ; after XCHG ah,al='CM'
- je CM_Found ; jump if You found the CM part of
- dec cx
- jnz CMAP_S
-
- TheEnd: ret
-
- CM_Found:
- lodsw
- cmp ax,'PA' ; after xchg ah,al='AP'
- jne TheEnd
- mov Offset2CMAP,si ; store offset
-
- ;--------------------------------------: Here is the part which sets colors
- SetColors:
- mov si,Offset2CMAP
- add si,4 ;skip the header of chunk
-
- cli ; It's quite good 2 disable int. here
- mov ax,0
- mov dx,3c8h
- out dx,al
- inc dx
- mov cx,300h
- lopez: mov al,[si]
- shr al,2 ; Always divide by 4!
- out dx,al
- inc si
- uloop cx,lopez
- sti
-
- ;--------------------------------------: Search for BODY signature
- Search4BODY:
- mov si,CurrentSi
- mov cx,5000
- Search:
- mov ax,word ptr ds:[si]
- cmp ax,'OB'
- je BO_Found
- add si,2
- dec cx
- jnz Search
- jmp TheEnd
- BO_Found:
- mov ax,word ptr ds:[si+2]
- cmp ax,'YD'
- jne DC_FINI
-
- ;--------------------------------------: Finally show the picture
- show256: ;si=offset to pict.
- add si,8
- pop es
- mov di,0
- mov bp,64000 ;how many pixels
- mov dx,0 ;this is our counter
-
- DCRUNC: lodsb
- and al,al
- js DC_LOW
-
- DC_HI: cbw
- mov cx,ax
- inc cx
- add dx,cx
- rep movsb
-
- cmp dx,bp
- jb DCRUNC
- jmp DC_FINI
-
- DC_LOW: neg al
- cbw
- mov cx,ax
- inc cx
- add dx,cx
- lodsb
- rep stosb
-
- cmp dx,bp
- jb DCRUNC
- DC_FINI:
- ret
-