Main Maze Loop


 
include emu8086.inc
org 100h
jmp code

 maze:  ;1 is a wall and 0 is a path 
 DB 1,1,1,1,1,1,1,1,1,1,1,1 
 DB 1,0,0,0,1,1,0,0,0,0,1,1 
 DB 1,0,1,0,0,0,0,1,1,0,0,1 
 DB 1,0,1,1,1,1,0,1,1,0,1,1 
 DB 1,0,0,0,0,1,0,1,1,0,0,1 
 DB 1,1,0,1,1,1,1,1,1,0,1,1 
 DB 1,1,0,0,0,0,0,1,1,0,1,1 
 DB 1,1,0,1,1,1,0,1,1,0,0,1 
 DB 1,0,0,1,0,1,0,1,1,0,1,1 
 DB 1,0,1,1,0,1,0,0,0,0,0,1 
 DB 1,0,0,1,0,1,0,1,0,1,0,1 
 DB 1,1,1,1,1,1,1,1,1,1,1,1 
 COLS = 12               ; number of bytes in a single row of walls  
 ROWS = ($ - maze)/ COLS ; # rows in maze

 code: 
  mov cx, ROWS   ; rows in the maze
  lea si, maze   ; pointer to the MAZE
  
  L1:
    mov bx, cx   ; save the loop counter - used in DRAW!
    call Draw    ; draw a row: space(32d) path, block(219d) wall  
    mov cx, bx   ; restore loop count
    add si,COLS  ; point to next row   
    printn       ; end of row
  loop L1   
  
  ; avatar 
  gotoxy  1,1
  putc 12   
ret