Shop OBEX P1 Docs P2 Docs Learn Events
flexspin compiler for P2: Assembly, Spin, BASIC, and C in one compiler - Page 132 — Parallax Forums

flexspin compiler for P2: Assembly, Spin, BASIC, and C in one compiler

1126127128129130132»

Comments

  • evanhevanh Posts: 17,322

    Tony,
    It seems to be fine using leading underscores in DAT section and as assignments in code. But not okay in CON section. Have you changed the section you use at some stage?

  • TonyB_TonyB_ Posts: 2,282

    @evanh said:
    Tony,
    It seems to be fine using leading underscores in DAT section and as assignments in code. But not okay in CON section. Have you changed the section you use at some stage?

    Evan,
    No, constants have always been in CON section. I've altered nothing, it's FlexSpin that has been changed. Old versions worked.

  • ersmithersmith Posts: 6,291

    @evanh said:
    Eric,
    What do you know about how the FAT filesystem operates in Flexspin? Does it keep a copy of any meta type blocks cached? Like the FAT and root directory blocks?

    I haven't looked at that in a long time. Looking at the structures in ff.h it appears only 1 sector is cached (probably the most recent one it's working with). Some of the information about the file system is parsed and stored in the FATFS structure though, so things will probably go quite wrong if the file system is modified behind the driver's back. Which I guess you've already figured out... it may be worth seeing if the upstream fatfs has any recent changes to handle disk change, or if anyone else has tried to do something similar.

  • ersmithersmith Posts: 6,291

    @TonyB_ said:
    FlexSpin used to allow leading underscores for binary constants, e.g. xyz = %_1001_1100. Is it possible to put that feature back?

    If not, please tell me the last version that supports this. The latest FlexSpin permits other numerical constants such as abc = $_ff and def = %%__3210 with single or multiple leading underscores. My automatic skip pattern generator creates patterns with %_ or %__ or %___, etc., on the left so that corresponding bits in different patterns are aligned.

    It's been over 3 years since % as a keyword indicator was added, to FlexSpin 6.0.0 in early 2023. I didn't specifically intend to use any keywords starting with %_, it just fell out of the existing parsing code since _ is a legal character to start an identifier. It's probably no big deal to exempt that and require that the keywords start with a letter.

  • ersmithersmith Posts: 6,291

    @evanh said:
    It seems to be fine using leading underscores in DAT section and as assignments in code. But not okay in CON section. Have you changed the section you use at some stage?

    I don't think so, the parser recognizes % followed by a non-numeric character as an extended Spin2 keyword, and that should be the same in all sections. (e.g. %if is used for conditional assembly in DAT, and %orelse is like the C || operator. But $_ and %%_ would be unaffected, again regardless of section.

    @TonyB_ said:
    No, constants have always been in CON section. I've altered nothing, it's FlexSpin that has been changed. Old versions worked.

    Very old versions indeed :). But I'll make %_ be numeric again in 7.6.11. Out of curiousity, do PNut and SpinTools handle %_ as numeric?

  • @ersmith said:

    @TonyB_ said:
    No, constants have always been in CON section. I've altered nothing, it's FlexSpin that has been changed. Old versions worked.

    Very old versions indeed :). But I'll make %_ be numeric again in 7.6.11. Out of curiousity, do PNut and SpinTools handle %_ as numeric?

    I checked PNut and it does not like numbers with leading underscore at all.

    BTW Tony is upgrading from 5.5.2 (I suddenly feel like an old hag...) on his Windows 98 machine, because of the if_x1/if_1x bugfix that got into 5.9.2

  • (BTW I checked this out on my end, the Actions flexptools build really does just run on 98 as-is, as long as your MSVCRT.DLL is sufficiently updated. A true coding miracle.)

  • evanhevanh Posts: 17,322

    @ersmith said:

    @evanh said:
    It seems to be fine using leading underscores in DAT section and as assignments in code. But not okay in CON section. Have you changed the section you use at some stage?

    I don't think so, the parser recognizes % followed by a non-numeric character as an extended Spin2 keyword, and that should be the same in all sections. (e.g. %if is used for conditional assembly in DAT, and %orelse is like the C || operator. But $_ and %%_ would be unaffected, again regardless of section.

    Ah, okay. I hadn't made any distinction between %, $ and blank before the underscore. I'd added an underscore to a decimal number in CON section, whereas I used $ prefix in the other sections.

  • ersmithersmith Posts: 6,291

    @Wuerfel_21 said:
    BTW Tony is upgrading from 5.5.2 (I suddenly feel like an old hag...) on his Windows 98 machine, because of the if_x1/if_1x bugfix that got into 5.9.2

    Oh, wow, Yeah, upgrading is a good idea, not just for that bugfix but for a bunch of other little things since then like long tjz/djnz branches, ORGF $ fix, some warning improvements, and recently a fix to callpa #x, ##longx. Plus the conditional assembly that you implemented. Not to mention all the language and library improvements, but I guess @TonyB_ you're more interested in assembly than high level languages. If you get curious, though, there's a BrainF*ck compiler now, that probably qualifies as "low level" :).

    I'm amazed things still work on Windows 98, thanks for testing that Ada. I'm sure the suggestion to use Linux has already been made, so we can just pass over that... One of these days Microsoft will probably retire 32 bit Windows apps and I'll have to start building Flexspin as 64 bits.

  • @ersmith said:
    I'm amazed things still work on Windows 98, thanks for testing that Ada. I'm sure the suggestion to use Linux has already been made, so we can just pass over that... One of these days Microsoft will probably retire 32 bit Windows apps and I'll have to start building Flexspin as 64 bits.

    Nah, that'd be a disaster. Too many 32 bit apps out there. WoW64 being so seamless lead to a lot of developers sticking to 32 bit for simplicity. Idk how much of a typical win11 install is WoW64 libraries vs utterly superfluous bloat. Likely not that much, so it wouldn't be worth it.

    The WINE people recently implemented a WoW-like layer on their side because Linux distros are dropping 32 bit support. So the 32 bit windows apps can now run on top of a 64 bit Unix system.

    Incidentally all the windows apps I regularly use on WINE are 32 bit. (Excluding games, but those are also mostly 32 bit because I play weird games)

  • evanhevanh Posts: 17,322
    edited 2026-06-16 01:15

    @ersmith said:
    ... it may be worth seeing if the upstream fatfs has any recent changes to handle disk change, or if anyone else has tried to do something similar.

    Found it. :)https://elm-chan.org/fsw/ff/

    PS: I've added a Flexspin entry for the "Projects using FatFs" on Wikipedia's talk page. https://en.wikipedia.org/wiki/Talk:FatFs#Projects_using_FatFs

    EDIT: I'm not seeing any indication of direct support for card change. Or even any examples on the website.

    Currently, I rely on an unresponsive card to trigger reinitialising. I could add an event mechanism via a pin input too. A slot sporting the power switch that Roger devised would provide a suitable card removal signal on the same pin. Although, the down side of using an actual hardware event is it can't be an inline momentary use like the way I'm currently using the SEx events.

  • @ersmith said:

    @Wuerfel_21 said:
    BTW Tony is upgrading from 5.5.2 (I suddenly feel like an old hag...) on his Windows 98 machine, because of the if_x1/if_1x bugfix that got into 5.9.2

    Oh, wow, Yeah, upgrading is a good idea, not just for that bugfix but for a bunch of other little things since then like long tjz/djnz branches, ORGF $ fix, some warning improvements, and recently a fix to callpa #x, ##longx. Plus the conditional assembly that you implemented. Not to mention all the language and library improvements, but I guess @TonyB_ you're more interested in assembly than high level languages. If you get curious, though, there's a BrainF*ck compiler now, that probably qualifies as "low level" :).

    I'm amazed things still work on Windows 98, thanks for testing that Ada. I'm sure the suggestion to use Linux has already been made, so we can just pass over that... One of these days Microsoft will probably retire 32 bit Windows apps and I'll have to start building Flexspin as 64 bits.

    Eric, yes, I write pure P2ASM programs only and load them into the P2 via a real serial port. I can confirm the new flexspin.exe v7.6.11 works on Windows 98SE (with MSVCRT.DLL v7.10.3052.4). Many thanks!

  • evanhevanh Posts: 17,322
    edited 2026-06-16 06:47

    Eric,
    Uh-oh, it looks like the disk_status() function is intended for querying the driver status before embarking on a file operation. But, I'm assuming, because the basic example driver that came with FatFs just had a stub for disk_status() it wasn't seen as useful and got removed from your plug-in driver interface you made for me.

    Would that be fair assessment?

  • evanhevanh Posts: 17,322
    edited 2026-06-16 06:59

    If the driver thinks the SD card has been changed then it can signal a STA_NOINIT from disk_status().

    I suspect that also means that disk_initialize() needs its own separate hook restored as well. That way, I won't be doing any hidden re-mounting. The filesystem layer is making those decisions.

    PS: I haven't tested that hypothesis. If the filesystem doesn't auto-mount, which is probably true, then the user program would have to handle an error that responds by issuing a mount() independent of device _open(). In this case then no new plug-in interface additions are needed at all.

    The only downside there is there's a difference between getting a CRC error and having no response from the SD card. And I doubt that could be conveyed back to the user program. No response indicates a likely card change has occurred, while a CRC error says there is signal quality issues.

Sign In or Register to comment.