flat assembler
Message board for the users of flat assembler.

Index > DOS > VGA graphics mode $13 - "Bresenham" circle drawing

Author
Thread Post new topic Reply to topic
avcaballero



Joined: 02 Feb 2004
Posts: 192
Location: Madrid - Spain
avcaballero
Someone asked it to me, so i put it here if it could be on interest. Code in masm sintax, sorry, and spanish commets, sorry... I'm in a hurry.

There are many circle algorithms, this one is "Bresenham" one. It uses octants similarity on circles.

It must be changed for screen aspect egg-circle result. For this maybe ellipse-algorithm.

Bye

EDIT (2x) by DOS386 2009-06-04 : enhanced subject, adding note: this post has an attachment visible for registered users only, see also below


Description:
Download
Filename: Circle.asm
Filesize: 7.62 KB
Downloaded: 134 Time(s)

Post 01 Jun 2009, 07:56
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
> Code in masm sintax, sorry, and spanish commets, sorry... I'm in a hurry.

Could you please at least add the binary to your attach ( .ASM + .COM -> ZIP ) ? Maybe later provide FASM version ... when you are no longer in a hurry Wink
Post 01 Jun 2009, 12:04
View user's profile Send private message Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 192
Location: Madrid - Spain
avcaballero
Well, here it is, very simple code... comments in spanish yet... to lazy now...


Description:
Download
Filename: Circle_F.zip
Filesize: 2.36 KB
Downloaded: 109 Time(s)

Post 01 Jun 2009, 13:47
View user's profile Send private message Visit poster's website Reply with quote
rCX



Joined: 29 Jul 2007
Posts: 166
Location: Maryland, USA
rCX
Very cool, thanks for sharing it.

(This is my 100th post! Wink )
Post 01 Jun 2009, 16:02
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
What is it supposed to do ? All what I get is a big black screen with a thin white potato (might be a fault of my electron ray based monitor) outline Wink

http://en.wikipedia.org/wiki/Midpoint_circle_algorithm ???
Post 04 Jun 2009, 13:58
View user's profile Send private message Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 192
Location: Madrid - Spain
avcaballero
Correct. Very simple, only a timid gentleman potato in a dark world. Did i say i would put a demo?. Perhaps everybody did not know an algorithm in assembler to draw one lady potato. Slightly more complicated (yes not very much...) is to feed the potato until it becomes a ring. I do not put the code because I already know that everyone is in masterful level Wink.
Post 04 Jun 2009, 15:51
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2887
Location: [RSP+8*5]
bitRAKE
I wonder if the eight pixel updates could be efficiently integrated with something like:
Code:
  mov [edi],ecx
       mov [edi+ebx*2],ecx
 mov [esi],ecx
       mov [esi+ebp*2],ecx
 lea edi,[edi+ebp*2]
 lea esi,[esi+ebx*2]
 mov [edi],ecx
       mov [edi+ebx*2],ecx
 mov [esi],ecx
       mov [esi+ebx*2],ecx    
(sorry, for the 32-bit code - hope the idea is clear)

Look at Abrash's book "The Zen of Graphics Programming."

Hardenbergh's algorithm from the book, Chapter 18.
Post 05 Jun 2009, 01:54
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.