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 Your Projects 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. Project Ideas/Start New Projects => Your Projects
Author Message
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 03 Apr 2007 12:06:34 pm    Post subject:

Dude, "ld de,(hl)" isn't a command. Just do "and (hl)" directly, with no de.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 03 Apr 2007 04:29:14 pm    Post subject:

optimization duly noted and changed. Other then that it works, right?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 03 Apr 2007 04:36:51 pm    Post subject:

It does.

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]bit 2, (hl)
would also work.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 04 Apr 2007 01:14:22 pm    Post subject:

I have made the drawing routine and I get 24 errors when I assemble it. I'm pretty sure it has to do with what I typed, but I can't figure it out for sure. Anyone want to take a look at it?

[attachment=1394:attachment]
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 04 Apr 2007 01:54:50 pm    Post subject:

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld (pixel),0 isn't a real instruction. At least one of the sides of the ld has to have a register there. So you could do something like: [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]xor a then [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld (pixel), a.

Things like [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld a, y_coor should be [font="courier new;font-size:9pt;line-height:100%;color:darkblue"] ld a, (y_coor) - you're not loading the address, you're loading what's at the address, so you need those parentheses. Same for [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld y_coor, a - it should be [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld (y_coor), a.

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld e,x_coor, [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld temp,e, [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld l,y_coor have that plus another problem: you can only use the a register for loading a single byte from memory. For the first part, use the a register instead for those lines; for the second, you can [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld a, (y_coor) and then [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld l, a.

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]sla hl doesn't work. You can't shift a register pair - you have to shift both registers individually. However, for shifting left, you can also do [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]add hl,hl

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]add hl, temp doesn't work either. Even if you could add a constant to hl, this adds the address of temp and not the value stored at temp. And the value stored at temp is one byte, not two, so you can't add it to hl just like that, you have to write special code to do so.

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld (array_base)+(pixl),x_coor is also a problem: if you could do addition like that, why would anyone mess around with instructions like "add" or "sub"? I'd help you with this one, but I really don't understand what you're trying to do.

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]inc (pixl) isn't an instruction either; you need to use a register, or you can [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]inc (hl) (setting hl to the right value first, of course).

A different kind of error is that you're never copying the graph buffer to the screen, so you won't ever see a result of this code. Add a [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]bcall(_GrBufCpy) just before [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]jp keyloop at the end.

Also, I have the suspicion you're making the Draw routine a bit too complicated; what do you want it to do, exactly?

Last edited by Guest on 05 Apr 2007 10:20:07 am; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 04 Apr 2007 02:59:53 pm    Post subject:

draw a line by pressing the number keys and storing those coordinates to an array( at array_base) for later manipulation
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 04 Apr 2007 03:33:23 pm    Post subject:

Okay.

To set a pixel, you can use a bcall:

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld a, (x_coor)
ld b, a
ld a, (y_coor)
ld c, a
bcall(_PointOn)


I think this will automatically update the screen as well. In the future, you could write your own routine (the z80 routines topic is a good start), or use Ion's.
The bcall uses coordinates that start with (0,0) as the lower left corner, though, so you'd need to switch your up and down routines for that.

To add the current coordinates to the array:

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld hl, (pixl)
ld a, (y_coor)
ld (hl), a
inc hl
ld a, (x_coor)
ld (hl), a
inc hl
ld (pixl), hl

Last edited by Guest on 04 Apr 2007 03:39:39 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 04 Apr 2007 04:30:49 pm    Post subject:

(pixl) is only the number of pixels that have been plotted. how would your routine work?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 04 Apr 2007 06:02:33 pm    Post subject:

Oh... I wasn't paying attention and instead accidentally made (pixl) contain the address of where the next pixel would go - so you would initialize it with:
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ld hl, array_base
ld (pixl), hl


This makes adding a pixel easier, but harder to get the number of pixels if you wanted to. (You would subtract array_base and then shift to divide by two)

Last edited by Guest on 05 Apr 2007 02:23:22 pm; edited 1 time in total
Back to top
kermmartian
Site Admin Kemetech


Calc Guru


Joined: 20 Mar 2004
Posts: 1220

Posted: 05 Apr 2007 08:23:23 am    Post subject:

That's correct. hl should be any value between gbuf and gbuf+767.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 05 Apr 2007 10:22:24 am    Post subject:

Wait, what? No, it shouldn't. I think you're missing the point here, Kerm: in this part of the code we're trying to record the coordinates of the pixel plotted, not actually draw the pixel - so the graph buffer has nothing to do with it.
Back to top
kermmartian
Site Admin Kemetech


Calc Guru


Joined: 20 Mar 2004
Posts: 1220

Posted: 06 Apr 2007 06:47:52 am    Post subject:

DarkerLine wrote:
Wait, what? No, it shouldn't. I think you're missing the point here, Kerm: in this part of the code we're trying to record the coordinates of the pixel plotted, not actually draw the pixel - so the graph buffer has nothing to do with it.
[post="100230"]<{POST_SNAPBACK}>[/post]

Misunderstanding, but for a different reason. I didn't realize there was a second page; I was responding to his post about checking the state of a pixel. Smile
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 06 Apr 2007 09:48:10 am    Post subject:

now I got it with no errors, but I can't assemble it. When I try to assemble it, I get "file corrupted". It might be tasm acting up. If anyone has a working tasm, I could try that. or maybe devpac8x?
Back to top
Cure


Active Member


Joined: 11 Apr 2006
Posts: 739

Posted: 06 Apr 2007 11:41:11 am    Post subject:

Here's my TASM folder (I use the same folder/assembling set-up as in Sigma's 28 Days). I haven't had a problem with it.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 06 Apr 2007 12:50:02 pm    Post subject:

That's perfect! with just one minor flaw. I can't open it. other then that, it's perfect.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 06 Apr 2007 12:55:18 pm    Post subject:

You could try this - works for me.
Back to top
Cure


Active Member


Joined: 11 Apr 2006
Posts: 739

Posted: 06 Apr 2007 01:06:42 pm    Post subject:

luby wrote:
That's perfect! with just one minor flaw.  I can't open it.  other then that, it's perfect.
Hmm? As in you can't open a .rar? Here's a .zip, if that helps.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 06 Apr 2007 05:32:35 pm    Post subject:

I got it fixed. Apparently tasm doesn't like long file names. Linerider is too long but lineridr is just fine.
Back to top
Harrierfalcon
The Raptor of Calcs


Super Elite (Last Title)


Joined: 25 Oct 2006
Posts: 2535

Posted: 06 Apr 2007 06:16:15 pm    Post subject:

Yeah, that makes sense, because TASM names the .8xp whatever you named the .z80...
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 08 Apr 2007 08:13:17 pm    Post subject:

Now after 5 total hours of car ride and 4 hours of "sound of music" I made a lot of progress. and accumulated questions.

1.how would I make sprites greater then 8*8?
2.what is the best way to shift a screen (say up and to the left)
3. what's more efficiant for variables: defining them in saferam or [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]x_coor: .db 0


edit: hit enter too fast

Last edited by Guest on 08 Apr 2007 08:15:22 pm; edited 1 time in total
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
    » Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
» View previous topic :: View next topic  
Page 2 of 7 » All times are UTC - 5 Hours

 

Advertisement