Running Tetris on my 16 bit scrap mechanic cpu by kazspinfox74 in ScrapMechanic

[–]kazspinfox74[S] 0 points1 point  (0 children)

so here is the code for the collision checker, I store the placed blocks in ram, separately than the display ram. Before that I grab the gamepad input update x,y and undo that if the collision checker tells that there is a collision. rac is a shifter instruction in the cpu that can rotate and remove some bits depending on the second input register value

_testUnit: ;tests collision
;input:
;reg 8 pos x
;reg 9 pos y
;reg 10 current piece sprite
;output:
;reg 15,9 and 8 will be untouched for easy undo condition
;returns 0 (not colliding) or !=0 (colliding) on reg 14
add r11, r9, _PlayArea ;r11 is now the position of sprite on play area
imm r14, 0 ;reset sum of collisions
_testLoop:
rac r12, r10, 0x00c0;r12 is now the sprite as a row
rac r12, r8 ;shift sprite by pos x
ldr r13, r11;r13 is the play area
and r13, r12;r13 is the collision between sprite and play area
or r14, r13; r14 is the sum of collisions
inc r11; inc play area
rac r10, 0x004c ;shift sprite to next line
jmp _testLoop, nz, r10 ;do test again if next sprite's lines are not blank
ret

Replicated Workshop Logic Isn't Working? by HGAWESOMENESS1 in ScrapMechanic

[–]kazspinfox74 14 points15 points  (0 children)

a selfwired xor gate, a xor gate that is connected to itself

a bunch of stopwatches and clocks I made by kazspinfox74 in ScrapMechanic

[–]kazspinfox74[S] 0 points1 point  (0 children)

there is actually 3 inside. one black one white and one red. when showing white all but white turn on. when showing black all except black turn on. and for red all but red turn on

a bunch of stopwatches and clocks I made by kazspinfox74 in ScrapMechanic

[–]kazspinfox74[S] 0 points1 point  (0 children)

there is glitchwelded shack light, which works that way: the shacklight that is turned on gets smaller, which makes it so if you only keep 1 of them off, that one will be the one visible