diff --git a/factory.dsk b/factory.dsk index cd14b6e..1e05f83 100644 Binary files a/factory.dsk and b/factory.dsk differ diff --git a/src/display.asm b/src/display.asm index 4979c3c..fa6cc7e 100644 --- a/src/display.asm +++ b/src/display.asm @@ -65,23 +65,27 @@ draw: ldx TILENUM ; This section gets the type of tile to draw. lin1t8: ldy #00 patch_1: ; Loop through the first 8 lines, drawing the value from the tile lda TILE2D,X ; data to the screen memory + beq skip1 sta (ADDR_1),Y - inx +skip1: inx iny patch_2: lda TILE2D,X + beq skip2 sta (ADDR_1),Y - inx +skip2: inx iny patch_3: lda TILE2D,X + beq skip3 sta (ADDR_1),Y - inx +skip3: inx iny patch_4: lda TILE2D,X + beq skip4 sta (ADDR_1),Y - inx +skip4: inx iny lda ADDR_1+1 adc #$04 @@ -93,23 +97,27 @@ patch_4: lin916: ldy #00 ; Y resets to go back to the beginning of screen memory offset patch_5: lda TILE2D,X + beq skip5 sta (ADDR_2),Y - inx +skip5: inx iny patch_6: lda TILE2D,X + beq skip6 sta (ADDR_2),Y - inx +skip6: inx iny patch_7: lda TILE2D,X + beq skip7 sta (ADDR_2),Y - inx +skip7: inx iny patch_8: lda TILE2D,X + beq skip8 sta (ADDR_2),Y - inx +skip8: inx iny lda ADDR_2+1 adc #$04 diff --git a/src/main.asm b/src/main.asm index deb3755..e7a7553 100644 --- a/src/main.asm +++ b/src/main.asm @@ -6,7 +6,6 @@ .import itemdraw .import World .import ItemLoc -.import itemRot .define UPDATEPT $6 .define UPDATERT $8 @@ -16,49 +15,34 @@ _main: jsr HGR ; Hires setup stuff jsr BKGND -loop: jsr update ; update runs the "game logic" (more to come) - jmp loop ; to every tile, which animates belts and assemblers +loop: jmp update ; update runs the "game logic" (more to come) + ; to every tile, which animates belts and assemblers update: ldx #00 ; This loop just updates any animated tiles, like conveyors. -update1:lda World,x -cktile: cmp #00 - beq view - cmp #16 ; Check if it is one of the three conveyor positions - beq rtconvJ ; Jump if it is - cmp #18 - beq rtconvJ - cmp #20 - beq rtconv2J ; Jump if it needs to be reset - cmp #22 - beq lfconvJ - cmp #24 - beq lfconvJ - cmp #26 - beq lfconv2J - cmp #10 - beq upassmJ - cmp #12 - beq upassmJ - cmp #14 - beq upassm2J - jmp ckitem -rtconvJ: jmp rtconv -rtconv2J:jmp rtconv2 -lfconvJ: jmp lfconv -lfconv2J:jmp lfconv2 -upassmJ: jmp upassm -upassm2J:jmp upassm2 -ckitem: lda World,x +update1:lda #>updates + sta UPDATEPT+1 + lda World,x ; Load every world coordinate + clc + adc #updates lda (UPDATEPT),Y sta UPDATERT+1 lda World,x - jmp (UPDATERT) - - -updates: -.word view ; If the tile is grass (0), do nothing -.word rtconv, rtconv, rtconv2 ; 02, 04, 06 -.word lfconv, lfconv, lfconv2 ; 08, 10, 12 -.word insert, insert, insert2 ; 14, 16, 18 -.word upassm, upassm, upassm2 ; 20, 22, 24 \ No newline at end of file + jmp (UPDATERT) \ No newline at end of file diff --git a/src/world.asm b/src/world.asm index 61a1e71..c775e78 100644 --- a/src/world.asm +++ b/src/world.asm @@ -10,13 +10,10 @@ .export World .export ItemLoc -.export ItemRot World: ; This is the array which stores all of the world data. ; Right now this is just 10x10, so no other methods are needed. -.byte 16, 16, 16, 16, 16, 16, 16, 10, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 02, 00, 02, 00, 00, 00, 00, 00, 00 +.byte 16, 00, 00, 00, 00, 00, 00, 00, 00, 00 .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 @@ -24,23 +21,24 @@ World: ; This is the array which stores all of the world data. .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 +.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 +.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 + + + +; Item's rotation and position. +; 00000000 +; | | | +; | | | First two bits are rotation (0-3) +; | | Third and fourth bits are position in cell (0-2) +; | Last 4 bits are the item type. +; +; For reference, 00001100 is $C +; 00000011 is $3 +; 00001111 is $F ItemLoc: -.byte 02, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 - - -; Item's rotation. 0 is to the right, 1 is up, 2 is left, 3 is down. -ItemRot: -.byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 +.byte $20, 00, 00, 00, 00, 00, 00, 00, 00, 00 .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 .byte 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 diff --git a/src/world.inc b/src/world.inc index 0bfa565..ca7a60e 100644 --- a/src/world.inc +++ b/src/world.inc @@ -1,3 +1,2 @@ .import World -.import ItemLoc -.import ItemRot \ No newline at end of file +.import ItemLoc \ No newline at end of file