84PCE:Syscalls:021D80: Difference between revisions

From WikiTI
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
[[Category:84PCE:Syscalls:By Name|SignExtendHL_broken]]
[[Category:84PCE:Syscalls:By Name|SignExtendHL]]
[[Category:84PCE:Syscalls:By Address|021D80 - SignExtendHL_broken]]
[[Category:84PCE:Syscalls:By Address|021D80 - SignExtendHL]]
== Synopsis ==
== Synopsis ==
'''Hypothesized Official Name:''' SignExtendHL_broken
'''Hypothesized Official Name:''' SignExtendHL


'''Syscall Address:''' 021D80h
'''Syscall Address:''' 021D80h


This is supposed to extend the signed 16-bit HL value to be 24-bit signed.
This was originally a buggy call, and still is in OS 5.0.0.0089 (and others, perchance?) But after sending in information, TI did an amazing job and fixed this call. It basically performs a sign extension on a 16bit HL to 24bit HL.
 
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.
 
<nowiki>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 </nowiki>

Revision as of 18:29, 4 September 2015

Synopsis

Hypothesized Official Name: SignExtendHL

Syscall Address: 021D80h

This was originally a buggy call, and still is in OS 5.0.0.0089 (and others, perchance?) But after sending in information, TI did an amazing job and fixed this call. It basically performs a sign extension on a 16bit HL to 24bit HL.