File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -385,19 +385,24 @@ def to_long(stype: DataType) -> list[str]:
385385 )
386386 return output
387387
388- if stype in { I8_t , U8_t , F16_t } : # Byte to word
388+ if stype in ( I8_t , U8_t ) : # Byte to word
389389 output = to_word (stype )
390+ output .append ("ld e, h" )
391+ output .append ("ld d, h" )
390392
391- if stype != F16_t : # If it's a byte, just copy H to D,E
392- output .append ("ld e, h" )
393- output .append ("ld d, h" )
393+ elif stype == I16_t : # Signed byte or fixed to word
394+ output .extend (
395+ [
396+ "ld a, h" ,
397+ "add a, a" ,
398+ "sbc a, a" ,
399+ "ld e, a" ,
400+ "ld d, a" ,
401+ ]
402+ )
394403
395- elif stype in (I16_t , F16_t ): # Signed byte or fixed to word
396- output .append ("ld a, h" )
397- output .append ("add a, a" )
398- output .append ("sbc a, a" )
399- output .append ("ld e, a" )
400- output .append ("ld d, a" )
404+ elif stype == F16_t :
405+ output .extend (["ex de, hl" , "ld de, 0" ])
401406
402407 elif stype in (U32_t , I32_t ):
403408 return []
You can’t perform that action at this time.
0 commit comments