Re: A86: Asm newbie question Part 2


[Prev][Next][Index][Thread]

Re: A86: Asm newbie question Part 2




Here ya go Matt...

  ld a,5
  ld (_curRow),a
  ld a,5
  ld (_curCol),a
  ld a,0
  ld hl,300
  call $4a33

The call to $4a33 displays (in decimal) the contents of the A,H, and L 
registers, appended together. A is the most signifigant, then H, and 
then L. Its kinda like decimal, with the 100's place, the 10's place, 
and the 1's place. I set A to zero so that it doesn't think I want a 5 
there (remember we used A to set the Col?).

Also, you mentioned wanting to use a value pushed on the stack in BC as 
HL? Well, heres a little trick you are allowed to do:

  push bc
  ...
  pop hl

In other words, you don't have to POP something as the same thing you 
PUSHed it.

In your case this sounds like the best way to do it, since you had code 
in the middle (or thats what it sounded like). If for some reason you 
needed to directly transfer BC to HL you may want to do it like this:

  ld h,b
  ld l,c

(thats what they were talking about in the other letters). If you were 
transfering DE (instead of BC) to HL, you could use the EXchange 
command:

  EX DE,HL

which EXchanges the contents of DE and HL. The EX command doesn't work 
on many registers, and that is its most common use (that I've seen). It 
saves a whole byte, and is faster.

Hope I helped! :)

Matt wrote:

>Robby Gutmann wrote:
>
>> you can't do "ld hl,bc"  you have to do "ex de,hl"  (or maybe switch 
>> the order, not sure).  this command exchanges the values in hl and 
de.
>
>I tried this:  (just the end of a section of code)
>
>	ld a,5		
>	ld (_curRow),a							
>	ld a,5
>	ld (_curCol),a 			
>	ld de,300	
>	ex de,hl	
>	call _getkey
>
>but nothing appears...
>
>I tried:
>
>load h into a, l into h, 0 into l and call $4a33
>
>(or at least what i could figure what this means) but then i got
>something like:
>
>5033:  
>
>where I wanted 300 to be displayed.
>
>ALSO, i'd appreciate it if you would write out the code as I would 
enter
>it instead of me trying to guess what some of it means, and tell me 
what
>calls like $4a33  are (I couldnt find it in ti86asm.inc)
>
>Matt
>



______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com