Oder Hintergrund, der immer gelöscht werden muss, nur darauf bauen die meisten digitalen Spiele auf.
Die Methode hier: Es entstehen beim Entwickeln Fehler und damit überschreiten man die Konstruktion oder legt offen, was für Bedingungen Spiele erfüllen müssen. Nennen wir sie FailTheConstruct .-) Ein funktionierendes Spiel ist das Ergebnis von unendlich vielen „Fehlern“.
Im vorliegenden Fall helfen die Spuren und man kann damit die Zukunft „voraussehen“. Wie wichtig das Erkennen des Randes ist wegen dem Abstossen wird auch in diesem Prototype erlebbar!
Ein 512 Bytes Exe und ein Glitch. Amiga Staff.
; ------------------------------------
; BREAKOUT SMALL
; SIZE-CODED
; ------------------------------------
; sizecoding - virtualise all
; approach: paint everything from new
;
; versions:
; short
; deluxe version
; art: destroying the graphics 1 pixel
; demoversion
; entry for "kulturfoerderung" vgl art
;
; > Template based (C) 2024 DEPECHE
BLTDDAT =0 ;result of the last word. used for bob collision detection and
;MFM decoding
DMACONR =2 ;bit 14=blitter busy flag
BLTCON0 =$40 ;blitter operation setup
BLTCON1 =$42
BLTAFWM =$44
BLTALWM =$46
BLTCPTH =$48 ;sources, destination, and size
BLTCPTL =$4a
BLTBPTH =$4c
BLTBPTL =$4e
BLTAPTH =$50
BLTAPTL =$52
BLTDPTH =$54
BLTDPTL =$56
BLTSIZE =$58
BLTCON0L=$5a ;ECS/AGA registers
BLTSIZV =$5c
BLTSIZH =$5e
BLTCMOD =$60 ;modulos
BLTBMOD =$62
BLTAMOD =$64
BLTDMOD =$66
BLTCDAT =$70 ;data to replace sources
BLTBDAT =$72
BLTADAT =$74
DMACON =$96 ;bit 6: enable blitter DMA. bit 10: give blitter priority over
;the CPU.
VPOSR EQU $dff004
bitplane1 equ $3c000
bitplane2 equ $3c000+40*256; $07d0 ; $07d0 will be used as value
bitplane1_double equ $3c000+4*40*256
bitplane2_double equ $40000+$07d0+4*40*256 ; $07d0 will be used as value
pwidth equ 40
numchars equ 3
delta equ 8 ; y spacing of chars
spacing equ 3 ; x (*8) spacing of chars
; gameplay
; playfield size
playfieldsize = 16 ; x
playfieldsizeheight = 10 ; *y
playfieldwidthx = playfieldsize*16
playfieldwidthstartx = (320-playfieldwidthx)/2
; * max playfield size
playfieldheight = 255
; number of bricks
bricksnumber = playfieldsize*playfieldsizeheight;
; ball collision
distance = 144
; paddle y
paddley = 256-16
gameovery = paddley+2
; -----------------------
; gameobjects
; -----------------------
; gameobjects - offsets
; gameobjectlength
gsize = 10
; propterties
x = 0
y = 2
state = 4
speedx = 6
speedy = 8
; special objects - ball
ball = 0
paddle = gsize
; reference
; exp: ball.x = ball+x(a5)
; -------------------------------------------
; CHIPMEMORY
; -------------------------------------------
code_c
; -------------------------------------------
lea clist(pc),a0 ;
move.l a0,$dff080 ;
; -------------------------------------------
; BASE VARS
; -------------------------------------------
; move.l #bitplane1,a6 ;
move.l #variables,a5 ; variables
; -------------------------
; init gameobjects
; -------------------------
; variables
startgame:
; all variables
move.l #0,d5 ; counter
move.l #0,d3 ; y
move.l #-2*16,d4 ; x
move.l a5,a1 ; var
dxs:
; version 1.0
move.w d4,x(a1)
move.w d3,y(a1)
move.w #1,state(a1)
; sizecoding: todo: state 2 > than set all to 2 !
; version 1
;move.w #2,speedx(a1)
;move.w #2,speedy(a1)
; version 2
; move.l #2+65536+1,speedx(a1)
move.l #%00000000000000100000000000000010,speedx(a1)
add.l #gsize,a1
add.l #16,d4
cmp.l #playfieldwidthx,d4
bne ct
add.l #8,d3
move.l #0,d4
ct:
add.l #1,d5
cmp.l #bricksnumber+2,d5
bne dxs
move.w #2001,(a1) ; stop brick
; version 1
; move.l a5,a4
; move.w #playfieldwidthx/2,ball+x(a4)
; move.w #100,ball+y(a4)
; move.w #playfieldwidthx/2,paddle+x(a4)
; move.w #paddley,paddle+y(a4)
; version 2
move.w #40,ball+x(a5)
move.w #100,ball+y(a5)
move.w #playfieldwidthx/2,paddle+x(a5)
move.w #paddley,paddle+y(a5)
; --------------------
; context
; --------------------
; a6 : screen
; a5 : variables
; ----------------------
demoloop:
; ----------------------
; -----------------------
; swap screen
; -----------------------
; version 2.0
; counterx
; clr.l d0
; move.w counterx,d0
; cmp.w #0,screenA
; version 1.0
add.l #1,counter ; do
move.l counter,d0
divu #2,d0
swap d0
cmp.w #0,d0
beq screenA
; version 2
; move.w #1,counterx
; version 1
; move.l #bitplaneparta,a1
; move.w #bitplane1>>16,(a1)
move.w #bitplane1>>16,bitplaneparta
; version 1.0
;move.l #bitplanepartb,a1
; move.w #bitplane1&$ffff,(a1)
move.w #bitplane1&$ffff,bitplanepartb
move.l #bitplane1_double,a6 ;
; move.w #$0fff,(color)
jmp screenB
screenA:
; version 2
; move.w #0,counterx
; version 1.0
; move.l #bitplaneparta,a1
; move.w #bitplane1_double>>16,(a1)
; move.l #bitplanepartb,a1
; move.w #bitplane1_double&$ffff,(a1)
move.w #bitplane1_double>>16,bitplaneparta
move.w #bitplane1_double&$ffff,bitplanepartb
move.l #bitplane1,a6 ;
; move.w #$0f0f,(color)
screenB:
; -----------------------
; clear screen
; -----------------------
; version 1
; move.l a6,a1
; move.l #40/4*playfieldheight,d1
;dhx:
; move.l #1,(a1) ; b=1 w=2 l=4
; add.l #4,a1
; dbra d1,dhx
; version 2 movem
move.l a6,a1
move.l #(40/4*playfieldheight)/8,d1
dhx:
move.l d1,d0
divu #2,d0
swap d0
cmp.w #0,d0
bne dhx_t
movem.l d0-d7,(a1) ; b=1 w=2 l=4
; version 2
; movem.l d0-d7,40*256(a1) ; b=1 w=2 l=4
; version 1
; movem.l #%1010101010101,40*256(a1) ; b=1 w=2 l=4
dhx_t:
add.l #4*8,a1
dbra d1,dhx
; version 3 - dirty, slow but not so many bytes!
; move.l a6,a1
; move.l #40*256,d1
;alpha:
; move.b #0,(a1)+
; dbra d1,alpha
; ----------------------------------
; MANAGE & RENDER GAMEOBJECTS
; ----------------------------------
move.l a5,a4
; a4 variables
renderit:
cmp.w #0,state(a4)
beq notactive
; render object
move.l a6,a1
move.w y(a4),d0 ; ball_y
; add.l counter,d0
; add.l ball+y(a5),d0
mulu #40,d0
add.l d0,a1
clr.l d0
move.w x(a4),d0
divu.w #16,d0
add.w d0,a1
add.w d0,a1
swap d0
ext.l d0
move.l #6,d2 ; distance
d1x:
move.l #%11111111000000000000000000000000,d1 ; (a1)
cmp.l a4,a5
beq paddled
move.l #%11111111111111100000000000000000,d1 ; (a1)
paddled:
; ==0 raster - no roll!
; cmp.l #0,d0
; beq direct
ror.l d0,d1
; move.l d1,(a1)
or.l d1,(a1)
jmp fwd
; direct:
; move.l d1,(a1)
fwd:
add.l #40,a1
dbra d2,d1x
; / render object
; 'collision detection'
; variant
cmp.l a4,a5 ; not the first!
beq nonearenough
clr.l d0
move.w x(a4),d0
add.w #4,d0 ; offset x
sub.w ball+x(a5),d0
muls d0,d0
move.w d0,d2
clr.l d1
move.w y(a4),d1
add.w #4,d1 ; offset y
sub.w ball+y(a5),d1
muls d1,d1
add.l d1,d0
cmp.l #distance,d0 ; distance / collision
bgt nonearenough
; d0 vs d1
; > x or y ! > left or up inversion
move.w #0,state(a4)
cmp.w d1,d2
blt up
jmp left
nonearenough:
notactive:
add.l #gsize,a4
cmp.w #2001,(a4)
bne renderit
; brutal fix
move.w #1,paddle+state(a5)
; vsync
waitVB:
move.l VPOSR,d0
and.l #$1ff00,d0
cmp.l #300<<8,d0
bne waitVB
; debug slower
; move.l #10000000,d1
;d12x:
; dbra d1,d12x
; ball
move.w ball+speedx(a5),d0
add.w d0,ball+x(a5)
move.w ball+speedy(a5),d0
add.w d0,ball+y(a5)
; borders
; border-x
cmp.w #1,ball+x(a5)
blt left
cmp.w #playfieldsize*16-8,ball+x(a5)
blt right
left:
move.w speedx(a5),d0
muls.w #-1,d0
move.w d0,speedx(a5)
right:
; borders-y
cmp.w #0,ball+y(a5)
bgt bottomy
up:
move.w speedy(a5),d0
muls.w #-1,d0
move.w d0,speedy(a5)
add.w d0,ball+y(a5)
move.w speedx(a5),d0
add.w d0,ball+x(a5)
bottomy:
; gameover
cmp.w #gameovery,ball+y(a5)
bgt startgame
; --------------------
; joystick-paddle
; --------------------
move.w $dff00c,d3 ; Read Joy1dat
btst.l #1,d3 ; If bit 1 is 1 we move to the Right
beq.s j_right ; else check for left
; cmp.w #300,paddle+x(a5)
; bgt j_right
add.b #4,paddle+x+1(a5)
j_right:
btst.l #9,d3 ; If bit 9 is 1 then we so to the left
beq.s j_left ; If the bit is 0 then we don't go to the left
; cmp.w #20,paddle+x(a5)
; blt j_left
sub.b #4,paddle+x+1(a5)
j_left:
; ----------------------
jmp demoloop
; ----------------------
; ----------------------
; DATA
; ----------------------
even
doublebufferf: dc.w 0
even
clist
; necessaire?
; dc.w $009a,$7fff
; dc.w $0096,$0020 ; sprites off
dc.w $008e,$2c81
dc.w $0090,$2bc1
; dc.w $0092,$0038
; dc.w $0094,$00d0
; screens
dc.w $00e0
bitplaneparta:
dc.w bitplane1>>16
dc.w $00e2
bitplanepartb:
dc.w bitplane1&$ffff
; dc.w $00e4,bitplane2>>16
; dc.w $00e6,bitplane2&$ffff
dc.w $1100,$1100 ; 1 01 2 bitplanes
;
dc.w $0180,$0000
dc.w $0182
color:
dc.w $0fff
; dc.w $0184,$0f00
; dc.w $0186,$00f0
dc.w $0000,$0000 ; stop the copper
even
; version
counter: dc.l 1
; version 2
counterx: dc.w 1
variables:
; dc.w 20,20,1,2,2 ; ball
; dc.w 120,180,1,2,1 ; paddle
; dc.w 0,0,1,1,1 ; bricks
; dc.w 16,0,1,1,1 ; bricks
; dc.w 32,0,1,1,1 ; bricks
; dc.w 48,0,1,1,1 ; bricks
; dc.w 48,48,1,1,1 ; bricks
; dc.w 64,64,1,1,1 ; bricks
; dc.w 2001 ; break
even
; not used code
; simple rect rendered
;move.w ball+y(a7),d0 ; ball_y
; mulu #40,d0
; add.l d0,a1
; clr.l d0
; move.w ball+x(a7),d0
; divu.w #16,d0
; add.w d0,a1
; add.w d0,a1
; swap d0
; ext.l d0
; move.l #7,d2
;d1x:
; move.l #%11111111000000000000000000000000,d1 ; (a1)
; move.l #%11111111111111110000000000000000,d1 ; (a1)
; ror.l d0,d1
; move.l d1,(a1)
;
; add.l #40,a1
; dbra d2,d1x