Dismiss Notice

Guest,
We are celebrating 14 years since the inception of Se7enSins! Join us in our celebrations!

(ASSEMBLY X86) Tetris

Discussion in 'Game Development' started by yannickky, Sep 18, 2014 with 20 replies and 2,419 views.

  1. yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    Hey guys,

    I'm working on a project for school.
    This being Tetris made in 16bit Assembly x86,
    and I was wondering if there are people out there with more understanding of this than I have.
    I do already have a lot of code (No freebies, I know :smile: ), but I was wondering if somebody could help me with it a little, this means some organizing and helping me go along the right track.

    Greetz.


    Update: After having been working on it for about 70 hours I, in the end, managed to get a working score buffer. The 3 "zero's". It adds up 1 points for every line that is removed, then when it reaches 999 it will spin around and the score will be back a 0 again.

    I did enjoy doing this very much! :smile:. It has thought me a lot about the commands DOS uses. Some of these are how DOS places pixels which can function by being read and written. Also thought me how DOS responds to the input of a keyboard, and how DOS handles such input.

    One of the things which proved to be the biggest challenge is the way in which you can place a block, make it move around and react and respond to you input, which unfortunately I couldn't get to work quite well. I did figure out how the coloring, and removal of complete lines works, and how to make the counter go up, but my brain just cannot comprehend the part of how to move the blocks

    For now I'll put it aside to make time for finishing my Brain**** Assembly x86 interpreter. (Help may be needed ^^), and when I do continue with my Tetris I'll keep this thread updated


    Haven't been doing nothing, so far it looks like this
    [​IMG]
     
    Last edited: Oct 17, 2014
  2. Im4eversmart

    Im4eversmart The hacks are real

    Messages:
    2,098
    Ratings:
    1,669
    Write it in C, compile it, then decompile it to x86 assembly.
     
    • Like Like x 1
  3. OP
    yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    Well, I don't know anything about C to begin with, and I am not allowed to do anything in C unfortunately, but I might have a look at it
     
  4. YYes

    YYes Enthusiast

    Messages:
    177
    Ratings:
    49
    Or, if you knew anything about gcc, you could simply: gcc -S file.c
    The output would be in GNU asm. If you suggested decompiling to produce output in x86_16, then props, I suppose, but I'm not sure how reliable this would be.

    I do like the recommendation, C would be a lot easier to work with, but it would leave you with no understanding of how the assembly works. It would be easiest to write it in NASM or gas, and compile it on your 16-bit system. That would at least make it somewhat portable.

    I don't have much of any experience with asm. I was kind of frustrated when learning it because much of it relies on C's standard libraries. Still a gem, though, I'd love to get into it more.
     
  5. OP
    yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    I have been trying to get it to compile for a couple of days now, I've used GCC which works for intel and at&t. I was able to create the playing field, and now onwards to actually implementing more things into the game, also some string which show the info are place luckily.

    The keyboard is already recognised, I only need to find a way in which the block can be placed, move left/right and them being able to turn.
     
    • Like Like x 1
  6. Drgstr420

    Drgstr420 Enthusiast

    Messages:
    507
    Ratings:
    60
    I feel bad for you :frown:
     
    • Like Like x 1
  7. Forgoten Dynasty

    Forgoten Dynasty Free Sosa #bangbang VIP

    Messages:
    5,919
    Ratings:
    2,441
    Good luck Chris Sawyer.
     
    • Like Like x 3
  8. OP
    yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    Haha Thanks, it'll be just working on it a lot! But the hard work is paying of though

    [​IMG]
     
  9. prancer

    prancer Newbie

    Messages:
    1
    Ratings:
    1
    Ok, do not try to write it in C and then decompile. Obviously. This is not what your professor wants, and he will know.
    It's really not that difficult, just lots of repeating code with a few special cases in there. You got this.
    I'm assuming this is the final project for an assembly class? We made a game called "EatDot". Basically pac man without the enemy. :smile: It took a long time, but I survived. We used NASM, so we were allowed to use some C functions, like scanf and printf! twas a good experience.
     
    • Like Like x 1
  10. Sumo

    Sumo ヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ VIP Retired

    Messages:
    5,409
    Ratings:
    3,071
    I'm not religious at all but I think I might actually pray for you.
     
    • Like Like x 3
  11. OP
    yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    Indeed, it is meant to not be done in C, which I'm not doing either ^^.
    Other than that it is just something people can do to get some extra credit, and I decided to go way overboard and make Tetris on my own. Basically the scoring system is finished now. It goes up to 999 and then it'll flip back over to 0. Now my only challenge will be to get the actual block to spawn and playable within 2 weeks :frown:. So far I haven't had any success with even placing a block, but I reckon I'll be capable of having a block spawned will just be a matter of time.

    Hopefully I can still pull it of though before the deadline, but my life has just been really really busy lately with a lot of assignments and whatnot. I am also working on Raspberry PI, and I am making a "Brain****" assembler, all needs to be finished in 2 weeks, and then there is my usual homework such as Calculus and Object Oriented Programming.[DOUBLEPOST=1412887818][/DOUBLEPOST]
    Than you for this comforting message, I will probably need it (even though I'm not religious as well)
     
  12. Sumo

    Sumo ヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ VIP Retired

    Messages:
    5,409
    Ratings:
    3,071
    Why does it only go to 999 on 16 bit? Actually I'm really confused because you say "16 bit x86 assembly" which makes no sense.
     
  13. OP
    yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    Well the counter is completely separated from being 16 bit, it is divided in 3 integers, which are calculated ^^. I use a score buffer which counts from 000 to 009, then flips over to 010. At 999 it flips back to zero. I was too lazy to make it go up more, but it could easy be done. In fact I can make it any amount of digits long!
     
  14. YYes

    YYes Enthusiast

    Messages:
    177
    Ratings:
    49
    x86 is a complex instruction set architecture with three different word sizes: x86-16, x86, and x86-64.
     
  15. OP
    yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    4 different :wink:, 8, 16, 32 and 64 ^^, but I must admit the size of 8 is rarely used, but it can be used. I only use the 16 at the moment
     
    Last edited: Oct 10, 2014
  16. YYes

    YYes Enthusiast

    Messages:
    177
    Ratings:
    49
    There never was an x86-8, but 8086 was based off of the previous architecture 8080, which was 8 bit. And if you're trying to be finicky, then apparently there are six variants of x86, 16- through 512-bit.
    http://en.wikipedia.org/wiki/X86#x86_registers

    But I digress...

    How goes your project? Care to post the source of what you have so far?
     
    Last edited: Oct 11, 2014
  17. OP
    yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    Agreed to that! Didn't quite read it well enough to see you were talking about registers, my bad. With commands and length it was different, or something like that.
    I will be posting some/if not all of my code online later, since right now it doesn't represent much.
     
  18. imGol2den

    imGol2den Life Goes On!

    Messages:
    1,056
    Ratings:
    396
    Would be very interesting to see some progress on this :smile:
    Have any pictures?
     
  19. OP
    yannickky

    yannickky Enthusiast

    Messages:
    304
    Ratings:
    30
    After having moments of me wanting to throw my laptop through a room full of people, I had decided today that I won't be able to finish this in time for the assignment, my teacher will help me later to finish it, but it won't get me the points for the subject (Will still pass the course though). I am now working on an Assembly X86 Brain**** Interpretor. I will put down some pics in a couple of sec :wink:.

    Updated first post!
     
    • Like Like x 3
    Last edited: Oct 17, 2014
  20. YYes

    YYes Enthusiast

    Messages:
    177
    Ratings:
    49
    This is hard too, dude.
     
    • Like Like x 1

Share This Page