home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-04-06 | 64.4 KB | 2,596 lines |
-
- *************************************************
- * Open Screen Routine for ColorBurst *
- * And Screen Controller *
- * (c) 1990 Gary Rayner *
- *************************************************
-
- Incdir "include/"
- include exec/exec_lib.i
- include exec/exec.i
- include exec/types.i
- include graphics/graphics_lib.i
- include graphics/GfxBase.i
- include hardware/dmabits.i
- include hardware/custom.i ;Load the Includes
- include libraries/dos_lib.i
- include libraries/dos.i
- GRAPHICS_REV equ 0
-
- Start:
- move.w #3,ScreenModes ;Hi/lo-res, Interlace, Overscan ???
- bsr OpenScreen ;Open the Screen & Allocate memory
- bsr mousewait ;draw on the screen
- bsr CloseScreen ;Close Screen & Deallocate memory
- rts
-
- Incdir "CBurst_PAL/"
- include Link_Stuff.i ;library of links for 'C'
-
- OpenScreen: ;attempts to open screen from ColorBurst
- ;screen structure
- clr.b Lo_Hi
- move.w ScreenModes,d0
- andi.w #%1111,d0 ;mask out unwanted bits
- lsl.b #4,d0 ;multiply by 16
- move.l #ScreenTable,a0 ;get values from lookup table
- move.w 0(a0,d0),Screen_Width
- move.w 2(a0,d0),Screen_Height
- move.w 4(a0,d0),Screen_Planes
- move.w 6(a0,d0),ScreenStart ;Vertical start position
- move.w 8(a0,d0),Start_Fetch ;Display widow start value
- move.w 10(a0,d0),Stop_Fetch ;display window stop
- move.w 12(a0,d0),Scroll ;display horizontal scroll value
- move.w 14(a0,d0),VStart ;different VStart pos. for PAL/NTSC
- ;Now try to get memory for screens
- ;if not enough memory, set partitions
- ;for virtual Memory.
- move.b #12,MaxNum_Cycles ;3 passes for screen update
- move.w Screen_Width,d0 ;get screen width
- move.w d0,d3
- rol.l #1,d3
- move.b #1,X_Div ;halve X mouse coords for lo-res
- cmp.w #400,d0 ;see if hi-res
- blt .nodiv ;if not
- ror #1,d3
- clr.b X_Div ;No halve the X coords for hi-res
- move.b #24,MaxNum_Cycles ;6 passes for screen update
- move.b #$ff,Lo_Hi
- lsr.w #1,d0 ;divide width by 2 for hi-res
- .nodiv
- move.w d3,Max_Mouse_X
- move.w d0,Int_XWidth ;Internal X width of screen
- lsr.w #2,d0 ;divide by 4
- move.w d0,Modulo ;the screen modulo
- mulu Screen_Height,d0
- move.l d0,RasterMemSize ;Size of each chunk of raster
- move.l d0,BitMapSize
- move.l d0,$0304
- bsr Get_Copper_Mem ;Get the Copper memory
- bsr Allocate_BitMaps ;Get Screen Memory
- bsr InitScreen ;Initialize the screen stuff
- rts
-
- Get_Copper_Mem: ;Get the Copper list memory
- move.b #14,d6 ;clear the tables of pointers
- move.l #Cop_1,a5
- .l1:
- clr.l (a5)+
- subq.b #1,d6
- bne .l1
-
- moveq.b #3,d6 ; clear the tables
- move.l #Col_1,a5
- .l2:
- clr.l (a5)+
- subq.b #1,d6
- bne .l2
- clr.l MiscMem
-
- move.b #12,d6 ; amount of copper lists to get
- move.l #Cop_1,a5 ; pointer to copper vector table
- .loop2:
- move.l #EndCopperList1-CopperList1,d0 ;find length of copper list
- move.l #MEMF_CHIP!MEMF_CLEAR,d1
- CALLEXEC AllocMem ;Get memory
- tst.l d0
- beq Free_Copper_Mem ;Exit if errors
- move.l d0,(a5)+
- subq.b #1,d6
- bne .loop2
-
- move.b #2,d6 ;amount of copper lists to get
- move.l #Cop_13,a5 ;pointer to copper vector table
- .loop4:
- move.l #EndCopperList3-CopperList3,d0 ;find length of copper list
- move.l #MEMF_CHIP!MEMF_CLEAR,d1
- CALLEXEC AllocMem ;Get memory
- tst.l d0
- beq Free_Copper_Mem ;Exit if errors
- move.l d0,(a5)+
- subq.b #1,d6
- bne .loop4
-
- move.b #3,d6 ;amount of copper lists to get
- move.l #Col_1,a5 ;pointer to copper vector table
- .loop5:
- move.l #EndCPList-CPList,d0 ;find length of copper list
- move.l #MEMF_CHIP!MEMF_CLEAR,d1
- CALLEXEC AllocMem ;Get memory
- tst.l d0
- beq Free_Copper_Mem ;Exit if errors
- move.l d0,(a5)+
- subq.b #1,d6
- bne .loop5
-
- move.l #EndMenuList-MenuList,d0 ;find length of copper list
- move.l #MEMF_CHIP!MEMF_CLEAR,d1
- CALLEXEC AllocMem ;Get memory
- tst.l d0
- beq Free_Copper_Mem ;Exit if errors
- move.l d0,Menu_Cop ;Menu CopperList
-
- ;Get Memory for control line data, data line data
- move.l #6400,d0 ;ammount of miscellaneous memory
- move.l #MEMF_CHIP!MEMF_CLEAR,d1
- CALLEXEC AllocMem ;Get memory
- tst.l d0
- beq Free_Copper_Mem ;Exit if errors
- move.l d0,MiscMem
- rts
-
- Free_Copper_Mem: ;free the Copper list memory
- move.b #12,d6 ;amount of copper lists to get
- move.l #Cop_1,a5 ;pointer to copper vector table
- .loop1:
- move.l (a5)+,a1
- cmp.l #0,a1
- beq .return
- move.l #EndCopperList1-CopperList1,d0 ;find length of copper list
- CALLEXEC FreeMem ;free memory
- subq.b #1,d6
- bne .loop1
-
- move.b #2,d6 ;amount of copper lists to free
- move.l #Cop_13,a5 ;pointer to copper vector table
- .loop3:
- move.l (a5)+,a1
- cmp.l #0,a1
- beq .return
- move.l #EndCopperList3-CopperList3,d0 ;find length of copper list
- CALLEXEC FreeMem ;free memory
- subq.b #1,d6
- bne .loop3
-
- moveq.b #3,d6 ;amount of copper lists to free
- move.l #Col_1,a5 ;pointer to copper vector table
- .loop4:
- move.l (a5)+,a1
- cmp.l #0,a1
- beq .return
- move.l #EndCPList-CPList,d0 ;find length of copper list
- CALLEXEC FreeMem ;free memory
- subq.b #1,d6
- bne .loop4
-
- move.l #EndMenuList-MenuList,d0 ;find length of copper list
- move.l Menu_Cop,a1
- cmp.l #0,a1
- beq .return
- CALLEXEC FreeMem ;free memory
-
- move.l #6400,d0 ;ammount of miscellaneous memory
- move.l MiscMem,a1
- cmp.l #0,a1
- beq .return
- CALLEXEC FreeMem ;free memory
- .return:
- rts
-
- Allocate_BitMaps: ;allocates screen bitplanes
- move.b #24,d0 ;clear the bitplane pointers
- move.l #BitPlane_0,a0
- .l1:
- clr.l (a0)+
- subi.b #1,d0
- bne .l1
- move.w Screen_Planes,temp
- move.l #BitPlane_0,a0
- .l2:
- move.l BitMapSize,d0 ;ammount of memory per bitplane
- move.l #MEMF_CHIP,d1
- move.l a0,-(sp)
- CALLEXEC AllocMem ;Get memory
- move.l (sp)+,a0 ;we are just feeling the water to
- tst.l d0 ;see how much memory the system will
- beq .Cant_Get_All_Memory ;let us take. then we will deallocte
- move.l d0,(a0)+ ;and get the same amount, but clear
- subq.w #1,temp ;it this time. The system stuffs up
- bne .l2 ;for some reason if I clear in the
- move.l #BitPlane_0,d0 ;first passes.
- move.l RasterMemSize,d0 ;subtract the wanted bitplane
- move.l BitMapSize,d1 ;size from what we got and find the
- move.w Screen_Height,Actual_Height
- sub.l d1,d0 ;ammount of virtual memory
- beq .NoVirtual ;go ahead if no virtual required
- divu Modulo,d0 ;round off to start of scan line
- andi.l #$1ff,d0
- addi.b #1,d0
- move.l d0,d1
- move.w Screen_Height,d2
- sub.w d1,d2
- move.w d2,Actual_Height ;store the actual screen height
- mulu Modulo,d0 ;bring back to real value
- .NoVirtual:
- move.l d0,Virtual_Mem ;ammount of virtual required
- bsr Deallocate_BitMaps ;deallocate
- move.b #24,d0 ;clear the bitplane pointers
- move.l #BitPlane_0,a0
- .l5:
- clr.l (a0)+
- subi.b #1,d0
- bne .l5
- move.w Screen_Planes,temp
- move.l #BitPlane_0,a0
- .l6:
- move.l BitMapSize,d0 ;reallocate memory but clear it
- move.l #MEMF_CHIP!MEMF_CLEAR,d1 ;This time
- move.l a0,-(sp)
- CALLEXEC AllocMem ;Get memory
- move.l (sp)+,a0
- move.l d0,(a0)+
- subq.w #1,temp
- bne .l6
- move.l #BitPlane_0,a0 ;return pointer to bitplanes in a0
- rts
-
- .Cant_Get_All_Memory: ;I go here if I couldnt get full screen of memory
- clr.l d0
- move.w Screen_Planes,d0
- move.w d0,d1
- lsr.w #1,d1 ;half number of bitplanes
- addi.w #1,d1 ;add extra to be above 50%
- sub.w temp,d0 ;did i get 50% or more?
- cmp.l d1,d0 ;Must have at least 50% or fail!
- blt .Get_Mem_Failure
- move.l BitMapSize,d1
- mulu.w d0,d1
- divu Screen_Planes,d1 ;Amount of memory to retry with to
- andi.l #$ffff,d1 ;try to get 24 bitplanes
- move.l d1,-(sp) ;push memory size to stack
- bsr Deallocate_BitMaps ;Deallocate the bitplane chunks
- move.l (sp)+,BitMapSize ;recall memory size from stack
- move.l RasterMemSize,d0
- lsr.l #1,d0 ;divide by 2
- cmp.l BitMapSize,d0 ;See if memory chunk > 50%
- bge .Get_Mem_Failure ;fail if can't get 50%
- bra Allocate_BitMaps ;and try to get 24 full bitplanes
- ;again
- .Get_Mem_Failure: ;Couldn't open screen that large!
- bsr Deallocate_BitMaps ;Deallocate attempted memory
- move.b #24,d0 ;clear the bitplane pointers
- move.l #BitPlane_0,a0
- .l7:
- clr.l (a0)+
- subi.b #1,d0
- bne .l7
- move.l #-1,a0 ;Allocate Failure !!!
- rts ;Return to calling routine
-
- Deallocate_BitMaps: ;Free all Bitmap memory
- move.l #BitPlane_0,a0
- move.b #24,temp
- .l1:
- move.l BitMapSize,d0
- move.l (a0)+,A1
- cmp.l #0,a1 ;if pointer is 0 dont deallocate!
- beq .endloop
- move.l a0,-(sp)
- CALLEXEC FreeMem ;free the memory
- move.l (sp)+,a0
- subq.b #1,temp
- bne .l1
- .endloop:
- rts
-
- ;*** Note on virtual memory. The open screen routines has been
- ;designed to support full display resolution even when there is
- ;not enough chip memory available for a full screen. It will display
- ;the portion of screen in memory and store the other portion on hard
- ;drive or in fast memory. This has been included to allow full
- ;compatibility with the full range of Amiga computers and will
- ;automatically tell you what portion and lines, (if any) have been
- ;allocated as virtual memory.
- ;*** There is a maximum of 14 different copper lists used to display a
- ;screen. 12 of these are for normal screen update, and the
- ;next 2 are used for Showing the current screen without updating it.
- ;This was included to give you full speed access to chip memory with
- ;no screen DMA contention to slow the processor down with.
-
- InitScreen:
- moveq #GRAPHICS_REV,d0 ;Open the Graphics Library
- lea graf_name(pc),a1
- CALLEXEC OpenLibrary
- tst.l d0
- beq EXIT_A ;return if could'nt get library
- move.l d0,_GfxBase
- ;Initialize memory pointers for mode lines, copper lists etc.
- move.b #14,d1
- move.l MiscMem,d0
- move.l #Mode_1,a1
- .l1:
- move.l d0,(a1)+ ;mode data pointers
- add.l #40,d0
- subq.b #1,d1
- bne .l1
-
- move.b #12,d1
- move.l #ColBitPlane_0,a1
- .l2:
- move.l d0,(a1)+ ;color palette memory pointers
- add.l #80,d0
- subq.b #1,d1
- bne .l2
-
- addq.l #1,d0
- move.l d0,ColorRam_1 ;pointer to 1st Palette data
- move.l d0,ColorRam
- subq.l #1,d0
- move.l d0,d1
- move.w d1,L1_d0l
- move.w d1,L5_d0l
- swap.w d1
- move.w d1,L1_d0h
- move.w d1,L5_d0h
- add.l #288,d0
- move.l d0,d1
- move.w d1,L1_d1l
- move.w d1,L5_d1l
- swap.w d1
- move.w d1,L1_d1h
- move.w d1,L5_d1h
- add.l #288,d0
- move.l d0,d1
- move.w d1,L1_d2l
- move.w d1,L5_d2l
- swap.w d1
- move.w d1,L1_d2h
- move.w d1,L5_d2h
- add.l #288,d0
- move.l d0,d1
- move.w d1,L1_d3l
- move.w d1,L5_d3l
- swap.w d1
- move.w d1,L1_d3h
- move.w d1,L5_d3h
- add.l #288,d0
- move.l d0,ColorRam_2
- addi.l #1,ColorRam_2 ;pointer to 2nd Palette data
- add.l #1056,d0
- move.l d0,DataRam_1
- move.l d0,DataRam
- add.l #1056,d0
- move.l d0,DataRam_2
- add.l #1056,d0
- move.l d0,Sprite_Mem
- move.w VStart,d0 ;different Vertical start position for
- move.b d0,L1_st0 ;control data in PAL or NTSC
- move.b d0,L1_st1 ;this is the lines where the Control and
- move.b d0,L1_st2 ;data for the CoPRO and palette lives
- move.b d0,L5_st0
- move.b d0,L5_st1
- move.b d0,L5_st2
- move.b d0,Sprite_0 ;data sync sprite start position
- addq.b #4,d0
- move.b d0,L1_st3
- move.b d0,L5_st3
- move.l #Sprite_0,a0
- move.b d0,2(a0) ;data sync sprite stop position
- clr.b Palette_VPOS
- clr.b Menu_VPOS
- clr.b Mode
- move.w #120,X_Offset ;Cursor X offset for Non-Overscan
- move.w ScreenModes,d0
- btst #2,d0
- beq .NormalOffset
- move.w #86,X_Offset ;Cursor X offset for overscan screen
- .NormalOffset:
- move.w ScreenStart,d0
- move.w d0,Y_Offset ;Y offset for cursor
- move.l #BitPlane_0,BitMaps
- move.w #00,Rel_X ;Zero relative X
- move.w #00,Rel_Y ;Zero relative Y
- move.b #0,DMA_Ratio ;Update Screen every 3 cycles for speed
- move.b #1,DMA_Enable ;Enable screen DMA
- move.w Actual_Height,d1
- clr d0
- moveq.l #0,d2
- move.b #1,Y_Div ;Dive Y counter by 2
- move.w Screen_Height,d2
- rol.l #1,d2 ;Multiply * 2 Y counter for no ILACE
- cmp.w #300,Screen_Height ;See if interlaced
- blt .NoInterlace
- move.b #0,Y_Div ;Dont dive Y counter
- ror.l #1,d2 ;leave Y count standard for ILACE
- ori.b #4,Mode ;add screen interlace bit
- move.w Modulo,d0 ;add modulo if interlaced
- lsr.w #1,d1 ;Multiply MaxY * 2 if ILaced
- .NoInterlace:
- move.w d2,Max_Mouse_Y ;Mouse Y maximum value
- move.w d0,L1_mod1 ;the display modulo
- move.w d0,L1_mod2 ;the display modulo
- ;Link in Data address ***** here
- move.w ScreenStart,d0
- move.b d0,L1_dwst ;display start vert. position
- add.w ScreenStart,d1 ;add start offset
- sub.w #$100,d1
- move.b d1,L1_dwsp ;Display stop position
- move.w Start_Fetch,L1_Disp_STRT ;display hor. fetch start
- move.w Stop_Fetch,L1_Disp_STOP ;display hor. fetch stop
- move.w Scroll,L1_scrl ;Scroll value
- move.b #$0,d0 ;Menu Cut - in position
- move.b d0,L1_skip2 ;No Display Menu
- move.b d0,L4_w1 ;No Display Menu
- move.b d0,L3_skip1 ;No Display Menu
- move.b d0,L5_skip1 ;No Display Menu
- addq.b #1,d0
- move.b d0,L4_w2 ;No Display Menu
- move.l _GfxBase,a0 ;Graphics base library
- move.w gb_DisplayFlags(a0),d0
- andi.b #$2,d0 ;See if genlock is installed
- or.b d0,Mode
- move.b Mode,L1_md1 ;Genlock, interlace enable
- move.b Mode,L4_md1 ;Genlock, interlace enable
- move.b Mode,L5_md1 ;Genlock, interlace enable
- move.b Mode,L1_md2 ; "
- move.b Mode,L4_md2 ; "
- move.b Mode,L5_md2 ; "
- move.b Mode,L1_md3 ; "
- move.b Mode,L5_md3 ; "
- move.b Mode,L1_md4 ; "
- move.l Menu_Cop,d1
- move.w d1,L1_cjaddr2L ;Menu copper Addr low bits
- swap.w d1
- move.w d1,L1_cjaddr2H ;Menu Copper list high addr
- swap.w d1
- move.w d1,L3_cjaddr2L ;Menu copper Addr low bits
- swap.w d1
- move.w d1,L3_cjaddr2H ;Menu Copper list high addr
- swap.w d1
- move.w d1,L5_cjaddr2L ;Menu copper Addr low bits
- swap.w d1
- move.w d1,L5_cjaddr2H ;Menu Copper list high addr
- SpriteSetup:
- move.b #8,d0
- move.l Sprite_Mem,d1 ;** Sprite memory
- move.l d1,a0
- move.w d1,L1_sp1l
- move.w d1,L5_sp1l
- swap.w d1
- move.w d1,L1_sp1h
- move.w d1,L5_sp1h
- move.l #Sprite_1,a1 ;mouse cursor sprite
- .loop:
- move.b (a1)+,(a0)+
- subq.b #1,d0
- bne .loop
- move.b #20,d0
- move.l a0,d1
- move.w d1,L1_sp0l
- move.w d1,L5_sp0l
- swap.w d1
- move.w d1,L1_sp0h
- move.w d1,L5_sp0h
- move.l #Sprite_0,a1 ;sync sprite for data load
- .loop2:
- move.b (a1)+,(a0)+
- subq.b #1,d0
- bne .loop2
- ;*** Setup the 12 copper lists required for screen
- CopperSetup:
- moveq.b #12,d2 ;12 copper passes
- moveq.b #6,d3 ;interlace co-ordinate
- move.l #Cop_1,a0 ;copper addresses
- move.l #BitPlane_0,a1 ;Video memory address
- move.l #Mode_1,a2 ;Mode line addresses
- move.l #Col_1,a3 ;Color Palette selector
- .loop:
- moveq.l #0,d4
- cmp.b #3,d3 ;reload color palette selector every 3 lists
- bne .n1
- move.l #Col_1,a3
- sub.l #48,a1 ;backwards 12 Bitplanes
- .n1:
- cmp.b #3,d3
- ble .nomodulo ;add modulo on every even 3 sets of lists
- move.w Modulo,d4
- .nomodulo:
- move.l (a1),d0
- add.l d4,d0 ;add modulo
- move.w d0,L1_v0l ;Write 1st & 5th bitplane
- swap d0 ;addresses
- move.w d0,L1_v0h
- move.l 4(a1),d0
- add.l d4,d0 ;add modulo
- move.w d0,L1_v1l ;Write 2nd & 6th bitplane
- swap d0 ;addresses
- move.w d0,L1_v1h
- move.l 8(a1),d0
- add.l d4,d0 ;add modulo
- move.w d0,L1_v2l ;Write 3rd & 7th bitplane
- swap d0 ;addresses
- move.w d0,L1_v2h
- move.l 12(a1),d0
- add.l d4,d0 ;add modulo
- move.w d0,L1_v3l ;Write 4th & 8th bitplane
- swap d0 ;addresses
- move.w d0,L1_v3h
- add.l #16,a1
- move.l (a2)+,d1 ;Base address of mode line
- move.w d1,L1_cll
- swap d1
- move.w d1,L1_clh
- move.l (a3)+,d1 ;link in the Color palette
- move.w d1,L1_cjaddr1L ;selector menu addresses
- swap d1
- move.w d1,L1_cjaddr1H
- ;*** Set up the COPPER LIST table
- LEA CopperList1,A4 ;Copper list structure
- move.l (a0)+,a5 ;chip copper list pointers
- .CLOOP1:
- MOVE.L (A4),(A5)+
- CMPI.L #$FFFFFFFE,(A4)+
- BNE .CLOOP1
- subq.b #1,d3
- bne .noreload
- moveq.b #6,d3
- move.l #Col_1,a3
- .noreload
- subq.b #1,d2
- bne .loop ;End of copper setup
-
- ; *** Menu Jump Copper list for setting up Intuition or other Menus, jumps to
- ; the Copper List Specified in "Menu_JumpAddr"
- CopperSetup2:
- move.l Menu_JumpAddr,d1 ;the Menu coppr jump addr
- move.w d1,L5_cll
- swap d1
- move.w d1,L5_clh
- ;*** Set up the COPPER LIST table
- LEA MenuList,A4 ;Copper list structure
- move.l Menu_Cop,a5 ;chip copper list pointers
- .CLOOP1:
- MOVE.L (A4),(A5)+
- CMPI.L #$FFFFFFFE,(A4)+
- BNE .CLOOP1
-
- ;*** Setup a 'Do nothing' copper list that is non destructive to
- ;picture in colorburst memory but turns off main display DMA for fast
- ;disk loads and operations into Amiga chip memory.
- CopperSetup3:
- moveq.b #2,d2 ;2 copper passes
- move.l #Cop_13,a0 ;copper addresses
- move.l #Mode_13,a2 ;Mode line addresses
- .loop:
- move.l (a2)+,d1 ;Base address of mode line
- move.w d1,L5_cll
- swap d1
- move.w d1,L5_clh
- ;*** Set up the COPPER LIST table
- LEA CopperList3,A4 ;Copper list structure
- move.l (a0)+,a5 ;chip copper list pointers
- .CLOOP1:
- MOVE.L (A4),(A5)+
- CMPI.L #$FFFFFFFE,(A4)+
- BNE .CLOOP1
- subq.b #1,d2
- bne .loop ;End of copper setup
-
- ;*** Setup the 3 copper lists required for the Color Palette Selector
- CopperSetup4:
- moveq.b #3,d2 ;3 copper passes
- move.l #Col_1,a0 ;copper addresses
- move.l #ColBitPlane_1,a1 ;Video memory address
- .loop:
- move.l (a1),d0
- move.w d0,L3_v0l ;Write 1st & 5th bitplane
- swap d0
- move.w d0,L3_v0h
- move.l 4(a1),d0
- move.w d0,L3_v1l ;Write 2nd & 6th bitplane
- swap d0
- move.w d0,L3_v1h
- move.l 8(a1),d0
- move.w d0,L3_v2l ;Write 3rd & 7th bitplane
- swap d0
- move.w d0,L3_v2h
- move.l 12(a1),d0
- move.w d0,L3_v3l ;Write 4th & 8th bitplane
- swap d0
- move.w d0,L3_v3h
- add.l #16,a1
- ;*** Set up the COPPER LIST table
- move.l #CPList,A4 ;Copper list structure
- move.l (a0)+,a5 ;chip copper list pointers
- .CLOOP1:
- MOVE.L (A4),(A5)+
- CMPI.L #$FFFFFFFE,(A4)+
- BNE .CLOOP1
- subq.b #1,d2
- bne .loop ;End of copper setup
-
- move.l #CopList_Cycle,a0 ;Setup the Copper lists into a
- move.l Cop_1,(a0)+ ;table that can easily be selected
- move.l Cop_2,(a0)+ ;by the vertical blank in the right
- move.l Cop_3,(a0)+ ;combination for Odd/even fields,
- move.l Cop_7,(a0)+ ;Lo/Hi res and screen modes
- move.l Cop_8,(a0)+
- move.l Cop_9,(a0)+
- move.l Cop_13,(a0)+
- move.l #0,(a0)+
- move.l Cop_6,(a0)+
- move.l Cop_4,(a0)+
- move.l Cop_5,(a0)+
- move.l Cop_12,(a0)+
- move.l Cop_10,(a0)+
- move.l Cop_11,(a0)+
- move.l Cop_14,(a0)+
- move.l #0,(a0)+
- clr.b Cycle_Count
-
- ;*** Setup the Control Line data for RAM write sequence
- ; The Control line lives on the first displayable line that the Amiga
- ; can output:- way up in the invisible overscan lines (lines $1a for
- ; PAL/SECAM and $15 for NTSC) this control line is a 1 bitplane lo-res
- ; display. The bits of data are shifted by a transition of foreground
- ; color to background color. The data latched is the color of the
- ; background color. The background color is toggled $0000,$0001,$0000
- ; $0001 .... .... .... by the Amiga copper. Here is a table of the
- ; functions of the control bits.
- ; **** Control Bit Name Function
- ;---------------------------------------------------------------------------
- ; Bit 15 Reserved Reserved for future expansion (Low)
- ; Bit 14 BWR2 Active high writes to Blue bank 2
- ; Bit 13 GWR2 Active high writes to Green bank 2
- ; Bit 12 RWR2 Active high writes to Red bank 2
- ; Bit 11 FIELD Odd or Even field display
- ; Bit 10 BWR2 Active high writes to Blue bank 1
- ; Bit 9 GWR2 Active high writes to Green bank 1
- ; Bit 8 RWR2 Active high writes to Red bank 1
- ; Bit 7 S0 Video Mode Control
- ; Bit 6 AUTO Auto display sync when high
- ; Bit 5 Col/Cop Update (0)Palette or (1)Coprocessor
- ; Bit 4 WREN Enable Write to Col/Cop when high
- ; Bit 3 VALID3 must be a 1 for a CBurst frame
- ; Bit 2 VALID2 must be a 0 for a CBurst frame
- ; Bit 1 VALID1 must be a 1 for a CBurst frame
- ; Bit 0 VALID0 must be a 0 for a CBurst frame
-
- move.l #Control_Data_List,a1
- move.l #Mode_1,a2
- move.b #14,d7
- .lp:
- move.w (a1)+,d0
- move.l (a2)+,a0
- bsr SetControl ;Set the appropriate bits in the control line
- subq.b #1,d7
- bne .lp
-
- ;*** Load the color palette registers with a grey scale
- move.l #$ff,d0
- .lp1
- move.b d0,d7
- not.b d7
- move.b d7,d1 ;Red value
- move.b d7,d2 ;Green value
- move.b d7,d3 ;Blue value
- bsr SetRGB ;Set the Palette
- subi.w #1,d0
- bne .lp1
- move.l #$00,d0 ;palette Register 0
- move.l #$00,d1 ;Red ;color register 0 black
- move.l #$00,d2 ;Green
- move.l #$00,d3 ;Blue
- bsr SetRGB ;Set the Palette
-
- ;*** Now Write to the Video Control Registers ***
- move.b #$00,ColAddress ;Color Address register start
- move.b #$ff,PixelMask ;Pixel Read Mask
- move.b #%00010101,ControlReg ;Control Data Register
- bsr SetData
-
- ;*** Setup the Video CoPRO
- ; The Video CoProcessor inside colorburst reads a 1 byte instruction
- ; per scan line. You can change the status of any of these bits for
- ; any scan line. If an address load is specified for that line,
- ; (active low BIT 7) the Video Address counters inside ColorBurst
- ; will be loaded with the address in "Load_Address".
- ; Bit # Name Function
- ;-------------------------------------------------------------------------
- ; Bit 7 AddressLoad* loads the Video Address counters when low
- ; Bit 6 S1 Video mode control
- ; Bit 5 LO/HI Low = Low resolution; High = Hi-res
- ; Bit 4 PM Priority Mode, 1 = use stencil for priority
- ; Bit 3 PR Video Priority, 0 = Amiga, 1 = ColorBurst
- ; Bit 2 DD Dual display, 0 = active, 1 = single display
- ; Bit 1 DCBD Use stencil for Dual ColorBurst Display (1)
- ; Bit 0 BNK Bank to display 0 = Bank 1; 1 = Bank 2
-
- move.w #290,d0 ;290 lines of Coprocessor setup
- .lp9:
- move.b #%10001100,d1 ;the coprocessor data
- move.b Lo_Hi,d2 ;See if low or High resolution & add bit
- andi.b #%00100000,d2 ;
- or.b d2,d1 ;Add Hi-Res enable if Hi-Res
- move.b d1,CoPRO_Reg ;keep copy of Coprocessor register
- movem.w d0,-(sp)
- bsr SetCoPro ;Set the Coprocessor data
- movem.w (sp)+,d0
- dbf d0,.lp9
- move.l #$0,Load_Address ;The Video load address
- bsr SetLoadAddress
-
- StartScreen:
- move.l #dosname,a1 ;Open the DOS library
- moveq #0,d0 ;any version
- CALLEXEC OpenLibrary
- tst.l d0
- beq EXIT_A ;quit if cant
- move.l d0,_DOSBase ;save pointer
- move.l _GfxBase,a0
- move.l 50(A0),ShCopList ;Save System copper list
- move.l _GfxBase,a0 ;Make my copper list active
- move.l Cop_1,50(a0)
- move.l #2,d1 ;Wait for my list to become active
- CALLDOS Delay
- move.b #1,d0
- bsr Select_Col_CoPro ;Enable CoPRO Update
- move.l DataRam_1,a0 ;the CoPRO list 1 memory
- bsr Chng_DataLine ;and link into copper list
- moveq #5,d0
- lea intstruct(pc),a1
- CALLEXEC AddIntServer ;Add vertical blank interrupt
- rts
-
- Test1:
- ;move.w #64,Rel_X
- ;move.w #100,Rel_Y
- move.l #290,d1
- .lpy:
- move.l #736,d0
- .lpx:
- move.b d0,Red_Value
- move.b d1,Blue_Value
- move.b d0,d2
- add.l d1,d2
- cmp.l #255,d2
- ble .noinvert
- eor.b #$ff,d2
- .noinvert:
- ;ror.l #1,d2
- move.b d2,Green_Value
- ;add.l #370,d0
- bsr WritePixel
- subq.w #1,d0
- bne .lpx
- subq.w #1,d1
- cmp.w #0,d1
- bge .lpy
-
- rts
-
- CloseScreen:
- moveq #5,d0
- lea intstruct(pc),a1
- CALLEXEC RemIntServer ;remove vertical blank interrupt
- EXIT_A:
- move.l _GfxBase,a0
- move.l ShCopList,d0
- tst.l d0
- beq .p0
- move.l ShCopList,50(a0) ;give back system Copper List
- move.l #2,d1
- CALLDOS Delay ;wait until system copper list active
- .p0:
- move.l _GfxBase,a1 ;close the Graphics library
- cmp.l #0,a1
- beq .p1
- CALLEXEC CloseLibrary
- .p1:
- move.l _DOSBase,a1
- cmp.l #0,a1
- beq .p2
- CALLEXEC CloseLibrary ;Close DOS library
- .p2:
- bsr Free_Copper_Mem ;Free copper list memory
- bsr Deallocate_BitMaps ;Give back bitplane memory
- rts
-
- vsub: ;vertical blank subroutine.
- movem.l d0-d2/a0-a1,-(sp)
- bsr Calc_Cursor
- move.l _GfxBase,a1
- move.l #CopList_Cycle,a0 ;table of copper list pointers
- moveq.l #0,d0
- move.b Cycle_Count,d0 ;current cycle count
- move.b MaxNum_Cycles,d2 ;see if > then maximum count
- cmp.b Cycle_Count,d2
- bgt .noclear
- clr.l d0
- clr.b Cycle_Count
- add.b #1,Ratio_Count ;The DMA ratio counter
- move.b Ratio_Count,d1
- cmp.b DMA_Ratio,d1 ;Ratio of DMA update time
- bgt .ClearRatio
- clr.b No_Dma
- bra .noclear
- .ClearRatio:
- move.b DMA_Enable,No_Dma ;Enable the DMA at all?
- clr.b Ratio_Count
- .noclear:
- btst.b #0,No_Dma
- bne .DoDMA
- move.l #24,d0 ;Make NO_DMA copper list active
- .DoDMA:
- add.l d0,a0
- btst.b #2,Mode ;see if Non interlaced display
- beq evenphase ;jump to even lines if no interlace
- move.w $dff004,d1
- btst.l #15,d1 ;See if on Odd or Even field
- bne oddphase
- evenphase:
- add.b #4,Cycle_Count ;Next cycle entry
- move.l 32(a0),50(a1) ;update Even field of display
- movem.l (sp)+,d0-d2/a0-a1
- moveq.l #0,d0
- rts
- oddphase:
- move.l (a0),50(a1) ;Update odd field of display
- movem.l (sp)+,d0-d2/a0-a1
- moveq.l #0,d0
- rts
-
- Calc_Cursor: ;Calculate current mouse coordinates
- clr.l d0
- clr.l d1
-
- move.b Old_XCount,d0
- move.b $dff00b,d1
- move.b d1,Old_XCount ;save new mouse position
- cmp.b d0,d1
- bgt .XGreater
- .XLess:
- sub.b d0,d1 ;subtract new from old
- tst.b d1
- bmi .s1
- add.w d1,Raw_Mouse_X
- bra .endcalcmouse
- .s1:
- neg.b d1
- sub.w d1,Raw_Mouse_X
- bra .endcalcmouse
- .XGreater:
- sub.b d0,d1
- tst.b d1
- bmi .s2
- add.w d1,Raw_Mouse_X
- bra .endcalcmouse
- .s2:
- neg.b d1
- sub.w d1,Raw_Mouse_X
- bra .endcalcmouse
- .endcalcmouse:
- move.b Old_YCount,d0
- move.b $dff00a,d1
- move.b d1,Old_YCount ;save new mouse position
- cmp.b d0,d1
- bgt .YGreater
- .YLess:
- sub.b d0,d1 ;subtract new from old
- tst.b d1
- bmi .s3
- add.w d1,Raw_Mouse_Y
- bra .endcalcmouse2
- .s3:
- neg.b d1
- sub.w d1,Raw_Mouse_Y
- bra .endcalcmouse2
- .YGreater:
- sub.b d0,d1
- tst.b d1
- bmi .s4
- add.w d1,Raw_Mouse_Y
- bra .endcalcmouse2
- .s4:
- neg.b d1
- sub.w d1,Raw_Mouse_Y
- bra .endcalcmouse2
- .endcalcmouse2:
- move.w Raw_Mouse_X,d0
- tst.w d0
- bpl .NoXZero
- clr.w Raw_Mouse_X
- .NoXZero:
- move.w Max_Mouse_X,d0
- cmp.w Raw_Mouse_X,d0
- bge .NoClipX
- move.w Max_Mouse_X,Raw_Mouse_X
- .NoClipX:
- move.w Raw_Mouse_Y,d0
- tst.w d0
- bpl .NoYZero
- clr.w Raw_Mouse_Y
- .NoYZero:
- move.w Max_Mouse_Y,d0
- cmp.w Raw_Mouse_Y,d0
- bge .NoClipY
- move.w Max_Mouse_Y,Raw_Mouse_Y
- .NoClipY:
- move.w Raw_Mouse_X,d0
- move.b X_Div,d1
- ror.l d1,d0
- move.w d0,Mouse_X
- move.w Raw_Mouse_Y,d0
- move.b Y_Div,d1
- ror.l d1,d0
- move.w d0,Mouse_Y
- bsr MoveMouse
- rts
-
- MoveMouse: ;Move the cursor to X, Y
- move.l Sprite_Mem,a0
- move.w Raw_Mouse_X,d0 ;Raw mouse position
- move.w Raw_Mouse_Y,d1
- ror.w #1,d1
- ror.w #1,d0
- add.w X_Offset,d0 ;cursor offsets
- add.w Y_Offset,d1
- ror.w #1,d0
- move.b d0,1(a0) ;cursor x 8 msb
- rol.w #1,d0
- andi.w #1,d0 ;isolate X lsb
- move.b d1,(a0) ;cursor y 8 lsb
- btst #8,d1
- beq .next1
- ori.w #$04,d0
- .next1:
- addi.w #1,d1
- move.b d1,2(a0) ;cursor stop 8 lsb
- btst #8,d1
- beq .next2
- ori.w #$02,d0
- .next2:
- move.b d0,3(a0)
- rts
-
-
-
-
- ReadPixel: ;Reads pixel at the current X,Y Position and returns the
- ; value in Red_Value, Green_Value, and Blue_Value. ReadPixel automatic-
- ; ally clips if you go outside screen boundarys. D0 holds X, D1 holds Y
- movem d0-d1,-(sp) ;Save X,Y values
- add.w Rel_X,d0 ;add X relative value
- add.w Rel_Y,d1 ;add Y relative value
- tst.b Lo_Hi
- beq .LoRes ;see if low or hi-res
- btst.l #0,d0 ;check if odd or even pixel
- bne .OddBank
- .EvenBank:
- move.l #BitPlane_0,BitMaps
- lsr.w #1,d0
- bra .LoRes
- .OddBank:
- move.l #BitPlane_12,BitMaps
- lsr.w #1,d0
- .LoRes:
- cmp.w Int_XWidth,d0 ;Clip the X value
- bcc .WClip
- cmp.w Actual_Height,d1 ;Clip the Y value
- bcc .WClip ;exit if out of range
- move.w d0,d3
- andi.w #$01fc,d0
- ror.w #2,d0
- andi.w #3,d3 ;find nibble to work on
- rol.w #1,d3
- eor.b #$06,d3 ;negate byte bits
- mulu Modulo,d1 ;multiply vertical
- add.w d0,d1 ;add X + Y byte offsets
- ;*** Operate on bitplanes and mask Red pixel data
- move.w #0,d2
- move.l BitMaps,a4
- move.l (a4)+,a5 ;Address of Bit plane 4&0
- add.l d1,a5
- move.b (a5),d5 ;get video byte to read
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z1
- addq.b #$1,d2
- .z1
- btst #1,d5
- beq .z2
- ori.b #$10,d2
- .z2
- move.l (a4)+,a5 ;address of bitplane 5&1
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z3
- addq.b #$2,d2
- .z3
- btst #1,d5
- beq .z4
- ori.b #$20,d2
- .z4
- move.l (a4)+,a5 ;address of bitplane 6&2
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z5
- addq.b #$4,d2
- .z5
- btst #1,d5
- beq .z6
- ori.b #$40,d2
- .z6
- move.l (a4)+,a5 ;address of bitplane 7&3
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z7
- addq.b #$8,d2
- .z7
- btst #1,d5
- beq .z8
- ori.b #$80,d2
- .z8
- move.b d2,Red_Value
- ;*** Operate on bitplanes and mask Green pixel data
- move.w #0,d2
- move.l (a4)+,a5 ;address of bitplane 12&8
- add.l d1,a5
- move.b (a5),d5 ;get video byte to read
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z9
- addq.b #$1,d2
- .z9
- btst #1,d5
- beq .z10
- ori.b #$10,d2
- .z10
- move.l (a4)+,a5 ;address of bitplane 13&9
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z11
- addq.b #$2,d2
- .z11
- btst #1,d5
- beq .z12
- ori.b #$20,d2
- .z12
- move.l (a4)+,a5 ;address of bitplane 14&10
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z13
- addq.b #$4,d2
- .z13
- btst #1,d5
- beq .z14
- ori.b #$40,d2
- .z14
- move.l (a4)+,a5 ;address of bitplane 15&11
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z15
- addq.b #$8,d2
- .z15
- btst #1,d5
- beq .z16
- ori.b #$80,d2
- .z16
- move.b d2,Green_Value
- ;*** Operate on bitplanes and mask Blue pixel data
- move.w #0,d2
- move.l (a4)+,a5 ;address of bitplane 20&16
- add.l d1,a5
- move.b (a5),d5 ;get video byte to read
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z17
- addq.b #$1,d2
- .z17
- btst #1,d5
- beq .z18
- ori.b #$10,d2
- .z18
- move.l (a4)+,a5 ;address of bitplane 21&17
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z19
- addq.b #$2,d2
- .z19
- btst #1,d5
- beq .z20
- ori.b #$20,d2
- .z20
- move.l (a4)+,a5 ;address of bitplane 22&18
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z21
- addq.b #$4,d2
- .z21
- btst #1,d5
- beq .z22
- ori.b #$40,d2
- .z22
- move.l (a4)+,a5 ;address of bitplane 23&19
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- ror.b d3,d5 ;rotate pixel chunk in byte
- btst #0,d5
- beq .z23
- addq.b #$8,d2
- .z23
- btst #1,d5
- beq .z24
- ori.b #$80,d2
- .z24
- move.b d2,Blue_Value
- .WClip: ;Clipped because Outside screen range
- movem (sp)+,d0-d1 ;return x,y position
- rts ;RETURN
-
- WritePixel:
- ;*** D0 holds X, D1 holds Y, Automatically clips if outside screen
- ; Boundarys, Relative X & Y offsets are added to the Current X & Y
- ; values.
- movem d0-d1,-(sp)
- add.w Rel_X,d0 ;add X relative value
- add.w Rel_Y,d1 ;add Y relative value
- tst.b Lo_Hi
- beq .LoRes ;see if low or hi-res
- btst.l #0,d0 ;check if odd or even pixel
- bne .OddBank
- .EvenBank:
- move.l #BitPlane_0,BitMaps
- lsr.w #1,d0
- bra .LoRes
- .OddBank:
- move.l #BitPlane_12,BitMaps
- lsr.w #1,d0
- .LoRes:
- cmp.w Int_XWidth,d0 ;Clip the X value
- bcc .WClip
- cmp.w Actual_Height,d1 ;Clip the Y value
- bcc .WClip
- move.w d0,d3
- andi.w #$01fc,d0
- ror.w #2,d0
- andi.w #3,d3 ;find nibble to work on
- rol.w #1,d3
- eor.b #$06,d3 ;negate byte bits
- mulu Modulo,d1 ;multiply vertical
- add.w d0,d1 ;add X + Y byte offsets
- move.b #$fc,d6
- rol.b d3,d6 ;pixel byte write mask
- ;*** Operate on bitplanes and mask in pixel data for RED 8 bits
- move.b Red_Value,d2
- clr d4
- btst #4,d2 ;test color bit 4
- beq .z1
- ori.b #$02,d4
- .z1
- btst #0,d2 ;test color bit 0
- beq .z2
- ori.b #$01,d4
- .z2
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.l BitMaps,a4 ;Address of Bit plane 0
- move.l (a4)+,a5
- add.l d1,a5
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #5,d2 ;test color bit 5
- beq .z3
- ori.b #$02,d4
- .z3
- btst #1,d2 ;test color bit 1
- beq .z4
- ori.b #$01,d4
- .z4
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #6,d2 ;test color bit 6
- beq .z5
- ori.b #$02,d4
- .z5
- btst #2,d2 ;test color bit 2
- beq .z6
- ori.b #$01,d4
- .z6
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #7,d2 ;test color bit 7
- beq .z7
- ori.b #$02,d4
- .z7
- btst #3,d2 ;test color bit 3
- beq .z8
- ori.b #$01,d4
- .z8
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- ;*** Operate on bitplanes and mask in pixel data for GREEN 8 bits
- move.b Green_Value,d2
- clr d4
- btst #4,d2 ;test color bit 4
- beq .z9
- ori.b #$02,d4
- .z9
- btst #0,d2 ;test color bit 0
- beq .z10
- ori.b #$01,d4
- .z10
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #5,d2 ;test color bit 5
- beq .z11
- ori.b #$02,d4
- .z11
- btst #1,d2 ;test color bit 1
- beq .z12
- ori.b #$01,d4
- .z12
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #6,d2 ;test color bit 6
- beq .z13
- ori.b #$02,d4
- .z13
- btst #2,d2 ;test color bit 2
- beq .z14
- ori.b #$01,d4
- .z14
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #7,d2 ;test color bit 7
- beq .z15
- ori.b #$02,d4
- .z15
- btst #3,d2 ;test color bit 3
- beq .z16
- ori.b #$01,d4
- .z16
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- ;*** Operate on bitplanes and mask in pixel data for BLUE 8 bits
- move.b Blue_Value,d2
- clr d4
- btst #4,d2 ;test color bit 4
- beq .z17
- ori.b #$02,d4
- .z17
- btst #0,d2 ;test color bit 0
- beq .z18
- ori.b #$01,d4
- .z18
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #5,d2 ;test color bit 5
- beq .z19
- ori.b #$02,d4
- .z19
- btst #1,d2 ;test color bit 1
- beq .z20
- ori.b #$01,d4
- .z20
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #6,d2 ;test color bit 6
- beq .z21
- ori.b #$02,d4
- .z21
- btst #2,d2 ;test color bit 2
- beq .z22
- ori.b #$01,d4
- .z22
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- move.l (a4)+,a5
- add.l d1,a5
- clr d4
- btst #7,d2 ;test color bit 7
- beq .z23
- ori.b #$02,d4
- .z23
- btst #3,d2 ;test color bit 3
- beq .z24
- ori.b #$01,d4
- .z24
- rol.b d3,d4 ;rotate pixel chunk in byte
- move.b (a5),d5 ;get video byte to modify
- and.b d6,d5 ;mask out any set bits
- or.b d4,d5
- move.b d5,(a5) ;rewrite data byte with pixel
- .WClip:
- movem (sp)+,d0-d1 ;return x,y position
- rts ;RETURN
-
-
- mousewait: ;Routine waits until mouse button is pressed and then returns
- ;move.b Count,ColAddress ;Color Address register start
- ;bsr SetData
- clr.l d0
-
- btst.b #6,$bfe001
- bne mousewait
- move.w Mouse_X,d0
- move.w Mouse_Y,d1
- cmp.w OldX,d0
- beq .stage2
- bra .DoDraw
- .stage2:
- cmp.w OldY,d1
- beq mousewait
- .DoDraw:
- move.b d0,Red_Value
- move.b #80,Green_Value
- move.b d1,Blue_Value
-
- moveq.w #2,d2
- .lp1:
- moveq.w #2,d3
- .lp2:
- move.w Mouse_X,d0
- add.w d3,d0
- move.w Mouse_Y,d1
- add.w d2,d1
- movem.w d2-d3,-(sp)
- bsr WritePixel
- bsr Calc_Cursor
- movem.w (sp)+,d2-d3
- dbf.w d3,.lp2
- dbf.w d2,.lp1
- cmp.w #0,Mouse_X
- bne mousewait
- cmp.w #0,Mouse_Y
- bne mousewait
-
- move.b $bfe001,d0 ;wait until
- andi.b #$40,d0 ;the left mouse button is
- bne mousewait ;pressed.
- .zerobut:
- move.w #$fff,d0 ;debounce button.
- .z1:
- subi.w #1,d0
- bne .z1
- move.b $bfe001,d0 ;now wait until the button
- andi.b #$40,d0 ;is let off
- beq .zerobut
- rts
-
- SetControl: ;*** writes the Control data to the Control Line. Put the
- ; Address of the Control line in A0 and the data to write to that in D0
- move.b #16,d1
- .loop:
- btst #15,d0
- beq .lowbit
- .highbit:
- move.w #$8000,(a0)+ ;Bitplane data for a high bit
- bra .nextbit
- .lowbit:
- move.w #$0004,(a0)+ ;Bitplane data for a low bit
- .nextbit:
- rol.l #1,d0
- subq.b #1,d1
- bne .loop
- rts
-
- SetRGB:
- ;*** D0 hold register to Modify; D1 - Redbyte, D2 - GreenByte, D3 - Bluebyte
- move.l ColorRam,a0 ;ColorRAM Bitplane 0
- not.b d0
- add.l d0,a0
- not.b d0
- move.b #4,d5 ;Rotate nibbles 4 times
- .Red:
- clr d4
- ori.b #$c0,d4 ;add sync bits
- btst #4,d1
- beq .n1
- ori.b #$20,d4
- .n1:
- btst #0,d1
- beq .Green
- ori.b #$10,d4
- .Green:
- btst #4,d2
- beq .n2
- ori.b #$08,d4
- .n2:
- btst #0,d2
- beq .Blue
- ori.b #$04,d4
- .Blue:
- btst #4,d3
- beq .n3
- ori.b #$02,d4
- .n3:
- btst #0,d3
- beq .rotate
- ori.b #1,d4
- .rotate:
- move.b d4,(a0)
- add.l #288,a0
- ror.b #1,d1
- ror.b #1,d2
- ror.b #1,d3
- subi.b #1,d5
- bne .Red
- rts
-
- SetData: ;Sets CoPRO video control instructions
- move.l ColorRam,a0 ;DataRAM Bitplane 0
- subq.l #1,a0
- move.b #4,d5 ;Rotate nibbles 4 times
- move.b ColAddress,d1 ;Color Address register
- move.b PixelMask,d2 ;Pixel Mask Bits
- move.b ControlReg,d3 ;Control Register data
- .sd1:
- clr d4
- ori.b #$c0,d4
- btst #4,d1
- beq .n1
- ori.b #$20,d4
- .n1:
- btst #0,d1
- beq .sd2
- ori.b #$10,d4
- .sd2:
- btst #4,d2
- beq .n2
- ori.b #$08,d4
- .n2:
- btst #0,d2
- beq .sd3
- ori.b #$04,d4
- .sd3:
- btst #4,d3
- beq .n3
- ori.b #$02,d4
- .n3:
- btst #0,d3
- beq .sdRotate
- ori.b #1,d4
- .sdRotate: ;rotate bits and go again
- move.b d4,(a0)
- add.l #288,a0
- ror.b #1,d1
- ror.b #1,d2
- ror.b #1,d3
- subi.b #1,d5
- bne .sd1
- rts
-
- SetCoPro: ;* set the ColorBurst's Coprocessor data list. Put scan line
- ;Number to modify in D0 (0 - 512), the Data in D1 to write,
- ;DataRam Holds the address of the Data memory.
- move.l DataRam,a0 ;DataRAM Bitplane 0
- andi.l #$1ff,d0
- move.l d0,d2
- divu #3,d0 ;Isolate byte group
- andi.l #$ff,d0
- move.l d0,d3
- mulu.w #3,d3
- sub.w d3,d2 ;which nibble to work on?
- add.l d0,a0 ;memory
- moveq.b #4,d5 ;Rotate nibbles 4 times
- move.b #$cf,d3
- moveq.b #$20,d6
- moveq.b #$10,d7
- lsl.b #1,d2
- lsr.b d2,d6 ;work on the nibbles MSB
- lsr.b d2,d7 ;work on the nibbles LSB
- ror.b d2,d3 ;the mask
- .lp1:
- move.b (a0),d4
- ori.b #$c0,d4
- and.b d3,d4
- btst #4,d1
- beq .n1
- or.b d6,d4
- .n1:
- btst #0,d1
- beq .rotate
- or.b d7,d4
- .rotate:
- move.b d4,(a0)
- add.l #288,a0
- ror.b #1,d1
- subq.b #1,d5
- bne .lp1
- rts
-
- SetLoadAddress: ;Sets the Video load address
- move.l ColorRam,-(sp)
- move.l DataRam,ColorRam ;swap pointers
- moveq.l #0,d0
- move.l Load_Address,d4
- move.b d4,d3
- ror.l #8,d4
- move.b d4,d2
- ror.l #8,d4
- move.b d4,d1
- bsr SetRGB ;Use the palette function to set data
- move.l (sp)+,ColorRam ;restore palette pointer
- rts
-
- Chng_DataLine: ;Changes the address of the currently displayed 'Data list'
- ; this is the list of Data for Color Palette load or CoPRO data.
- ; use 'Chng_Dataline' for double buffered updates to the CoPRO or
- ; for Updating the Palette Glitch Free
- move.b #12,d2 ;Update all copper lists
- move.l #Cop_1,a2
- .lp1:
- move.l a0,d3
- move.l #L1_d0h-CopperList1,d1 ;Find Bitplane pointers
- move.l (a2)+,a1
- swap.w d3
- move.w d3,(a1,d1) ;link low address into copper list
- swap.w d3
- move.w d3,4(a1,d1) ;link high address into copper list
- addi.l #288,d3 ;Next bitplanes of Data
- swap.w d3
- move.w d3,8(a1,d1) ;link low address into copper list
- swap.w d3
- move.w d3,12(a1,d1) ;link high address into copper list
- addi.l #288,d3 ;Next bitplanes of Data
- swap.w d3
- move.w d3,16(a1,d1) ;link low address into copper list
- swap.w d3
- move.w d3,20(a1,d1) ;link high address into copper list
- addi.l #288,d3 ;Next bitplanes of Data
- swap.w d3
- move.w d3,24(a1,d1) ;link low address into copper list
- swap.w d3
- move.w d3,28(a1,d1) ;link high address into copper list
- subq.b #1,d2
- bne .lp1
- Chng_NoWrt_DataLine:
- move.b #2,d2 ;update the 2 No DMA copper lists
- move.l #Cop_13,a2
- .lp1:
- move.l a0,d3
- move.l #L5_d0h-CopperList3,d1
- move.l (a2)+,a1
- swap.w d3
- move.w d3,(a1,d1)
- swap.w d3
- move.w d3,4(a1,d1)
- addi.l #288,d3
- swap.w d3
- move.w d3,8(a1,d1)
- swap.w d3
- move.w d3,12(a1,d1)
- addi.l #288,d3
- swap.w d3
- move.w d3,16(a1,d1)
- swap.w d3
- move.w d3,20(a1,d1)
- addi.l #288,d3
- swap.w d3
- move.w d3,24(a1,d1)
- swap.w d3
- move.w d3,28(a1,d1)
- subq.b #1,d2
- bne .lp1
- rts
-
- Select_Col_CoPro: ;Selects whether to update the CoPRO or Color Palette
- move.w #13,d5 ;affect all 14 control lines
- move.l #Mode_1,a1
- .lp1:
- move.l (a1)+,a0
- moveq.b #5,d1
- bsr SetControlBit ;Set or clear the appropriate bit
- dbf d5,.lp1
- rts
-
- SetControlBit: ;D1 holds bit to modify, D2 Holds state of the bit (eg 1 or
- ;0), A0 holds Control Line Address
- move.b #$f,d3
- sub.b d1,d3
- lsl.b #1,d3
- andi.l #$1f,d3
- btst #0,d0
- beq .lowbit
- .highbit:
- move.w #$8000,(a0,d3)
- bra .nextbit
- .lowbit:
- move.w #$0004,(a0,d3)
- .nextbit:
- rts
-
- Set_Menu_Position: ;Sets where the Menu will start, D0 hold V position
- move.b #12,d2 ;Do it for main display copper lists
- move.l #Cop_1,a2
- .lp1:
- move.l #L1_skip2-CopperList1,d1
- move.l (a2)+,a1
- move.b d0,(a1,d1)
- subq.b #1,d2
- bne .lp1
- move.b #2,d2 ;Now for No DMA copper lists
- move.l #Cop_13,a2
- .lp2:
- move.l #L5_skip1-CopperList3,d1
- move.l (a2)+,a1
- move.b d0,(a1,d1)
- subq.b #1,d2
- bne .lp2
- move.b #3,d2 ;Now for Color palette selector copper lists
- move.l #Col_1,a2
- .lp3:
- move.l a0,d3
- move.l #L3_skip1-CPList,d1
- move.l (a2)+,a1
- move.b d0,(a1,d1)
- subq.b #1,d2
- bne .lp3
- move.l Menu_Cop,a2
- move.l #L4_w1-MenuList,d1
- add.l d1,a2
- move.b d0,(a2)
- move.l Menu_Cop,a2
- move.l #L4_w2-MenuList,d1
- add.l d1,a2
- addq.b #1,d0
- move.b d0,(a2)
- move.l d0,-(sp)
- move.b #1,d0
- bsr Select_Col_CoPro ;Enable Coprocessor Update
- move.l DataRam_1,a0 ;the Coprocessor list 1 memory
- bsr Chng_DataLine ;and link into copper list
- move.l (sp)+,d0
- andi.w #$ff,d0
- cmp.w VStart,d0
- bgt .NoEditVStart ;remove menu if value = 0
- move.w #500,d0
- .NoEditVStart:
- move.w #290,d2 ;modify 290 CoPRO lines
- move.l d0,d3
- moveq.l #0,d0
- move.w VStart,d1
- sub.w d1,d3
- sub.w #4,d3 ;extra 4 lines include data lines
- .lp4:
- move.b CoPRO_Reg,d1
- cmp.w d3,d0
- blt .NoMenu
- andi.b #%01100011,d1 ;Mask out unwanted CoPRO bits
- ori.b #%10000100,d1 ;Amiga Only display for Menu
- .NoMenu:
- movem.l d0-d3,-(sp)
- bsr SetCoPro
- movem.l (sp)+,d0-d3
- addi.w #1,d0
- subq.w #1,d2
- bne .lp4
- rts
-
- Set_DMA_Ratio: ;Set the screen update rate for faster screen access
- ;d0 holds update rate (byte) 0=fastest, 255 = No update
- ;a rate of about 2 or 3 is the best tradeoff and no real
- ;speed increase is gained with slower rates.
- move.b d0,DMA_Ratio
- cmp.b #$ff,d0
- bne .EnableDMA ;Disable screen DMA if d0 = 255
- clr.b DMA_Enable
- rts
- .EnableDMA:
- move.b #1,DMA_Enable ;Enable the screen update DMA
- rts
-
- Load_Menu_Palette: ;Setup menu Amiga colors (all 32 of them) d0 holds
- ;address of table of menu colors and loads them into
- ;the menu copper list
- move.l Menu_Cop,a2
- move.l #Menu_Col0-MenuList,d1
- move.l d0,a0 ;address of menu color table
- move.w (a0)+,d2
- ori.w #1,d2 ;make sure bit 0 of blue is set for screen sync
- move.w d2,(a2,d1) ;Write color 0
- addq.l #4,d1
- move.b #31,d2 ;number of color registers to load
- .lp1:
- move.w (a0)+,(a2,d1)
- addq.l #4,d1
- subq.b #1,d2
- bne .lp1
- rts
-
- Update_Palette_CoPRO:
- btst #0,d0
- beq .Update_Palette
- .Update_CoPRO:
- move.b #1,d0
- bsr Select_Col_CoPro
- move.l DataRam,a0
- bsr Chng_DataLine
- rts
- .Update_Palette:
- move.b #0,d0
- bsr Select_Col_CoPro
- move.l ColorRam,a0
- bsr Chng_DataLine
- rts
-
- Set_Menu_Address: ;link in bitplanes into menu copper list
- move.l Menu_Cop,a1
- move.l #L4_v0h-MenuList,d1
- add.l d1,a1
- move.l (a0)+,d1 ;Menu Bitplanes into C-List
- swap.w d1
- move.w d1,(a1)
- swap.w d1
- move.w d1,4(a1)
- move.l (a0)+,d1 ;Bitplane 1 of a 5 bitplane
- swap.w d1 ;the Paint program Menu
- move.w d1,8(a1) ;Lo-res screen used for
- swap.w d1 ;the Paint program Menu
- move.w d1,12(a1)
- move.l (a0)+,d1
- swap.w d1 ;the Paint program Menu
- move.w d1,16(a1)
- swap.w d1
- move.w d1,20(a1)
- move.l (a0)+,d1
- swap.w d1 ;the Paint program Menu
- move.w d1,24(a1)
- swap.w d1
- move.w d1,28(a1)
- move.l (a0)+,d1
- swap.w d1 ;the Paint program Menu
- move.w d1,32(a1)
- swap.w d1
- move.w d1,36(a1)
- rts
-
-
- ;*** This is the Copper List structure
- CopperList1: ;THE control line copper list
- dc.w bpl1mod
- dc.w 0
- dc.w bpl2mod
- dc.w 0
- ;Scroll right 8 pixels for
- dc.w bplcon1,$0044 ;Data RAM data alignment
- dc.w bplcon0
- dc.b $10
- L1_md1: dc.b $04
- dc.w ddfstrt,$0038
- dc.w ddfstop,$00d0
- dc.w diwstrt
- L1_st0: dc.b $1a,$11 ;control data start pos.
- dc.w diwstop,$1ed8
-
- dc.w $0120 ;Data RAM data align sprite
- L1_sp0h dc.w $0000 ;sprite 0 high pointer
- dc.w $0122
- L1_sp0l dc.w $0000 ;sprite 0 low pointer
- dc.w $0124
- L1_sp1h dc.w $0000 ;sprite 1 high pointer
- dc.w $0126 ;Mouse Cursor
- L1_sp1l dc.w $0000 ;sprite 1 low pointer
-
- dc.w color+38,$0f67 ;color load for sync sprite
- dc.w color+32,$0fff
- dc.w color+34,$0fff ;and mouse cursor
- dc.w color+36,$0ffe
-
- dc.w color+30,$0fff ;Set up color registers to
- dc.w color+28,$0ffe ;Give correct 4 bit output
- dc.w color+26,$0ff7 ;from digital output on the
- dc.w color+24,$0ff6 ;video port
- dc.w color+22,$0f6f
- dc.w color+20,$0f6e
- dc.w color+18,$0f67
- dc.w color+16,$0f00
- dc.w color+14,$00ff
- dc.w color+12,$00fe
- dc.w color+10,$00f7
- dc.w color+8,$00f6
- dc.w color+6,$006f
- dc.w color+4,$006e
- dc.w color+2,$0000
-
- dc.w $00E0
- L1_clh: dc.w $0007 ;load bit plane 0 high word
- dc.w $00E2
- L1_cll: dc.w $0000 ;load bit plane 0 low byte
- dc.w $0128,$0000 ;Kill all other sprites
- dc.w $012a,$0000
- dc.w $012c,$0000
- dc.w $012e,$0000
- dc.w $0130,$0000
- dc.w $0132,$0000
- dc.w $0134,$0000
- dc.w $0136,$0000
- dc.w $0138,$0000
- dc.w $013a,$0000
- dc.w $013c,$0000
- dc.w $013e,$0000
-
- ;Data is shifted into the 16 bit Control Register by a transition
- ;from forground color to backgound data. To shift a 0, put a fore-
- ;gound color where the background color is $0000 and 0 will be
- ;shifted in. To shift a 1, put a pixel over $0001 background color
- ; This next section of the copper list will toggle the backround
- ;color from $0000, $0001, $0000, $0001, $0000, $0001 ........
- ; Put your foreground pixel on a $0000 or $0001 background to
- ;shift the data you desire.
- L1_st1: dc.b $1a,$3d,$ff,$fe
- dc.w color,$0000
- dc.w color,$0001 ;Bit 15
- dc.w color,$0000
- dc.w color,$0001 ;Bit 14
- dc.w color,$0000
- dc.w color,$0001 ;Bit 13
- dc.w color,$0000
- dc.w color,$0001 ;Bit 12
- dc.w color,$0000
- dc.w color,$0001 ;Bit 11
- dc.w color,$0000
- dc.w color,$0001 ;Bit 10
- dc.w color,$0000
- dc.w color,$0001 ;Bit 9
- dc.w color,$0000
- dc.w color,$0001 ;Bit 8
- dc.w color,$0000
- dc.w color,$0001 ;Bit 7
- dc.w color,$0000
- dc.w color,$0001 ;Bit 6
- dc.w color,$0000
- dc.w color,$0001 ;Bit 5
- dc.w color,$0000
- dc.w color,$0001 ;Bit 4
- dc.w color,$0000
- dc.w color,$0001 ;Bit 3
- dc.w color,$0000
- dc.w color,$0001 ;Bit 2
- dc.w color,$0000
- dc.w color,$0001 ;Bit 1
- dc.w color,$0000
- dc.w color,$0001 ;Bit 0
- dc.w color,$0000
- dc.w color+2,$0067
-
-
- ;*** This section of the copper list sets up video lines $16 - $19
- ;that are used to program the color palette or coprocessor in the
- ;COLORBURST.
- ;Format is Hi-Res Amiga screen, 88 bytes per line, 4 bit planes.
-
- L1_st2: dc.b $1a,$ff,$ff,$fe ;wait for Vertical line $16
- dc.w ddfstrt,$0031 ;display window start
- dc.w ddfstop,$00d4 ;display window stop
- dc.w bplcon0
- dc.b $c0
- L1_md2: dc.b $04 ;Hi-Res 4 bitplanes
- dc.w $00E0
- L1_d0h: dc.w $0007 ;Bit plane 0 pointer
- dc.w $00E2
- L1_d0l: dc.w $1000
- dc.w $00e4
- L1_d1h: dc.w $0007 ;Bit plane 1 pointer
- dc.w $00e6
- L1_d1l: dc.w $1000
- dc.w $00e8
- L1_d2h: dc.w $0007 ;Bit plane 2 pointer
- dc.w $00ea
- L1_d2l: dc.w $1000
- dc.w $00ec
- L1_d3h: dc.w $0007 ;Bit plane 3 pointer
- dc.w $00ee
- L1_d3l: dc.w $1000
- L1_st3: dc.b $1e,$11,$ff,$fe ;Wait for data load finish
- dc.w color+0,$0889 ;Set up color registers to
- dc.w bplcon0
- dc.b $00
- L1_md3: dc.b $00 ;Disable video display
- dc.w bplcon1
- L1_scrl: dc.w $0000 ;zero the Scroll value
-
- dc.w ddfstrt
- L1_Disp_STRT: dc.w $003c ;display data start
- dc.w ddfstop
- L1_Disp_STOP: dc.w $00d4 ;display data stop
- dc.w diwstop
- L1_dwsp: dc.b $28
- dc.b $f1
- dc.w $00E0
- L1_v0h: dc.w $0007 ;Bit plane 0 pointer
- dc.w $00E2
- L1_v0l: dc.w $1000
- dc.w $00e4
- L1_v1h: dc.w $0007 ;Bit plane 1 pointer
- dc.w $00e6
- L1_v1l: dc.w $1000
- dc.w $00e8
- L1_v2h: dc.w $0007 ;Bit plane 2 pointer
- dc.w $00ea
- L1_v2l: dc.w $1000
- dc.w $00ec
- L1_v3h: dc.w $0007 ;Bit plane 3 pointer
- dc.w $00ee
- L1_v3l: dc.w $1000
-
- dc.w bpl1mod ;screen modulo
- L1_mod1: dc.w 0
- dc.w bpl2mod ;screen modulo
- L1_mod2: dc.w 0
- dc.w color+2,$0888 ;Give correct 4 bit output
- dc.w color+4,$0887 ;from digital output on the
- dc.w color+6,$0886 ;video port
- dc.w color+8,$0879
- dc.w color+10,$0878
- dc.w color+12,$0877
- dc.w color+14,$0876
- dc.w color+16,$0789
- dc.w color+18,$0788
- dc.w color+20,$0787
- dc.w color+22,$0786
- dc.w color+24,$0779
- dc.w color+26,$0778
- dc.w color+28,$0777
- dc.w color+30,$0776
- videodisplay1:
- L1_dwst: dc.b $28
- dc.b $01
- dc.w $fffe ;wait until video start
- dc.w bplcon0
- dc.b $c0
- L1_md4: dc.b $04 ;enable video display
-
- dc.w $0142,$0000
-
-
-
-
-
- dc.w $0084
- L1_cjaddr1H: dc.w $0000 ;high address copper jump
- dc.w $0086
- L1_cjaddr1L: dc.w $0000 ;low address copper jump
- L1_skip1: dc.b $00,$01,$ff,$ff ;Skip jump ????
- dc.w $808a,$0000 ;JUMP to ColorPalette !!!
-
- dc.w $0084
- L1_cjaddr2H: dc.w $0000 ;high address copper jump
- dc.w $0086
- L1_cjaddr2L: dc.w $0000 ;low address copper jump
- L1_skip2: dc.b $18,$01,$ff,$ff ;Skip jump ????
- dc.w $008a,$0000 ;JUMP to Menu Screen !!!
- dc.w $ffff,$fffe ;end this list, goto jump
- EndCopperList1:
-
-
- CPList: ;the ColorPalette list
-
- dc.w $0180,$00f0
- dc.w $ffff,$fffe
-
-
- dc.w bpl1mod ;screen modulo
- dc.w 80 ; *** test
- dc.w bpl2mod ;screen modulo
- dc.w 80 ; *** test
- ;dc.w $28ff
- ;dc.w $fffe
- dc.w $00E0
- L3_v0h: dc.w $0007 ;Bit plane 0 pointer
- dc.w $00E2
- L3_v0l: dc.w $1000
- dc.w $00e4
- L3_v1h: dc.w $0007 ;Bit plane 1 pointer
- dc.w $00e6
- L3_v1l: dc.w $1000
- dc.w $00e8
- L3_v2h: dc.w $0007 ;Bit plane 2 pointer
- dc.w $00ea
- L3_v2l: dc.w $1000
- dc.w $00ec
- L3_v3h: dc.w $0007 ;Bit plane 3 pointer
- dc.w $00ee
- L3_v3l: dc.w $1000
-
-
- dc.w $0180,$00f0 ;***************************
-
-
- dc.w $0084
- L3_cjaddr2H: dc.w $0000 ;high address copper jump
- dc.w $0086
- L3_cjaddr2L: dc.w $0000 ;low address copper jump
- L3_skip1: dc.b $ff,$01,$00,$01 ;Skip jump ????
- dc.w $008a,$0000 ;JUMP to Menu Screen !!!
- dc.w $ffff,$fffe ;end this list, goto jump
- EndCPList:
-
- MenuList:
- L4_w1 dc.b $e0,$ff,$ff,$fe
- dc.w bplcon0
- dc.b $0
- L4_md1: dc.b $0
- dc.w bpl1mod
- dc.w 0
- dc.w bpl2mod
- dc.w 0
- dc.w diwstrt
- dc.w $2c81
- dc.w diwstop
- dc.w $40c1
- dc.w ddfstrt
- dc.w $0038
- dc.w ddfstop
- dc.w $00d0
- dc.w bplcon1,$0000 ;Zero the scroll value
- dc.w color ;Setup the Menu Colors
- Menu_Col0: dc.w $0001
- dc.w color+2
- dc.w $000f
- dc.w color+4
- dc.w $00f0
- dc.w color+6
- dc.w $0f00
- dc.w color+8
- dc.w $0ff0
- dc.w color+10
- dc.w $00ff
- dc.w color+12
- dc.w $0f0f
- dc.w color+14
- dc.w $0000
- dc.w color+16
- dc.w $0007
- dc.w color+18
- dc.w $0070
- dc.w color+20
- dc.w $0700
- dc.w color+22
- dc.w $0770
- dc.w color+24
- dc.w $0077
- dc.w color+26
- dc.w $0707
- dc.w color+28
- dc.w $0111
- dc.w color+30
- dc.w $0222
- dc.w color+32
- dc.w $0333
- dc.w color+34
- dc.w $0444
- dc.w color+36
- dc.w $0555
- dc.w color+38
- dc.w $0666
- dc.w color+40
- dc.w $0777
- dc.w color+42
- dc.w $0888
- dc.w color+44
- dc.w $0999
- dc.w color+46
- dc.w $0aaa
- dc.w color+48
- dc.w $0bbb
- dc.w color+50
- dc.w $0ccc
- dc.w color+52
- dc.w $0ddd
- dc.w color+54
- dc.w $0eee
- dc.w color+56
- dc.w $0fff
- dc.w color+58
- dc.w $0f70
- dc.w color+60
- dc.w $00f7
- dc.w color+62
- dc.w $070f
- dc.w $00e0
- L4_v0h: dc.w $0000 ;Bit plane 0 pointer
- dc.w $00E2
- L4_v0l: dc.w $0000
- dc.w $00e4
- L4_v1h: dc.w $0000 ;Bit plane 1 pointer
- dc.w $00e6
- L4_v1l: dc.w $0000
- dc.w $00e8
- L4_v2h: dc.w $0000 ;Bit plane 2 pointer
- dc.w $00ea
- L4_v2l: dc.w $0000
- dc.w $00ec
- L4_v3h: dc.w $0000 ;Bit plane 3 pointer
- dc.w $00ee
- L4_v3l: dc.w $0000
- dc.w $00f0
- L4_v4h: dc.w $0000 ;Bit plane 4 pointer
- dc.w $00f2
- L4_v4l: dc.w $0000
- L4_w2 dc.b $e1,$ff,$ff,$fe ;turn on display
- dc.w bplcon0
- dc.b $50 ;Lo-Res 5 bitplanes
- L4_md2: dc.b $0
- dc.w $ffff,$fffe
- ;dc.w $0084
- L4_cjaddr2H: ;dc.w $0000 ;high address copper jump
- ;dc.w $0086
- L4_cjaddr2L: ;dc.w $0000 ;low address copper jump
- ;dc.w $008a,$0000 ;JUMP to Menu Screen !!!
- dc.w $ffff,$fffe ;end this list, goto jump
- EndMenuList:
-
- ;*** This is the Copper List for NO DMA or video update
- CopperList3: ;THE control line copper list
-
- dc.w bpl1mod
- dc.w 0
- dc.w bpl2mod
- dc.w 0 ;Scroll right 8 pixels for
- dc.w bplcon1,$0044 ;Data RAM data syncronising
- dc.w bplcon0
- dc.b $10
- L5_md1: dc.b $00
- dc.w ddfstrt,$0038
- dc.w ddfstop,$00d0
- dc.w diwstrt
- L5_st0: dc.b $1a,$11 ;control data Start pos.
- dc.w diwstop,$1ed8
-
- dc.w $0120 ;Data RAM data align sprite
- L5_sp0h dc.w $0000 ;sprite 0 high pointer
- dc.w $0122
- L5_sp0l dc.w $0000 ;sprite 0 low pointer
- dc.w $0124
- L5_sp1h dc.w $0000 ;sprite 1 high pointer
- dc.w $0126 ;Mouse Cursor
- L5_sp1l dc.w $0000 ;sprite 1 low pointer
-
- dc.w color+38,$0f67 ;color load for sync sprite
- dc.w color+32,$0fff
- dc.w color+34,$0fff ;and mouse cursor
- dc.w color+36,$0ffe
- dc.w color+30,$0fff ;Set up color registers to
- dc.w color+28,$0ffe ;Give correct 4 bit output
- dc.w color+26,$0ff7 ;from digital output on the
- dc.w color+24,$0ff6 ;video port
- dc.w color+22,$0f6f
- dc.w color+20,$0f6e
- dc.w color+18,$0f67
- dc.w color+16,$0f00
- dc.w color+14,$00ff
- dc.w color+12,$00fe
- dc.w color+10,$00f7
- dc.w color+8,$00f6
- dc.w color+6,$006f
- dc.w color+4,$006e
- dc.w color+2,$0000
- dc.w $00E0
- L5_clh dc.w $0007 ;load bit plane 0 high word
- dc.w $00E2
- L5_cll dc.w $0000 ;load bit plane 0 low byte
- dc.w $0128,$0000 ;Kill all other sprites
- dc.w $012a,$0000
- dc.w $012c,$0000
- dc.w $012e,$0000
- dc.w $0130,$0000
- dc.w $0132,$0000
- dc.w $0134,$0000
- dc.w $0136,$0000
- dc.w $0138,$0000
- dc.w $013a,$0000
- dc.w $013c,$0000
- dc.w $013e,$0000
-
- ;Data is shifted into the 16 bit Control Register by a transition
- ;from forground color to backgound data. To shift a 0, put a fore-
- ;gound color where the background color is black and 0 will be
- ;shifted in. To shift a 1, put a pixel over a white background color
- ; This next section of the copper list will toggle the backround
- ;color from black, white, black, white, black, white ........
- ; Put your foreground pixel on a black or white background to
- ;shift the data you desire.
- L5_st1: dc.b $1a,$3d,$ff,$fe
- dc.w color,$0000
- dc.w color,$0001 ;Bit 15
- dc.w color,$0000
- dc.w color,$0001 ;Bit 14
- dc.w color,$0000
- dc.w color,$0001 ;Bit 13
- dc.w color,$0000
- dc.w color,$0001 ;Bit 12
- dc.w color,$0000
- dc.w color,$0001 ;Bit 11
- dc.w color,$0000
- dc.w color,$0001 ;Bit 10
- dc.w color,$0000
- dc.w color,$0001 ;Bit 9
- dc.w color,$0000
- dc.w color,$0001 ;Bit 8
- dc.w color,$0000
- dc.w color,$0001 ;Bit 7
- dc.w color,$0000
- dc.w color,$0001 ;Bit 6
- dc.w color,$0000
- dc.w color,$0001 ;Bit 5
- dc.w color,$0000
- dc.w color,$0001 ;Bit 4
- dc.w color,$0000
- dc.w color,$0001 ;Bit 3
- dc.w color,$0000
- dc.w color,$0001 ;Bit 2
- dc.w color,$0000
- dc.w color,$0001 ;Bit 1
- dc.w color,$0000
- dc.w color,$0001 ;Bit 0
- dc.w color,$0000
- dc.w color+2,$0067
-
- ;*** This section of the copper list sets up video lines $16 - $19
- ;that are used to program the color palette or coprocessor in the
- ;COLORBURST.
- ;Format is Hi-Res Amiga screen, 88 bytes per line, 4 bit planes.
-
- L5_st2: dc.b $1a,$ff,$ff,$fe ;wait for Vertical line $16
- dc.w ddfstrt,$0031 ;display window start
- dc.w ddfstop,$00d4 ;display window stop
- dc.w bplcon0
- dc.b $c0
- L5_md2: dc.b $00 ;Hi-Res 4 bitplanes
-
- dc.w $00E0
- L5_d0h: dc.w $0007 ;Bit plane 0 pointer
- dc.w $00E2
- L5_d0l: dc.w $1000
- dc.w $00e4
- L5_d1h: dc.w $0007 ;Bit plane 1 pointer
- dc.w $00e6
- L5_d1l: dc.w $1000
- dc.w $00e8
- L5_d2h: dc.w $0007 ;Bit plane 2 pointer
- dc.w $00ea
- L5_d2l: dc.w $1000
- dc.w $00ec
- L5_d3h: dc.w $0007 ;Bit plane 3 pointer
- dc.w $00ee
- L5_d3l: dc.w $1000
-
- L5_st3: dc.b $1e,$01,$ff,$fe ;Wait for data load to finish
- dc.w bplcon0
- dc.b $00
- L5_md3: dc.b $00 ;Disable video display
- dc.w bplcon1
- dc.w $0000 ;zero the Scroll value
- dc.w color+0,$0889 ;Set up color registers to
- dc.w $1e21,$fffe
- dc.w $0084
- L5_cjaddr2H: dc.w $0000 ;high address copper jump
- dc.w $0086
- L5_cjaddr2L: dc.w $0000 ;low address copper jump
- L5_skip1: dc.b $a0,$01,$ff,$fe ;Skip jump ????
- dc.w $008a,$0000 ;JUMP to Menu Screen !!!
- dc.w $ffff,$fffe ;end this list, goto jump
- EndCopperList3:
-
- Cop_1 dc.l 0 ;write red field 0 bank0
- Cop_2 dc.l 0 ;write green field 0 bank0
- Cop_3 dc.l 0 ;write blue field 0 bank 0
- Cop_4 dc.l 0 ;write red field 1 bank 0
- Cop_5 dc.l 0 ;write green field 1 bank 0
- Cop_6 dc.l 0 ;write blue field 1 bank 0
- Cop_7 dc.l 0 ;write red field 0 bank 1
- Cop_8 dc.l 0 ;write green field 0 bank 1
- Cop_9 dc.l 0 ;write blue field 0 bank 1
- Cop_10 dc.l 0 ;write red field 1 bank 1
- Cop_11 dc.l 0 ;write green field 1 bank 1
- Cop_12 dc.l 0 ;write blue field 1 bank 0
- Cop_13 dc.l 0 ;No DMA copper display list (odd field)
- Cop_14 dc.l 0 ;No DMA copper display list (even field)
- Col_1 dc.l 0
- Col_2 dc.l 0
- Col_3 dc.l 0
-
- Control_Data_List:
- dc.b %00000001,%00011010 ;update red, field 0, bank 0
- dc.b %00000010,%00011010 ;update green, field 0, bank 0
- dc.b %00000100,%00011010 ;update blue, field 0, bank 0
- dc.b %00001001,%00011010 ;update red, field 1, bank 0
- dc.b %00001010,%00011010 ;update green, field 1, bank 0
- dc.b %00001100,%00011010 ;update blue, field 1, bank 0
- dc.b %00010000,%00011010 ;update red, field 0, bank 1
- dc.b %00100000,%00011010 ;update green, field 0, bank 1
- dc.b %01000000,%00011010 ;update blue, field 0, bank 1
- dc.b %00011000,%00011010 ;update red, field 0, bank 1
- dc.b %00101000,%00011010 ;update green, field 0, bank 1
- dc.b %01001000,%00011010 ;update blue, field 0, bank 1
-
- dc.b %00000000,%00011010 ;NO screen update, field 0
- dc.b %00001000,%00011010 ;NO screen update, field 1
-
- ;Struct CBurstScreen:
- Screen_Width dc.w 0 ;Width of current screen
- Screen_Height dc.w 0 ;Requested height of current screen
- Actual_Height dc.w 0 ;Actual Height of current screen
- Mode dc.w 0 ;Screen Modes (Genlock, Interlace)
- PAL_NTSC dc.b 0 ;PAL or NTSC Modes (PAL = 1; NTSC = 0)
- Lo_Hi dc.b 0 ;Lo or Hi-res $ff = Hi-res
- Virtual_Mem dc.l 0 ;Amount of Virtual memory required
- Mouse_X dc.w 0 ;Current X mouse position (resolution depend)
- Mouse_Y dc.w 0 ;Current Y mouse position (resolution depend)
- Raw_Mouse_X dc.w 0 ;Raw Mouse position (not affected by res)
- Raw_Mouse_Y dc.w 0 ;Raw Mouse position (not affected by res)
- Pen_X dc.w 0 ;Current X position of Pen
- Pen_Y dc.w 0 ;Current X position of Pen
- Rel_X dc.w 0 ;Relative X offset value
- Rel_Y dc.w 0 ;Relative Y offset value
- Red_Value dc.b 0 ;Red color Data
- Green_Value dc.b 0 ;Green color Data
- Blue_Value dc.b 0 ;Blue color Data
- Kluge_Pad dc.b 0 ;Oh no! a Kludge filler!
- Screen_Planes dc.w 0 ;Number of Amiga Bitplanes in screen (12/24)
- BitMaps dc.l 0 ;Pointer to Bitmap structure
- Menu_BitMaps dc.l 0 ;Menu Bitmap structure
- Color_BitMaps dc.l 0 ;Color palette bitmap struct
- DMA_Ratio dc.b 0 ;Screen Update Ratio (for greater speed)
- DMA_Enable dc.b 0 ;Bit 0 on enables screen DMA & screen update
-
- BitPlane_0 dc.l 0 ;Red bank 1
- BitPlane_1 dc.l 0 ;Pointers to Actual Bitplanes
- BitPlane_2 dc.l 0
- BitPlane_3 dc.l 0
- BitPlane_4 dc.l 0 ;Green Bank 1
- BitPlane_5 dc.l 0
- BitPlane_6 dc.l 0
- BitPlane_7 dc.l 0
- BitPlane_8 dc.l 0 ;Blue Bank 1
- BitPlane_9 dc.l 0
- BitPlane_10 dc.l 0
- BitPlane_11 dc.l 0
- BitPlane_12 dc.l 0 ;Red Bank 2
- BitPlane_13 dc.l 0
- BitPlane_14 dc.l 0
- BitPlane_15 dc.l 0
- BitPlane_16 dc.l 0 ;Green Bank 2
- BitPlane_17 dc.l 0
- BitPlane_18 dc.l 0
- BitPlane_19 dc.l 0
- BitPlane_20 dc.l 0 ;Blue Bank 2
- BitPlane_21 dc.l 0
- BitPlane_22 dc.l 0
- BitPlane_23 dc.l 0
- Mode_1 dc.l 0 ;the mode lists for specifying
- Mode_2 dc.l 0 ;which bank and color of VIDEO RAM
- Mode_3 dc.l 0 ;to update in ColorBurst
- Mode_4 dc.l 0
- Mode_5 dc.l 0
- Mode_6 dc.l 0
- Mode_7 dc.l 0
- Mode_8 dc.l 0
- Mode_9 dc.l 0
- Mode_10 dc.l 0
- Mode_11 dc.l 0
- Mode_12 dc.l 0
- Mode_13 dc.l 0
- Mode_14 dc.l 0
- DataRam dc.l 0 ;Pointer to memory used to hold
- DataRam_1 dc.l 0 ;ColorBurst CoPROcessor data
- DataRam_2 dc.l 0
- ColorRam dc.l 0 ;Pointer to memory used to hold
- ColorRam_1 dc.l 0 ;Color Palette data
- ColorRam_2 dc.l 0
- ColBitPlane_0 dc.l 0 ;Bitplane pointers to ColorPalette
- ColBitPlane_1 dc.l 0 ;Selector video memory
- ColBitPlane_2 dc.l 0
- ColBitPlane_3 dc.l 0
- ColBitPlane_4 dc.l 0
- ColBitPlane_5 dc.l 0
- ColBitPlane_6 dc.l 0
- ColBitPlane_7 dc.l 0
- ColBitPlane_8 dc.l 0
- ColBitPlane_9 dc.l 0
- ColBitPlane_10 dc.l 0
- ColBitPlane_11 dc.l 0
- Menu_Bitplane_0 dc.l 0 ;Bitplanes for the lo-res 5 bitplane
- Menu_Bitplane_1 dc.l 0 ;Amiga screen used for menu selection
- Menu_Bitplane_2 dc.l 0
- Menu_Bitplane_3 dc.l 0
- Menu_Bitplane_4 dc.l 0
- ScreenStart dc.w 0
- Scroll dc.w 0
- Start_Fetch dc.w 0
- Stop_Fetch dc.w 0
- graf_name GRAFNAME
- _GfxBase dc.l 0
- _IntuitionBase dc.l 0
- _DOSBase dc.l 0
- dosname DOSNAME
- CopList_Cycle ds.l 16 ;Current cycle for updating the
- ScreenModes dc.w 0 ;screen sequence to consequetively
- Palette_VPOS dc.w 0 ;update the full 24 bit ColorBurst
- Menu_VPOS dc.w 0 ;memory
- MiscMem dc.l 0
- temp dc.l 0
- Int_XWidth dc.l 0
- Modulo dc.w 0
- BitMapSize dc.l 0 ;Size of each bitmap
- RasterMemSize dc.l 0
- ShCopList dc.l 0 ;Store system copper list pointer
- ShCopList2 dc.l 0 ;Store system copper list pointer
- copold dc.l 0
- copold2 dc.l 0
- Bank dc.w 0
- Sprite_Mem dc.l 0 ;Sprite memory pointer
- Menu_Cop dc.l 0
- Menu_JumpAddr dc.l 0
- Load_Address dc.l 0
- OldX dc.w 0
- OldY dc.w 0
- X_Offset dc.w 0 ;offset for mouse pointer
- Y_Offset dc.w 0
- VStart dc.w 0 ;PAL/NTSC start pos.
- Max_Mouse_X dc.w 0 ;mouse X maximum value
- Max_Mouse_Y dc.w 0 ;mouse Y maximum value
- ColAddress dc.b 0 ;Palette start load address
- PixelMask dc.b 0 ;Mask out pixel data
- ControlReg dc.b 0 ;Video mode control
- Cycle_Count dc.b 0
- MaxNum_Cycles dc.b 0
- No_Dma dc.b 0
- Ratio_Count dc.b 0
- Count dc.b 0
- CoPRO_Reg dc.b 0 ;copy of Coprocessor register
- Old_XCount dc.b 0
- Old_YCount dc.b 0
- X_Div dc.b 0 ;Mouse divide ratios
- Y_Div dc.b 0
- even
- intstruct:
- ;interrupt server structure for vertical B interrupt
- dc.l 0
- dc.l 0
- dc.b 2 ;type
- dc.b -128 ;priority
- dc.l 0
- dc.l 0
- dc.l vsub
-
-
- Sprite_1: ;Sprite data for the mouse pointer
- dc.w $0000,$ff00
- dc.b %00000110,%00110000,%00011110,%00111100
-
- Sprite_0: ;Data lines sync sprite
- dc.b $1a,$34,$1e,$00
- dc.w $8000,$0000,$8000,$0000,$8000,$0000,$8000,$0000
- dc.w $0000,$0000
-
- ScreenTable: ;for PAL ;Screen Mode Value:-
- ;---------------------------------------------------------------------------
- dc.w 320,256,12,$2c ;Lo-Res 0
- dc.w $3c,$d4,$00,$1a ;diwstrt, diwstop, scroll
- dc.w 640,256,24,$2c ;Hi-Res 1
- dc.w $3c,$d4,$00,$1a ;diwstrt, diwstop, scroll
- dc.w 320,512,12,$2c ;Interlace Lo-Res 2
- dc.w $3c,$d4,$00,$1a ;diwstrt, diwstop, scroll
- dc.w 640,512,24,$2c ;Interlace Hi-Res 3
- dc.w $3c,$d4,$00,$1a ;diwstrt, diwstop, scroll
- dc.w 368,286,12,$1f ;Overscan Lo-Res 4
- dc.w $28,$e0,$ee,$1a
- dc.w 736,286,24,$1f ;Overscan Hi-Res 5
- dc.w $28,$e0,$ee,$1a
- dc.w 368,576,12,$1f ;Overscan Interlace Lo-Res 6
- dc.w $28,$e0,$ee,$1a
- dc.w 736,576,24,$1f ;Overscan Interlace Hi_Res 7
- dc.w $28,$e0,$ee,$1a
- ;---------------------------------------------------------------------------
- ;ScreenTable for NTSC ;Screen Mode Value:-
- ;---------------------------------------------------------------------------
- dc.w 320,200,12,$2c ;Lo-Res 0
- dc.w $3c,$d4,$00,$15 ;diwstrt, diwstop, scroll
- dc.w 640,200,24,$2c ;Hi-Res 1
- dc.w $3c,$d4,$00,$15 ;diwstrt, diwstop, scroll
- dc.w 320,400,12,$2c ;Interlace Lo-Res 2
- dc.w $3c,$d4,$00,$15 ;diwstrt, diwstop, scroll
- dc.w 640,400,24,$2c ;Interlace Hi-Res 3
- dc.w $3c,$d4,$00,$15 ;diwstrt, diwstop, scroll
- dc.w 368,236,12,$1f ;Overscan Lo-Res 4
- dc.w $28,$e0,$ee,$15
- dc.w 736,236,24,$1f ;Overscan Hi-Res 5
- dc.w $28,$e0,$ee,$15
- dc.w 368,476,12,$1f ;Overscan Interlace Lo-Res 6
- dc.w $28,$e0,$ee,$15
- dc.w 736,476,24,$1f ;Overscan Interlace Hi_Res 7
- dc.w $28,$e0,$ee,$15
- ;---------------------------------------------------------------------------
-
- END
-
-
-