Recent Posts

Pages: [1] 2 3 ... 10
The Campus / Division and the relationship with registers
« Last post by Jbarrera on Today at 03:45:16 PM »
Hello all,

I know that this may be trivial to many programmers on here and I do apologize. I am just having some trouble understanding the relationship between the registers and division.

currently, I am working on a piece of code that will convert a numeric value into an ASCII character to be displayed on the screen.

I have a general idea of how to do it. The steps I plan to take are the following

1. Take the number I plan to convert to ascii and divide it by ten
2. take the remainder and save it to an array (keep doing this until the whole number is in the array - backwards most likely)
3. add the numbers in the array by the ascii char for '0 to convert it to the numerical representation of "said" number.
4. print them out backwards from the array to put them back in order
5. use a write routine to print out the values to screen.

So an example:
Code: [Select]
;other important stuff


    PutDataHere  byte      8 dup(?)
    val1            word     356
    divisor          byte      10
    temp         byte      ?    ;same problem is I use word


mov ax, val1
mov bl,divisor
idiv bl
lea esi, PutDataHere
mov [esi],AH
inc esi
mov temp,AL
mov ax, temp ;datasize conflict

main PROC

main END

END main

So my questions:

1. does dividing ax always result with the answer in AL and AH, where AH is the remainder
2. what about dividing EAX or AH, do they always default to the same registers, or how is that determined.
3. How can I keep dividing a value to keep splitting it up
        - in the above example, I want to divide 356 by 10 to get 35.6 and save the six, I then want to loop back and divide 35 by 10 to get 3.5 and save the 5 then finally 3/10 to get .3  and save the 3.

I understand that a 16-bit number once divided will result in an 8-bit answer and remainder, so how can I take the 8-bit answer and divide it again without having a size conflict.

Once again this may be very simple for some, but I am a very visual learner and sometimes I need things explained like a 5th grader :(

thank you.

The Campus / Calling Convention Conceptual Help
« Last post by Mondragon on Today at 02:35:53 PM »
Hi all,

So I've been getting deeper into asm lately and I have a question - from a purely assembler programmer's standpoint, do calling conventions even need to exist? In other words, when I disassemble a program written by a compiler, it follows something like cdecl, fastcall, etc... And it may have your standard push ebp, mov ebp, esp, sub esp, 0E4h .....
push ebp
mov ebp, esp
sub esp, 0E4h
 and then at the end of the routine,

pop     eax
pop     edx
pop     edi
pop     esi
pop     ebx
mov     esp, ebp
pop     ebp

However, I've noticed that when I write plain assembler or read other people's plain-old assembly programs, there is no need for the whole stack clean-up/set-up stuff and in fact, there are labels used to track where "routines" are, etc....

Sorry for my ignorance, but if someone who is experienced with all of this could elaborate and explain that would be very helpful. Thank you.
The Laboratory / Re: Fun with Pixel Shaders and maths
« Last post by felipe on Today at 02:25:58 PM »
Nice!  :icon14:
The Campus / Re: joke
« Last post by jj2007 on Today at 02:09:20 PM »
ps: JJ, please send me the check to the same bank account  :greenclp:

Back on topic :t
The Campus / Re: joke
« Last post by hutch-- on Today at 10:28:36 AM »

Now consistent with my previous assertion, if your taste in Editor's does not fit into the Blonde - Brunette distinction, walk on the wild side, live dangerously, try out a redhead. Its like a kid playing with matches, its risky but fun.  :P
The Laboratory / Re: Fun with Pixel Shaders and maths
« Last post by Siekmanski on Today at 08:27:20 AM »
I also converted this shader some days ago.  :biggrin:
I can imagin you want to do the GLSL to HLSL conversion yourself but, if you want the HLSL code for this shader then let me know.
The Campus / Re: joke
« Last post by LordAdef on Today at 07:24:56 AM »
in RichMasm´s defense:

I like the freedom to colour things on my own way, and mainly in places I´m currently working on.

RichMasm has many great features. Having said that, Many of them are hidden and I believe Jochen should spend some of his time improving RM´s GUI. But I know his main focus is actually masmBasic. if he wanted to work on RichMasm GUI, it would certainly become a much more used editor than it is today. Regardless of that, it´s what I use on a daily basis.

ps: JJ, please send me the check to the same bank account  :greenclp:
The Laboratory / Re: Fun with Pixel Shaders and maths
« Last post by caballero on Today at 07:03:25 AM »
> We love pixel shaders
Yes  :biggrin:

A sea scape made by Alexander Alekseev aka TDM here, where you can find its source code too. I only translated to Siekmanski's PSC. I have to improve the sun reflections, the original code is right.
MasmBasic & the RichMasm IDE / Re: my 100% Assembly game development
« Last post by LordAdef on Today at 06:47:27 AM »
thanks Caballero and Daydreamer,

now that's odd, we have the game stalling in some win8 and some win7 but not on every one. hmm..damn it  :icon_redface:
MasmBasic & the RichMasm IDE / Re: my 100% Assembly game development
« Last post by LordAdef on Today at 06:44:16 AM »
hi HSE, cheers my friend! In fact this is not a problem. Since I'm working on this new engine, there is now the need to have image masks for all assets, which I still didn't bother to do it. Before I was getting away without this extra payload. Now I am going to need two imgs for each stuff, and "AND" the two to create the transparency. I'm slowly doing this in the free time. But I am looking for someone to do all the art for this game.
Pages: [1] 2 3 ... 10