;ChoongHong Oh TITLE PGM10 :W_ENEMY EXTRN NO_W_ENE : BYTE, GRAPHIC_W_ENE : BYTE EXTRN W_ENE1 : WORD, W_ENE2 : WORD, W_ENE3 : WORD EXTRN W_ENE4 : WORD, W_ENE5 : WORD EXTRN NO_C_ENE : BYTE EXTRN AUX_X : WORD PUBLIC MOVE_W_ENEMY .MODEL SMALL IF1 INCLUDE G_MACRO.ASM ENDIF .CODE DRAW_W_KNIGHT PROC ;this procedure draws a walking knight at (AUX_X, 384) ;by using the right macro according to the graphic number ;input:AUX_X is the x-coordinate of a walking enemy CMP GRAPHIC_W_ENE, 0 ;the graphic number of W_ENE = 0? JE NO_0 JMP NO1 ;no, check if it is 1 NO_0: W_KNIGHT1 AUX_X ;yes, draw W_ENE using W_KNIGHT1 JMP DONE ;this procedure is done NO1: CMP GRAPHIC_W_ENE, 1 ;the graphic number of W_ENE = 1? JE NO_1 JMP NO2 ;no, check if it is 2 NO_1: W_KNIGHT2 AUX_X ;yes, draw W_ENE using W_KNIGHT2 JMP DONE ;this procedure is done NO2: CMP GRAPHIC_W_ENE, 2 ;the graphic number of W_ENE = 2? JE NO_2 JMP NO3 ;no, check if it is 3 NO_2: W_KNIGHT3 AUX_X ;yes, draw W_ENE using W_KNIGHT3 JMP DONE ;this procedure is done NO3: ;the graphic number = 3 W_KNIGHT2 AUX_X ;yes, draw W_ENE using W_KNIGHT2 DONE: RET DRAW_W_KNIGHT ENDP UPDATE_W_ENE PROC ;this procedure checks if a walking knight is used or not ;if it is not used, this procedure does not do anything ;if this is used, this procedure erases a walking knight at the current position ;and updates the coordinate and draw a knight at the new position ;input:AUX_X is the X-coordinate of a walking knight CMP AUX_X, 0FFFFh ;if this W_ENE is not used, JZ DONE_ ;then, check the next W_ENE ERASE_W_KNIGHT AUX_X ;erase this W_ENE ADD AUX_X, 30 ;else move this W_ENE forward CMP AUX_X, 488 ;if this W_ENE has reached the cliff JL DRAW_W_ENE INC NO_C_ENE ;then, increment the number of climbing enemy MOV AUX_X, 0FFFFh ;delete this W_ENE DEC NO_W_ENE ;decrement the number of walking enemy JMP DONE_ ;then check the next W_ENE DRAW_W_ENE: CALL DRAW_W_KNIGHT DONE_: RET UPDATE_W_ENE ENDP MOVE_W_ENEMY PROC ;this procedure updates all the walking knights and the graphic number ;by calling UPDATE_W_ENE procedure, having AUX_X as a parameter PUSH AX ;prepare to call UPDATE_W_ENE for W_ENE1 MOV AX, W_ENE1 ;pass X-coordinate of W_ENE1 MOV AUX_X, AX ;to AUX_X CALL UPDATE_W_ENE MOV AX, AUX_X ;pass back the value of AUX_X MOV W_ENE1, AX ;to X-coordinate of W_ENE1 ;prepare to call UPDATE_W_ENE for W_ENE2 MOV AX, W_ENE2 ;pass X-coordinate of W_ENE2 MOV AUX_X, AX ;to AUX_X CALL UPDATE_W_ENE MOV AX, AUX_X ;pass back the value of AUX_X MOV W_ENE2, AX ;to X-coordinate of F_ENE2 ;prepare to call UPDATE_W_ENE for W_ENE3 MOV AX, W_ENE3 ;pass X-coordinate of W_ENE3 MOV AUX_X, AX ;to AUX_X CALL UPDATE_W_ENE MOV AX, AUX_X ;pass back the value of AUX_X MOV W_ENE3, AX ;to X-coordinate of W_ENE3 ;prepare to call UPDATE_W_ENE for W_ENE4 MOV AX, W_ENE4 ;pass X-coordinate of W_ENE4 MOV AUX_X, AX ;to AUX_X CALL UPDATE_W_ENE MOV AX, AUX_X ;pass back the value of AUX_X MOV W_ENE4, AX ;to X-coordinate of W_ENE4 ;prepare to call UPDATE_W_ENE for W_ENE5 MOV AX, W_ENE5 ;pass X-coordinate of W_ENE5 MOV AUX_X, AX ;to AUX_X CALL UPDATE_W_ENE MOV AX, AUX_X ;pass back the value of AUX_X MOV W_ENE5, AX ;to X-coordinate of W_ENE5 ;change the graphic number CMP GRAPHIC_W_ENE, 3 ;if the graphic number is 3, JE CLEAR ;then, clear it INC GRAPHIC_W_ENE ;else, increment it by 1 JMP END_ CLEAR: MOV GRAPHIC_W_ENE, 0 ;clear the graphic number END_: POP AX RET MOVE_W_ENEMY ENDP END