Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data scripts #163

Open
ksherlock opened this issue Jan 9, 2025 · 1 comment
Open

data scripts #163

ksherlock opened this issue Jan 9, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@ksherlock
Copy link

Currently scripting seems to be limited to visualization and jsr/jsl/brk checking. While formatting some repetitive data (a table of DCI strings followed by 2 16-bit integers) I yearned for a way to automate it.

TFBD and ORCA/Disassembler both have scripts to format data.

Example from orca/disassembler:

**
*  GSOS_Create - CreateGS parameter block
*
        SCRIPT  GSOS_Create
        @A=@ARG
        @P=[@A]
        DC      @A,I2
        COMMENT @A,pCount
        @A=@A+2
        DC      @A,I4
        COMMENT @A,pathname
        @A=@A+4
        IF      @P<2,doneCreate
        DC      @A,I2
        COMMENT @A,access
        @A=@A+2
        IF      @P<3,doneCreate
        DC      @A,I2
        COMMENT @A,file type
        @A=@A+2
        IF      @P<4,doneCreate
        DC      @A,I4
        COMMENT @A,aux type
        @A=@A+4
        IF      @P<5,doneCreate
        DC      @A,I2
        COMMENT @A,storage type
        @A=@A+2
        IF      @P<6,doneCreate
        DC      @A,I4
        COMMENT @A,eof
        @A=@A+4
        IF      @P<7,doneCreate
        DC      @A,I4
        COMMENT @A,resource eof
.doneCreate
        ENDS

Example from the flaming bird:

**
*  GSOS_Create - CreateGS parameter block
*
GSOS_Create SCRIPT
 @P=[@A]|W-1
 DW @A
 COM @A,pCount
 @A=@A+2
 ADRL @A
 COM @A,pathname ptr
 @A=@A+4
 ON @P,:done,:access,:type,:aux,:storage,:eof
:res ADRL @A+E
 COM @A+E,resource eof
:eof ADRL @A+A
 COM @A+A,eof
:storage DW @A+8
 COM @A+8,storage type
:aux ADRL @A+4
 COM @A+4,auxtype
:type DW @A+2
 COM @A+2,type
:access DW @A
 COM @A,access
:done ENDS

It would be nice if there was similar functionality in SourceGen -- either a data-centric language like they have or just use c# scripting. (with file access the c# script could even execute orca disasm or fb files).

@fadden fadden added the enhancement New feature or request label Jan 9, 2025
@fadden
Copy link
Owner

fadden commented Jan 9, 2025

The SourceGen equivalent to the scripts you posted is this. As you note, it's triggered by a JSL, but it's not limited to just formatting the bytes near the JSL. The ProDOS and GS/OS scripts follow the pointers and format the parameter block.

The JSR/JSL/BRK mechanism is essentially passive: you add the script to the project, and magic happens. For visualizers, you add an element that invokes a script with a set of parameters. What you're proposing is essentially a visualizer that applies formatting instead of generating graphics.

I've resisted adding a separate data script mechanism because it's hard to find something that handles all situations without being excessively complex. (Also, I'd be shocked if the number of people who actually used it required more than one hand to count.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants