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
Basjuh


Advanced Newbie


Joined: 19 Nov 2003
Posts: 56

Posted: 07 Dec 2003 05:29:10 pm    Post subject:

i got a routine that extracts coordinates out of L1 and draws a 5x5 square at that point but it isn't working right can some body help me with this...

i have this so far...


Code:
.nolist

#include   "ti83plus.inc"

.list

.org   $9D93
.db t2ByteTok,tAsmCmp

   b_call(_ClrLcdFull)
   b_call(_ZeroOP1)
   ld hl,listname
   ld de,op1
   ld bc,4
   ldir
   b_call(_ChkFindSym)
   jp c,ErrUndefined
   push de
   pop hl
   b_call(_LdHLInd)
   push hl
   pop bc
   ld hl,1

lloop:
   push bc
   push hl
   push de
   b_call(_GetLToOP1)
   b_call(_ConvOP1)
   ld h,d
   ld l,e
   ld a,4
   add a,d
   ld d,a
   ld a,4
   add a,e
   ld e,a
   b_call(_FillRect)
   pop de
   pop hl
   inc hl
   pop bc
   dec bc
   ld a,b
   or c
   jr nz,lloop
   ret

ErrUndefined:
   ld hl,$0000
   ld (currow),hl
   ld hl,noexist
   b_call(_PutS)
   ret

noexist:
.db "L1 doesn't exist",0

listname:
.db ListObj,tVarLst,tL1,0
   

.end
END
Back to top
Tyler


Advanced Member


Joined: 29 May 2003
Posts: 352

Posted: 07 Dec 2003 05:32:13 pm    Post subject:

I never saw you pop hl!


Code:
jp c,ErrUndefined
push de
pop hl
b_call(_LdHLInd)
push hl


Otherwise I'm too lazy too look through, I'll probably miss the error anyways!
Back to top
Basjuh


Advanced Newbie


Joined: 19 Nov 2003
Posts: 56

Posted: 07 Dec 2003 05:37:39 pm    Post subject:

it isnt optimized

that whas

Code:
push de
pop hl


it could be


Code:
ld hl,de
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 07 Dec 2003 07:24:28 pm    Post subject:

Basjuh wrote:

Code:
ld hl,de

Actually ld hl,de is not a legal z80 instruction.
Back to top
Basjuh


Advanced Newbie


Joined: 19 Nov 2003
Posts: 56

Posted: 07 Dec 2003 07:40:49 pm    Post subject:

i thought ld hl,de was legal but ld de,hl wasn't
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 07 Dec 2003 07:46:01 pm    Post subject:

No that is inncorrect. The only legal 16 bit load instruction that load a 16 bit register into another are as follows.

ld sp,hl
ld sp,ix
ld sp,iy

All other forms are not legal instructions.
Back to top
Basjuh


Advanced Newbie


Joined: 19 Nov 2003
Posts: 56

Posted: 08 Dec 2003 05:12:33 am    Post subject:

and help me with the code in the first post any???
Back to top
Tyler


Advanced Member


Joined: 29 May 2003
Posts: 352

Posted: 08 Dec 2003 06:06:54 pm    Post subject:

Sorry, I don't prefer using the variables that come with the operating system, I know almost nothing about them except how to load programs....
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 08 Dec 2003 07:24:53 pm    Post subject:

Ok I'm going to answer your question. But not just this second. I'm looking at your code and I'm wondering, are you trying to draw multiple squares or just a singular one?

Tell me this and I'll be able to help you out.
Back to top
Tyler


Advanced Member


Joined: 29 May 2003
Posts: 352

Posted: 08 Dec 2003 08:21:48 pm    Post subject:

Looks like 1 at a time repeated as many times needed to me


Code:
ld hl,listname ;List
ld de,op1       ;Stuff
ld bc,4           ;Four Rows
ldir



Code:
jr nz,lloop
Back to top
Basjuh


Advanced Newbie


Joined: 19 Nov 2003
Posts: 56

Posted: 09 Dec 2003 05:18:24 am    Post subject:

multiple squares...

and i use this because its for a basic prog, it actually used L1 as x coordinates and L2 as y but that was too hard to make, but if anyone can make that ome i would be very gratefull....
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 09 Dec 2003 07:22:54 pm    Post subject:

Well my next question is, would it not make sense to just use a single list for both coordinates. Element 1 could be the X coordinates, and Element 2 could be the Y coordinates. In this case I'd prefer to use a different method if you don't mind.

My idea would be to store the Pixel Row and Pixel Column into the one element.

It would work like this.

10*256+10->L1(1)

The first 10 would be the pixel Row, and the second would be the column.

From there it would be very simple to draw a 5*5 square.

If you wanted Variable size rectangles/Squares Then you would use two elements per square/rectangle.
Back to top
Basjuh


Advanced Newbie


Joined: 19 Nov 2003
Posts: 56

Posted: 11 Dec 2003 06:46:17 am    Post subject:

i made that program using a single list but i have to rewrite a large part of the basic prog now...

i used your method but it gives an invalid dim error almost every time...
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