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
hotdog1234


Advanced Member


Joined: 14 Aug 2009
Posts: 291

Posted: 25 Aug 2009 02:50:34 pm    Post subject:

I've been using "Learn TI-83 Plus Assembly In 28 Days" to teach myself ASM. Assuming most ASM programmers have heard of it, or even have read it, the following code is given for setting pixel coordinates (where register A is the x-location, and register L is the y-location):


Code:
   LD    H, 0
   LD    D, H
   LD    E, L
   ADD   HL, HL
   ADD   HL, DE
   ADD   HL, HL
   ADD   HL, HL

   LD    E, A
   SRL   E
   SRL   E
   SRL   E
   ADD   HL, DE

   LD    DE, PlotSScreen
   ADD   HL, DE


I understand all of this, and the next step given is to AND A and 7 to retreive the particular pixel in the byte, whether the 1st pixel, the 6th pixel, etc.


Code:
AND 7


So the rest of the code, then, is used to set bit 7 in A, and rotate that bit to the left until the right pixel in the byte is selected, or so I assume:


Code:
   LD    A, $80 ; A = 01000000
   RET   Z ;
   LD    B, A
Loop:
   RRCA
   DJNZ   Loop
   RET


But doesn't setting A to $80 erase all work done with "AND-ing" A? I understand everything perfectly except for the lines between (and including) AND 7 and LD B,A, but I'm confused during those four lines. So a detailed explination of what is done in those 4 lines and how it affects the pixel-determining process would be nice.
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 25 Aug 2009 05:35:38 pm    Post subject:

Simple - they did it wrong. You should move the LD B,A so it's between the AND 7 and the LD A,$80.
Back to top
hotdog1234


Advanced Member


Joined: 14 Aug 2009
Posts: 291

Posted: 25 Aug 2009 05:37:29 pm    Post subject:

Neutral Shoot, it's so obvious now! Thanks a lot!
Back to top
JoeYoung


Advanced Member


Joined: 15 Nov 2008
Posts: 316

Posted: 25 Aug 2009 08:40:56 pm    Post subject:

wow.....

it not so obvious to me, I'm struggling with assembly. something in my brain just hasn't clicked yet in how to do this Sad
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 25 Aug 2009 09:39:20 pm    Post subject:

metagross111 wrote:
it not so obvious to me, I'm struggling with assembly. something in my brain just hasn't clicked yet in how to do this Sad

Yeah, asm to me is like a pain in the neck. It is difficult.
Back to top
hotdog1234


Advanced Member


Joined: 14 Aug 2009
Posts: 291

Posted: 25 Aug 2009 09:51:43 pm    Post subject:

Asm is definitely difficult in its own way. Because you're only one step away from typing in 1s and 0s, you have to deal directly with the processor. But there are two advantages:

1. Once you know what you're doing, you only need a handful of commands that are repeated over and over, making it easier (though longer) to work with, believe it or not, than Ti-Basic. The trick is, understanding what you're doing in the first place. Everything clicked with me yesterday, but I had to spend 3 years reading, re-reading, and comprehending Asm, before "the lights turned on." Now, I'm not trading it for Ti-Basic, which I do comparatively terrible at.
2. With a 6 Mhz processor (or more, depending on the model) you can do more with a Ti-83+ than you can with a game boy, or sometimes, more than you can with a NES (for instance, Calc4Maniac's projects)--once you understand ASM.

My suggestion is that knowledge of C++ will be a great asset--it's easier than ASM, but has similar concepts.
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 25 Aug 2009 09:53:39 pm    Post subject:

Since C is so much like asm, is there a C to asm translator? (TI-83/84 models)
Back to top
JoeYoung


Advanced Member


Joined: 15 Nov 2008
Posts: 316

Posted: 25 Aug 2009 09:54:38 pm    Post subject:

3 years reading!?

heh, I only got about 8 months.
Back to top
hotdog1234


Advanced Member


Joined: 14 Aug 2009
Posts: 291

Posted: 25 Aug 2009 10:04:06 pm    Post subject:

Quote:
3 years reading!?

heh, I only got about 8 months.


Well, there you go! Only 2 years, 4 months left! :biggrin:
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 26 Aug 2009 07:36:51 am    Post subject:

I only have 4 months...

a lot of time left....
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 26 Aug 2009 11:20:13 am    Post subject:

Hot Dog wrote:
2. With a 6 Mhz processor (or more, depending on the model) you can do more with a Ti-83+ than you can with a game boy, or sometimes, more than you can with a NES (for instance, Calc4Maniac's projects)--once you understand ASM.
The CPU isn't everything - the Sega Master System had the same CPU as the TI-83+ (running at ~3.5MHz) but has dedicated video hardware that handled smooth-scrolling tilemaps and sprites for you and so the games are a lot more impressive. Smile The GameBoy's CPU is vaguely similar (8080-ish), but the NES uses a completely different CPU (6502-ish) - and the 6502 can do more per clock cycle than the Z80, so comparing clock frequency isn't very fair.
Back to top
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 26 Aug 2009 02:25:56 pm    Post subject:

3 years????

It took me 'bout half a month to understand the concepts, understand the whole little-endian thing and so on, and another few months to really learn the language and learn to apply it in calculator stuff.

(but I didn't go into making games, which is a business of its own...)


Last edited by Guest on 26 Aug 2009 02:26:34 pm; edited 1 time in total
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 27 Aug 2009 08:16:17 am    Post subject:

If you're still interested, here's a more detailed explanation of the routine. What you're looking for is in code chunk 3 (it's marked).

Hot Dog wrote:
1. Once you know what you're doing, you only need a handful of commands that are repeated over and over, making it easier (though longer) to work with, believe it or not, than Ti-Basic. The trick is, understanding what you're doing in the first place. Everything clicked with me yesterday, but I had to spend 3 years reading, re-reading, and comprehending Asm, before "the lights turned on." Now, I'm not trading it for Ti-Basic, which I do comparatively terrible at.

So I'm not alone! About three years ago I tried learning ASM and failed horribly, then waited a few months and tried again (and failed again). Somehow my Winter break then became my annual failed attempt at ASM, but last Winter everything clicked for me and I failed at failing :biggrin:
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