This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
CobyWalker


Newbie


Joined: 03 Jul 2008
Posts: 22

Posted: 22 Aug 2008 01:14:39 pm    Post subject:

How would I draw a line?

Coordinates:
Point1=2,14
Point2=6,25

Is there a Call or do I have to make a Routine?

Thanks


Last edited by Guest on 25 Aug 2008 07:54:22 pm; edited 1 time in total
Back to top
DigiTan
Unregistered HyperCam 2


Super Elite (Last Title)


Joined: 10 Nov 2003
Posts: 4468

Posted: 22 Aug 2008 01:27:24 pm    Post subject:

Badja (maker of Lotus Turbo and Crates 3D) has a clipped linedraw routine that works along those lines. I think it was used in Shadow of the Narkemen. Or one like it.
Back to top
fourchanb


Advanced Newbie


Joined: 24 Sep 2006
Posts: 93

Posted: 22 Aug 2008 01:47:26 pm    Post subject:

There's also a romcall that does the same, but it's probably a lot slower.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 22 Aug 2008 02:21:13 pm    Post subject:

I don't know about Badja's routine, but the one used in MirageOS doesn't work all that great for diagonal lines (the result has a hanging pixel on one end). The bcall isn't that bad if speed isn't a huge priority.
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 22 Aug 2008 04:08:53 pm    Post subject:

I thought Patai's Gergely was the best from the description.

http://www.ticalc.org/archives/files/fileinfo/234/23429.html


I, myself, have no idea how to draw a line without floating point numbers. :\


Last edited by Guest on 22 Aug 2008 04:11:27 pm; edited 1 time in total
Back to top
CobyWalker


Newbie


Joined: 03 Jul 2008
Posts: 22

Posted: 22 Aug 2008 05:47:55 pm    Post subject:

Sorry couldn't get either one to work.

Im using the Ti-84+ Native not Ion or MirageOs.

Also using LateNite.


Last edited by Guest on 22 Aug 2008 05:48:26 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 22 Aug 2008 06:59:46 pm    Post subject:

I suggest using the bcall in my signature unless in a speed-critical section of code, you'll save space.
Back to top
Liazon
title goes here


Bandwidth Hog


Joined: 01 Nov 2005
Posts: 2007

Posted: 22 Aug 2008 07:49:19 pm    Post subject:

Brensenham is a good read. drawing lines is more about slope, and fortunately we don't have to worry about antialiasing too much on our b/w screens ^^
Back to top
CobyWalker


Newbie


Joined: 03 Jul 2008
Posts: 22

Posted: 22 Aug 2008 08:16:55 pm    Post subject:

What Registers do I use for bcall(_DarkLine)?
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 22 Aug 2008 09:17:49 pm    Post subject:

TI-83 Plus System Routines is useful in these cases. Smile
Back to top
tr1p1ea


Elite


Joined: 03 Aug 2003
Posts: 870

Posted: 22 Aug 2008 10:18:32 pm    Post subject:

Since you're interested in 3D stuff, i would suggest against using the bcall.

I would use badja's clipped line routine for now:

http://www.ticalc.org/archives/files/fileinfo/191/19192.html
Back to top
CobyWalker


Newbie


Joined: 03 Jul 2008
Posts: 22

Posted: 23 Aug 2008 04:50:45 pm    Post subject:

Thanks,
but this is the same one that DigiTan posted.

How do I get this to work?

Also im not using Ion.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 23 Aug 2008 05:05:29 pm    Post subject:

do a #include "linedraw.inc" at the end of your program and then call the routine.
Back to top
CobyWalker


Newbie


Joined: 03 Jul 2008
Posts: 22

Posted: 23 Aug 2008 06:57:20 pm    Post subject:

I need the ionGetPixel Code.
Because, in the Asm code it says "CALL ionGetPixel"

Since im doing a native program I need this.
Back to top
lafferjm


Member


Joined: 02 Aug 2006
Posts: 169

Posted: 23 Aug 2008 10:48:55 pm    Post subject:

Don't know if it is the same as ions but there is one in the 28 days tutorial.

Link: http://dragonfire.unitedti.org/asmin28/lesson/day24.html and the routine is about half way down the page.
Back to top
Madskillz


Active Member


Joined: 02 Jan 2004
Posts: 608

Posted: 24 Aug 2008 09:06:31 pm    Post subject:

I dont know if you wanna use this but I have used the bcall(_iline)


Code:
   ld b, 0    ;x1 coord
   ld c, 62  ;y1 coord
   ld d, 94  ;x2 coord
   ld e, 62  ;y2 coord
   ld h, 1    ; 1 for dark line, 0 for light, 2 invert
   bcall(_iline)


that should draw you a line
Back to top
asdf


Advanced Newbie


Joined: 17 Aug 2008
Posts: 73

Posted: 25 Aug 2008 02:09:16 am    Post subject:

If you need any of ion's functions, just download ion, as it includes the source. Just look up the ionf.z80 file and all the routines are defined there.

ionGetPixel is:

Code:
;-----> Get pixel information
; input:   e=y coordinate
;  a=x coordinate
; output:   a holds data for pixel (e.g. %00100000)
;  hl->byte where pixel is on the gbuf
getPixel:
   ld   d,$00
   ld   h,d
   ld   l,e
   add   hl,de
   add   hl,de
   add   hl,hl
   add   hl,hl
   ld   de,gbuf
   add   hl,de
   ld   b,$00
   ld   c,a
   and   %00000111
   srl   c
   srl   c
   srl   c
   add   hl,bc
   ld   b,a
   inc   b
   ld   a,%00000001
getPixelLoop:
   rrca
   djnz   getPixelLoop
   ret
Although, feel free to use another getPixel routine (or better yet, try writing your own!) so long as its parameters match what your linedrawing routine requires.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement