Click to See Complete Forum and Search --> : Game in Assembly (Need ideas)


blinksumgreen
January 27th, 2009, 05:43 PM
I have to design a game and implement it in Assembly. I can use a high level language for a GUI, but the majority of the programming has to be done in Assembly. All that I have to go off is that hangman would be to simple. Does anyone have any ideas of what I could do?

ckweius
February 15th, 2009, 09:46 PM
Start with the skeleton code:

;###########################################################################
;###########################################################################
;
; This is the main portion of code. It has WinMain and performs all
; of the management for the game.
;
; - WinMain()
; - WndProc()
; - Main_Loop()
; - Game_Init()
; - Game_Main()
; - Game_Shutdown()
;
;
;###########################################################################
;###########################################################################


;###########################################################################
;###########################################################################
; THE COMPILER OPTIONS
;###########################################################################
;###########################################################################

.386
.MODEL flat, stdcall
OPTION CASEMAP :none ; case sensitive

;###########################################################################
;###########################################################################
; THE INCLUDES SECTION
;###########################################################################
;###########################################################################

;==================================================
; This is the include file for the Windows structs,
; unions, and constants
;==================================================
INCLUDE Includes\Windows.inc

;================================================
; These are the Include files for Window calls
;================================================
INCLUDE \masm32\include\comctl32.inc
INCLUDE \masm32\include\comdlg32.inc
INCLUDE \masm32\include\shell32.inc
INCLUDE \masm32\include\user32.inc
INCLUDE \masm32\include\kernel32.inc
INCLUDE \masm32\include\gdi32.inc

;====================================
; The Direct Draw include file
;====================================
INCLUDE Includes\DDraw.inc

;===============================================
; The Lib's for those included files
;================================================
INCLUDELIB \masm32\lib\comctl32.lib
INCLUDELIB \masm32\lib\comdlg32.lib
INCLUDELIB \masm32\lib\shell32.lib
INCLUDELIB \masm32\lib\gdi32.lib
INCLUDELIB \masm32\lib\user32.lib
INCLUDELIB \masm32\lib\kernel32.lib

;=================================================
; Include the file that has our prototypes
;=================================================
INCLUDE Protos.inc

;###########################################################################
;###########################################################################
; LOCAL MACROS
;###########################################################################
;###########################################################################

szText MACRO Name, Text:VARARG
LOCAL lbl
JMP lbl
Name DB Text,0
lbl:
ENDM

m2m MACRO M1, M2
PUSH M2
POP M1
ENDM

return MACRO arg
MOV EAX, arg
RET
ENDM

RGB MACRO red, green, blue
XOR EAX,EAX
MOV AH,blue
SHL EAX,8
MOV AH,green
MOV AL,red
ENDM

hWrite MACRO handle, buffer, size
MOV EDI, handle
ADD EDI, Dest_index
MOV ECX, 0
MOV CX, size
ADD Dest_index, ECX
MOV ESI, buffer
movsb
ENDM

hRead MACRO handle, buffer, size
MOV EDI, handle
ADD EDI, Spot
MOV ECX, 0
MOV CX, size
ADD Spot, ECX
MOV ESI, buffer
movsb
ENDM

;#################################################################################
;#################################################################################
; Variables we want to use in other modules
;#################################################################################
;#################################################################################


;#################################################################################
;#################################################################################
; External variables
;#################################################################################
;#################################################################################


;#################################################################################
;#################################################################################
; BEGIN INITIALIZED DATA
;#################################################################################
;#################################################################################

.DATA

;#################################################################################
;#################################################################################
; BEGIN CONSTANTS
;#################################################################################
;#################################################################################


;#################################################################################
;#################################################################################
; BEGIN EQUATES
;#################################################################################
;#################################################################################

;=================
;Utility Equates
;=================
FALSE EQU 0
TRUE EQU 1


;#################################################################################
;#################################################################################
; BEGIN THE CODE SECTION
;#################################################################################
;#################################################################################

.CODE

start:

;########################################################################
; WinMain Function
;########################################################################


;########################################################################
; End of WinMain Procedure
;########################################################################



;########################################################################
; Main Window Callback Procedure -- WndProc
;########################################################################


;########################################################################
; End of Main Windows Callback Procedure
;########################################################################




;========================================================================
;========================================================================
; THE GAME PROCEDURES
;========================================================================
;========================================================================


;########################################################################
; Game_Init Procedure
;########################################################################


;########################################################################
; END Game_Init
;########################################################################



;########################################################################
; Game_Main Procedure
;########################################################################


;########################################################################
; END Game_Main
;########################################################################



;########################################################################
; Game_Shutdown Procedure
;########################################################################


;########################################################################
; END Game_Shutdown
;########################################################################

;######################################
; THIS IS THE END OF THE PROGRAM CODE #
;######################################
END start


Kevin Choong

NoneOfThem
March 27th, 2009, 08:23 AM
Hi friend!!!

I have the code for one game, the SearMines, in TASM.
If you need tell me.

Bye!!