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
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 06 Dec 2003 09:16:13 am    Post subject:

This is what my code looks like:

xcoor equ savesscreen
ycoor equ savesscreen+1

ld a,88
ld (xcoor),a
ld hl,(xcoor)
ld a,8
bcall(_DivHLByA) ;hl has integer part of quotient ,a has the remainder
bcall(_Disphl)
;the rest of the code


When it gets to the display hl, it outputs 43. The purpose of this code is to try to create smooth scrolling sprite. You're probably wondering why I just didn't load 88 directly into hl instead of doing what I did above. The reason is I in the future, if I can get the code above to work, then I will be loading different values into (xcoor) and not just 88.

If anyone knows another way to divide 'hl' by 'a' or knows whats wrong, then please post.
Back to top
tr1p1ea


Elite


Joined: 03 Aug 2003
Posts: 870

Posted: 06 Dec 2003 11:20:36 am    Post subject:

..... I dont really see how exactly you plan on creating a smooth scrolling sprite by dividin the xCoord by 8 ..... ?
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 06 Dec 2003 12:54:30 pm    Post subject:

The screen is 96 pixels. So the number 88 means go 88 pixels across and start drawing there. If it is a number that isn't divided by 8 evenly, then I bit shift 'r' times where 'r' is the remainder when you divide by 8. I'm not entirely sure if this will work, or if this is efficient.
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 06 Dec 2003 01:17:56 pm    Post subject:


Code:
xcoor equ savesscreen
ycoor equ savesscreen+1

ld a,88
ld (xcoor),a
ld l,(xcoor)
ld h,0
ld a,8
bcall(_DivHLByA);hl has integer part of quotient ,a has the remainder
bcall(_Disphl)
;the rest of the code
ok, that is the edited code... it SHOULD work, but cant garuntee anything...
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