Jump to content
IGNORED

a course : graphics .... xio draw, fill works, plot ?


funkheld

Recommended Posts

These should really go in the programming section.

 

Do you have the OS Manual? It has the info you need. It's online in PDF in various places (I had a thread with it in, but chances are the site doesn't exist anymore).

 

Plot is essentially just a PUT CHARACTER. First you set the COLCRS and ROWCRS to where the pixel is to go.

If you just keep doing Put Chr, the pixels go left to right. Clear screen and <EOL> function as normal.

 

Draw line and Fill come under CIO Special commands. For Draw, you set NEWROW/NEWCOL.

 

You don't necessarily need to use IOCB #6 like Basic does, I guess a good implentation might be to use it as default but allow others if specified.

 

I don't have all the info in front of me, but could get it if you can't find an OS manual.

Link to comment
Share on other sites

Draw command is $11. I think the info I posted re Newrow/Newcol is wrong. The handler maintains the Old/New variables, so you should just set Colcrs/Rowcrs, plot the point then set them again to the end point of the line then call with the Draw command.

 

Fill command is $12.

Link to comment
Share on other sites

I'm not sure what you're after. XIO 18,#6,0,0,"S:" is a XIO drawto fill command.

 

Here's a little drawto program in Atari BASIC

 

10 GRAPHICS 7

12 SETCOLOR 4,0,15

15 CC=79:CR=44

16 TC=79:TR=0

17 RC=125:RR=70

18 LC=34:LR=70

92 COLOR 2:SETCOLOR 1,6,4

100 PLOT RC,RR

110 DRAWTO CC,CR

120 DRAWTO CC,CR

130 POSITION LC,LR

140 POKE 765,2:XIO 18,#6,0,0,"S:"

142 SETCOLOR 0,3,4:COLOR 1

144 MC=50

150 PLOT CC,CR:DRAWTO TC,TR:DRAWTO TC,TR:POSITION MC,CR:POKE 765,1:XIO 18,#6,0,0,"S:"

160 PLOT CC,CR:DRAWTO LC,LR:DRAWTO LC,LR:POSITION MC,CR:XIO 18,#6,0,0,"S"

170 MC=107

172 SETCOLOR 2,12,2:COLOR 3:POKE 765,3

180 PLOT MC,CR:DRAWTO TC,TR:DRAWTO TC,TR:POSITION CC,CR:XIO 18,#6,0,0,"S:"

190 PLOT RC+1,RR:DRAWTO MC,CR:DRAWTO CC,CR:POSITION RC,RR:XIO 18,#6,0,0,"S:"

 

Makes this:post-21816-0-18946700-1326431181_thumb.png

The .BAS file

XIODRAW.zip

Edited by russg
Link to comment
Share on other sites

XIO calls CIOV allowing the program to specify IOCB#,Aux1, Aux2, and command.

 

It can serve as a good example of a calling sequence since any other parameters have to be Poked in.

 

Practically all the other file and graphics statements use CIO too, but don't serve well for examples because all the grunt work happens behind the scenes.

 

Doing XIO stuff in Assembler - easy. IOCB *16 goes in register X, the other stuff gets stored in the IOCB.

 

XIO is only so useful though, no good for Buffer_Length=0 stuff where the data is passed via A.

 

I should add to this, in the spirit of the original request:

 

The OS Fill is pretty useless, very simple algorithm with no stacking mechanism.

Providing a flood fill would be a good inclusion to any language, but the stack required for complex fills could be potentiall enormous.

 

The diamond fill algorithm is slower, but much less costly in stack space. IIRC it comes to something like 4 X/Y entries * <max resolution used> - so under 2K or so for most modes, somewhat bigger for Graphics 8 since X co-ords take 2 bytes.

Edited by Rybags
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...