Jump to content

Photo

Saving to PC, editing, and then running the program in Altirra


17 replies to this topic

#1 pmgraphics OFFLINE  

pmgraphics

    Space Invader

  • 49 posts

Posted Thu Apr 25, 2019 3:39 PM

I am experimenting with saving a BASIC program from Altirra to the PC, editing the saved program in notepad++, and then loading it again in Altirra.

 

In my procedures below two programs had different end-of-line characters as displayed in notepad++, a right pointing carrot (not a greater than symbol) and the box below that was actually the letters CSI in inverse (black background and white text). Things worked great for the program that used the CSI as the end of line, I saved, edited in notepad++, and ran the edited program in Altirra. The program that used the right pointing carrot, even though it loaded in Altirra after editing in notepadd++ with no error and the code looked good, the program crashed Altirra at run.

 

Is there a safer/better way to do what I am doing? What I like about my procedures below is going from Altirra to PC back to Altirra all special characters, case, and inverses were retained.

 

My procedures:

-Setup Host Device
Click System > Configure > Devices
Click Add
Under HLE select Host Devices (H:)
Browse to an existing directory
Uncheck Read only
 
-save a BASIC program in Altirra as a text file for the PC
LIST "H:name.ext"
 
-edit file
Open the name.ext file in notepad++
Clean up by replacing end of line (› or or...) with end of line\n: find replace with \n
--Search mode: Extended
When done editing and before saving, replace all the added \n with nothing by not entering anything the replace box
 
-load the edited file in Altirra

ENTER "H:name.ext" 



#2 rdea6 OFFLINE  

rdea6

    River Patroller

  • 2,836 posts
  • Location:Arizona USA

Posted Thu Apr 25, 2019 4:00 PM

There is a program by Joyfullcoder here in the forums and It will do a much better job at editing a listed basic file. plus it will change all the end of line characters to Atari standard. 

 

http://joyfulcoder.c...MemoPad-R26.zip


Edited by rdea6, Thu Apr 25, 2019 4:03 PM.


#3 Wrathchild OFFLINE  

Wrathchild

    River Patroller

  • 2,234 posts
  • Location:Reading, UK.

Posted Thu Apr 25, 2019 4:03 PM

Also, rather when mapping your H: drive, also check to map that as a D: drive.

That way you can also use LIST/ENTER "D6:name.ext" and the cr/lf to $9B conversion is handled for you.



#4 pmgraphics OFFLINE  

pmgraphics

    Space Invader

  • Topic Starter
  • 49 posts

Posted Thu Apr 25, 2019 4:45 PM

There is a program by Joyfullcoder here in the forums and It will do a much better job at editing a listed basic file. plus it will change all the end of line characters to Atari standard. 

 

http://joyfulcoder.c...MemoPad-R26.zip

Memopad worked great for my LIST "H:name.ext" that broke in notepad++.

 

I tried the import Atari Basic, since the original is a .BAS file. It imported fine. I made a change and did a save as. In Altirra I loaded the .bas file using File > Boot image and got ERROR 21 and 130. Is there a step required before saving the changes to make the new BAS file work? Thanks



#5 pmgraphics OFFLINE  

pmgraphics

    Space Invader

  • Topic Starter
  • 49 posts

Posted Thu Apr 25, 2019 4:47 PM

Also, rather when mapping your H: drive, also check to map that as a D: drive.

That way you can also use LIST/ENTER "D6:name.ext" and the cr/lf to $9B conversion is handled for you.

Can you explain further what this does? Is D6 always used or I can start with D, as my H is just H for being only 1? thanks.


Edited by pmgraphics, Thu Apr 25, 2019 4:51 PM.


#6 rdea6 OFFLINE  

rdea6

    River Patroller

  • 2,836 posts
  • Location:Arizona USA

Posted Thu Apr 25, 2019 5:08 PM

All listed programs are ATASCI and not tokenized so need to be save in the basic you are using even if it is named BAS it is still a listed file ... memopad just converts the end of line to 9B instead of the PC EOL of control J and control M

 

 

From basic in the emulator Altirria ENTER "H:filename.LST   Just rename to filename.BAS still needs to be entered ENTER "H:FILENAME.BAS


Edited by rdea6, Thu Apr 25, 2019 5:12 PM.


#7 rdea6 OFFLINE  

rdea6

    River Patroller

  • 2,836 posts
  • Location:Arizona USA

Posted Thu Apr 25, 2019 10:41 PM

End-of-line character translation
By default, the H: device does not do any translations on read or written data.
This is inconvenient for text files since the host-based text programs use a
LF or CR/LF convention instead of the Atari's $9B end-of-line character. To deal
with this, the host device maps H6: through H9: to the same paths as H1:-H4:, but
accesses through the H6-H9: aliases do EOL conversion. On read, CR, LF, or CR/LF
pairs are converted to ATASCII EOL characters, and on write, EOL is converted
back to CR/LF.

All file sizes and file positions seen by the emulation are in the
ATASCII version of the file stream and are consistent with GET/PUT
commands.



#8 pmgraphics OFFLINE  

pmgraphics

    Space Invader

  • Topic Starter
  • 49 posts

Posted Fri Apr 26, 2019 11:20 AM

I was able to import a .bas file into memopad, edit the file, save the file, and in Altirra use ENTER"H:FILE.BAS" to load the file and run the program. Since I had started Altirra with a dos2 formatted atr file attached to Drive 1, with a program already on it thus I know I can load and save to it (I tested it), when I do SAVE"D:FILE.BAS" to the atr file I keep getting ERROR 165, Invalid filename.

 

What is preventing me from loading a program from the H: and saving it to and atr file attached to Drive 1?



#9 Wrathchild OFFLINE  

Wrathchild

    River Patroller

  • 2,234 posts
  • Location:Reading, UK.

Posted Fri Apr 26, 2019 11:46 AM

Maybe ensure your "Also install as D:" is unchecked?

 

You can still save to (LIST) and load from (ENTER) H6 and then you should be able work on the file outside of the Atari in cr/lf mode

 

map_hd.png



#10 Irgendwer OFFLINE  

Irgendwer

    Stargunner

  • 1,485 posts
  • Location:Germany

Posted Fri Apr 26, 2019 12:29 PM

Hopefully I do not derail the thread, but did you tried "Turban"?

 

http://atariage.com/...rbobasic-nifty/

 

It supports Atari-Basic too.



#11 rdea6 OFFLINE  

rdea6

    River Patroller

  • 2,836 posts
  • Location:Arizona USA

Posted Fri Apr 26, 2019 2:09 PM

I was able to import a .bas file into memopad, edit the file, save the file, and in Altirra use ENTER"H:FILE.BAS" to load the file and run the program. Since I had started Altirra with a dos2 formatted atr file attached to Drive 1, with a program already on it thus I know I can load and save to it (I tested it), when I do SAVE"D:FILE.BAS" to the atr file I keep getting ERROR 165, Invalid filename.

 

What is preventing me from loading a program from the H: and saving it to and atr file attached to Drive 1?

Make sure disk is not locked. and a directory tree has free sectors.  and also try SAVE "D1:FILE.BAS"..  I believe that some Dos variants don't like the name without the drive number..



#12 pmgraphics OFFLINE  

pmgraphics

    Space Invader

  • Topic Starter
  • 49 posts

Posted Fri Apr 26, 2019 2:11 PM

For Host devices (H:) Also installas D: is not checked.

 

Both SAVE and LIST produce the error 165, when trying to save the program to the ATR file attached to Drive 1.



#13 pmgraphics OFFLINE  

pmgraphics

    Space Invader

  • Topic Starter
  • 49 posts

Posted Fri Apr 26, 2019 2:12 PM

Make sure disk is not locked. and a directory tree has free sectors.  and also try SAVE "D1:FILE.BAS"..  I believe that some Dos variants don't like the name without the drive number..

The disk is not locked. it is set to R/W. Trying D1 produces the same error as before. I just tested it and saved a onliner program. I just cannot save a program loaded from H:. The disk has 565 free sectors.


Edited by pmgraphics, Fri Apr 26, 2019 2:17 PM.


#14 rdea6 OFFLINE  

rdea6

    River Patroller

  • 2,836 posts
  • Location:Arizona USA

Posted Fri Apr 26, 2019 2:36 PM

I think it is time for a newdisk attached to D1 and start over fresh.



#15 pmgraphics OFFLINE  

pmgraphics

    Space Invader

  • Topic Starter
  • 49 posts

Posted Fri Apr 26, 2019 2:43 PM

Problem solved. My file name started with a number SAVE"D:104T.SAV" I changed it to SAVE"D:TENFOURT.SAV"  and it saved. Is it not allowed in ATARI to start files with a number?

 

Correction: the long name did not work, but I also saved it as short name, T2.SAV and that did work. I loaded the saved T2.SAV program and it ran. Sorry for the head scratching if provided my actual file name as starting with a number would have answered the question earlier.


Edited by pmgraphics, Fri Apr 26, 2019 2:57 PM.


#16 Wrathchild OFFLINE  

Wrathchild

    River Patroller

  • 2,234 posts
  • Location:Reading, UK.

Posted Fri Apr 26, 2019 2:53 PM

No it isn't typically permitted



#17 Stephen OFFLINE  

Stephen

    Quadrunner

  • 7,651 posts
  • A8 Gear Head
  • Location:No longer in Crakron, Ohio

Posted Fri Apr 26, 2019 5:52 PM

Problem solved. My file name started with a number SAVE"D:104T.SAV" I changed it to SAVE"D:TENFOURT.SAV"  and it saved. Is it not allowed in ATARI to start files with a number?

 

Correction: the long name did not work, but I also saved it as short name, T2.SAV and that did work. I loaded the saved T2.SAV program and it ran. Sorry for the head scratching if provided my actual file name as starting with a number would have answered the question earlier.

Dos 2 and variants will not allow it.  Real DOSes like Sparta Dos and Sparta DOS X do.



#18 Nezgar OFFLINE  

Nezgar

    Stargunner

  • 1,975 posts
  • Location:Saskatchewan Canada

Posted Sun Apr 28, 2019 12:58 AM

Dos 2 and variants will not allow it.  Real DOSes like Sparta Dos and Sparta DOS X do.

 

Heh, I was burned by this recently as well... Trying to dump the 850 ROM.... to a file called "850.ROM"... WTF I was thinking.. took me while to figure it out! I have been spoiled by SpartaDOS as well. :)

 

Here's the passage from the DOS II manual: https://archive.org/...-2-ref/page/n16

 

filename.png

Would love to know the rationale behind that design decision...






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users