home *** CD-ROM | disk | FTP | other *** search
- INCLUDE "EXEC/TYPES.I"
-
- INCLUDE "GRAPHICS/GFXBASE.I"
- INCLUDE "GRAPHICS/GFX.I"
- INCLUDE "GRAPHICS/VIEW.I"
- INCLUDE "GRAPHICS/RASTPORT.I"
-
- XREF _AbsExecBase ;library references
- XREF _LVOCloseLibrary
- XREF _LVOOpenLibrary
- XREF _LVOInitView
- XREF _LVOLoadView
- XREF _LVOInitBitMap
- XREF _LVOFreeRaster
- XREF _LVOFreeColorMap
- XREF _LVOFreeVPortCopLists
- XREF _LVOAllocRaster
- XREF _LVOMakeVPort
- XREF _LVOMrgCop
- XREF _LVOInitVPort
- XREF _LVOGetColorMap
- XREF _LVOWaitTOF
- XREF _LVOLoadRGB4
- XREF _LVOExit
- XREF _LVOBltBitMap
-
-
- XREF readfile
-
- XDEF dosbase
-
- CSECT text,code
- main:
- jsr openlibraries ;for graphics library
- move.l graphicsbase,a6
- move.l gb_ActiView(a6),d0
- movem.l d0,oldview ;save old view address
- jsr init ;initialise view
- lea viewport,a0 ;load colours to clear the screen
- lea colourlist,a1
- move.l #16,d0
- move.l graphicsbase,a6
- jsr _LVOLoadRGB4(a6)
- jsr remake ;load the display
- move.l #filename,d0 ;in this case piccy
- move.l #BMscene,d1 ;initialised bitmap
- move.l #colourlist2,d2 ;list for colours
- jsr readfile ;read the iff file using C module iffread2
- lea viewport,a0 ;load colours from colourlist
- lea colourlist2,a1
- move.l #16,d0
- move.l graphicsbase,a6
- jsr _LVOLoadRGB4(a6)
- jsr remake
- loop:
- move.b $bfe001,d1 ;CIA-A parallel port A
- btst #6,d1 ;test bit 6 for game port 0 fire button
- beq finish
- move.b $bfe001,d1 ;CIA-A parallel port A
- btst #7,d1 ;test bit 7 for game port 1 fire button
- bne loop
- finish:
- move.l oldview,a1 ;replace old view
- move.l graphicsbase,a6
- jsr _LVOLoadView(a6)
- jsr cleanup ;release memory
- jsr closelibraries
- rts
-
- remake: ;remakes the display
- move.l graphicsbase,a6 ;the display could be made any which way
- lea view,a0 ;you want
- lea viewport,a1
- jsr _LVOMakeVPort(a6)
- lea view,a1
- jsr _LVOMrgCop(a6)
- jsr _LVOWaitTOF(a6)
- lea view,a1
- jsr _LVOLoadView(a6)
- rts
-
- init: ;if you are not using graphics primitives
- move.l graphicsbase,a6 ;all you need do here is set up a bitmap
- lea view,a1 ;structure, poking the values in directly
- jsr _LVOInitView(a6)
- lea viewport,a0
- jsr _LVOInitVPort(a6) ;initialises viewport(NTSC) viewport
- lea view,a5
- move.l #viewport,d0
- move.l d0,v_ViewPort(a5)
- lea BMscene,a0 ;bitmap
- move.b #4,d0 ;playfield 1 320x256 fixed
- move.w #320,d1
- move.w #200,d2
- jsr _LVOInitBitMap(a6)
- move.l #BMscene,d0
- lea riscene,a5 ;rasinfo
- move.l d0,ri_BitMap(a5)
- move.w #0,ri_RxOffset(a5)
- move.w #0,ri_RyOffset(a5)
- move.l #0,ri_Next(a5)
- lea viewport,a5 ;viewport parameters
- move.w #320,vp_DWidth(a5)
- move.w #200,vp_DHeight(a5)
- move.w #0,vp_DyOffset(a5) ;centred
- move.w #-2,vp_DxOffset(a5)
- move.l #riscene,d0
- move.l d0,vp_RasInfo(a5)
- move.w #0,vp_Modes(a5)
- move.l #16,d0 ;put in colour map
- jsr _LVOGetColorMap(a6)
- lea viewport,a5
- move.l d0,vp_ColorMap(a5)
- movem.l d0,colourmap
- lea BMscene,a5 ;allocate rasters for bitmap
- move.l #3,d5
- lea bm_Planes(a5),a3
- nextplane:
- move.l #320,d0
- move.l #200,d1
- jsr _LVOAllocRaster(a6)
- tst.l d0
- beq notworthstarting
- move.l d0,(a3)+
- dbra d5,nextplane
- rts
-
- notworthstarting: ;graceful exit if necessary
- move.l #1,d0
- move.l #dosbase,a6
- jsr _LVOExit(a6)
- rts
-
- openlibraries:
- move.l _AbsExecBase,a6
- move.l #dosname,a1
- clr.l d0
- jsr _LVOOpenLibrary(a6)
- movem.l d0,dosbase
- tst.l d0
- beq notworthstarting
- move.l #graphicsname,a1
- clr.l d0
- jsr _LVOOpenLibrary(a6)
- movem.l d0,graphicsbase
- tst.l d0
- beq notworthstarting
- rts
-
- cleanup:
- move.l graphicsbase,a6
- lea viewport,a0
- jsr _LVOFreeVPortCopLists(a6)
- move.l colourmap,a0
- jsr _LVOFreeColorMap(a6)
- lea BMscene,a5
- move.l #3,d5
- lea bm_Planes(a5),a3
- cleanrast:
- move.l (a3)+,a0
- move.l #320,d0
- move.l #200,d1
- jsr _LVOFreeRaster(a6)
- add.l #4,a0
- dbra d5,cleanrast
- rts
-
- closelibraries:
- move.l _AbsExecBase,a6
- move.l graphicsbase,a1
- jsr _LVOCloseLibrary(a6)
- move.l dosbase,a1
- jsr _LVOCloseLibrary(a6)
- rts
-
-
- CSECT data
- filename:
- dc.b 'piccy',0
- ds.w 0
- dosname:
- dc.b 'dos.library',0
- ds.w 0
- graphicsname:
- dc.b 'graphics.library',0
- ds.w 0
- riscene:
- dc.l 0
- dc.l BMscene
- ds.w 2
- viewport:
- ds.b vp_SIZEOF
- ds.w 0
- graphicsbase:
- ds.l 1
- oldview:
- ds.l 1
- colourmap:
- ds.l 1
- colourlist:
- ds.l 32
- colourlist2:
- dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- BMscene:
- ds.b bm_SIZEOF
- ds.w 0
- view:
- ds.b v_SIZEOF
- ds.w 0
- dosbase:
- ds.l 1
- END
-
-
-