Skip to content

Enhancement Request: BLOAD  #96

Open

Description

@MariusAtarius

Usually I combine assembler created objects with Basic. BLOAD would make life easier if you still want to combine Basic with external binary objects. Sure it still is possible to do a BGET, skip the first 6 bytes, and then BGET the rest of the file, but everytime when I make updates to the .OBJ file I have to adapt the routine in FastBasic to let FastBasic know how many bytes should be loaded. With just a BLOAD it would be a lot easier.

Activity

  1. vitococl commented on Jan 5, 2025

    @vitococl

    Just don't skip those 6 bytes but use them as parameters for the BGET statement.

  2. MariusAtarius commented on Jan 5, 2025

    @MariusAtarius
    Author

    Just don't skip those 6 bytes but use them as parameters for the BGET statement.

    Unbelievable how I didn't come up with this. It is actually a very good idea. But then again: is it possible to use variables after the BGET command? I guess yes, but i try to visualize it. Thanks for the brilliant idea, it will fix the absence of a BLOAD command.

  3. vitococl commented on Jan 5, 2025

    @vitococl

    This is a sample program:

    ' Create sample OBJ file:
    OPEN #1,8,0,"D:TEST.OBJ"
    ? #1,""$FF$FF$00$06$06$06$06$48$65$6C$6C$6F$21;
    CLOSE #1
    
    ' Read the file:
    FIRST=0
    LAST=0
    OPEN #1,4,0,"D:TEST.OBJ"
    BGET #1,&FIRST,2:' discard $FFFF
    BGET #1,&FIRST,2
    BGET #1,&LAST,2
    BGET #1,FIRST,LAST-FIRST+1
    CLOSE #1
    ? FIRST
    ? LAST
    ? $($600)
    

    The first part creates a sample object file with binary headers to be loaded at page 6. It contains just a FastBasic string to be printed, no assembled code. I know, there are too many $06 bytes in this file ;-)

    The &() function in the first parameter of some BGET is to make it fill the respective variables from the file header words, which are then used to load the OBJ data. &() is the same than ADR(), and parentheses can be omited. $() function returns the string stored at any memory location.

    This example will load only the first block of data at a given memory address. If there are more blocks in the file or the INIT or RUN vectors are present, those will be ignored, You might need to do a loop to read many blocks using ERR() function as a stop condition to read up to the end of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions