;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; This is just made to demonstrate my unpack-routine for 256color LBM-Files.
; Nothing to be proud of, just only to show how it works ....
;
; I used the IDEAL-mode of Tasm adn Tran's Pmode-Extender v2.5
;
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

ideal
p386

segment  code32  para public use32
assume cs:code32
assume ds:code32

public _main

masm
include pmode.inc
ideal

_main:          sti

                mov edx,offset filename   ; opens a gfx-file, reads it and
                call _openfile            ; close it at the end
                jc error

                mov edx,offset buffer
                mov ecx,0ffffh
                call _readfile
                jc error

                call _closefile
                jc error
 

                mov [ds:v86r_ax],0013h
                mov al,10h
                int 33h

                mov esi,offset buffer
                mov cx,64000
                mov edi,offset depack_buffer
                
                call unpack_lbm           ; unpacks the graphics on the 
                                          ; screen and store the colors in
                                          ; the palette-buffer
                jc error
                
                mov esi,[color_table]

                mov cx,768
                mov dx,03c8h
                xor al,al
                out dx,al
                inc dx
color_set:      mov al,[esi]
                shr al,2
                out dx,al
                inc esi
                dec cx
                jnz color_set

                mov ecx,[Bitmap_Bytes]
                mov esi,offset depack_buffer
                xor edi,edi
xtx:            mov eax,[ds:esi]
                mov [gs:0a0000h+edi],eax
                inc esi
                inc edi
                dec cx
                jnz xtx

                
warte:          in al,60h
                cmp al,01h
                jne warte

error:          mov [ds:v86r_ax],0003h
                mov al,10h
                int 33h
                
                mov ax,4c00h
                int 21h


include "unp_lbm.asm"


filename        db "test.lbm",0

buffer          db 64000 dup (?)
depack_buffer   db 64000 dup (?)

ends  code32

end _main



