1

http://jbwyatt.com/253/a/a5Mazes.htm

那是我作业的链接。

我把迷宫画了出来,而让我困惑的终点和起点是如何开始其他任务。我通常会立即学习编程语言,但汇编对我来说是一个巨大的头痛。

如果有人能给我一些例子并指出我正确的方向,我应该能够克服减速带并加油。

INCLUDE "emu8086.inc"
ORG 100h

; LINE 1 -------------
lea si, maz1
mov cx, 20
wall1:
     cmp [si], 0 ; path
     je p1
     PUTC    219       ;  white block:
     jmp nx1
p1:  PUTC    32        ;  blank space
nx1: inc si
loop wall1
PRINTN ;****

; LINE 2 -------------
lea si, maz2
mov cx, 20
wall2:
     cmp [si], 0 ; path
     je p2
     PUTC    219       ;  white block:
     jmp nx2
p2:  PUTC    32        ;  blank space
nx2: inc si
loop wall2
PRINTN ;****

; LINE 3 -------------
lea si, maz3
mov cx, 20
wall3:
     cmp [si], 0 ; path
     je p3
     PUTC    219       ; white block:
     jmp nx3
p3:  PUTC    32        ; blank space
nx3: inc si
loop wall3
PRINTN ;****


; LINE 4 -------------
lea si, maz4
mov cx, 20
wall4:
     cmp [si], 0 ; path
     je p4
     PUTC    219       ;  white block:
     jmp nx4
p4:  PUTC    32        ;  blank space
nx4: inc si
loop wall4
PRINTN ;****

; LINE 5 -------------
lea si, maz5
mov cx, 20
wall5:
     cmp [si], 0 ; path
     je p5
     PUTC    219       ;  white block:
     jmp nx5
p5:  PUTC    32        ;  blank space
nx5: inc si
loop wall5
PRINTN ;****

; LINE 6 -------------
lea si, maz6
mov cx, 20
wall6:
     cmp [si], 0 ; path
     je p6
     PUTC    219       ;  white block:
     jmp nx6
p6:  PUTC    32        ; blank space
nx6: inc si
loop wall6
PRINTN ;****

; LINE 7 -------------
lea si, maz7
mov cx, 20
wall7:
     cmp [si], 0 ; path
     je p7
     PUTC    219       ; white block:
     jmp nx7
p7:  PUTC    32        ;   blank space
nx7: inc si
loop wall7
PRINTN ;****


; LINE 8 -------------
lea si, maz8
mov cx, 20
wall8:
     cmp [si], 0 ; path
     je p8
     PUTC    219       ;  white block:
     jmp nx8
p8:  PUTC    32        ;  blank space
nx8: inc si
loop wall8
PRINTN ;****

; LINE 9 -------------
lea si, maz9
mov cx, 20
wall9:
     cmp [si], 0 ; path
     je p9
     PUTC    219       ;  white block:
     jmp nx9
p9:  PUTC    32        ;  blank space
nx9: inc si
loop wall9
PRINTN ;****

; LINE 10 -------------
lea si, maz10
mov cx, 20
wall10:
     cmp [si], 0 ; path
     je p10
     PUTC    219       ;  white block:
     jmp nx10
p10:  PUTC    32        ;  blank space
nx10: inc si
loop wall10
PRINTN ;****

; LINEW 11 -------------
lea si, maz11
mov cx, 20
wall11:
     cmp [si], 0 ; path
     je p11
     PUTC    219       ;  white block:
     jmp nx11
p11:  PUTC    32        ;   blank space
nx11: inc si
loop wall11
PRINTN ;****


; LINE 12 -------------
lea si, maz12
mov cx, 20
wall12:
     cmp [si], 0 ; path
     je p12
     PUTC    219       ;  white block:
     jmp nx12
p12:  PUTC    32        ;   blank space
nx12: inc si
loop wall12
PRINTN ;****

; LINE 13 -------------
lea si, maz13
mov cx, 20
wall13:
     cmp [si], 0 ; path
     je p13
     PUTC    219       ;  white block:
     jmp nx13
p13:  PUTC    32        ;  blank space
nx13: inc si
loop wall13
PRINTN ;****

; LINE 14 -------------
lea si, maz14
mov cx, 20
wall14:
     cmp [si], 0 ; path
     je p14
     PUTC    219       ; white block:
     jmp nx14
p14:  PUTC    32        ; blank space
nx14: inc si
loop wall14
PRINTN ;****

; LINE 15 -------------
lea si, maz15
mov cx, 20
wall15:
     cmp [si], 0 ; path
     je p15
     PUTC    219       ;  white block:
     jmp nx15
p15:  PUTC    32        ;  blank space
nx15: inc si
loop wall15
PRINTN ;****


; LINE 16 -------------
lea si, maz16
mov cx, 20
wall16:
     cmp [si], 0 ; path
     je p16
     PUTC    219       ; white block:
     jmp nx16
p16:  PUTC    32        ;  blank space
nx16: inc si
loop wall16
PRINTN ;****

; LINE 17 -------------
lea si, maz17
mov cx, 20
wall17:
     cmp [si], 0 ; path
     je p17
     PUTC    219       ;  white block:
     jmp nx17
p17:  PUTC    32        ;  blank space
nx17: inc si
loop wall17
PRINTN ;****

; LINE 18 -------------
lea si, maz18
mov cx, 20
wall18:
     cmp [si], 0 ; path
     je p18
     PUTC    219       ;  white block:
     jmp nx18
p18:  PUTC    32        ;  blank space
nx18: inc si
loop wall18
PRINTN ;****

; LINE 19 -------------
lea si, maz19
mov cx, 20
wall19:
     cmp [si], 0 ; path
     je p19
     PUTC    219       ;  white block:
     jmp nx19
p19:  PUTC    32        ;  blank space
nx19: inc si
loop wall19
PRINTN ;****


; LINE 20 -------------
lea si, maz20
mov cx, 20
wall20:
     cmp [si], 0 ; path
     je p20
     PUTC    219       ; white block:
     jmp nx20
p20:  PUTC    32        ;  blank space
nx20: inc si
loop wall20
PRINTN ;****




; PUT GUY AND END IN MAZE
GOTOXY 1, 1       ;guy at start position
PUTC 01

GOTOXY 18, 17     ;finish point
PUTC 03         
ret

  maz1  DB  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  maz2  DB  1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1
  maz3  DB  1,0,1,0,0,0,0,1,1,0,0,0,1,1,0,1,0,1,0,1
  maz4  DB  1,0,1,1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1
  maz5  DB  1,0,0,0,0,1,0,1,1,0,1,1,0,0,0,1,1,1,0,1
  maz6  DB  1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1
  maz7  DB  1,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,0,0,1
  maz8  DB  1,1,0,1,1,1,0,1,1,0,1,1,0,0,0,1,1,1,1,1
  maz9  DB  1,0,0,1,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,1
  maz10 DB  1,0,1,1,0,1,0,0,0,0,1,1,1,1,1,1,1,1,0,1
  maz11 DB  1,0,0,1,0,1,0,1,0,1,1,0,0,0,0,0,0,1,0,1
  maz12 DB  1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1
  maz13 DB  1,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,1
  maz14 DB  1,1,0,1,0,1,0,1,0,0,0,1,1,1,0,0,0,1,0,1
  maz15 DB  1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1
  maz16 DB  1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1
  maz17 DB  1,1,0,0,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1
  maz18 DB  1,1,0,1,1,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1
  maz19 DB  1,1,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,1,3,1
  maz20 DB  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
end
4

2 回答 2

0

* * *在一个数组中定义你的迷宫,而不是 20 个。

* * *您不想逐行打印...做一个循环。

* * *字符随wasd移动:

W = char position - 20 (检查 maze[pos-20] != 1 or == endpoint)

A = 字符位置 - 1

D = 字符位置 + 1

S = 字符位置 + 20

这些是我在上面的代码中看到的问题。

你还有什么问题?有什么具体的不知道怎么做?

1- 为迷宫制作 1 个阵列并在屏幕上循环打印。

2- 在检查墙壁和端点时,通过加/减 1 和 20 获取输入并使用 wasd 移动角色

3- 我不知道如何用这种语言实现这个作业的图形部分。我确实做了一个迷宫游戏,但它是为了调试比赛。(映射在内存中,而不是在屏幕上)因此,如果您稍微更新一下代码,我可以帮助您处理逻辑。

于 2011-10-28T01:13:52.353 回答
0

你知道如何用你更熟悉的语言来做吗?然后制定一个你会怎么做的计划。然后尝试将该计划逐个转换为组装。然后,如果您有更具体的问题,您会发现更容易获得答案。

于 2011-10-27T22:06:57.577 回答