Skip to content

Maze Model Buffer

Benoît de Keyn edited this page Dec 11, 2023 · 1 revision

Function Name

BuildMazeModelBuffer

Description

The maze model buffer is a clone of the original Maze Model, here to be modified during the game, by deleting pellets. Each time pacman eats a pellet, the hexa code of the pellet's tile in this buffer, is replaced by the hexa code of the background tile. Objectively, this function create a 25 by 40 array of bytes, each byte being the hexa code of a maze's tile. This function write the maze model buffer in the bss section.

Parameters:

This function needs to reserve the size of the buffer in the bss section. This function needs to include the heap library.

Usage Example:

The function which clones the MazeModel into the bss section :

BuildMazeModelBuffer:
; clone the MazeModel to be modified while keeping the original

    ;set the destination 'es:di'
    push ds
    pop es
    mov di, MazeModelBuffer

    ;set the source 'ds:si'
    mov si, MazeModel

    mov cx, MAZE_HEIGHT*MAZE_WIDTH
    rep movsb

    ret

Important Notes

You only need to call this function once at the beginning of the program. This function is needed to detect which pellets have been eated or not.

Test Cases

Author:

Benoît DE KEYN

Clone this wiki locally