Windoze 3.0 Advice

General FreeBASIC programming questions.
Post Reply
Gablea
Posts: 1104
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Windoze 3.0 Advice

Post by Gablea »

Hi All,

can someone help me about a bit. I am trying to get a simple Windzoe application to work but I am not having any
luck.

this is the errors I am getting when I try to run the example WIN3.BAS File


FbTemp.bas(480) error 74: Var-len arrays cannot be initialized, before '{'
STATIC SHARED InternalFont(0 TO 318) AS SHORT => {-7937, -8199, -16480, -8199, -7937, -1, -16136, -16388, -15361, -16392,_
^
FbTemp.bas(1452) warning 11(0): Implicit variable allocation, DSPDataAvail
FbTemp.bas(2550) warning 11(0): Implicit variable allocation, bx
FbTemp.bas(2550) warning 11(0): Implicit variable allocation, cx
FbTemp.bas(2550) warning 11(0): Implicit variable allocation, dx
FbTemp.bas(2580) warning 11(0): Implicit variable allocation, bx
FbTemp.bas(4604) warning 11(0): Implicit variable allocation, bufferlen
FbTemp.bas(4616) warning 11(0): Implicit variable allocation, voff

can someone explain to me please what i am doing wrong
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Windoze 3.0 Advice

Post by marcov »

Gablea wrote: can someone help me about a bit. I am trying to get a simple Windzoe application to work but I am not having any
luck.
Seems it already failed in 2010: http://www.freebasic.net/forum/viewtopic.php?t=15554

There it says to use the fblite dialect, and it seems to be for the dos target, so use the dos compiler (the 16-bit ax/bx/cx/dx references already indicate that)
angros47
Posts: 2324
Joined: Jun 21, 2005 19:04

Re: Windoze 3.0 Advice

Post by angros47 »

You have to use -lang fblite (as far as I recall, you already used windoze 3.0 in the past... you also sent me some mail about it)

Windoze should work on other targets, not only dos: the 16 bit ax/bx references are not used, they're only leftovers of the 16 bit version (windoze is a rough port of a 16 bit qbasic program)
Gablea
Posts: 1104
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Re: Windoze 3.0 Advice

Post by Gablea »

Well I put that project on the back burner as I moved my systems into Windows.

Now I want to make a DOS version (mainly to pass the time when I am not working)

i am now getting this error message when i changed the language option

C:\Program Files\FreeBASIC\fbc -lang fblite "WIN3.BAS"
WIN3.BAS(758) error 74: Var-len arrays cannot be initialized, before '{'
STATIC SHARED InternalFont(0 TO 318) AS SHORT => {-7937, -8199, -16480, -8199, -7937, -1, -16136, -16388, -15361, -16392,_
^

Build error(s)

I have no idea what this means
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Windoze 3.0 Advice

Post by counting_pine »

I suspect you have Option Dynamic or '$DYNAMIC in your code somewhere. That means your array, despite having constant bounds, is dynamic, and dynamic arrays can't be initialised.
Gablea
Posts: 1104
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Re: Windoze 3.0 Advice

Post by Gablea »

do i still need the winfont.bas file? if so where would i get it from.

i have not changed anything in the code.

also can i mix xfont with the windoze code?
angros47
Posts: 2324
Joined: Jun 21, 2005 19:04

Re: Windoze 3.0 Advice

Post by angros47 »

The font is embedded in the InternalFont array (all these numbers between curly brackets), you don't need external files.

I never tried xfonts with windoze, and I doubt anybody else tried, so I don't know if it works.
frisian
Posts: 249
Joined: Oct 08, 2009 17:25

Re: Windoze 3.0 Advice

Post by frisian »

A quick and dirty way to get win3.bas compiled.

Add #lang "fblite" before defint a-z

Change the line
static shared internalfont (0 to 318) as short => { .....
into
static shared internalfont (0 to 318) as short : data ....
Remove the curly bracket at the end of the data block (}).

Insert at the end of the data block the following lines
for i = 0 to 318
read internalfont(i)
next


And the program will compile without error messages.

The program has a slow response to mouse-clicks and it complained that it could not find the Sound Blaster settings. The first window it produced showed the data and time but the window was to small so a part was printed outside the window.

Have fun.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Windoze 3.0 Advice

Post by counting_pine »

Actually, now I think about it, it'd probably be enough just to put Option Static before the Static Shared line, and Option Dynamic again after it.
Gablea
Posts: 1104
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Re: Windoze 3.0 Advice

Post by Gablea »

Thanks Guys

it Complies Now SO I shall be having a play with it over the next few hours
frisian
Posts: 249
Joined: Oct 08, 2009 17:25

Re: Windoze 3.0 Advice

Post by frisian »

counting_pine wrote:Actually, now I think about it, it'd probably be enough just to put Option Static before the Static Shared line, and Option Dynamic again after it.
That works, thanks.
Gablea
Posts: 1104
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Re: Windoze 3.0 Advice

Post by Gablea »

@angros47

DO you know if i can use XFont with windoze 3.0? I or can the built in text be made bigger?
angros47
Posts: 2324
Joined: Jun 21, 2005 19:04

Re: Windoze 3.0 Advice

Post by angros47 »

Built in text cannot be made any bigger, at least not easily, because it's achieved with the PUT command for every character. Actually, there are some ways to allow PUT to scale/rotate an image, but it would be slow (and, if you are using a DOS machine, usually it's an old computer, with poor performances... and FreeBasic graphics is not really optimized for DOS, too).

Even if you managed to use a scaling PUT, default font data are stored as 6x8 pixels per character... so if you upscale them you'd get an horribly pixelated result.

I haven't tried XFonts, but its documentation states that it's OOP, so it should be used in -lang FB, and windoze runs in -lang fblite, so they cannot be used at the same time without some rewrite.
Post Reply