# Screen Manipulation

8 messages
Open this post in threaded view
|

## Screen Manipulation

 Is it possible to draw a circle of an arbitrary radius purely using Hack Assembly Language on CPEU Emulator, if so please provide an insight on how you can solve this problem?
Open this post in threaded view
|

## Re: Screen Manipulation

 Administrator Sure, you just need to develop a circle-drawing algorithm in assembly language. Just like any other programming problem, break the problem down into smaller pieces. Ask which of those pieces you could implement in assembly language and set those aside for the time being. For each of the remaining pieces, break it down into smaller pieces. Keep repeating this process until you have gotten everything down to a point where you can do it in assembly language. Then start coding. Do it incrementally so that you can implement and test smaller pieces and put the pieces together to make larger testable pieces until you have it all done. A circle drawing algorithm in assembly is not a trivial undertaking, but it is very doable. In the end, you will likely have an algorithm that will considerably outperform the one in the Screen library, if for no other reason that it doesn't suffer the calling overhead and restrictions imposed by the VM language acting as an intermediary.
Open this post in threaded view
|

## Re: Screen Manipulation

 Thank you for the response, I understand the fact we have to break down a circle algorithm written in a higher language to a Hack Assembly, Doesn't it mean that we have to develop a coordinate system for the screen and handle the pointer according to it, to reach my goal, Essentially speaking, I 'll have to come up with a user-defined screen library to suit my needs?
Open this post in threaded view
|

## Re: Screen Manipulation

Open this post in threaded view
|

## Re: Screen Manipulation

 I have been trying to implementing mid point algorithm for drawing circles, breaking the algorithm/code down i realized the problem of coordinate systems, which is handled in high level languages. By pointers i mean trying to set the M values of the corresponding pixel to 1 to change it to a dark colour. So basically i was implying the mapping to each pixel when i told that. What i m trying to achieve is to draw a circle of arbitrary radius Around center of the cpeu emulator screen. To which i m facing the issue of implementation stumbling on coordinate system definition and pixel mapping according to the developed coordinate system.
Open this post in threaded view
|