Click to See Complete Forum and Search --> : Drawing a box
RedDevil
Apr 3rd, 2005, 09:22 AM
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!
chemicalNova
Apr 3rd, 2005, 11:02 AM
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
RedDevil
Apr 3rd, 2005, 09:28 PM
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.
chemicalNova
Apr 5th, 2005, 03:47 AM
All I could find was this. Should round your number out.
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.