mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2025-11-23 22:34:50 +00:00
Use some more blitter
This commit is contained in:
@ -5,7 +5,7 @@ BASE_ADDRESS=4000 # if you change this you must also change link.script.x
|
||||
# note: this must be high enough not to conflict with MFMbufE
|
||||
|
||||
BOOTBLOCK_ASM=alpine_bootblock.s
|
||||
OBJS=out/init.o out/utils.o out/trackloader.o out/image.o out/disk.o out/blit.o out/cpu.o
|
||||
OBJS=out/init.o out/utils.o out/trackloader.o out/image.o out/disk.o out/blittext.o out/cpu.o out/blit2.o
|
||||
|
||||
|
||||
IMAGES=font.png
|
||||
|
||||
42
024.simple_text/blit2.s
Normal file
42
024.simple_text/blit2.s
Normal file
@ -0,0 +1,42 @@
|
||||
include "includes.i"
|
||||
|
||||
xdef BlitFillColor
|
||||
|
||||
BLIT_LF_MINTERM equ $ff
|
||||
BLIT_DEST equ $100
|
||||
BLIT_SRCC equ $200
|
||||
BLIT_SRCB equ $400
|
||||
BLIT_SRCA equ $800
|
||||
|
||||
|
||||
BlitFillColor:
|
||||
;; d0 - color#
|
||||
;; d1 - height
|
||||
movem.l d0-a6,-(sp)
|
||||
move.b #0,d3 ; bitplane #
|
||||
.loop:
|
||||
move.w d1,d4
|
||||
btst d3,d0 ; is the color's bit set in this plane?
|
||||
beq .zero
|
||||
move.l #BLIT_DEST|$FF,d2 ; yes ? all ones
|
||||
bra .doblit
|
||||
.zero
|
||||
move.l #BLIT_DEST|$0,d2 ; no ? all zeros
|
||||
.doblit
|
||||
jsr WaitBlitter
|
||||
|
||||
move.w #0,BLTCON1(A6)
|
||||
move.w d2,BLTCON0(A6)
|
||||
move.w #SCREEN_WIDTH_BYTES*(SCREEN_BIT_DEPTH-1),BLTDMOD(a6)
|
||||
move.l a0,BLTDPTH(a6)
|
||||
|
||||
lsl.w #6,d4
|
||||
ori.w #SCREEN_WIDTH_WORDS,d4
|
||||
move.w d4,BLTSIZE(a6)
|
||||
add.b #1,d3
|
||||
add.l #SCREEN_WIDTH_BYTES,a0
|
||||
cmp.b #SCREEN_BIT_DEPTH,d3 ; all planes for a single line done ?
|
||||
bne .loop ; no ? do the next plane
|
||||
jsr WaitBlitter
|
||||
movem.l (sp)+,d0-a6
|
||||
rts
|
||||
@ -30,24 +30,18 @@ BLIT_BOB_HEIGHT equ 10
|
||||
BLIT_BOB_WIDTH_BYTES equ BLIT_BOB_WIDTH/8
|
||||
BLIT_BOB_WIDTH_WORDS equ BLIT_BOB_WIDTH/16
|
||||
|
||||
blitWait:
|
||||
tst DMACONR(a6) ;for compatibility
|
||||
.waitblit:
|
||||
btst #6,DMACONR(a6)
|
||||
bne.s .waitblit
|
||||
rts
|
||||
|
||||
;; blitobject
|
||||
;; BlitText
|
||||
;; d0 - xpos
|
||||
;; d1 - ypos
|
||||
;; d3 - odd character
|
||||
;; a0 - display
|
||||
;; a1 - object
|
||||
;; a2 - mask
|
||||
blitText:
|
||||
BlitText:
|
||||
movem.l d0-a6,-(sp)
|
||||
bsr blitWait
|
||||
|
||||
jsr WaitBlitter
|
||||
;; d0 = XPOS
|
||||
;; d1 = YPOS
|
||||
;; d3 = odd character
|
||||
@ -101,20 +95,19 @@ blitText:
|
||||
movem.l (sp)+,d0-a6
|
||||
rts
|
||||
|
||||
|
||||
DrawText:
|
||||
;; a0 - bitplane
|
||||
;; a1 - text
|
||||
;; d0 - xpos
|
||||
;; d1 - ypos
|
||||
|
||||
|
||||
;; d1 - ypos
|
||||
.loop:
|
||||
clr.l d2
|
||||
move.b (a1)+,d2
|
||||
cmp.b #0,d2
|
||||
beq .done
|
||||
jsr DrawChar
|
||||
add.l #8,d0
|
||||
add.l #FONT_WIDTH,d0
|
||||
bra .loop
|
||||
.done:
|
||||
rts
|
||||
@ -153,7 +146,7 @@ DrawChar:
|
||||
|
||||
add.l d2,a1
|
||||
add.l d2,a2
|
||||
jsr blitText
|
||||
jsr BlitText
|
||||
movem.l (sp)+,d0-a6
|
||||
rts
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
FONT_WIDTH equ 8
|
||||
SCREEN_WIDTH equ 320
|
||||
SCREEN_HEIGHT equ 256
|
||||
SCREEN_WIDTH_BYTES equ (SCREEN_WIDTH/8)
|
||||
SCREEN_WIDTH_WORDS equ SCREEN_WIDTH_BYTES/2
|
||||
SCREEN_BIT_DEPTH equ 4
|
||||
SCREEN_RES equ 8 ; 8=lo resolution, 4=hi resolution
|
||||
RASTER_X_START equ $81 ; hard coded coordinates from hardware manual
|
||||
|
||||
@ -26,7 +26,7 @@ Init:
|
||||
lea copperList,a0
|
||||
move.l a0,COP1LC(a6)
|
||||
move.w COPJMP1(a6),d0
|
||||
move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6)
|
||||
move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6)
|
||||
;; move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6)
|
||||
movem.l (sp)+,d0-a6
|
||||
rts
|
||||
@ -13,5 +13,5 @@
|
||||
255 255 000 255
|
||||
255 255 000 255
|
||||
255 255 000 255
|
||||
255 255 000 255
|
||||
255 000 000 255
|
||||
|
||||
|
||||
@ -21,29 +21,33 @@ Entry:
|
||||
|
||||
lea Level3InterruptHandler,a3
|
||||
move.l a3,LVL3_INT_VECTOR
|
||||
|
||||
jsr SwitchBuffers
|
||||
|
||||
move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6)
|
||||
move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_MASTER),DMACON(a6)
|
||||
|
||||
move.l offscreen,a0
|
||||
move.l #4,d0 ; color#
|
||||
jsr CpuFillColor
|
||||
move.l onscreen,a0
|
||||
move.l #4,d0 ; color#
|
||||
jsr CpuFillColor
|
||||
|
||||
jsr SwitchBuffers
|
||||
|
||||
jsr Init ; enable the playfield
|
||||
|
||||
move.l #4,d0 ; color#
|
||||
move.w #SCREEN_HEIGHT,d1 ; height
|
||||
jsr BlitFillColor
|
||||
move.l offscreen,a0
|
||||
move.l #4,d0 ; color#
|
||||
move.w #SCREEN_HEIGHT,d1 ; height
|
||||
jsr BlitFillColor
|
||||
|
||||
jsr Init ; enable the playfield
|
||||
|
||||
.mainLoop:
|
||||
move.l offscreen,a0
|
||||
move.l #4,d0 ; color#
|
||||
jsr CpuFillColor
|
||||
move.w #25,d1
|
||||
jsr BlitFillColor
|
||||
|
||||
move.l direction,d0
|
||||
add.l d0,xpos
|
||||
move.l xpos,d0
|
||||
move.l #50,d1
|
||||
move.l #15,d1
|
||||
move.l offscreen,a0
|
||||
lea text,a1
|
||||
jsr DrawText
|
||||
@ -51,30 +55,30 @@ Entry:
|
||||
jsr WaitVerticalBlank
|
||||
jsr SwitchBuffers
|
||||
|
||||
cmp.l #320-(26*8),xpos
|
||||
ble .notright
|
||||
cmp.l #SCREEN_WIDTH-((endText-text)*FONT_WIDTH),xpos
|
||||
ble .notRightEdge
|
||||
move.l direction,d0
|
||||
muls.w #-1,d0
|
||||
move.l d0,direction
|
||||
bra .mainLoop
|
||||
.notright:
|
||||
.notRightEdge:
|
||||
cmp.l #0,xpos
|
||||
bne .mainLoop
|
||||
bne .notLeftEdge
|
||||
move.l direction,d0
|
||||
muls.w #-1,d0
|
||||
move.l d0,direction
|
||||
|
||||
move.l d0,direction
|
||||
.notLeftEdge:
|
||||
bra .mainLoop
|
||||
|
||||
|
||||
text:
|
||||
dc.b "My first text on an Amiga!"
|
||||
endText:
|
||||
dc.b 0
|
||||
align 4
|
||||
xpos:
|
||||
dc.l 0
|
||||
direction:
|
||||
dc.l 1
|
||||
dc.l 2
|
||||
|
||||
Level3InterruptHandler:
|
||||
movem.l d0-a6,-(sp)
|
||||
|
||||
@ -1,6 +1,17 @@
|
||||
include "includes.i"
|
||||
|
||||
xdef WaitVerticalBlank
|
||||
xdef WaitRaster
|
||||
xdef WaitBlitter
|
||||
xdef Depack
|
||||
|
||||
WaitBlitter:
|
||||
tst DMACONR(a6) ;for compatibility
|
||||
.waitblit:
|
||||
btst #6,DMACONR(a6)
|
||||
bne.s .waitblit
|
||||
rts
|
||||
|
||||
|
||||
WaitVerticalBlank:
|
||||
movem.l d0,-(sp)
|
||||
|
||||
Reference in New Issue
Block a user