Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added different blocks to minecraft

  • Loading branch information...
commit 556fce67e8b63bc434f11a332a29d189ddb8ebd0 1 parent e9a4e60
Trevor Siemens authored
Showing with 212 additions and 80 deletions.
  1. +108 −47 0x64c.dasm16
  2. +9 −2 README.txt
  3. +95 −31 minecraft.dasm16
155 0x64c.dasm16
View
@@ -23,7 +23,7 @@ DAT " by Pseudox/trevs231 v0.1.2 ", 0
:COMMAND_INIT_MSG
DAT " Type 'help' for a list of "
-DAT " commands 64k RAM k free ", 0
+DAT " commands 64k RAM k FREE ", 0
;Program start -------------------------------
@@ -225,12 +225,14 @@ DAT " commands 64k RAM k free ", 0
;begins the MINECRAFT GAME
:MINECRAFT_START_SCREEN
-DAT " MINECRAFT for DCPU-16 v1.0 "
+DAT " MINECRAFT for DCPU-16 v1.2 "
DAT " by Pseudox/trevs231", 0
-:MINECRAFT_INSTRUCTIONS
-DAT " p - quit r - restart "
-DAT " w,a,s,d - place/remove blocks "
-DAT " arrow keys - move", 0
+:MINECRAFT_INSTRUCTIONS1
+DAT " p - Quit o - Restart "
+DAT " w,a,s,d - Place/ remove blocks "
+DAT " arrow keys - Move", 0
+:MINECRAFT_INSTRUCTIONS2
+DAT " e - Change block", 0
:MINECRAFT_COMMAND_SR
JSR clrSCRN
@@ -238,9 +240,12 @@ DAT " arrow keys - move", 0
SET B, MINECRAFT_START_SCREEN
JSR printDAT
JSR newLine
- SET B, MINECRAFT_INSTRUCTIONS
+ SET B, MINECRAFT_INSTRUCTIONS1
JSR printDAT
- SET [SLEEP_DURATION], 0xD000
+ JSR newLine
+ SET B, MINECRAFT_INSTRUCTIONS2
+ JSR printDAT
+ SET [SLEEP_DURATION], 0xF000
JSR sleep
JSR sleep
JSR MINECRAFT_init ;play minecraft! :D
@@ -738,7 +743,7 @@ DAT " arrow keys - move", 0
-;MINECRAFT GAME FOR DCPU-16 by Pseudox/trevs231
+;MINECRAFT GAME FOR DCPU-16 v1.0 by Pseudox/trevs231
;A= nothing
;B= prevents other buttons from messing up input
@@ -751,8 +756,15 @@ DAT " arrow keys - move", 0
:MC_PLAYER_POS RESERVE 1
+
+:MC_CURRENT_BLOCK RESERVE 1
+
:MC_SKY_CHAR DAT 0x0B00
-:MC_GROUND_CHAR DAT 0x862A
+:MC_BLOCK_CHARS DAT 0x862A, 0x0200, 0x0800, 0x0600
+ DAT 0x782A, 0xE82A, 0xC82A, 0xB82A, 0
+; sky, dirt, grass, rock, cobblestone, wood, gold deposit
+; redstone, diamond,
+
:MC_PLAYER_CHAR DAT 0x1058
:MC_FALL_TIME DAT 0x0500
@@ -766,7 +778,9 @@ DAT " arrow keys - move", 0
:MC_do_left_key DAT 0x0061 ;a
:MC_do_right_key DAT 0x0064 ;d
-:MC_reset_key DAT 0x0072 ;r
+:MC_swap_key DAT 0x0065 ;e
+
+:MC_reset_key DAT 0x006F ;o
:MC_quit_key DAT 0x0070 ;p
@@ -796,14 +810,34 @@ DAT " arrow keys - move", 0
IFG j, x
SET PC, MINECRAFT_init_loop1
- SET J, [SCRN_END]
- ADD j, 1
+ ADD j, 0x20
+ SET i, 1
:MINECRAFT_init_loop2
- SET [x], [MC_GROUND_CHAR]
+ SET [x], [MC_BLOCK_CHARS+i]
ADD x, 1
IFG j, x
SET PC, MINECRAFT_init_loop2
+ ADD j, 0x40
+:MINECRAFT_init_loop3
+ SET [x], [MC_BLOCK_CHARS]
+ ADD x, 1
+ IFG j, x
+ SET PC, MINECRAFT_init_loop3
+
+ SET j, [SCRN_END]
+ ADD j, 0x1
+ SET i, 2
+:MINECRAFT_init_loop4
+ SET [x], [MC_BLOCK_CHARS+i]
+ ADD x, 1
+ IFG j, x
+ SET PC, MINECRAFT_init_loop4
+
+ SET [MC_CURRENT_BLOCK], [MC_BLOCK_CHARS] ;show current block
+ SET x, [SCRN_START]
+ SET [x], [MC_CURRENT_BLOCK]
+
;initialize player
SET [MC_PLAYER_POS], [SCRN_START]
ADD [MC_PLAYER_POS], 0xF0
@@ -832,6 +866,9 @@ DAT " arrow keys - move", 0
IFE [z], [MC_do_right_key]
JSR MC_do_right
+ IFE [z], [MC_swap_key]
+ JSR MC_swap_item
+
IFE [z], [MC_reset_key]
SET PC, MC_reset_game
@@ -873,7 +910,7 @@ DAT " arrow keys - move", 0
SUB J, 0x20
IFG [SCRN_START], j ;at the top?
SET PC, POP
- IFE [j], [MC_GROUND_CHAR] ;ground above?
+ IFN [j], [MC_SKY_CHAR] ;block above?
SET PC, POP
SET [X], [MC_SKY_CHAR]
SET [MC_PLAYER_POS], j
@@ -891,7 +928,7 @@ DAT " arrow keys - move", 0
SET J, [MC_PLAYER_POS]
SUB j, 1
- IFE [j], [MC_GROUND_CHAR] ;ground there?
+ IFN [j], [MC_SKY_CHAR] ;block there?
SET PC, POP
SET j, [MC_PLAYER_POS]
@@ -903,7 +940,7 @@ DAT " arrow keys - move", 0
:MC_wrap_left
SET J, [MC_PLAYER_POS]
ADD J, 0x1F
- IFE [j], [MC_GROUND_CHAR] ;ground there?
+ IFN [j], [MC_SKY_CHAR] ;block there?
SET PC, POP
SET X, [MC_PLAYER_POS]
SET [x], [MC_SKY_CHAR]
@@ -920,7 +957,7 @@ DAT " arrow keys - move", 0
SET J, [MC_PLAYER_POS]
ADD j, 1
- IFE [j], [MC_GROUND_CHAR] ;ground there?
+ IFN [j], [MC_SKY_CHAR] ;block there?
SET PC, POP
SET j, [MC_PLAYER_POS]
@@ -933,7 +970,7 @@ DAT " arrow keys - move", 0
:MC_wrap_right
SET J, [MC_PLAYER_POS]
SUB J, 0x1F
- IFE [J], [MC_GROUND_CHAR] ;ground there?
+ IFN [J], [MC_SKY_CHAR] ;block there?
SET PC, POP
SET X, [MC_PLAYER_POS]
SET [x], [MC_SKY_CHAR]
@@ -947,10 +984,12 @@ DAT " arrow keys - move", 0
SUB J, 0x20
IFG [SCRN_START], j ;at the top?
SET PC, POP
+ IFE [SCRN_START], j ;current block?
+ SET PC, POP
- IFE [j], [MC_GROUND_CHAR] ;is it ground?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [j], [MC_SKY_CHAR] ;is it a block?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -961,9 +1000,9 @@ DAT " arrow keys - move", 0
IFG J, [SCRN_END] ;at the bottom?
SET PC, POP
- IFE [j], [MC_GROUND_CHAR] ;is it ground?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [j], [MC_SKY_CHAR] ;is it a block?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -976,9 +1015,12 @@ DAT " arrow keys - move", 0
SET J, [MC_PLAYER_POS]
SUB j, 1
- IFE [j], [MC_GROUND_CHAR] ;ground there?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFE j, [SCRN_START] ;current block?
+ SET PC, POP
+
+ IFN [j], [MC_SKY_CHAR] ;block there?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -987,9 +1029,9 @@ DAT " arrow keys - move", 0
SET J, [MC_PLAYER_POS]
ADD J, 0x1F
- IFE [J], [MC_GROUND_CHAR] ;ground there?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [J], [MC_SKY_CHAR] ;block there?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -1003,9 +1045,9 @@ DAT " arrow keys - move", 0
SET J, [MC_PLAYER_POS]
ADD j, 1
- IFE [j], [MC_GROUND_CHAR] ;ground there?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [j], [MC_SKY_CHAR] ;block there?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -1013,18 +1055,45 @@ DAT " arrow keys - move", 0
:MC_do_wrap_right
SET J, [MC_PLAYER_POS]
SUB J, 0x1F
+ IFE j, [SCRN_START] ;current block?
+ SET PC, POP
- IFE [J], [MC_GROUND_CHAR] ;ground there?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [J], [MC_SKY_CHAR] ;block there?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
-:MC_do_is_ground
+:MC_do_is_block
SET [j], [MC_SKY_CHAR]
SET PC, POP
+
+:MC_swap_item
+ SET [z], 0
+ SET j, MC_BLOCK_CHARS
+:MC_swap_item_loop
+ IFE [MC_CURRENT_BLOCK], [j]
+ SET PC, MC_swap_item_x
+ ADD j, 1
+ SET PC, MC_swap_item_loop
+
+:MC_swap_item_x
+ ADD j, 1
+ IFE [j], 0
+ SET PC, MC_swap_item_reset
+ SET [MC_CURRENT_BLOCK], [j]
+ SET x, [SCRN_START]
+ SET [x], [MC_CURRENT_BLOCK]
+ SET PC, POP
+:MC_swap_item_reset
+ SET [MC_CURRENT_BLOCK], [MC_BLOCK_CHARS]
+ SET x, [SCRN_START]
+ SET [x], [MC_CURRENT_BLOCK]
+ SET PC, POP
+
+
:MC_reset_game
SET [z], 0
SET PC, MC_reset_point
@@ -1032,7 +1101,7 @@ DAT " arrow keys - move", 0
:MC_in_air_check
SET X, [MC_PLAYER_POS]
ADD X, 0x20
- IFE [x], [MC_GROUND_CHAR] ;ground below?
+ IFN [x], [MC_SKY_CHAR] ;ground below?
SET PC, MC_in_air_check_on_ground
IFG x, [SCRN_END] ;at bottom?
SET PC, POP
@@ -1061,11 +1130,3 @@ DAT " arrow keys - move", 0
SET [x], j
SET PC, POP
-
-
-
-
-
-
-
-
11 README.txt
View
@@ -1,5 +1,12 @@
Repo for files I've written for 0x10c
+All files are in the public domain. Credit would be nice though.
-0x64c.dasm16 is a simple command line. it includes the minecraft game
+0x64c.dasm16 :
+ A simple command line/ pseudo OS. It can be used to launch any
+ subroutine that keeps the stack and most regiters in tact.
+ **It includes the minecraft game, pre-installed.
-minecraft.dasm16 is a 2D sim of minecraft.
+minecraft.dasm16 :
+ A 2D sim of minecraft. Resembles Terraria.
+ controls: arrow keys - moving a,w,s,d - placing/removing blocks
+ e - switchign blocks o - reset p - quit
126 minecraft.dasm16
View
@@ -1,5 +1,5 @@
; minecraft.dasm16
-; v1.0
+; v1.2
; Created by Pseudox/trevs231
SET PC, main_inits
@@ -53,8 +53,15 @@
:MC_PLAYER_POS RESERVE 1
+
+:MC_CURRENT_BLOCK RESERVE 1
+
:MC_SKY_CHAR DAT 0x0B00
-:MC_GROUND_CHAR DAT 0x862A
+:MC_BLOCK_CHARS DAT 0x862A, 0x0200, 0x0800, 0x0600
+ DAT 0x782A, 0xE82A, 0xC82A, 0xB82A, 0
+; sky, dirt, grass, rock, cobblestone, wood, gold deposit
+; redstone, diamond,
+
:MC_PLAYER_CHAR DAT 0x1058
:MC_FALL_TIME DAT 0x0500
@@ -68,7 +75,9 @@
:MC_do_left_key DAT 0x0061 ;a
:MC_do_right_key DAT 0x0064 ;d
-:MC_reset_key DAT 0x0072 ;r
+:MC_swap_key DAT 0x0065 ;e
+
+:MC_reset_key DAT 0x006F ;o
:MC_quit_key DAT 0x0070 ;p
@@ -98,14 +107,34 @@
IFG j, x
SET PC, MINECRAFT_init_loop1
- SET J, [SCRN_END]
- ADD j, 1
+ ADD j, 0x20
+ SET i, 1
:MINECRAFT_init_loop2
- SET [x], [MC_GROUND_CHAR]
+ SET [x], [MC_BLOCK_CHARS+i]
ADD x, 1
IFG j, x
SET PC, MINECRAFT_init_loop2
+ ADD j, 0x40
+:MINECRAFT_init_loop3
+ SET [x], [MC_BLOCK_CHARS]
+ ADD x, 1
+ IFG j, x
+ SET PC, MINECRAFT_init_loop3
+
+ SET j, [SCRN_END]
+ ADD j, 0x1
+ SET i, 2
+:MINECRAFT_init_loop4
+ SET [x], [MC_BLOCK_CHARS+i]
+ ADD x, 1
+ IFG j, x
+ SET PC, MINECRAFT_init_loop4
+
+ SET [MC_CURRENT_BLOCK], [MC_BLOCK_CHARS] ;show current block
+ SET x, [SCRN_START]
+ SET [x], [MC_CURRENT_BLOCK]
+
;initialize player
SET [MC_PLAYER_POS], [SCRN_START]
ADD [MC_PLAYER_POS], 0xF0
@@ -134,6 +163,9 @@
IFE [z], [MC_do_right_key]
JSR MC_do_right
+ IFE [z], [MC_swap_key]
+ JSR MC_swap_item
+
IFE [z], [MC_reset_key]
SET PC, MC_reset_game
@@ -175,7 +207,7 @@
SUB J, 0x20
IFG [SCRN_START], j ;at the top?
SET PC, POP
- IFE [j], [MC_GROUND_CHAR] ;ground above?
+ IFN [j], [MC_SKY_CHAR] ;block above?
SET PC, POP
SET [X], [MC_SKY_CHAR]
SET [MC_PLAYER_POS], j
@@ -193,7 +225,7 @@
SET J, [MC_PLAYER_POS]
SUB j, 1
- IFE [j], [MC_GROUND_CHAR] ;ground there?
+ IFN [j], [MC_SKY_CHAR] ;block there?
SET PC, POP
SET j, [MC_PLAYER_POS]
@@ -205,7 +237,7 @@
:MC_wrap_left
SET J, [MC_PLAYER_POS]
ADD J, 0x1F
- IFE [j], [MC_GROUND_CHAR] ;ground there?
+ IFN [j], [MC_SKY_CHAR] ;block there?
SET PC, POP
SET X, [MC_PLAYER_POS]
SET [x], [MC_SKY_CHAR]
@@ -222,7 +254,7 @@
SET J, [MC_PLAYER_POS]
ADD j, 1
- IFE [j], [MC_GROUND_CHAR] ;ground there?
+ IFN [j], [MC_SKY_CHAR] ;block there?
SET PC, POP
SET j, [MC_PLAYER_POS]
@@ -235,7 +267,7 @@
:MC_wrap_right
SET J, [MC_PLAYER_POS]
SUB J, 0x1F
- IFE [J], [MC_GROUND_CHAR] ;ground there?
+ IFN [J], [MC_SKY_CHAR] ;block there?
SET PC, POP
SET X, [MC_PLAYER_POS]
SET [x], [MC_SKY_CHAR]
@@ -249,10 +281,12 @@
SUB J, 0x20
IFG [SCRN_START], j ;at the top?
SET PC, POP
+ IFE [SCRN_START], j ;current block?
+ SET PC, POP
- IFE [j], [MC_GROUND_CHAR] ;is it ground?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [j], [MC_SKY_CHAR] ;is it a block?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -263,9 +297,9 @@
IFG J, [SCRN_END] ;at the bottom?
SET PC, POP
- IFE [j], [MC_GROUND_CHAR] ;is it ground?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [j], [MC_SKY_CHAR] ;is it a block?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -278,9 +312,12 @@
SET J, [MC_PLAYER_POS]
SUB j, 1
- IFE [j], [MC_GROUND_CHAR] ;ground there?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFE j, [SCRN_START] ;current block?
+ SET PC, POP
+
+ IFN [j], [MC_SKY_CHAR] ;block there?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -289,9 +326,9 @@
SET J, [MC_PLAYER_POS]
ADD J, 0x1F
- IFE [J], [MC_GROUND_CHAR] ;ground there?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [J], [MC_SKY_CHAR] ;block there?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -305,9 +342,9 @@
SET J, [MC_PLAYER_POS]
ADD j, 1
- IFE [j], [MC_GROUND_CHAR] ;ground there?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [j], [MC_SKY_CHAR] ;block there?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
@@ -315,18 +352,45 @@
:MC_do_wrap_right
SET J, [MC_PLAYER_POS]
SUB J, 0x1F
+ IFE j, [SCRN_START] ;current block?
+ SET PC, POP
- IFE [J], [MC_GROUND_CHAR] ;ground there?
- SET PC, MC_do_is_ground
- SET [j], [MC_GROUND_CHAR]
+ IFN [J], [MC_SKY_CHAR] ;block there?
+ SET PC, MC_do_is_block
+ SET [j], [MC_CURRENT_BLOCK]
SET PC, POP
-:MC_do_is_ground
+:MC_do_is_block
SET [j], [MC_SKY_CHAR]
SET PC, POP
+
+:MC_swap_item
+ SET [z], 0
+ SET j, MC_BLOCK_CHARS
+:MC_swap_item_loop
+ IFE [MC_CURRENT_BLOCK], [j]
+ SET PC, MC_swap_item_x
+ ADD j, 1
+ SET PC, MC_swap_item_loop
+
+:MC_swap_item_x
+ ADD j, 1
+ IFE [j], 0
+ SET PC, MC_swap_item_reset
+ SET [MC_CURRENT_BLOCK], [j]
+ SET x, [SCRN_START]
+ SET [x], [MC_CURRENT_BLOCK]
+ SET PC, POP
+:MC_swap_item_reset
+ SET [MC_CURRENT_BLOCK], [MC_BLOCK_CHARS]
+ SET x, [SCRN_START]
+ SET [x], [MC_CURRENT_BLOCK]
+ SET PC, POP
+
+
:MC_reset_game
SET [z], 0
SET PC, MC_reset_point
@@ -334,7 +398,7 @@
:MC_in_air_check
SET X, [MC_PLAYER_POS]
ADD X, 0x20
- IFE [x], [MC_GROUND_CHAR] ;ground below?
+ IFN [x], [MC_SKY_CHAR] ;ground below?
SET PC, MC_in_air_check_on_ground
IFG x, [SCRN_END] ;at bottom?
SET PC, POP
Please sign in to comment.
Something went wrong with that request. Please try again.