Here are a few samples that I wrote to test it:

(t.bas)

10 for i = 1 to 10
20 print i, "Hello"
30 next i
40 end

> D:\BASCOMP>bascomp t
> __________               _________
> \______   \_____    _____\_   ___ \  ____   _____ ______
>  |    |  _/\__  \  /  ___/    \  \/ /  _ \ /     \\____ \
>  |    |   \ / __ \_\___ \\ 2.0 \___(  <_> )  Y Y  \  |_> >
>  |______  /(____  /____  >\______  /\____/|__|_|  /   __/
>         \/      \/     \/        \/             \/|__|
> COMPILING t.BAS -> t.ASM
> DONE.
> D:\BASCOMP>nasm -o t.com t.asm
> D:\BASCOMP>t.com
> 1Hello
> 2Hello
> 3Hello
> 4Hello
> 5Hello
> 6Hello
> 7Hello
> 8Hello
> 9Hello
> 10Hello


(g.bas)

10 let s=rnd(100)
20 print "guess a secret number from 1 to 100"
30 print "Your guess?"
35 input g
40 if g>s then print "Too high"
50 if g<s then print "Too low"
60 if g<>s then goto 30
70 print "Thats right!"
80 end

You can also use ASMPACK to make the exe a bit smaller, but that
doesn't make much difference for this small test program:

> D:\BASCOMP>bascomp g
> __________               _________
> \______   \_____    _____\_   ___ \  ____   _____ ______
>  |    |  _/\__  \  /  ___/    \  \/ /  _ \ /     \\____ \
>  |    |   \ / __ \_\___ \\ 2.0 \___(  <_> )  Y Y  \  |_> >
>  |______  /(____  /____  >\______  /\____/|__|_|  /   __/
>         \/      \/     \/        \/             \/|__|
> COMPILING g.BAS -> g.ASM
> DONE.
> D:\BASCOMP>asmpack
> ASMPACK NEW - Version 1.1 - BASCOMP ASM postprocessor
> ASM SOURCE
> ? g.asm
> ASM TARGET
> ? g.a
> PASS 1/8: SIGNATURES
> PASS 2/8: DUPLICATES
> PASS 3/8: REFERENCES
> PASS 4/8: STRING-CLEARS
> PASS 5/8: MULTI-LINE PATTERNS
> PASS 6/8: SINGLE-LINE PATTERNS
> PASS 7/8: NUMERIC STORES
> PASS 8/8: FINALIZATION
> CLEANUP
> D:\BASCOMP>nasm -o g.com g.a
> D:\BASCOMP>g.com
> guess a secret number from 1 to 100
> Your guess?
> ? 50
> Too low
> Your guess?
> ? 75
> Too low
> Your guess?
> ? 88
> Too high
> Your guess?
> ? 80
> Thats right!

And RND generates a random number every time.

As I mentioned above, ASMPACK doesn't make much difference for this
test program: G.ASM (orig) and G.A (packed)

> G        A          49,577  06-01-2026 10:19a
> G        ASM        52,781  06-01-2026 10:19a
> G        BAS           226  06-01-2026 10:02a
> G        COM         1,168  06-01-2026 10:19a


_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to