(PC-1211) Engineering format
|
05-13-2022, 05:43 PM
(This post was last modified: 05-13-2022 08:01 PM by robve.)
Post: #10
|
|||
|
|||
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?\ I dusted off some of my old PC-1350 notes. The following is for S-BASIC for most Sharp PCs. I don't know for sure if this also holds for the earlier PC-1211 BASIC, probably not. Also the PC-1500, PC-1600, PC-E500 and PC-G850 use variations of this memory layout. MERGEd programs are separated by 255 byte markers: 255 <- BASIC START ADDRESS hi <- hi line number byte lo <- lo line number byte len <- line length, including 0xD (13) BASIC tokenized line 13 <- 0xD end of line (carriage return) hi lo len ... etc ... 255 <- MARGE MARKER hi <- hi line number byte lo <- lo line number byte len <- line length, including 0xD (13) BASIC tokenized line 13 <- 0xD hi lo len ... etc ... 255 <- LAST MERGE MARKER AT BASIC MERGE ADDRESS hi <- hi line number byte lo <- lo line number byte len <- line length, including 0xD (13) BASIC tokenized line 13 <- 0xD hi lo len ... etc ... 255 <- BASIC END ADDRESS A program ends when the next hi byte of the line number is 255, which is either the next MERGEd program or the BASIC END ADDRESS with marker. The last MERGEd program is editable, stored in memory starting at the BASIC MERGE ADDRESS. For the PC-1360 there are two pairs of addresses for START, END and MARGE. One extra set resides on the RAM card, so RAM card with BASIC (merged) programs can be swapped. The internal START, END and MERGE are copies that must be synched. PC-1360 BASIC addresses with low/high address byte pairs pointers are stored at the following locations in RAM:
So all that we need to do to create a new "MERGEd" program is manipulate these pointers and POKE a small new program in memory with this 3 liner: Code: 1 "NEW" L=PEEK 65497,H=PEEK 65498,E=L+256*H: POKE 65499,L,H: POKE 32779,L,H To create a new "MERGEd" program:
(05-11-2022 11:19 PM)Dave Britten Wrote: Some kind of catalog command to list all the labels in memory would be nice too. Here you go: Code: 1 "CAT" WAIT 0: A=PEEK 65495+256*PEEK 65496+1,E=PEEK 65497+256*PEEK 65498 It would be a whole lot faster in machine code, but this works reasonably quickly. These two programs work for most Sharp PC, if you can find the BASIC START and BASIC END addresses with the pointers to manipulate. The above was for the PC-1360. For the PC-1350: 28417 BASIC START 28419 BASIC END 28421 BASIC MERGE But the RAM card BASIC pointers differ depending on the RAM card size: RAM card address + 7: RAM BASIC START RAM card address + 9: RAM BASIC END RAM card address + 11: RAM BASIC MERGE No RAM card address = &6000, 8K RAM card address = &4000, 16K RAM card address = &2000 For the PC-1403 (no RAM cards): 65281 BASIC START 65283 BASIC END 65285 BASIC MERGE For the PC-1262 (no RAM cards): 26337 BASIC START 26339 BASIC END 26341 BASIC MERGE I've tested this on the PC-1360 without any issues so far. Feedback is appreciated if you encounter a problem. The "NEW" program assumes that at least a 9 bytes are available to POKE the new program in memory. It does not check for available space (adding a MEM check might be useful). Minor edit: changed "LIST" to "CAT" as suggested to catalog labels. - Rob "I count on old friends to remain rational" |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)