Proting from old MS bascom

General FreeBASIC programming questions.
Post Reply
pmurphy555
Posts: 1
Joined: Jan 25, 2021 13:32

Proting from old MS bascom

Post by pmurphy555 »

ALl,
I am trying to port an old MS bascom code to Freebasic in language QB.
IS there a list of guidelines and/or rules for making the conversion?
I am especially looking for replacements for these "unique" types of code:

TESTFB.BAS(33) error 10: Expected '=', found 'SEG'
445 DEF SEG = 0: IA=PEEK(&H46C)+256*PEEK(&H46D): DEF SEG: RETURN ' 9 TICKS=0.5 S, 546=30 SEC
^
TESTFB.BAS(33) error 24: Invalid data types, found '+'
445 DEF SEG = 0: IA=PEEK(&H46C)+256*PEEK(&H46D): DEF SEG: RETURN ' 9 TICKS=0.5 S, 546=30 SEC
^
TESTFB.BAS(33) error 10: Expected '=', found 'SEG'
445 DEF SEG = 0: IA=PEEK(&H46C)+256*PEEK(&H46D): DEF SEG: RETURN ' 9 TICKS=0.5 S, 546=30 SEC

/thanks
/paul
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Proting from old MS bascom

Post by marcov »

These constructs are msdos specific, and won't work outside msdos.

Under Windows however the functions gettickcount/gettickcount64 fulfil roughly the same role, giving you a monotonous increasing time since startup in milliseconds. (the -64 variant is Vista+ though)

Under *nix it is usually something like clock_gettime(clock_monotonic,&tv) to get a clock value in seconds and nanoseconds that you then have to combine to a int64 milliseconds number.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Proting from old MS bascom

Post by MrSwiss »

MCS Electronic's BASCOM (for Windows) is a commercial compiler for AVR-MicroControllers ...

FreeBASIC is NOT compatible with that.

Search the Internet for: Great Cow BASIC (which should do).
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Proting from old MS bascom

Post by marcov »

MrSwiss wrote:MCS Electronic's BASCOM (for Windows) is a commercial compiler for AVR-MicroControllers ...

FreeBASIC is NOT compatible with that.

Search the Internet for: Great Cow BASIC (which should do).
Clock ticks at 0:046C are not a Atmel feature to my best knowledge.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Proting from old MS bascom

Post by caseih »

MrSwiss wrote:MCS Electronic's BASCOM (for Windows) is a commercial compiler for AVR-MicroControllers ...
MS BasCom is the Microsoft Business BASIC Compiler for MS-DOS or CP/M, released sometime in 1983. DEF SEG was something only seen on 16-bit real mode x86 processors, usually under MS-DOS. No other processor that I know of had a segmented architecture. Certainly AVR has never been segmented.
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Proting from old MS bascom

Post by angros47 »

MrSwiss wrote:MCS Electronic's BASCOM (for Windows) is a commercial compiler for AVR-MicroControllers ...

FreeBASIC is NOT compatible with that.
BasCom was the original compiler developed by Microsoft for MsDos and CP/M.

http://www.emsps.com/oldtools/msbasv.htm

It was used to compile GWBasic programs, but supported also a bit of structured programming, and didn't need line numbers, so after some time Microsoft added an IDE and called it Quick Basic 1.0

The BASCOM for AVR is totally unrelated with it. And since it doesn't seem to support the DEF SEG instruction, it's pretty clear that pmurphy555 was talking about the Microsoft one (since he also called it "old bascom"
Post Reply