CompuServe Thread

Forum unknown · Programming

Basic Windows

11 messages in this thread
#25186From: GARY SARFFJul 3, 1986 7:43 PM
Hi, a C programmer has a question for some of you amigabasic people. I am trying to open a screen on an interlaced window and I want to draw a circle on it and fill it in with the PAINT command. My screen is 640×400 with 2 bit planes (interlaced), and the window I want is from (1,1)-(630,380) on this screen. As soon as the program attempts to execute the WINDOW statement, the screen scrolls down a little, like when you get a GURU Med. and it says "out of heap space" According to the basic manual, it will allocate memory for a bit map for the screen from the heap, (this would be 640x400x2 bits or 64000 bytes) and then it states the window must be opened with a mode of 16 through 31, I presume this corresponds in C to SMART_REFRESH, so there would be an additional 630x380x2 bits or 59850 bytes. This totals to 123850 bytes. Basic's statement fre(-1) which is supposed to return the number of bytes available in the heap, prints 229112 on my machine. This seems like more than enough, so what is going on. Between this, and microsoft basic constantly crashing the amiga, or beeping illegal function calls at me and the slowness of its windows I feel like jumping up and down on the disk very hard and throwing it out the window. I'd rather use C than this fuss-budget basic, but the project is already started in basic. Any ideas anybody? Thanks to any basic guru's out there, my basic rusted away years ago.
#25586From: John ChenJul 6, 1986 12:47 PM
Try this (it works on my Amiga): Top: SCREEN 1,640,400,2,4 WINDOW 2,"Interlace",(1,1)-(630,380),30,1 DoSomething: CIRCLE (180,120),50 PAINT (180,120) GetKey: WHILE a$="" a$=INKEY$ WEND EndIt: WINDOW CLOSE 2 SCREEN CLOSE 1 END Maybe you opened a window that was too large for the screen? I hope this helps!
#25660From: GARY SARFFJul 6, 1986 7:11 PM
I'll try that tomorrow and let you know. I know I tried to open a window like that I remember those numbers (630,380) but I would get the beep, then the little box around the window statement, then the scroll down message saying Out of heap space, but I'll try again. I think I was using mode 18 instead of 30, cause I don't want the window to resize. That shouldn't make a difference though.
#25660From: GARY SARFFJul 6, 1986 7:11 PM
I'll try that tomorrow and let you know. I know I tried to open a window like that I remember those numbers (630,380) but I would get the beep, then the little box around the window statement, then the scroll down message saying Out of heap space, but I'll try again. I think I was using mode 18 instead of 30, cause I don't want the window to resize. That shouldn't make a difference though.
#25586From: John ChenJul 6, 1986 12:47 PM
Try this (it works on my Amiga): Top: SCREEN 1,640,400,2,4 WINDOW 2,"Interlace",(1,1)-(630,380),30,1 DoSomething: CIRCLE (180,120),50 PAINT (180,120) GetKey: WHILE a$="" a$=INKEY$ WEND EndIt: WINDOW CLOSE 2 SCREEN CLOSE 1 END Maybe you opened a window that was too large for the screen? I hope this helps!
#25632From: Sid TinsleyJul 6, 1986 3:59 PM
My test program is almost an exact copy of John Chen's (msg25586), and it worked too. But if I changed the type/mode in the window statement to an odd setting (17,19,etc) then the program bombed. Now to deepen the mystery, if I opened a small window (0,0)-(100,100), then all modes/types worked. I could extend the sucker to full screen with no problems. I haven't done a full study to see where the breakover point is. ps. John labeled his window, and I didn't. That guy must be a GREAT programmer. <big GRIN!>
#25639From: John ChenJul 6, 1986 5:10 PM
Hi. If you set the type/mode number in the window statement to an odd number, then you have a sizing gadget that reduces the window size you can have (I forget how much).
#25639From: John ChenJul 6, 1986 5:10 PM
Hi. If you set the type/mode number in the window statement to an odd number, then you have a sizing gadget that reduces the window size you can have (I forget how much).
#25662From: GARY SARFFJul 6, 1986 7:16 PM
Thanks. I labelled my window too, but it didn't help <grin> I was using a type/mode of 18, cause I don't want to resize. The manual says that if you specify a mode of 16-31 and also set sizeable then basic will have to reserve enough memory to hold the bitmap of a full screen window, in case you ever size it to be full-screen. I didn't make the window sizeable and it was still giving me that message. But I'll try again. I have noticed that this basic seems to devour little morsels of memory as I have been playing with this window thing. By printing FRE(-1) all the time after opening and closing windows and screens maybe 30 or more times you can lose as much as 30K or more of RAM! This is not my idea of how a language should work, although it is probably the fault of the memory management in the OS. I still think there should have been hardware memory management in the Amiga from the beginning.
#25662From: GARY SARFFJul 6, 1986 7:16 PM
Thanks. I labelled my window too, but it didn't help <grin> I was using a type/mode of 18, cause I don't want to resize. The manual says that if you specify a mode of 16-31 and also set sizeable then basic will have to reserve enough memory to hold the bitmap of a full screen window, in case you ever size it to be full-screen. I didn't make the window sizeable and it was still giving me that message. But I'll try again. I have noticed that this basic seems to devour little morsels of memory as I have been playing with this window thing. By printing FRE(-1) all the time after opening and closing windows and screens maybe 30 or more times you can lose as much as 30K or more of RAM! This is not my idea of how a language should work, although it is probably the fault of the memory management in the OS. I still think there should have been hardware memory management in the Amiga from the beginning.
#25632From: Sid TinsleyJul 6, 1986 3:59 PM
My test program is almost an exact copy of John Chen's (msg25586), and it worked too. But if I changed the type/mode in the window statement to an odd setting (17,19,etc) then the program bombed. Now to deepen the mystery, if I opened a small window (0,0)-(100,100), then all modes/types worked. I could extend the sucker to full screen with no problems. I haven't done a full study to see where the breakover point is. ps. John labeled his window, and I didn't. That guy must be a GREAT programmer. <big GRIN!>