leuat / TRSE

Turbo Rascal Syntax Error full repo
GNU General Public License v3.0
243 stars 44 forks source link

ASM for j := hi(p.y>>3); fails #830

Closed AndyHOvine closed 9 months ago

AndyHOvine commented 10 months ago

This bit of code:

j := hi(p.y>>3);

produces the following ASM output.

    lda +1
    ; Calling storevariable on generic assign expression
    sta j

lda +1 is not correct.

Variables I am using above:

i,j,k,l: byte at $13;   // general purpose, reusable variables, good for FOR loops and counters, at addresses $00, $01, $02 and $03 in this case

player = record

    x, y: integer;
    dx, dy: integer;
    action: byte;

end;
AndyHOvine commented 10 months ago

BTW, the above logic I had was inccorect, I actually should have done j := hi(p.y)>>3; which does generate the correct ASM output, however, the lsr on an integer inside of the hi() function produces the unexpected output in the error report above.

leuat commented 9 months ago

fixed! was a bug with lo/hi that actually made it fail for expressions... funny how this one hadn't been caught