Page 1 of 1

ROM Text Editor - where are file details?

Posted: Tue Nov 19, 2024 3:14 pm
by Martin Schmalenbach
Hi

The excellent built in text editor in the ROM is, well, excellent!

I want to have my assembler and my pascal compiler be able to access and process the file that the text editor has got loaded.

Where do I find the details of where this text file is stored? I need the RAM bank and starting address and also its length or the ram bank and ending address.

Thanks in advance.

Cheers

Martin

Re: ROM Text Editor - where are file details?

Posted: Tue Nov 19, 2024 3:50 pm
by Stefan
Hi,

Great that you like the text editor!

You'll find the manual here: https://github.com/stefan-b-jakobsson/x ... manual.pdf

Appendix B contains information on how to launch the editor, which I think is of particular interest to you.

Some notes:
  • The text buffer is stored in banked RAM
  • You control which banks are used by the editor when you launch it
  • In the Load file entry point, the X and Y registers are used to set the first and last RAM bank respectively
  • The BASIC command EDIT allocates all banks from #10 onwords for the use of the editor
  • I would not recommend that you interact with the text buffer directly. It is better to read the file from disc.
  • If you still want to interact directly with the text buffer, note that the first RAM bank is used for variable storage. The text buffer starts from the second bank that is allocated to the editor. Also note that the text buffer is not organized as a contiguous stream. The buffer is broken up in 256 byte blocks. Each block begins with 5 bytes of metadata, holding a reference to the previous block, the next block, and the text length of the current block. The text buffer memory layout is described in the source code. Please note that the text buffer memory layout is not part of the published API. It could be changed, even though it's not on my to do list.

Re: ROM Text Editor - where are file details?

Posted: Tue Nov 19, 2024 8:33 pm
by Martin Schmalenbach
Thanks Stefan - that’s very clear, and good to know.

I’ll go with your recommendation and stick with accessing the source code file from disk!