Difference between revisions of "84PCE:Syscalls:021D80"

From WikiTI
Jump to: navigation, search
(Synopsis)
Line 19: Line 19:
 
   ld (0D02AD7h), hl
 
   ld (0D02AD7h), hl
 
   bit 7, b                ; This should be h, not b
 
   bit 7, b                ; This should be h, not b
   jr z, _+
+
   jr z, +_
 
   dec a
 
   dec a
_+:
+
_:
 
   ld (0D02AD9h), a
 
   ld (0D02AD9h), a
 
   ld de, (0D02AD7h)
 
   ld de, (0D02AD7h)
 
  pop af
 
  pop af
 
  ret </nowiki>
 
  ret </nowiki>

Revision as of 13:01, 1 September 2015

Synopsis

Hypothesized Official Name: SignExtendHL_broken

Syscall Address: 021D80h

This is supposed to extend the signed 16-bit HL value to be 24-bit signed.

However, due to what looks like a copy-paste error by TI, this routine is pretty much useless.

It looks like they tried to use code from SignExtendBC, and forgot to change a byte.

Here is what this routine calls, if you can find a particular use for it, go for it.

SignExtendHL_broken:
 push af
  xor a
  ld (0D02AD7h), hl
  bit 7, b                ; This should be h, not b
  jr z, +_
  dec a
_:
  ld (0D02AD9h), a
  ld de, (0D02AD7h)
 pop af
 ret