RFC-3: Enhance EhBASIC? #59
Replies: 15 comments 51 replies
-
Today, I got EhBASIC working with CC65 and all the other tools I built. Save and load would be awesome. I looked at it briefly and it wasn't hooked up much beyond having keywords. |
Beta Was this translation helpful? Give feedback.
-
Thank you both - for the EhBASIC / CC65 repo updates and recent tooling & (re)build verification. For item (1) SAVE / LOAD above: I created an (enhancement) issue-#1 in the local ehbasic repo. On that tracker/issue, I've been gathering related notes to aid implementation. For item (2) BASIC-Graphics: The EhBASIC Reference Manual includes guidance (pgs 27-29) on how-to-add graphics point-plotting using the BASIC CALL command. @vruumllc 's Tetricks efforts should prove to be a helpful example for adding point-plotting to EhBASIC. I created a 2nd ehbasic enhancement issue on adding graphic point-plotting. |
Beta Was this translation helpful? Give feedback.
-
I have been thinking about approaches to the two proposed EhBASIC enhancements for the RP6502 Picocomputer. Analysis: For item (2) - adding BASIC-Graphics: There, example may be found in extending BASIC's assembly source with added graphics commands in EhBASIC. For item (1) - enabling SAVE / LOAD: |
Beta Was this translation helpful? Give feedback.
-
Hyenadae commented in https://github.com/picocomputer/ehbasic/issues/2#issuecomment-1843810300
There's a lot of good thoughts and ideas to unpack in that post. In response to the two items above:
I'd suggest prioritizing in adding SAVE/LOAD to EhBASIC as "traditional c" file-i/o is integrated into the cc65 environment. IMHO that seems manageable, once a clear understanding of (a) the memory map is available -and- (b) a clear understanding-of and skills-available on the assembler/compiler/linker/IDE tool-chain (i.e., map-files, interim assembly-from-c build-files, CMake, etc.) . In general, I'm not a stranger to these concepts, though I'm not agile (yet) in these specific rp6502 tools as others. "Mixing C and [EhBASIC assembly] source" seems the way to go, as example source pieces are available in C and assembly. Importantly EhBASIC's source is assembly, and others have provided example in how to add new commands to EhBASIC at the assembly level. So focus on mixing assembly and C seems necessary. Re:
IMHO, I think a clear understanding of both the C- and EhBASIC- memory maps, along with their shared memory resources (zero-page and page-FF) is a prerequisite. Finally, In other words: crawl, walk, then run.... |
Beta Was this translation helpful? Give feedback.
-
Hmm. Well... in-light of above comments, it may be better to code any EhBASIC enhancements in assembly. Locate them above EhBASIC's executable (above Label AA_end_basic but below $FF00. Initially the graphics plot enhancements can be coded in separate assembly file for possible inclusion w/ EhBASIC repo, then user can use BASIC's CALL command at runtime; example framework in EhBASIC manual pgs 27-29. Similar approach for SAVE/LOAD commands; hooks already available in init.s. Code the added SAVE/LOAD commands in assembly; locate above EhBASIC's executable. Should probably move EhBASIC's .org and Ram_top down from $D000 to something like $C000, providing ~5-kbyte enhancement-code space. Enhancement-code examples could first be coded in C (e.g., simpler versions of vruumllc's bitmap_graphics.c/h in his tetricks), then their interim assembly code inspected and reverse-engineered as a step prior to coding directly into assembly. Here's an illustration of the affected memory map: |
Beta Was this translation helpful? Give feedback.
-
Attached is initial attempt at "learning to crawl" following steps 2 - 7 above. Thanks extended to: @rumbledethumps, @Hyenadae, @linuxplayground, James-HoneyBadger and WojciechGw whose online dialog helped get to this point. Hope is: distilling @vruumllc example bitmap_graphics c-code can aid in filling out the graphic details. :) |
Beta Was this translation helpful? Give feedback.
-
https://github.com/picocomputer/ehbasic/tree/cc65mix (merged to main) |
Beta Was this translation helpful? Give feedback.
-
All of stdio.h works. |
Beta Was this translation helpful? Give feedback.
-
I removed all the layers that supported EhBASIC being part of "a system of EPROMs" which recovered about 55 bytes for C/ASM. That allowed me to move everything out of page 2, where I recovered 256 bytes for BASIC. 48639 bytes free now. Up from 48383. All the stuff that's low hanging fruit for me is done. I'll let you guys figure out connecting the internals. Anyone needing to adjust the memory map should start in basic.cfg. This is the magick what weaves the two universes together. |
Beta Was this translation helpful? Give feedback.
-
The earlier versions of min_mon.asm used a small vector table to reference monitor functions for input, output, load and save. The benefit of this approach is that the programmer should be able to change the values in the table to have basic go someplace different for those functions. This is especially easy to.do.on the picocomputer because it's all RAM. My idea was to write a stub function that writes a byte given by an argument to an open file whose handler is a global variable. Then a save routine could open the file for writing, change the input vector in the jump table to point to the file write byte function, call LAB_LIST and when that returns go ahead and revert the input vector to what it was to begin with. I tried this out but once again I must have been missing something obvious. |
Beta Was this translation helpful? Give feedback.
-
Troy Schrapel got EhBASIC doing save/load and gfx on his "56" project. His internals aren't useful to us, but how he hooked them up is. |
Beta Was this translation helpful? Give feedback.
-
picocomputer/ehbasic@main...saveload (merged) SAVE is working on the |
Beta Was this translation helpful? Give feedback.
-
Snapshot combining above w/ experimental plotting working; binaries here. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@netzerohero, I finally got a chance to check out the plotting. Good job! Could you get rid of the 8-bit parameter limit if you made them keywords, rather than use the CALL mechanism? But really, what you have already is very nice. And SAVE and LOAD are wonderful, @rumbledethumps. |
Beta Was this translation helpful? Give feedback.
-
Hello Rumbledethumps and the Picocomputer community.
I'm hoping to encourage thoughts and discussion on enhancing EhBASIC for the picocomputer system.
Rumbledethumps has an initial ehbasic repo in the picocomputer Github project. (Thank you!)
And he has built-out two fundamental picocomputer capabilities: SDK/file-io and VGA-graphics. (Thank you!)
Is there an interest in bringing BASIC-program file SAVE/LOAD and graphics-support to EhBASIC?
SAVE / LOAD: EhBASIC, written in assembler, has the hooks for SAVE / LOAD from the BASIC-prompt. rp6502-sdk provides file-io within C. Adding SAVE & LOAD would enhance EhBASIC's user experience.
BASIC-Graphics: Adding point and line plotting graphics to EhBASIC would open-up the picocomputer's EhBASIC to a wealth of BASIC code available from the retro-computer domain. Unclear to me how adding plot and line graphics that might be approached within EhBASIC. Historically BASICs "back-in-the-day" provided 'USR hooks' to assembly routines. EhBASIC appears to also provide USR() functionality.
And importantly from my perspective (as I am new to Git / Github, but know the importance of good CM practices) is the setup and management of repo workflows:
Thank you for your consideration.
Beta Was this translation helpful? Give feedback.
All reactions