(PC-1211) Engineering format
|
05-20-2022, 02:23 AM
(This post was last modified: 05-21-2022 09:23 PM by robve.)
Post: #18
|
|||
|
|||
RE: (PC-1211) Engineering format
(05-11-2022 11:19 PM)Dave Britten Wrote: That would be extremely handy to have. How do the Sharp computers distinguish between MERGEd programs? Do they just look for out-of-order line numbers? Some kind of catalog command to list all the labels in memory would be nice too. The MERGEd BASIC Programs Rotator "prot" code is complete I'm quite happy with it. It makes it much more convenient to store and run multiple programs on the early Sharp pocket computer models that lack a RAM file system. I've tested "prot" on a PC-1360 and a PC-1350. I wanted to make sure that the code is fully compatible with the internals of these machines. So the machines won't hang or otherwise misbehave. To do so, I had to research materials on the memory organization of these machines to find the flags that control program editing and the display of the last line when cursor up is pressed. The START, END and MERGE pointers are not sufficient to update. Other flags must be set. However, there was not a single source of information I could find among many online resources that I've collected over years that point to the 0x35 internal RAM register used by the BASIC interpreter. After dumping and comparing external and internal RAM and much experimenting, I am convinced that I found the right flags in register 0x35 as well as the external RAM flags and pointers to update. Installation
Now you have two CALLs, one to create a new MERGEd BASIC program that is added to the list at the bottom and one to rotate the programs so that the previous MERGEd program rotates to the bottom of the list and can be edited. For example, suppose we have one program "A" already in memory: 1 "A" REM my first program 2 PRINT "I am program A" To add a new program, CALL 32818 (PC-1360) to create a new MERGEd program consisting of one line with a quote: 1 "A" REM my first program 2 PRINT "I am program A" 1 " Note that the new line 1 " starts a new program that is independent of the previous programs, even when the listing appears to be continuous. To verify, LIST only lists the last merged program's first lines. In this case: LIST 1 " Complete the new program by adding a label "B" and the rest of the code: 1 "A" REM my first program 2 PRINT "I am program A" 1 "B" REM my second program 2 PRINT "I am program B" Executing RUN will run program "B", because it is the last MERGEd just as LIST list program "B". Program "A" is executed with RUN "A". Program "A" stops at line 2 and will not run program "B". Programs are internally separated when MERGEd. Separate programs can call each other using GOTO and GOSUB with labels or string expressions. RESTORE of labelled data in another program is also possible. In this way, libraries of routines and data can be created and shared among several programs. CALL 32820 (PC-1360) rotates the programs, effectively switching "A" and "B": 1 "B" REM my second program 2 PRINT "I am program B" 1 "A" REM my first program 2 PRINT "I am program A" Program "A" can now be edited, which was not possible before the rotation: 1 "B" REM my second program 2 PRINT "I am program B" 1 "A" REM my first program 2 PRINT "I am the first program" Note that only the last program MERGEd can be edited, as stated in the Sharp manuals. If you try to edit a line of an older MERGEd program, it will end up in the last program! Use the "CAT" program to list program labels (see earlier post.) The last program can be deleted with DELETE, (with comma) or just type the line numbers until the program is deleted. When the last program is deleted, the one before it will become the last program that can be edited. Note that NEW, LOAD/CLOAD and MERGE can be used and work fine. SAVE/CSAVE saves all programs. The "prot" machine code takes only about 245 bytes of RAM space. Program source and usage on the PC-1360 Code: 100 CLEAR:V=1
Disclaimer: I have only tested with ONE RAM card in slot S1!! Not sure if a second card in slot S2 works. Program source and usage on the PC-1350 with 16K RAM card Code: 100 CLEAR:V=1
Program source and usage on the PC-1350 without RAM card Code: 100 CLEAR:V=1
What about other Sharp PC? The "prot" program (for lack of a better name) should in principle work on other Sharp PC with some modifications, because it does not use non-portable syscalls. If there is some interest in this, then we should create a new thread. I will create a GitHub repo with the source code, installers and documentation. - Rob "I count on old friends to remain rational" |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)