farique1 / msx-basic-dignified

⛔️ DEPRECATED <Current version at https://github.com/farique1/basic-dignified>
15 stars 0 forks source link

passing a program already typed, with line numbers #10

Open wilsonpilon opened 4 years ago

wilsonpilon commented 4 years ago

Hi... first of all, that's a great tool. when compiling a program with line numbers, like:

10 print "Teste" 20 a$=input$(1) 30 end

using this syntax

python3 bin\msxbadig.py source\teste.bad

I get the following result:

1 1PRINT"Teste" 2 2A$=INPUT$() 3 3END

Is this a bug? or have any option to disable duplicate numbers

My msxbadig.ini [DEFAULT] use_ini_file = True source_file = destin_file = line_start = 1 line_step = 1 leading_zeros = rem_header = false colon_spaces = general_spaces = unpack_operators = keep_blank_lines = label_gap = show_branches_labels = handle_label_lines = 0 new_rem_format = convert_rem_formats = keep_indent = capitalize_all = convert_interr_to_print = true strip_then_goto = translate = long_var_summary = verbose_level = 2 output_format = tokenize_tool = export_list = batoken_filepath = bin/msxbatoken.py openbatoken_filepath = bin/openMSXbatoken.py

farique1 commented 4 years ago

EDIT: Yep, it is a bug. Even if MSX Basic Dignified do not take line numbers it should just ignore them in this case. On to the todo list. Thanks.

Hi, @wilsonpilon , sorry for the long delay, I blame the pandemic :) Actually MSX Basic Dignified do NOT take line numbers. So if you just write:

print "Teste"
a$=input$(1)
end

it will be converted to:

10 PRINT"Teste"
20 A$=INPUT$(1)
30 END

There are several ways to direct the code flow without the numbers, the most common is to use labels, like:

{loop}
print "Teste"
a$=input$(1)
goto {loop}

wich will convert to:

10 PRINT"Teste"
20 A$=INPUT$(1)
30 END
40 GOTO 10

There are also functions and simple loops, they are explained on the README.MD Cheers.

wilsonpilon commented 4 years ago

Hello Farique

Don't worry about the delay, we are all in trouble these days.

I actually understood how it works. I've been using it for some time now in new projects, I even made a template for Visual Studio Code that you program with the BADIG syntax and it generates the .BAS in token.

The problem is that I have many old projects, done in the traditional way, with lines.

I wanted to remaster these programs.

Some have many lines, so I wanted to know if BADIG compiled it with the lines, and I would gradually adjust the syntax by removing the lines, separating the routines, rewriting the code, etc.

They are big programs, so changing everything at once is complicated.

I asked, because Nestor PRETER (for MSX) allows you to compile a program with numbers, and generates a .BAS with the same numbers (or renumber, don't remember), so the changes can be made gradually.

Thank you very much for the clarifications and for the kindness to answer my question.

Cheers!

farique1 commented 4 years ago

Hi, @wilsonpilon.

I don't know how far you are on your remastering efforts but I may have some good news. I still haven't fixed the line numbers thing with Basic Dignified but I just made a tool to convert Classic Basic to the Dignified format. It's on the repo, MSXBader.py, along with a .md instruction.

Hope it helps.

Stay safe!

wilsonpilon commented 4 years ago

Hi @farique1

Thank you very much. I did a little test now at work and it worked well. It was a small program, soon I will do tests on larger programs and give you feedback. Thanks again. And congratulations for these tools.

Helps a lot!

Stay safe too!

Cheers!