Drawing a Circle on a 286

?

?# Keyboard Navigation

## Global Keys

[, < / ], > Jump to previous / next episode

W, K, P / S, J, N Jump to previous / next timestamp

t / T Toggle theatre / SUPERtheatre mode

V Revert filter to original state Y Select link (requires manual Ctrl-c)## Menu toggling

q Quotes
r References
f Filter
y Link
c Credits
## In-Menu and Index Controls

## Quotes and References Menus and Index

Enter Jump to timestamp

## Quotes, References and Credits Menus

o Open URL (in new tab)
## Filter Menu

x, Space Toggle category and focus next

X, ShiftSpace Toggle category and focus previous

v Invert topics / media as per focus## Filter and Link Menus

z Toggle filter / linking mode
## Credits Menu

Enter Open URL (in new tab)

W, K, P / S, J, N Jump to previous / next timestamp

t / T Toggle theatre / SUPERtheatre mode

V Revert filter to original state Y Select link (requires manual Ctrl-c)

a

w

s

s

d

h
j
k
l

←

↑

↓

↓

→

Esc Close menu / unfocus timestamp

X, ShiftSpace Toggle category and focus previous

v Invert topics / media as per focus

⏫

Previous: 'CRTP and Library Design'

⏫

2:11Upgrade remedybg to 0.2.4.2

🗹

2:11Upgrade remedybg to 0.2.4.2

🗹

2:11Upgrade remedybg to 0.2.4.2

🗹

5:40The "free" aspects of drawing a circle on a 286: the centre and cardinal radius points

🖌

5:40The "free" aspects of drawing a circle on a 286: the centre and cardinal radius points

🖌

5:40The "free" aspects of drawing a circle on a 286: the centre and cardinal radius points

🖌

8:10Our target requirements: no floating point, wide instructions or threading; but branching is fine

🖌

8:10Our target requirements: no floating point, wide instructions or threading; but branching is fine

🖌

🖌

11:10Efficiently computing the circle's arc

🖌

11:10Efficiently computing the circle's arc

🖌

11:10Efficiently computing the circle's arc

🖌

26:13Storing the error value, x and y

🖌

26:13Storing the error value, x and y

🖌

26:13Storing the error value, x and y

🖌

31:55Plotting a mere eighth of the circle

🖌

31:55Plotting a mere eighth of the circle

🖌

31:55Plotting a mere eighth of the circle

🖌

37:11Create bcircle.cpp (from "Bresenham Circle") and create a pixel grid to contain our circle

🖌

🖮

37:11Create bcircle.cpp (from "Bresenham Circle") and create a pixel grid to contain our circle

🖌

🖮

37:11Create bcircle.cpp (from "Bresenham Circle") and create a pixel grid to contain our circle

🖌

🖮

40:10Build and run bcircle to see our pixel grid

🏃

🖮

40:10Build and run bcircle to see our pixel grid

🏃

🖮

40:10Build and run bcircle to see our pixel grid

🏃

🖮

40:49Reduce the size of our pixel grid to 32×32 characters

🖮

40:49Reduce the size of our pixel grid to 32×32 characters

🖮

40:49Reduce the size of our pixel grid to 32×32 characters

🖮

41:04Check out our smaller pixel grid

🏃

41:04Check out our smaller pixel grid

🏃

41:04Check out our smaller pixel grid

🏃

41:19Implement our error-based circle drawing routine

🖮

41:19Implement our error-based circle drawing routine

🖮

41:19Implement our error-based circle drawing routine

🖮

48:44Check out our circle, to find that it is positioned incorrectly

🏃

48:44Check out our circle, to find that it is positioned incorrectly

🏃

48:44Check out our circle, to find that it is positioned incorrectly

🏃

48:51Fix our routine to plot the circle around its centre

🖮

48:51Fix our routine to plot the circle around its centre

🖮

48:51Fix our routine to plot the circle around its centre

🖮

48:57Check out our circle, one eighth of it

🏃

48:57Check out our circle, one eighth of it

🏃

48:57Check out our circle, one eighth of it

🏃

49:32Make our routine plot our eighth of the circle around the entire circumference

🖮

49:32Make our routine plot our eighth of the circle around the entire circumference

🖮

49:32Make our routine plot our eighth of the circle around the entire circumference

🖮

50:05Check out our fuller circle

🏃

50:05Check out our fuller circle

🏃

50:05Check out our fuller circle

🏃

50:11Prevent our routine from plotting the pixel grid's centre point

🖮

50:11Prevent our routine from plotting the pixel grid's centre point

🖮

50:11Prevent our routine from plotting the pixel grid's centre point

🖮

50:16Check out our fuller circle

🏃

50:16Check out our fuller circle

🏃

50:16Check out our fuller circle

🏃

50:24Plot the initial pixel

🖮

50:24Plot the initial pixel

🖮

50:24Plot the initial pixel

🖮

50:32Check out our perfect circle

🏃

50:32Check out our perfect circle

🏃

50:32Check out our perfect circle

🏃

50:39Optimise our routine, using one pointer initialised at the circle's centre in lieu of two stored Cx and Cy values

🖮

50:39Optimise our routine, using one pointer initialised at the circle's centre in lieu of two stored Cx and Cy values

🖮

🖮

54:31Check out our same circle

🏃

54:31Check out our same circle

🏃

54:31Check out our same circle

🏃

54:41Consider how to remove the eight integer multiplies by the WIDTH

54:41Consider how to remove the eight integer multiplies by the WIDTH

54:41Consider how to remove the eight integer multiplies by the WIDTH

58:25Temporarily make our routine test abs(E0) < abs(E1)

🖮

58:25Temporarily make our routine test abs(E0) < abs(E1)

🖮

58:25Temporarily make our routine test abs(E0) < abs(E1)

🖮

58:46Check out our identical circle

🏃

58:46Check out our identical circle

🏃

58:46Check out our identical circle

🏃

58:55Revert that -E0 < E1 test

🖮

58:55Revert that -E0 < E1 test

🖮

58:55Revert that -E0 < E1 test

🖮

59:07See that all remains identical

🏃

59:07See that all remains identical

🏃

59:07See that all remains identical

🏃

59:10Continue to consider how to remove the eight integer multiplies by the WIDTH

59:10Continue to consider how to remove the eight integer multiplies by the WIDTH

59:10Continue to consider how to remove the eight integer multiplies by the WIDTH

1:00:20Sully the WIDTH and HEIGHT so that they are not a power of two

🖮

1:00:20Sully the WIDTH and HEIGHT so that they are not a power of two

🖮

1:00:20Sully the WIDTH and HEIGHT so that they are not a power of two

🖮

1:02:12Ruminate on our circle drawing routine

1:02:12Ruminate on our circle drawing routine

1:02:12Ruminate on our circle drawing routine

1:03:22Consider the WIDTH multiply to have potential for improvement

1:03:22Consider the WIDTH multiply to have potential for improvement

1:03:22Consider the WIDTH multiply to have potential for improvement

1:04:00Try to remove the Ep += 1 from the equation

🖮

1:04:00Try to remove the Ep += 1 from the equation

🖮

1:04:00Try to remove the Ep += 1 from the equation

🖮

1:04:43Check out our (different) circle

🏃

1:04:43Check out our (different) circle

🏃

1:04:43Check out our (different) circle

🏃

1:04:50Reinstate the Ep += 1

🖮

1:04:50Reinstate the Ep += 1

🖮

1:04:50Reinstate the Ep += 1

🖮

1:07:09Try to negate X the whole way through

🖮

1:07:09Try to negate X the whole way through

🖮

1:07:09Try to negate X the whole way through

🖮

1:08:17Check out our same circle

🏃

1:08:17Check out our same circle

🏃

1:08:17Check out our same circle

🏃

1:08:37Assess our options, with X negated, and try plotting X and Y pixels from different eights of the circle

🖮

1:08:37Assess our options, with X negated, and try plotting X and Y pixels from different eights of the circle

🖮

🖮

1:13:31Check out our barely-plotted circle

🏃

1:13:31Check out our barely-plotted circle

🏃

1:13:31Check out our barely-plotted circle

🏃

1:13:35Try looping while X <= (R / 2)

🖮

1:13:35Try looping while X <= (R / 2)

🖮

1:13:35Try looping while X <= (R / 2)

🖮

1:14:02Check out our big X

🏃

1:14:02Check out our big X

🏃

1:14:02Check out our big X

🏃

1:14:06Continue to try plotting X and Y pixels from different eights of the circle

🖮

1:14:06Continue to try plotting X and Y pixels from different eights of the circle

🖮

1:14:06Continue to try plotting X and Y pixels from different eights of the circle

🖮

1:17:16Plotting X and Y pixels from different eights of the circle

🖌

1:17:16Plotting X and Y pixels from different eights of the circle

🖌

1:17:16Plotting X and Y pixels from different eights of the circle

🖌

1:18:41Understanding why our X / Y plotting on different eighths doesn't work

1:18:41Understanding why our X / Y plotting on different eighths doesn't work

1:18:41Understanding why our X / Y plotting on different eighths doesn't work

1:21:20Midpoint^{1} and Bresenham's circle drawing algorithm^{2}

📖

1:21:20Midpoint^{1} and Bresenham's circle drawing algorithm^{2}

📖

1:21:20Midpoint^{1} and Bresenham's circle drawing algorithm^{2}

📖

1:23:22Temporarily make our routine always increment the Y

🖮

1:23:22Temporarily make our routine always increment the Y

🖮

1:23:22Temporarily make our routine always increment the Y

🖮

1:23:48Check out our circle with the Y always incrementing

🏃

1:23:48Check out our circle with the Y always incrementing

🏃

1:23:48Check out our circle with the Y always incrementing

🏃

1:24:36Revert our routine to not always increment the Y

🖮

1:24:36Revert our routine to not always increment the Y

🖮

1:24:36Revert our routine to not always increment the Y

🖮

1:24:39Compare our circle

🏃

1:24:39Compare our circle

🏃

1:24:39Compare our circle

🏃

1:24:41Increase the radius of our circle

🖮

1:24:41Increase the radius of our circle

🖮

1:24:41Increase the radius of our circle

🖮

1:24:50Check out our larger circle

🏃

1:24:50Check out our larger circle

🏃

1:24:50Check out our larger circle

🏃

1:25:17Leave further optimisation as an exercise for the reader

1:25:17Leave further optimisation as an exercise for the reader

1:25:17Leave further optimisation as an exercise for the reader

1:26:40Check out the register count of the Intel 386^{3} and 286^{4}^{,5}^{,6} and suggest writing this routine in x86 assembly targeted at DOSBox's emulation of a 286^{7}

📖

1:26:40Check out the register count of the Intel 386^{3} and 286^{4}^{,5}^{,6} and suggest writing this routine in x86 assembly targeted at DOSBox's emulation of a 286^{7}

📖

📖

1:32:29Wonder who is responsible for the message truncation

1:32:29Wonder who is responsible for the message truncation

1:32:29Wonder who is responsible for the message truncation

2:00:31Recommend The ryg blog^{11}

📖

2:00:31Recommend The ryg blog^{11}

📖

2:00:31Recommend The ryg blog^{11}

📖

2:22:52Understanding a Skylake core^{12}

📖

2:22:52Understanding a Skylake core^{12}

📖

2:22:52Understanding a Skylake core^{12}

📖

2:33:51Branch-prediction in the context of a Skylake core^{13}

📖

2:33:51Branch-prediction in the context of a Skylake core^{13}

📖

2:33:51Branch-prediction in the context of a Skylake core^{13}

📖

2:38:48Understanding the Skylake CALL instruction^{14}

📖

2:38:48Understanding the Skylake CALL instruction^{14}

📖

2:38:48Understanding the Skylake CALL instruction^{14}

📖

2:52:22Recommend Fabian's entire YouTube channel^{17}

📖

2:52:22Recommend Fabian's entire YouTube channel^{17}

📖

2:52:22Recommend Fabian's entire YouTube channel^{17}

📖

2:53:01Wind down

2:53:01Wind down

2:53:01Wind down

⏬

Next: 'Modern x64 Architectures and the Cache'

⏬