SYS in assembly

Discussions related to using the integrated assembler
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

SYS in assembly

Post by Ric »

Could someone please explain why this doesnt work, when converting this

Code: Select all

SYS DevCon.UpdateSubresource%, DevCon%, CBMenu2D%,       0, 0, CBMenu2D{},             0, 0
into this

Code: Select all

        push                   0
        push                   0
        push             DWORD [^CBMenu2D{}]
        push                   0
        push                   0
        push             DWORD [^CBMenu2D%]
        push             DWORD [^DevCon%]
        CALL             DWORD [^DevCon.UpdateSubresource%]
Thanks in advance
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Richard Russell
Posts: 366
Joined: Tue 18 Jun 2024, 09:32

Re: SYS in assembly

Post by Richard Russell »

Ric wrote: Sat 21 Jun 2025, 20:16 Could someone please explain why this doesn't work
Since CBMenu2D{} is a vector, not scalar, object shouldn't you be passing it as:

Code: Select all

        push    DWORD CBMenu2D{}
or if you prefer:

Code: Select all

        push    DWORD PTR(CBMenu2D{})
The indirection you are using in your original code definitely doesn't look right to me.

Incidentally the x86-32 CPU can only push 32-bit values, making the DWORD qualifiers superfluous I would expect.
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

Re: SYS in assembly

Post by Ric »

Thanks Richard, I'll try in the morning 👍
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

Re: SYS in assembly

Post by Ric »

Thanks Richard, it worked a charm.
To which piece of code are you refering to when you say

The indirection you are using in your original code definitely doesn't look right to me.
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Richard Russell
Posts: 366
Joined: Tue 18 Jun 2024, 09:32

Re: SYS in assembly

Post by Richard Russell »

Ric wrote: Sun 22 Jun 2025, 21:59 To which piece of code are you referring to when you say
The indirection you are using in your original code definitely doesn't look right to me.
The code you have now changed:

Code: Select all

        push             DWORD [^CBMenu2D{}]