Submit a SINGLE FILE (unzipped) callled "MAZE.asm" to D2L that simply draws the maze and places the peson in it
Submit a SINGLE FILE (unzipped) callled "MAZE2.asm" to D2L that is the complete maze
1. Create a maze at least 12 x 12 characters
(represent: 0 = path, 1 = wall, 2 = goal)
(1 draw: 0DBh (219d) = block)
(0 draw: 20h (32d) = space)
(2 draw: - you choose)
2. Allow a character to navigate the maze and find a goal
(draw: 1 = face) updating the positon of the man & NOT redrawing the maze
3 Use the WASD keys
[ w(11h) up, a(1Eh) left, s(1Fh) down, d(20h) right ]
[ these are the scan codes: use INT 16h (ah=00h) to read char ]
[ note scan code returned in AH, ascii code is in AL (case sensitive) ]
4. At least one procedure PLUS the Draw procedure.
Pass any parameters via registers or stack(careful).
will draw the initial maze.
representation: data structure = array of bytes (0,1)
render (draw): PUTC , ascii
coordinate system: x, y ; 0,0 in upper left
user interaction: wasd
data struct must always be in synch with rendered image on the screen
(pointer in struct corresponds to x,y coordinate in maze)
only draw minimal amount: do NOT redraw entire screen (ugh)
Draw the Maze & put man at starting position and put the goal in it
Point to maze
Point to man
Loop until GOAL
read char (up, down, left, right)
use ptr & determine if u can move (1(n), 0(y)) in specified direction
if u can move
see if at GOAL(done if u are)
update screen (move the man)
beep and indicate "error" (wall)
Cleanup & Bye Bye
Render the maze
1. Define the data structure:
maze DB 1,1,1,1,1,1,1,1,1,1,1,1
MCOL = 12 ; # columns in maze
MROW = ($ - maze)/ MCOL ; # rows in maze
2. Setup a POINTER (lea) to the maze
Setup counters to loop thru the maze.
Set the screen coordinates.
3. Use the pointer to identify the next element in the data structure.
Using that pointer, write either a wall character or a space.
Remember that at the end of each row, you must also write a CR/LF.
May use PUTC to write the character.
4. After each character is written:
update the screen position and
update the pointer to the maze data.
5. Goto Step 3 until you are done.
6. Place avatar into maze and point to it.
7. Hide the cursor.
Superman! *tron blog - like our superman?
Timing bonus - how long to solve