Thread: questions: Game ideas and assembler

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    questions: Game ideas and assembler

    1. Game ideas:

    Can anyone suggest a completely text-based, non graphical, non RPG / Action type game (ex: tic tac toe) that i could make to test my C++ skills? I cant think of any pure text based games. And im not doing Jeopardy .

    2. can you put multiple lines of assembler into code like this:

    extern "asm" {
    // ASM CODE HERE
    }

    ? Thanks all !
    Do not make direct eye contact with me.

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    249
    non RPG
    Hmm...what about writing a simple battle engine? Those are fun to make, at least more than tic tac toe.
    Well, there are a few things wrong with your code:

    1) It does not work.
    2) It does not work.
    3) It does not work.

    Hope this helps.

  3. #3
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Connect4.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    To mix C and pure assembly modules there are a couple of things to remember.

    • If you are in TASM/MASM and are not using their variable passing macros - you must know the memory model you are coding for.
    • You must know the type of function call you are making - either C or PASCAL. This matters because of the order in which parameters are pushed onto the stack.
    • When using the ARG macro in TASM you absolutely must preserve bp, and restore it prior to returning to the caller. If you do not, C will crash hard when you return.
    • All integral return values are placed in (e)ax and all floating point return values are placed in st(0).
    • All assembly functions to be used with C MUST have an underscore placed in front of them - i.e.: _MyFunc proc
    • All assembly functions must be prototyped in your C module or in a header to be included with your module.


    There are others, but these are the most common mistakes - at least IMO.

    Examples:

    No parameters

    Assembly
    Code:
    public _MyFunc
    _MyFunc    proc
      ...
      ...
      ret
    _MyFunc    endp
    C
    extern "C" MyFunc(void)


    With parameters
    Assembly
    Code:
    public _MyFunc
    
    _MyFunc    proc
    ARG  x:WORD,y:WORD
    
      push  bp
      mov   bp,sp
      ...
      ...
      ret
    _MyFunc    proc
    C
    extern "C" MyFunc(int x,int y);


    AFAIK using extern with asm is not correct. I've never tried it so I'm not positive, but it does not make sense syntactically.

  5. #5
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    I don't think I've ever seen a text based tetris, but there's nothing preventing it from being done. Do it.
    Away.

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    249
    Do it.
    Just do it.
    Well, there are a few things wrong with your code:

    1) It does not work.
    2) It does not work.
    3) It does not work.

    Hope this helps.

  7. #7
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    How bout...

    How bout a maze game... you can try working with AI, collision detection etc.

  8. #8
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    Battleships or a Memory game (flip two matching squares).
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  9. #9
    napKINfolk.com napkin111's Avatar
    Join Date
    Apr 2002
    Posts
    310
    My first *real* game was a breakout-clone, it wasn't text based (I used SDL), but I think it was a really good choice because I learned collision, map loading, input, and some other miscellanious stuff.

    //napKIN

  10. #10
    Registered User
    Join Date
    Mar 2002
    Posts
    249
    How bout a maze game...
    Said completly text based...
    Well, there are a few things wrong with your code:

    1) It does not work.
    2) It does not work.
    3) It does not work.

    Hope this helps.

  11. #11
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Originally posted by funkydude9
    Said completly text based...
    a text based maze game is possible. if you want large mazes graphics would be your best option though.

  12. #12
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    A fun one to program is Life.

    Have a matrix and living cells in it. If a cell is touching less that 2 other cells it dies of isolation, if it is touching more than 4 it dies of overcrowding, and if an empty space touches 3 living cells it is "born."

    kermi3
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  13. #13
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by funkydude9
    Said completly text based...
    www.gametutorials.com has a console (a.k.a.: text-based) maze tutorial (+ another you can get when you buy their cd)

  14. #14
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Quantrizi:

    What's the deal with stealing Silvercord's avatar? I always think you're him. Get a new one.
    Away.

  15. #15
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by blackrat364
    Quantrizi:

    What's the deal with stealing Silvercord's avatar? I always think you're him. Get a new one.
    I didn't steal it from him, I found it on another board...anyways, why should I, it's not copyright infragment, and Silvercord hasn't said anything to me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assembler Language Subroutine
    By John_L in forum Tech Board
    Replies: 9
    Last Post: 03-27-2008, 06:10 PM
  2. Inline Assembler Macros?
    By Aidman in forum C++ Programming
    Replies: 14
    Last Post: 07-15-2003, 05:10 AM
  3. Designing assembler???
    By Silverdream in forum C Programming
    Replies: 4
    Last Post: 06-20-2002, 11:29 AM