Am 28.03.2018 um 11:07 schrieb Eric Rullens:
> Dear Philipp,
> 
> I see you have been busy fighting the assembler (devil, details)... I also
> could not get it to extract the high byte of a 24 bit word (.msb is not
> available), but I could trick it into generating useful code like in the
> example below.
> 
> ===================
>   ; Write AC ah am al.
>   jpf _test2
>   ; Change jpf (AC) into ld a, #ah (A6 ah).
>   . = . - 4
>   .db 0xA6
>   . = . + 1
>   ; Bytes am al can be overwitten with subsequent instructions.
> ===================
> 
> The result file:
> 
> ===================
>                                     174 ;     Write AC ah am al.
>       010080 AC 01 00 94      [ 2]  175       jpf     _test2
>                                     176 ;     Change jpf (AC) into ld a,
> #ah (A6 ah).
>                            00805C   177       .       = . - 4
>       010080 A6                     178       .db     0xA6
>                            00805E   179       .       = . + 1
>                                     180 ;     Bytes am al can be
> overwitten with subsequent instructions.
>                                     181 ;     test.c: 112: return x + 1;
>       010082 .. ..            [ 2]  182       ...
> ===================
> 
> A bit confusing to read, but it works for this little test. Do you think it
> can also work with the code generator?
> 
>  Eric

It would work in the code generator. But it would require quite some
complicated workarounds in the peephole optimizer. For now I hope that
someone who knows the assembler better than me (e.g. Maarten, Ben) comes
up with a simple solution (which might or might not include changes in
the assembler).

Philipp

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to