Shop OBEX P1 Docs P2 Docs Learn Events
A retromachine Basic interpreter [beta] - Page 7 — Parallax Forums

A retromachine Basic interpreter [beta]

123457»

Comments

  • pik33pik33 Posts: 2,387

    coginit/cogstop implemented and pushed.

    There can be

    cog=coginit(cog#, addr, ptra)

    or

    cog=coginit(addr,ptra)

    In the second case 16 is used for a cog number

    Address can be PSRAM:

    1  ' An example of assembly code running in a dedicated cog
    5  ' ------- asm code start
    10 data $58,$4c,$64,$fd ' drvl #38
    20 data $5f,$4c,$64,$fd ' drvnot #38
    30 data $fe,$21,$8a,$ff ' setq
    40 data $1f,$00,$66,$fd ' waitx ##340000000
    50 data $f0,$ff,$9f,$fd ' jmp #1
    55 ' ------- the end of asm code
    60 for i=0 to 19: read a : poke 1000000+i,a : next i
    70 cog=coginit(1000000,0)
    80 ?"The cog ";cog;" was initialized. Press any key to stop it"
    90 if inkey$="" then goto 90
    100 cogstop cog : ?"The cog ";cog;" is now stopped."
    

    This example blinks the led until a key is pressed.

  • pik33pik33 Posts: 2,387
    edited 2023-09-15 14:51

    Preparing for beta - the new documentation file, this time in pdf format.

    I managed to add a bug somewhere to the inkey$ command, that worked in older versions, that I have to find and correct. Also, while upgrading a documentation file , I encountered 3 planned and not implemented yet commands: setcolor, memtop and memlo.

    After this, I will prepare a first beta release.


    Edit: the documentation text also needs debugging :):(

  • roglohrogloh Posts: 5,837
    edited 2023-09-16 07:25

    @pik33 said:
    coginit/cogstop implemented and pushed.

    This is useful. Very much reminds me of poking assembly language opcodes from data statements to run assembly code in BASIC.

  • pik33pik33 Posts: 2,387
    edited 2023-09-16 07:47

    @rogloh said:

    @pik33 said:
    coginit/cogstop implemented and pushed.

    This is useful. Very much reminds me of poking assembly language opcodes from data statements to run assembly code in BASIC.

    The example in the post #182 is exactly this. The assembly code in data lines. Notice I poked these to the PSRAM and used PSRAM address in coginit() - the interpreter supports this.

  • pik33pik33 Posts: 2,387

    Let's go beta.

  • pik33pik33 Posts: 2,387
    edited 2023-10-07 17:53

    3 new keywords added:

    defchar asciicode, defptr - define a character in the current font. defptr is an address of 16 bytes block that defines 8x16 character. As always, it can be HUB or PSRAM if the address is >$80000
    findfirst(pattern,[mode]) - find a file name in the current direvtory that matches the pattern. "mode" is a string and can be nothing, "file" or "dir". If nothing, both files and directories are searched
    findnext returns the next file name with pattern set by findfirst or an empty string if no more files.

    The new binary attached.

  • You've been quiet for a while.
    Great to know that you're still making progress. :+1:

    Craig

  • pik33pik33 Posts: 2,387

    There was too much other work to do.

  • pik33pik33 Posts: 2,387

    There was this post on Basic facebook group: https://www.facebook.com/groups/2057165187928233/posts/3540343772943693/

    A pi (3.141...) computing benchmark in Basic. So I tried it on my interpreter and then I discovered that I forgot to implement str$ that is needed there. Also my interpreter doesn't like variables that end wih # and has no 'line input'
    So I had to implement str$ and slihghtly modify the program (input instead of line input, rename variables that end in # and it works. Not very fast, however, good PC Basics are much faster on a slower machine
    Attached a binary with str$ implemented.

  • @pik33 said:
    There was this post on Basic facebook group: https://www.facebook.com/groups/2057165187928233/posts/3540343772943693/

    A pi (3.141...) computing benchmark in Basic. So I tried it on my interpreter and then I discovered that I forgot to implement str$ that is needed there. Also my interpreter doesn't like variables that end wih # and has no 'line input'
    So I had to implement str$ and slihghtly modify the program (input instead of line input, rename variables that end in # and it works. Not very fast, however, good PC Basics are much faster on a slower machine
    Attached a binary with str$ implemented.

    That ain't too bad, actually. The 168MHz ArmMite F4 takes ~2.0 seconds.

    Tomorrow I will test The 480MHz ArmMite H7 with hardware double-precision floating point.

    Craig

  • pik33pik33 Posts: 2,387
    edited 2024-12-09 11:33

    After a year of reduced activity (moving, renovation) I returned to the project and tried to compile it with new flexprop. It doesn't work then.

    It still works when compiled with 6.9.1

    Compiled with 7.0.0 hangs up after start. Seems something USB related - the mouse cursor doesn't move, the keyboard works.. strange. Maybe I simply need to use newer version of the USB driver. I compiled the project as it was a year ago.

    .... edit: upgraded USB driver, still the same problem. Needs debugging and/or using github search for the first spin2cpp commit that doesn't compile the working project

    .... edit 2: somethings happened to varptr. Now, varptr(v.spr1ptr) returns 0. Then a wrong address is passed to usbnew so it cannot move the mouse cursor, destroying the code at address 196 instead (196 is the offset from v.spr1ptr to to the sprite #16 data that controls the mouse cursor).

  • cgraceycgracey Posts: 14,206

    Welcome back!

  • evanhevanh Posts: 16,027

    @pik33 said:
    Compiled with 7.0.0 hangs up after start.

    Try with -O0 compile option.

  • pik33pik33 Posts: 2,387

    o0 doesn't fit in the hub. And yes, old flexprop generated proper value for varptr.

  • pik33pik33 Posts: 2,387

    The official 6.9.10 flexprop works. Something wrong happened between 6.9.10 and 7.0.0.beta.

  • pik33pik33 Posts: 2,387
    edited 2024-12-09 12:44

    Finding the first bad commit.....

    Version 7.0.0-beta2-v6.9.7-86-g7431c833 Compiled on: Nov 15 2024: good
    Version 7.0.0-beta2-v6.9.7-95-g98588891 Compiled on: Nov 18 2024: bad
    Version 7.0.0-beta2-v6.9.7-90-gcb2ee721 Compiled on: Nov 17 2024: good
    Version 7.0.0-beta2-v6.9.7-91-g280d8e05 Compiled on: Nov 18 2024: bad

    The first bad commit: 280d8e0
    The last good commit: cb2ee72

Sign In or Register to comment.