I'm looking to understand how to do basic input/output to write a text based game in x86 assembly, simply for the sake of learning of the instruction set and the internals.
I don't want to use stdlib.h or stdio.hin my assembly code unless it involves something complicated like printf, which I'd then call from assembly.
I'd like to learn how to emulate enums and structs if possible. AFAIK writing functions and sending them params is just a case of pushing/popping specific registers on and off the stack and/or manipulating esp using multiples of 4.
How would I do this in x86 using intel syntax?
Update
Sorry, I forgot to specify the target - I'm using Linux.
Example Code - Function prototype implementation omitted for sake of brevity
#include <stdio.h>
#include <stdlib.h>
typedef enum __weapon_type__ {
    weapon_type_sword = 1, 
    weapon_type_spear = 2, 
    weapon_type_knife = 3
} weapon_type;
typedef struct __weapon__ {
    unsigned int damage;
    char*        name;
    weapon_type  type;  
} weapon;
weapon* weapon_create( int damage, char* name, weapon_type type );
void putline( const char* msg );
int main( int argc, char** argv )
{
    unsigned int weapon_selection, weapon_damage;
    weapon_type weptype;
    weapon* player_weapon = NULL;
    char* weapon_name = NULL;
    putline( "Choose your weapon type:\t" );
    putline( "(1) Sword" );
    putline( "(2) Spear" );
    putline( "(3) Knife" );
    while ( weapon_selection > 3 || weapon_selection < 1 )
    {
        scanf( "%u", &weapon_selection );
        switch( weapon_selection )
        {
            case 1:
                weptype = weapon_type_sword;
                break;
            case 2: 
                weptype = weapon_type_spear;
                break;
            case 3:
                weptype = weapon_type_knife;
                break;
            default:
                putline( "ERROR! Please select options 1 - 3\t" );
                break;
        }
    }
    /*do the same thing for weapon_damage and weapon_name, etc.
      Then ask for player name, type of character, blah blah blah.
    */
    player_weapon = weapon_create( weapon_damage, weapon_name, weptype );
    return 0;
}
 
     
    