Post Reply 
(42S) challenge: repeat a character N times
01-17-2018, 12:56 PM
Post: #8
RE: (42S) challenge: repeat a character N times
Try and write a program that will draw a horizontal line of n pixels towards the right from the current position (x0,y0), and offer the option of drawing a single-width line or a double-width line. (I'm drawing sudoku grids ;-)
(I put the arrow at the beginning to make it show up on the menu, so that I can see the difference between drawing left, right, up and down..)

>LBL "\->DRAW"

In:
A: char ("x" for single-width, "integral sign" for double-width etc.)
Z: y0
Y: x0
X: N

Out: draws 'char' from (x0,y0) to (x0+n-1,y0)
Y: y0
X: x0+n

Ideally it should also accept (x0,y0) in Y, and return (x0+n,y0) in X. That is not hard at all in this case.

The 'best' way to draw multiple pixels at a time is (I think - but I may be wrong, as I was in the use of XTOA above) using AGRAPH with as many characters as possible in the Alpha register, up to 44. So, if you want to draw a line of 40 pixels, you need to duplicate the character you want to draw 40 times.

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (42S) challenge: repeat a character N times - Werner - 01-17-2018 12:56 PM



User(s) browsing this thread: 1 Guest(s)