News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Cards game

Started by wheresthatcamaro, December 08, 2010, 04:32:10 PM

Previous topic - Next topic

wheresthatcamaro

So I've finally formatted the card itself (I know I took the more monotonous method, but it makes a pretty rectangle nontheless), now I need help using the template to make each and every card.  I broke up all the dashes to accept a 2 character card symbol in both the upper left corner and lower right corner.  I'm looking for code to complete my project, just some detailed syntax and logic to help me on my way.  Thank you!
TITLE Card Template

INCLUDE Irvine32.inc

.data

prompt  BYTE " -------- ",0
prompt2 BYTE "|",0
prompt3 BYTE "      |",0
prompt4 BYTE "|        |",0
prompt5 BYTE "|        |",0
prompt6 BYTE "|        |",0
prompt7 BYTE "|      ",0
prompt8 BYTE "|",0
prompt9 BYTE " -------- ",0     

.code
main PROC

   mov   edx,OFFSET prompt
   call   WriteString
   call   Crlf
   mov   edx,OFFSET prompt2
   call   WriteString   
   mov   edx,OFFSET prompt3
   call   WriteString
   call   Crlf
   mov   edx,OFFSET prompt4
   call   WriteString
   call   Crlf
   mov   edx,OFFSET prompt5
   call   WriteString
   call   Crlf
   mov   edx,OFFSET prompt6
   call   WriteString
   call   Crlf
   mov   edx,OFFSET prompt7
   call   WriteString
   mov   edx,OFFSET prompt8
   call   WriteString
   call   Crlf
   mov   edx,OFFSET prompt9
   call   WriteString
   call   Crlf
   
   call   WaitMsg         ; "Press any key..."
   
   exit
main ENDP
END main

dedndave

make a PROC that draws a card
write it so that it may have any face value and be located anywhere on the screen
for a beginner, it may be a good idea to split those up, so...

1) make it a PROC

2) make it so it can have any face value
the value should be passed to the PROC as a parameter
you can pass it on the stack or in a register

3) make it so it will locate it anywhere on the screen
one way is to use X-Y coordinates
the X-Y coordinates should be passed to the PROC as a parameter
again, pass it on the stack or in register(s)

it will help if you can either use the same PROC or a seperate one to undraw a card, too

once you have that running, it is a matter of playing black jack   :P

dedndave

you might start out with a proc that can just place a single character on the screen
make it so the character and location are passable parameters
then, use that to build on


http://msdn.microsoft.com/en-us/library/ms686025%28v=vs.85%29.aspx

dedndave

also - it would be easier for us to help you if you used masm32.lib instead of Kip's lib
nothing bad about Kip - he's a good guy   ThumbsUp
but - in here, we are all familiar with masm32 library and macros

dedndave

well - you can do that, but it is over-complicating it
it would certainly be faster
you aren't really trying to write fast code yet
you just want to get a grasp on the basics and get it to work