What's new

(ASSEMBLY X86) Tetris

yannickky

Enthusiast
Messages
304
Reaction score
37
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
 
Last edited:

yannickky

Enthusiast
Messages
304
Reaction score
37
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
 

YYes

Enthusiast
Messages
177
Reaction score
52
Write it in C, compile it, then decompile it to x86 assembly.
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.
 

yannickky

Enthusiast
Messages
304
Reaction score
37
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.
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.
 

prancer

Newbie
Messages
1
Reaction score
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.
 

Sumo

ヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ
VIP
Retired
Messages
5,515
Reaction score
3,443
I'm not religious at all but I think I might actually pray for you.
 

yannickky

Enthusiast
Messages
304
Reaction score
37
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.
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. 
I'm not religious at all but I think I might actually pray for you.
Than you for this comforting message, I will probably need it (even though I'm not religious as well)
 

Sumo

ヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ
VIP
Retired
Messages
5,515
Reaction score
3,443
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.
 

yannickky

Enthusiast
Messages
304
Reaction score
37
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.
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!
 

YYes

Enthusiast
Messages
177
Reaction score
52
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.
x86 is a complex instruction set architecture with three different word sizes: x86-16, x86, and x86-64.
 

yannickky

Enthusiast
Messages
304
Reaction score
37
x86 is a complex instruction set architecture with three different word sizes: x86-16, x86, and x86-64.
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:

YYes

Enthusiast
Messages
177
Reaction score
52
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
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:

yannickky

Enthusiast
Messages
304
Reaction score
37
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?
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.
 

yannickky

Enthusiast
Messages
304
Reaction score
37
Would be very interesting to see some progress on this :smile:
Have any pictures?
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!
 
Last edited:

YYes

Enthusiast
Messages
177
Reaction score
52
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!
This is hard too, dude.
 
Top Bottom