home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d421
/
ezasm
/
window.asm
< prev
next >
Wrap
Assembly Source File
|
1990-12-29
|
3KB
|
191 lines
* Opens a window, gets the window's fontdata into our CHIP area
* and blits part of it into the window.
* ( uses "ENDS" for data at bottom )
* ( text might be trashed under 2.0 )
* click left mouse button to exit
include "intuition/intuition.i"
include "exec/types.i"
include "graphics/gfx.i"
include "graphics/rastport.i"
CLEAR_CHIP equ $10002
CSEG
Wind equ -4
_IntuitionBase equ -8
FontData equ -12
Planes equ -16
_GfxBase equ -20
XREF _LVOAllocMem
XREF _LVOOpenLibrary
XREF _LVOOpenWindow
XREF _LVOCloseWindow
XREF _LVOCloseLibrary
XREF _LVOFreeMem
link a5,#-24
movea.l $4,a6
move.l #2048,d0
move.l #CLEAR_CHIP,d1
jsr _LVOAllocMem(a6)
move.l d0,FontData(a5)
beq Quit
movea.l #intuiname,a1
moveq #0,d0
jsr _LVOOpenLibrary(a6)
move.l d0,_IntuitionBase(a5)
beq Quit
movea.l #graphname,a1
moveq #0,d0
jsr _LVOOpenLibrary(a6)
move.l d0,_GfxBase(a5)
beq Quit
movea.l _IntuitionBase(a5),a6
movea.l #newwin,a0
jsr _LVOOpenWindow(a6)
move.l d0,Wind(a5)
beq Quit
* a handy debugging aid!
* ( just remove the '*', change the color, and be sure a label's
* before the next one )
* d6 = 1000
*1$ d7 = 10000
*2$ ($dff180) = $0f0 w ;GREEN
* dbf d7,2$
* dbf d6,1$
* load fontdata into our chip area
movea.l Wind(a5),a0
movea.l wd_RPort(a0),a1
movea.l rp_Font(a1),a2
movea.l tf_CharData(a2),a3
move.l #383,d1
movea.l FontData(a5),a4
FontLoop move.l (a3)+,(a4)+
dbf d1,FontLoop
* get addr of windows 1st bitplane
movea.l rp_BitMap(a1),a2
move.l bm_Planes(a2),Planes(a5)
* blit out first portion of fontdata
lea 14675968,a6
move.w #$03aa,$40(a6) ;BLTCON0 USE: C D D=C
move.w #$007a,$60(a6) ;BLTCMOD
move.w #$000a,$66(a6) ;BLTDMOD
move.l Planes(a5),d1
addi.l #1605,d1
move.l d1,$54(a6)
move.l FontData(a5),$48(a6)
clr.w $74(a6) ;BLTADAT
clr.w $72(a6) ;BLTBDAT
move.w #$8240,$96(a6) ;DMACON SET DMAEN BLTEN
move.w #547,$58(a6) ;BLTSIZE
BlitWait btst.b #6,$dff002
bne BlitWait ;DMACONR BBUSY?
QuitLoop btst.b #6,$bfe001
bne QuitLoop ;wait for LMB down
Quit
tst.l Wind(a5)
beq .laaa
movea.l _IntuitionBase(a5),a6
movea.l Wind(a5),a0
jsr _LVOCloseWindow(a6)
.laaa
tst.l _IntuitionBase(a5)
beq .laab
movea.l $4,a6
movea.l _IntuitionBase(a5),a1
jsr _LVOCloseLibrary(a6)
.laab
tst.l _GfxBase(a5)
beq .laac
movea.l $4,a6
movea.l _GfxBase(a5),a1
jsr _LVOCloseLibrary(a6)
.laac
tst.l FontData(a5)
beq .laad
movea.l $4,a6
movea.l FontData(a5),a1
move.l #2048,d0
jsr _LVOFreeMem(a6)
.laad
unlk a5
moveq #0,d0
rts
DSEG
newwin ds.w 0
dc.w 0,0,640,200
dc.b -1,-1
dc.l 0
dc.l WINDOWDRAG|WINDOWSIZING|SIZEBRIGHT|ACTIVATE|SMART_REFRESH
dc.l 0,0,0,0,0
dc.w 100,100,640,400
dc.w WBENCHSCREEN
intuiname dc.b "intuition.library",0
graphname dc.b "graphics.library",0
END