Results 1 to 4 of 4

Thread: Drawing a box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2004
    Location
    Some where on Earth
    Posts
    98

    Drawing a box

    Hi guys!

    Im facing a problem how to draw a box in the middle of the screen. If the input i entered is 7, then it should draw a box 7x7 in the middle. The calculation should be:

    79-7 = 77/2=36 <---to get the culumn
    24-7 = 17/2 =8.5 <---to get the row

    now for the row, should i use 8 or 9 to get the coordinate? if i do use 8 or 9, will the assembly round it up to 8 or 9? Thanks!
    Anime is what i LIVE for, BREATH for, and DIE for!

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Drawing a box

    Maybe its just that I haven't programmed a line of ASM code longer then I have VB or C (which is about 6 months), but I have no idea what you want help with. Maybe including your code to do this would help?

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2004
    Location
    Some where on Earth
    Posts
    98

    Re: Drawing a box

    Hi «°°phReAk°°»! Thanks for your reply. I haven't write any code to calculate the coordinate for drawing a box in the middle. But im trying to find out how do i round up the row coordinate because it has a double value (8.5). I cant just point the row cursor at 8.5. I need to round it up to 8 or 9 to point the cursor and get (8,36) or (9,36). Once i get the coordinate, i need to print 7 times to the right and 7 times below to draw a box.
    I hope you still get what i meant already. Thanks.
    Anime is what i LIVE for, BREATH for, and DIE for!

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Drawing a box

    All I could find was this. Should round your number out.
    Code:
    sar     eax,cl          ; ?  Arithmetic shift, last bit shifted into carry
    sbb     ebx,ebx         ; U EBX = (Carry) ? -1 : 0
    mov     edx,eax         ; V
    sar     edx,31          ; U EDX = (EAX < 0) ? -1 : 0
    and     ebx,edx         ; U EBX = (Carry && EAX < 0)? -1 : 0
    sub     eax,ebx         ; U
    Hope that helped.

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width