I've been having a lot of homework lately, and before that, it was mostly C/TI-BASIC, but I'm starting to get more into assembly again (and I'm a bit rusty, so I'm not completely sure of a few things). Anyway, I only have one question at the moment, but I'll probably have a few others soon. The question: if I do

ld hl,(label)

Then, does "h" contain (label) and "l" contain (label+1)? For example, if I had:

label:

.db 1,2

Would "h" be 1 and "l" be 2?
No, it would be the other way around (little-endian)
When do I need to reset the keyport when using direct port input for key testing? If I am testing for arrow keys and a few other keys, such as 2ND, could I just reset the keyport right before testing for the keys? Could I just do something like:


Code:

               ld a,$ff         ;Dummy read to reset keyport
          out (1),a
      ld a, $fe    ;Check for arroy keys
          out (1), a
          nop
          nop
          in a, (1)
          jp Z,down2
          CP $f7



Also, does anybody know what registers _VPutS destroys? I've looked and looked and haven't found anything, even on WikiTI.

EDIT:

If I had strings set up like this:

strings:
.db "String1",0
.db "String2",0

And I did ld hl,strings \ bcall(_VPuts), then would hl point to the beginning of "String2"?

EDIT AGAIN:

It appears as if that is the case (that hl points to the beginning of the next string after calling _VPutS, which makes perfect sense)

Also, what should I do to flush out the key port so that if the user was already pressing 2ND, for example, he/she would have to press it again? The following doesn't seem to do the job:


Code:

ld a,$ff
out (1),a


Should I do some sort of dummy read with "in" instead?
Think about it this way: The key port keeps track of the keysets it's reading. When you output a value, it ands it with the current keyset value, thereby adding it to the list. When you output $ff to the keyport, it clear the list.
calc84maniac wrote:
No, it would be the other way around (little-endian)
Incorrect. (hl) would contain a POINTER to 1,2. You'd have to bcall(_ldhlind) to get 2 in h and 1 in l.
Notice he wrote

ld hl,(label)

not

ld hl,label
Wink
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement