• Please review our updated Terms and Rules here

Uploading a text file for MBASIC

MykeLawson

Experienced Member
Joined
Mar 21, 2014
Messages
387
I know I have done this before, but it has been awhile and I cannot find my instructions to save my soul. I wrote a BASIC program in Notepad/Notepad++, complete with the line numbers. I can upload it to my CP/M 2.2 machine and save it without issue. But when I bring up MBASIC, load the file, and try to list it; nada.... I'm sure it has to do with the old carriage return and line feed stuff, but I cannot find the info I had about how to fix that stuff. So, if anyone has any ideas..... Thanks. :)
 
Textpad will save your program giving you the choice of formats (PC, UNIX, MAC)


Basic Program saved by BASIC

00000000 31 30 20 52 45 4D 20 54 48 49 53 20 50 52 4F 47 10 REM THIS PROG
00000010 52 41 4D 20 57 49 4C 4C 20 43 48 45 43 4B 20 54 RAM WILL CHECK T
00000020 48 45 20 53 50 45 45 44 20 4F 46 20 59 4F 55 52 HE SPEED OF YOUR
00000030 20 44 49 53 4B 20 44 52 49 56 45 53 0D 0A 32 30 DISK DRIVES..20
00000040 20 52 45 4D 20 4F 4E 20 59 4F 55 52 20 4B 41 59 REM ON YOUR KAY
00000050 50 52 4F 20 43 4F 4D 50 55 54 45 52 2E 20 20 46 PRO COMPUTER. F
00000060 45 45 4C 20 46 52 45 45 20 54 4F 20 50 41 53 53 EEL FREE TO PASS
00000070 20 49 54 20 54 4F 0D 0A



Basic Program saved in .MAC Format

00000000 31 30 20 52 45 4D 20 54 48 49 53 20 50 52 4F 47 10 REM THIS PROG
00000010 52 41 4D 20 57 49 4C 4C 20 43 48 45 43 4B 20 54 RAM WILL CHECK T
00000020 48 45 20 53 50 45 45 44 20 4F 46 20 59 4F 55 52 HE SPEED OF YOUR
00000030 20 44 49 53 4B 20 44 52 49 56 45 53 0D 32 30 20 DISK DRIVES.20
00000040 52 45 4D 20 4F 4E 20 59 4F 55 52 20 4B 41 59 50 REM ON YOUR KAYP
00000050 52 4F 20 43 4F 4D 50 55 54 45 52 2E 20 20 46 45 RO COMPUTER. FE
00000060 45 4C 20 46 52 45 45 20 54 4F 20 50 41 53 53 20 EL FREE TO PASS
00000070 49 54 20 54 4F 0D



Basic Program saved in .UNIX Format

00000000 31 30 20 52 45 4D 20 54 48 49 53 20 50 52 4F 47 10 REM THIS PROG
00000010 52 41 4D 20 57 49 4C 4C 20 43 48 45 43 4B 20 54 RAM WILL CHECK T
00000020 48 45 20 53 50 45 45 44 20 4F 46 20 59 4F 55 52 HE SPEED OF YOUR
00000030 20 44 49 53 4B 20 44 52 49 56 45 53 0A 32 30 20 DISK DRIVES.20
00000040 52 45 4D 20 4F 4E 20 59 4F 55 52 20 4B 41 59 50 REM ON YOUR KAYP
00000050 52 4F 20 43 4F 4D 50 55 54 45 52 2E 20 20 46 45 RO COMPUTER. FE
00000060 45 4C 20 46 52 45 45 20 54 4F 20 50 41 53 53 20 EL FREE TO PASS
00000070 49 54 20 54 4F 0A



Basic Program saved in .PC Format = DOS

00000000 31 30 20 52 45 4D 20 54 48 49 53 20 50 52 4F 47 10 REM THIS PROG
00000010 52 41 4D 20 57 49 4C 4C 20 43 48 45 43 4B 20 54 RAM WILL CHECK T
00000020 48 45 20 53 50 45 45 44 20 4F 46 20 59 4F 55 52 HE SPEED OF YOUR
00000030 20 44 49 53 4B 20 44 52 49 56 45 53 0D 0A 32 30 DISK DRIVES..20
00000040 20 52 45 4D 20 4F 4E 20 59 4F 55 52 20 4B 41 59 REM ON YOUR KAY
00000050 50 52 4F 20 43 4F 4D 50 55 54 45 52 2E 20 20 46 PRO COMPUTER. F
00000060 45 45 4C 20 46 52 45 45 20 54 4F 20 50 41 53 53 EEL FREE TO PASS
00000070 20 49 54 20 54 4F 0D 0A

Larry
 
I know I have done this before, but it has been awhile and I cannot find my instructions to save my soul. I wrote a BASIC program in Notepad/Notepad++, complete with the line numbers. I can upload it to my CP/M 2.2 machine and save it without issue. But when I bring up MBASIC, load the file, and try to list it; nada.... I'm sure it has to do with the old carriage return and line feed stuff, but I cannot find the info I had about how to fix that stuff. So, if anyone has any ideas..... Thanks. :)

I think there's a bit more to it than carriage return/linefeed issues. MS Basic generally* doesn't save your programs in text file format, but rather saves them in a 'tokenized' format (just as the programs exists in memory when typed in). These files are essentially in binary format as a result. As such, attempts to load a non-tokenized file will fail.

Most folks get around that by cutting/pasting the text based listings (like the ones you have) into terminal emulator software that is attached to the host system that is running Basic, in your case a CP/M 2.2 machine. I've done that many times over the years using various term emu software packages (most typically TeraTerm). You would typically enable some form of character pacing in the term emu to insure the paste operation works properly. Alternatively, some term emu applications have the ability to send a text file in raw format (without any specific transfer protocol)... that may work as well.

* I seem to recall a Basic dialect or two that had an option to save and/or load programs as text, but I don't recall the details.
 
Last edited:
I think MBASIC has SAVE "filename",A, same as GW-BASIC.

Might require a Ctrl-Z at the end?
 
Well, this is more of an issue with uploading the file I created on my PC, up to the CP/M machine, saving it, and then trying to open and list it in MBASIC. So, I suspect the issue is with whatever Notepad or Notepad++ is padding along with the actual text. I did a copy/paste line by line using PuTTY as the terminal and it worked fine. But I know that isn't exactly the most efficient way to do it either.
 
So, I suspect the issue is with whatever Notepad or Notepad++ is padding along with the actual text

In Notepad++, go to Edit and then EOL Conversion... if it's 'Windows (CR LF)', select 'Unix (LF)' and then save the document.
 
Awhile back I was playing with an altairz80 emulator that I had set up to run M. I coded up a small assembly language program to try just to see if I could assemble it and run it. I created it on my Linux box and then copied it into CP/M. I don't remember if I used the editor to paste into or not. It was quite some time ago. But in the process I discovered on my first try it would not read the text file correctly when trying to assemble. I had to save it with a different format of what the line termination was to make it work. Linux uses LF. I think I had to set it to CR/LF to get it to work. Or I may be remembering some of this wrong. But I know I had to change the line termination type.
 
I know I have done this before, but it has been awhile and I cannot find my instructions to save my soul. I wrote a BASIC program in Notepad/Notepad++, complete with the line numbers. I can upload it to my CP/M 2.2 machine and save it without issue. But when I bring up MBASIC, load the file, and try to list it; nada.... I'm sure it has to do with the old carriage return and line feed stuff, but I cannot find the info I had about how to fix that stuff. So, if anyone has any ideas..... Thanks. :)
Myke, are you saving the downloaded file with a filename in all caps? This could account for the file being there, but MBASIC not being able to load it properly.
 
I have a similar problem in CPM3. Even if I type out the program in MBASIC and go to save it to the local directory it saves the FILENAME.BAS but there's nothing in it when I try to LOAD -> LIST it.
 
Do you need the ",A" option? I don't know as I have never used MBASIC. WIthout the A it saves as tokenized. Does it show a file size?
 
Big difference. Here is the same program saved without the ",A" :
Code:
00000000  ff d0 61 0a 00 91 20 22  68 65 6c 6c 6f 20 77 6f  |..a... "hello wo|
00000010  72 6c 64 22 00 e2 61 14  00 91 20 22 61 6c 6c 20  |rld"..a... "all |
00000020  64 6f 6e 65 21 22 00 00                           |done!"..|
00000028
and with the ",A":
Code:
00000000  31 30 20 50 52 49 4e 54  20 22 68 65 6c 6c 6f 20  |10 PRINT "hello |
00000010  77 6f 72 6c 64 22 0d 0a  32 30 20 50 52 49 4e 54  |world"..20 PRINT|
00000020  20 22 61 6c 6c 20 64 6f  6e 65 21 22 0d 0a 1a     | "all done!"...|
0000002f

Using MS CP/M BASIC-80 5.2. I've trimmed off the garbage after the data (CP/M file granularity is 128 bytes).
 
Last edited:
Adding the ",A" to a SAVE still didn't fix the problem of files having no data in CPM3, at least on my machine. I AM running an IDE / CF card as my drive. I don't know if this has anything to do with it. I think CPM sees the IDE as an HD?
 
What version of MBASIC are you using? How large is the CP/M 3 partition? When you say "No Data", does that mean that the CP/M DUMP utility shows nothing also?
 
I have BASIC 5? running on CP/M. When I upload the file and save it with the CP/M SAVE command, and then read it back in with MBASIC; nothing shows up when I try to LIST it. Not highly important, but something I do want to figure out at some point.
 
Woah, I'm not sure that I understand. You use some sort of linkup to get the file onto disk, then start MBASIC and use the LOAD "filename" command to get the file into MBASIC. Can you LIST it then? Then you SAVE the file to a different filename and that filename is empty?
 
So, I bring up my CP/M 2.2 system, then run the 'monitor' program to load whatever I want through the serial port and put it in RAM. I've always used the standard 0100h for the start of where to store it. Then I return to CP/M and use the SAVE command to put it on the disk; ie SAVE x B:FILENAME.BAS.

Then I run MBASIC, then LOAD "B:FILENAME.BAS. then go to LIST it. and nothing. Now, this was just a wild shot I know, and it didn't work, as I suspected it wouldn't. Frankly, I'm not sure what the 'preferred method' is for copying a BASIC text file onto a CP/M machine and then placing it on the disk so MBASIC can use it. I'm sure there is some kind of 'prep' work to get the text file setup properly, etc.
 
I thought the 100h only mattered for COM programs. BASIC files shouldn't need it.
Do you get good files SAVEd if typed in BASIC?
 
Back
Top