Skip to content

Maths doesn't promote to destination type #119

@oziphantom

Description

@oziphantom

So Given

word CurrentNumMovesLeft

CurrentNumMovesLeft = 148 << 6

You then get

    LDA #0
    STA CurrentNumMovesLeft
    LDA #0
    STA CurrentNumMovesLeft + 1

Which is wrong. You have to do
; CurrentNumMovesLeft = word(148) << 6
Which then gets you

    LDA #0
    STA CurrentNumMovesLeft
    LDA #$25
    STA CurrentNumMovesLeft + 1

It should detect that the destination is a word and limit the value to the size of the destination without having everything cast. It should also perform all maths at the highest needed and then only truncate at the end.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions