home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 4: Demo 1
/
almathera_demo1.bin
/
sourcecode
/
german
/
duke.s
< prev
next >
Wrap
Text File
|
1995-03-17
|
6KB
|
281 lines
; --- New Bitplane Scrollroutine !
; --- written by Duke of T.L.C
; --- with many helps from the Mad Thinker
org $38000
load $38000
ScrPlane1: equ $45000
; ---- Special AMIGA Equates
AbsExecBase=4 ; the only absolute address !
Level3Int=$6c
; ---- Exec Library Vector Offsets
Permit=-138
Forbid=-132
OpenLibrary=-408
CloseLibrary=-414
; ---- Graphics Library Vector Offsets
Text=-60
SetFont=-66
CloseFont=-78
InitRastPort=-198
InitBitMap=-390
MovePen=-240
; ---- Diskfont Library Vectors
OpenDiskFont=-30
DMACON=$dff096
;
; Initialize the libraries for system calls
;
move.l sp,initialSP
move.l AbsExecBase,a6 ; ExecLib Base
lea GfxName,a1 ; addr. of library name
jsr OpenLibrary(a6) ; open it
move.l d0,GfxBase ; store base pointer for use
move.l d0,d6 ; save for use
;
; Open the Diskfont library
;
lea FontLName,a1 ; name of library
jsr OpenLibrary(a6) ; do a open
move.l d0,DiskfontBase ; store pointer
beq FontErr
;
; Load the special font to in ram
;
move.l d0,a6 ; move library pointer
lea TextAttr,a0 ; discription of font
jsr OpenDiskFont(a6)
move.l d0,FontBase ; addr of TextFont structure
beq FontErr
;
; Print the text in bit plane
;
move.l GfxBase,a6 ; copy library base pointer
lea BitMap,a0 ; addr of BitMap
moveq #1,d0 ; Depth of BitMap
move.l #480,d1 ; Width of BitMap
move.l #40,d2 ; Height of BitMap
jsr InitBitMap(a6) ; setup the structure
move.l #ScrPlane1,a0 ; pointer to memory
move.l a0,Plane1 ; install in BitMap
move.l #8000/4-4,d0 ; clear memory
lok1: clr.l (a0)+
dbra d0,lok1
lea RastPort,a1 ; my RastPort structure
jsr InitRastPort(a6)
move.l #BitMap,R_BitMap ; install pointer to BitMap
lea RastPort,a1
move.l FontBase,a0 ; addr of TextFont
jsr SetFont(a6) ; install new font in RastPort
; ---- Put text...
;
; setup the new copper list (will be performed in next VBlank)
;
move.l AbsExecBase,a6
jsr Forbid(a6) ; stop multitasking
move.l GfxBase,a0
add.l #$32,a0 ; point to LOFlist in GfxBase
move.w #$0080,DMACON ; stop Copper DMA
move.l (a0),OldCopper ; pointer to old copper list
move.l #CopList,(a0) ; my own Coppers..
move.w #$8080,DMACON
;
; blitter scrolling
;
move.l #str,c_ptr
next:
bsr put_char
akt: btst #14,$dff002
bne akt
move.l #$ffffffff,$dff044 ; first/last word mask
move.l #$45002,$dff050 ; source A
move.l #buffer,$dff054 ; destination D
move.w #02,$dff064
move.w #00,$dff066 ; modulos
move.w #$00,$dff042
move.w #$09f0,$dff040
bsr sync
move.w #25,d0
lsl.w #6,d0
ori.w #29,d0 ; 30 words
move.w d0,$dff058
move.w #$f,d7
fine:
akt2: btst #14,$dff002
bne akt2
move.l #buffer,$dff050 ; source A
move.l #$45000,$dff054 ; destination D
move.w #00,$dff064
move.w #02,$dff066 ; modulos
move.w #$00,$dff042
move.w d7,d6
lsl.w #8,d6
lsl.w #4,d6
ori.w #$9f0,d6
move.w d6,$dff040
bsr sync
move.w #25,d0
lsl.w #6,d0
ori.w #29,d0 ; 30 words
move.w d0,$dff058
again:
move.b $bfe001,d0 ; wait until mouse button
move.b d0,d1
and.l #$40,d0
beq raus
move.l #$1000,d1
ti1: dbra d1,ti1
sub.w #$1,d7
bpl fine
bra next
raus:
;
; reset all resources used!
;
move.l GfxBase,a0
add.l #$32,a0 ; point to LOFlist in GfxBase
move.w #$0080,DMACON ; stop Copper and Sound
move.l OldCopper,(a0) ; restore pointer
move.w #$8080,DMACON ; start again ...
move.l AbsExecBase,a6
jsr Permit(a6) ; restart multitasking
;
; Ready to give system back
;
move.l GfxBase,a6
move.l FontBase,a1 ; addr of font
jsr CloseFont(a6) ; font memory back to system
move.l AbsExecBase,a6 ; Exec-Master-Program
move.l DiskfontBase,a1
jsr CloseLibrary(a6) ; no need for Libraries!!
move.l GfxBase,a1
jsr CloseLibrary(a6)
ende:
move.l initialSP,sp
clr.l d0 ; E.T. phone home!!
ILLEGAL
; rts
;
; ---- syncronize blitter with raster beam
sync:
move.w $dff006,d4
lsr.w #8,d4
cmp.b #$50,d4
bls sync
rts
;
; ---- put character to screen
;
put_char:
move.l GfxBase,a6
move.l #448,d0 ; x pos
move.l #15,d1 ; y pos
lea RastPort,a1
jsr MovePen(a6)
lea RastPort,a1 ; addr of structure
move.l c_ptr,a0
move.l #2,d0 ; num of chars to put
jsr Text(a6);
add.l #2,c_ptr
cmp.l #str+250,c_ptr ;HOW MANY TEXTBYTES ?
blo.s Duke ;jump out
move.l #str,c_ptr
Duke: rts
; ---- Error ... assume that you use Intuition's DisplayAlert()
;
FontErr:
move.l initialSP,sp
rts ; try to escape (without hope!)
GfxName: DC.B 'graphics.library',0
even
FontLName: DC.B 'diskfont.library',0
even
;
; DISPLAY COPROCCESSOR INSTRUCTION LIST
;
CopList:
DC.W $008e,$9c81 ; DIW Start
DC.W $0090,$f4c1 ; DIW Stop
DC.W $0092,$38 ; DDF Start
DC.W $0094,$d0 ; DDF Stop
DC.W $00e0,$0004
DC.W $00e2,$5002
DC.W $0108,20
DC.W $0180,$28f ; Background color
DC.W $0182,$fff
DC.W $0102,$000 ; Scroll delay 0
DC.W $0100,$1200 ; 1 Bit Plane
DC.W $ffff,$fffe
; ---- Demo Text
str: DC.B 'THIS IS A DEMO TEXT TO SHOW YOU THE MIGHTY SCROLL-'
DC.B 'ROUTINE WITH FULL BLITTER CONTROL! WRITTEN BY D'
DC.B 'UKE OF THE LIGHT-CIRCLE ! IF YOU USE THIS ROUTINE,'
DC.B ' PLEASE SET IN SOME GREETINGS TO US !!! '
DC.B '{} BY DUKE OF T.L.C IN 1941 '
len: equ *
even
FontName: DC.B 'tempfont.font',0
even
TextAttr:
DC.L FontName
DC.W 8 ; hight of Font
DC.W 0
DiskfontBase: blk.l 1,0
GfxBase: blk.l 1,0
initialSP: blk.l 1,0
OldCopper: blk.l 1,0
FontBase: blk.l 1,0
c_ptr: blk.l 1,0
; Structures used by graphics.library
BitMap:
BytesPerRow: blk.w 1,0
Bytes: blk.w 1,0
Flags: blk.b 1,0
Depth: blk.b 1,0
Pad: blk.w 1,0
Plane1: blk.l 1,0
Planes: blk.l 7,0
RastPort: blk.l 1,0
R_BitMap: blk.l 1,0
blk.b 96,0 ; space for laber unused data
buffer: blk.b 60*40,0