home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 4: Demo 1
/
almathera_demo1.bin
/
sourcecode
/
german
/
iff-lader.s
< prev
next >
Wrap
Text File
|
1995-03-17
|
6KB
|
421 lines
;
; offsets Intuition
;
OpenIntuition = -30 -0
Intuition = -30 -6
CloseScreen = -30 -36
OpenScreen = -30 -168
PrintIText = -30 -186
;
; offsets exec
;
OpenLib = -30 -378
OldOpenLibrary = -30 -378
CloseLibrary = -30 -384
AllocMem = -30 -168
FreeMem = -30 -180
;
; offsets graphics (gfx)
;
LoadRGB4 = -30 -162
;
;
; offsets dos
;
Open = -30
Close = -30 -6
Read = -30 -12
Exit = -30 -114
;
;
; einzige absolute Adresse:
;
ExecBase = 4
;
even
;
;
; Beginn des Hauptprogramms
;
start:
clr.l d0
move.l ExecBase,a6
lea.l gfxname,a1
jsr oldopenlibrary(a6)
move.l d0,gfxbase
;
move.l execbase,a6
lea intname,a1
jsr oldopenlibrary(a6)
move.l d0,a6
move.l d0,intuitionbase
;
;
jsr open_dos
jsr open_file
move.l #disk_buf,d2
move.l #8,d3
jsr load
move.l d2,a0
;
move.l 4(a0),d3
move.l d3,chunk_size
jsr allocate
move.l chunk_size,d3
move.l pic_buf,d2
jsr load
jsr close_file
;
jsr iff_search
;
move.l intuitionbase,a6
lea.l newscreen,a0
jsr openscreen(a6)
move.l d0,screen
;
jsr pic_print
jsr free
;
col_move:
move.l #3,d3
move.l #7,d4
jsr color_move
jsr colour_set
;
wait_loop:
move.l #$2000,d1
wlp1:
andi.b #64,$bfe001
beq wait_end
dbra d1,wlp1
bra col_move
;
wait_end:
move.l intuitionbase,a6
move.l screen,a0
jsr closescreen(a6)
;
move.l execbase,a6
move.l intuitionbase,a1
jsr closelibrary(a6)
;
move.l gfxbase,a1
jsr closelibrary(a6)
;
move.l dos_base,a1
jsr closelibrary(a6)
;
prg_end:
rts
;
color_move:
lsl.l #1,d3
lsl.l #1,d4
lea.l colour_map,a0
move.l a0,a1
add.l d3,a0
add.l d4,a1
move.w (a1),d5
move.l a1,a2
sub.l #2,a2
move.w (a2),(a1)
vergleich:
cmp.l a2,a0
beq color_exit
move.w -(a2),-(a1)
bra vergleich
color_exit:
move.w d5,(a2)
rts
;
; Daten für Screen- und Bildschirmverwaltung
;
align 4
title: dc.b "The C.C.G. presents",0
align 4
dosname: dc.b "dos.library",0
align 4
intname: dc.b "intuition.library",0
align 4
gfxname: dc.b "graphics.library",0
align 4
gfxbase: blk.l 1,0
intuitionbase: blk.l 1,0
dos_base: blk.l 1,0
;
Newscreen:
dc.w 0,0
width: dc.w 320
height: dc.w 200
dc.w 5
dc.b 0,1
modes: dc.w $0,$0f
dc.l font
dc.l title
dc.l 0,0
;
font = 0
;
screen: dc.l 0
;
even
;
planes: blk.l 10,0
colour_map: blk.w 32,0
black_colour: blk.w 32,0
even
;
planes_init:
move.l screen,a0
add.l #$c0,a0
move.l #planes,a1
move.w planes_num,d0
plane_loop:
move.w d0,d1
mulu #4,d1
move.l (a0,d1),(a1,d1)
dbra d0,plane_loop
rts
;
colours_init:
move.l cmap_chunk,a0
add.l #8,a0
move.l #colour_map,a1
move.w #31,d7
co_loop1:
clr.w d0
move.b (a0)+,d0
and.b #$f0,d0
lsl.w #4,d0
move.b (a0)+,d0
and.w #$0ff0,d0
clr.w d1
move.b (a0)+,d1
lsr.b #4,d1
and.b #$0f,d1
or.b d1,d0
move.w d0,(a1)+
dbra d7,co_loop1
rts
;
pic_print:
jsr planes_init
jsr colours_init
jsr black_colour_set
jsr unpacker
jsr colour_set
rts
;
colour_set:
move.l screen,a0
add.l #44,a0
move.l #colour_map,a1
move.w #32,d0
move.l gfxbase,a6
jsr loadrgb4(a6)
rts
;
black_colour_set:
move.l screen,a0
add.l #44,a0
move.l #black_colour,a1
move.w #32,d0
move.l gfxbase,a6
jsr loadrgb4(a6)
rts
;
iff_search:
move.l pic_buf,a0
add.l #4,a0
move.l a0,bmhd_chunk
move.l 4(a0),d0
add.l d0,a0
add.l #8,a0
move.l a0,cmap_chunk
iff_l1:
move.l 4(a0),d0
add.l d0,a0
add.l #8,a0
move.l #"BODY",d1
cmp.l (a0),d1
bne iff_l1
move.l a0,body_chunk
move.l bmhd_chunk,a2
move.l a2,a1
add.l #16,a1
clr.w d0
move.b (a1),d0
cmp.w #6,d0
blt iff_cont
move.w #6,d0
iff_cont:
move.l #newscreen,a0
move.w d0,8(a0)
subq.w #1,d0
move.w d0,planes_num
;
move.l a2,a1
add.l #18,a1
move.b (a1),comp_flag
move.l a2,a1
add.l #8,a1
clr.l d0
move.w (a1)+,d0
move.w d0,width
clr.l d3
cmp.w #640,d0
blt iff_cont3
or.w #$8000,d3
iff_cont3:
move.w d0,d1
and.w #7,d1
beq iff_cont2
or.w #8,d0
iff_cont2:
divu #8,d0
move.w d0,width_bytes
clr.l d0
move.w (a1),d0
move.w d0,height
cmp.w #400,d0
blt iff_cont4
or.w #4,d3
iff_cont4:
move.w d3,modes
rts
;
unpacker:
move.l #planes,a2
move.l body_chunk,a0
add.l #4,a0
move.l (a0)+,d7
move.l a0,a3
add.l d7,a3
move.w planes_num,d2
addq.w #1,d2
;
unp_loop:
cmp.l a3,a0
bge unpack_end
;
clr.w d3
pic_loop1:
move.w d3,d4
mulu #4,d4
move.l (a2,d4),a5
jsr unpack_row
move.l a5,(a2,d4)
addq.w #1,d3
cmp.w d2,d3
blt pic_loop1
move.l bmhd_chunk,a5
andi.b #1,17(a5)
beq unp_loop
move.l #mask_dummy,a5
jsr unpack_row
bra unp_loop
unpack_row: move.l d2,-(sp)
move.w width_bytes,d2
unp_loop1: tst.w d2
beq unpack_row_end
clr.w d0
tst.w comp_flag
bne unp_comp
move.w width_bytes,d0
subq.w #1,d0
bra unp_loop2
unp_comp:
move.b (a0)+,d0
bmi packed
unp_loop2:
move.b (a0)+,(a5)+
subq.w #1,d2
dbra d0,unp_loop2
bra unp_loop1
;
packed:
neg.b d0
move.b (a0)+,d1
unp_loop3:
move.b d1,(a5)+
subq.w #1,d2
dbra d0,unp_loop3
bra unp_loop1
;
unpack_row_end:
move.l (sp)+,d2
rts
;
unpack_end:
rts
;
;
; chunk-Daten
;
align 4
bmhd_chunk: blk.l 1,0
cmap_chunk: blk.l 1,0
body_chunk: blk.l 1,0
planes_num: blk.w 1,0
comp_flag: blk.w 1,0
width_bytes: blk.w 1,0
;
; Diskroutinen für Filehandling
;
open_dos:
move.l execbase,a6
lea.l dosname,a1
jsr openlib(a6)
move.l d0,dos_base
rts
;
open_file:
move.l dos_base,a6
move.l #filename,d1
move.l #1005,d2
jsr open(a6)
beq prg_end
move.l d0,bif
rts
;
load:
move.l dos_base,a6
move.l bif,d1
jsr read(a6)
rts
;
close_file:
move.l dos_base,a6
move.l bif,d1
jsr close(a6)
rts
;
allocate:
move.l execbase,a6
move.l #$100000,d1
move.l chunk_size,d0
jsr allocmem(a6)
move.l d0,pic_buf
rts
;
;
free:
move.l execbase,a6
move.l pic_buf,a1
move.l chunk_size,d0
jsr freemem(a6)
rts
;
; Daten für File handling
;
align 4
filename: dc.b "Waterfall",0
align 4
bif: dc.l 0
disk_buf: blk.b 10,0
align 4
pic_buf: blk.l 1,0
chunk_size: blk.l 1,0
mask_dummy: blk.b 128,0
; -Ende-