[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

2172.0. "dpaint screens & basic programs" by NZOV01::MCKENZIE (Nuke the Leprechaun!) Mon Jan 30 1989 19:23

    Most of you probably know about this - but anyway
    
    I created a few DPAINT screens awhile back and was asking around
    to find out how to incorporate these screens in a BASIC program(s)
    
    I recieved a number of replies concerning this package and that
    package - but recently I started playing around with the demos on
    the EXTRAS disk that comes standard with the amiga:
    
    I found 2 programs of interest. the first LOADILBM-SAVEACBM reads
    in a DPAINT screen (which is stored in IFF format) and converts
    it to an ACBM format on the disk specified. You can then add the
    program LOADACBM to your program as a sub-routine and call screens
    as needed.
    
    There are a couple of minor problems however...The LOADACBM program
    seems to only load a single screen. Further attempts within the
    same program to load/display further screens result in the famous
    
    "Illegal function call" error on a WINDOW statement in the program.
    I have not been able to get around this. 
    
    The second problem is that if you get one program to load another
    the second screen displayed has a menu bar LOADILBM-SAVEACBM appearing
    at the top of the screen. If you move the mouse onto this bar and
    press the right button, this bar goes away...cant figure this at
    all...?
    
    The last problem is that I have not been able to find a way to load/run
    a 2nd program while preserving the DPAINT screen currently displayed.
    Every time a new program is loaded, the screen is cleared then the
    new DPAINT Screen appears. This is very annoying!
    
    
    Any help would be Greatly appreciated....
    
    Phil
    
    
    
    
    
    
    
    
    
    
    
    
T.RTitleUserPersonal
Name
DateLines
2172.1NZOV01::MCKENZIENuke the Leprechaun!Thu Feb 02 1989 00:197
    I found a way round the window problem
    
    define an integer called SCR% and substitute into WINDOW statement.
    
    then - for every new DPAINT Screen increment SCR% by 1
    
    
2172.2Help me,I am a beginner!!!GUCCI::HERBThu Feb 02 1989 00:5611
    How do I make load acbm a routine???
    
    What commands do I use to call up a Dpaint picture (I have already
    turned them in ACBM format)??
    
    Can someone give me a program that would just show a Dpaint file
    called "ROCK" ? (I want to use it as a title page and background
    for my amigabasic programs)
    
              Matt
    
2172.3help...?NZOV01::MCKENZIENuke the Leprechaun!Thu Feb 02 1989 02:0439
    ok try this.....
    
    
    (1) copy loadacbm to the disk with your program on it
    (2) hop into basic and load the loadacmb program
    (3) use your mouse to select the entire porgram for cutting
    (4) select the EDIT option on the menu bar and select the CUT
        sub-option.
    (5) load your program
    (6) Decide on a line number for the sub routine and move the pointer
        to the appropriate place in the program
    (7) select the EDIT option on the menu bar and select the PASTE
        sub-option.
    (8) you will need to copy the DOS.LIBRARY, GRAPHIC.LIBRARY and
        EXEC.LIBRARY files to your program disk. These are found on
        the EXTRAS disk.
    (9) CUT the 1st DIM statement and DECLARE statments and PASTE these
        at the top of the program.
    (10) remove the INPUT ACMBname$ statement and all associated PRINT
         statments.
    (11) place the following lines at the top of yourt program (after
         the DIM and DECLARE Statements)
    
         ACBMname$ = "[dpaint file that has been converted to acbm]"
         Gosub [line of sub-routine] 
    
    
     If your new to amiga basic - read BASIC manual section on
     editing/debugging programs - specifically CUT/PASTE functions.
     
    One last thing: there is a subroutine in LOADACBM called Mcleanup:
    inside this routine is an END statement - you might like to use
    an INKEY$ statement (A$=INKEY$ statement) followed by a RETURN
    statement - this will allow you to use the LOADACBM as a sub-routine.
    
     Try this - if you have any problems - let me know - I'll see what
     I can do.

     Phil        
2172.4help meGUCCI::HERBThu Feb 02 1989 23:2043
    What my program is suppose to do:
    
    Shows acbm picture called "rock2" then goes on and draws circles
    and other stuff.
    
    That is what I wanted it to,but it did not do that.   
    
    here is what the whole program looks like after it was editted.
    
    ACBMname$ = "df0:rock2"
    GOSUB 105
    REM - FUNCTIONS FROM DOS.LIBRARY
    DECLARE FUNCTION XOPEN& LIBRARY
    DECLARE FUNCTION XREAD& LIBRARY
    DECLARE FUNCTION XWRITE& LIBRARY
    REM - XCLOSE RETURNS NO VALUE
    REM - FUNCTION FROM EXEC.LIBRARY
    DECLARE FUNCTION ALLOCMEM&() LIBRARY
    
    [ LOTS OF REM STATEMENTS ]
    
    MAIN:
    
    [ MORE STUFF ]
    
    NEXT
    RETURN         <-- END OF LOAD ACBM PROGRAM
    
    100 CLS        <-- BEGINNING OF MY PROGRAM
    102 SCREEN 1,640,400,5,3     <-- IS THIS NECESSERY??
    105 WINDOW 1,"DEMO",(0,0)-(320,385),15,1     <-- I GET A "ILLEAGEL
    FUNCTION CALL" WHEN IT GOSUBS TO THIS LINE
    
    [ MORE OF MY PROGRAM ]
    
    END
    
    
    Do need to use a screen or window command???  Is this what the program
    is suppose to look like????
    
           Matt
    
2172.5my programNZOV01::MCKENZIENuke the Leprechaun!Mon Feb 06 1989 18:0263
>>    Do need to use a screen or window command???  Is this what the program
>>    is suppose to look like????

      You DO need both screen and window commands - without these the
    screen resolution gets badly knackered and produces all kinds of
    garbage that can only be cleared by cold-booting.
    
    My program looks somthing like this...

    10 cls
    20 DECLARE FUNCTION XOPEN& LIBRARY
    20 DECLARE FUNCTION XREAD& LIBRARY
    40 DECLARE FUNCTION XWRITE& LIBRARY
    50 DECLARE FUNCTION ALLOCMEM&() LIBRARY
    60 ACBMname$ = "df0:Picture"
    65 SCR% = 2    
    70 gosub 1000
    80 IF A$ = "X" THEN END
    90 ACBMname$ = "DF1:Piture2"
    100 SCR% = 3
    110 Gosub 1000
    115 if a$ = "E" then end
    120 
    .
    .      <--- rest of my program: note that I dont continue program
    .      <--- after line 1000 where acbm routine is. Also - you can
    .      <--- only display each window ONCE like in this program
    .      <--- if you wanted to re-display df0:picture you couldnt
    .      <--- just goto or gosub 60 - you would have to set scr% to
    .      <--- 4 and acmbname$ to df0:picture and gosub to 1000 again
    950
    990 END
    1000 REM
    MAIN:
    .
    .
    .
    Mcleanup:
    if ACBMName$ = "" then RETURN
    [Couple of error checks here]
    A$ = INKEY$:IF A$ = "" then goto Mcleanup <--- my entry
    Mcleanup2:
    [WINDOW CLOSE 2]  <--- GET RID OF THIS LINE
    [SCREEN CLOSE 2]  <--- GET RID OF THIS LINE
    RETURN
    .
    . <------- Still more of the ACBM program
    .
    SCREEN SCR%,640,400,5,3                    <--- notice scr% instead
    WINDOW SCR%1,"DEMO",(0,0)-(320,385),15,1   <--- of fixed number
    .
    .
    .
    END OF ACBM ROUTINE

    
    I could never get this to work without removing the window close
    and screen close statements - this will mean that memory will be
    used up quickly - unless someone else can find a way around it.
    
    Phil
    
    
2172.6still need help...NZOV01::MCKENZIENuke the Leprechaun!Tue Feb 07 1989 20:5434
    Hi - could still use some help on the following...    
    
        The problem is that if you get one program to load another
    the second screen displayed has a menu bar LOADILBM-SAVEACBM appearing
    at the top of the screen. If you move the mouse onto this bar and
    press the right button, this bar goes away...cant figure this at
    all...?
    
    Has anyone ever come across this problem - how can it be fixed?
    
    The last problem is that I have not been able to find a way to load/run
    a 2nd program while preserving the DPAINT screen currently displayed.
    Every time a new program is loaded, the screen is cleared then the
    new DPAINT Screen appears. This is very annoying!
    
    help!
    
    Phil    
    Any help would be Greatly appreciated....
    
    Phil
    
    
    
    
    
    
    
    
    
    
    
    
2172.7I want to hurt the person who made AmigabasicGUCCI::HERBWed Feb 08 1989 01:0245
    I still have trouble on getting it to work.  My latest problem is
    it can not find dos.library.  
    
    I still have more questions concering the program you gave me.
    
    10 cls
    20-50 [declare statements]
    60 acbmname$ = "df0:[name of picture]"
    65 scr% = 2
    70 gosub 1000
    80 if a$ = "x" then end
    90 acbmname$ = "df1:picture2" [I do not have 2 disk drives][is this
    for the second picture]
    100 scr% = 3
    110 gosub 1000
    115 if a$ = "e" then end      
    
    are lines 80,90,100,110 and 115 necessary if I only want one shown?
    
    .
    .
    .
    .
    950
    990 end
    1000 rem
    
    do I get rid of what was originally in Mcleanup???  There is not
    any screen or window close statements in mcleanup2: do I change
    anything in Mcleanup2:?  Do I get rid of the window and screen close
    in Mcleanup:?  Is this the part of the program that brings you back
    to your program?  If so,can I delete everything after the end of
    mcleanup2:?
    
    screen scr%,640,400,5,3    Do I adjust the screen statement to the
    resolution of then picture???
    window scr%,"demo",(0,0)- (320,385),15,1
    
    Should these 2 statements be right after the declare statements
    at the begining of the program?    
    
    Maybe you can upload the program you made to display acbm pictures?
    
              Matt
    
2172.8hang in there...NZOV01::MCKENZIENuke the Leprechaun!Wed Feb 08 1989 19:1422
    Um - cant upload at the moment as I have no access to modem etc
    - however...
    
    if you only want one picture displayed then leave the WINDOW CLOSE
    and SCREEN CLOSE statements in mcleanup2: and either end your program
    there or RETURN to your main prog.
    
    as far as the DF1:picture2 bit is concernerd - thats just an example
    of how you can request acbm files from a second drive - if you only
    have one drive - then just use df0:...
    
    your program is nearly working - I had the same dos.library not
    found problem - there are three library files that you have to copy
    off your extras disk onto your program disk. I'll get back to you
    with the file names and location on the EXTRAS disk... I vaguely
    remember cursing loudly because i couldnt find these library files
    on the disk. (AMIGADOS badly needs a dir [...]file.tag type command)
    
    
    Dont give up - your nearly there...

    Phil 
2172.9Should I get a new copy of extras??GUCCI::HERBSat Feb 11 1989 00:2512
    Where is the dos.library at? If it is on the extras disk I can't
    find it.
    
    Can the get statement load up pictures drawn in basic? Example:
    I make a drawing program that can save a drawing and then use the
    get statement to call up the picture.
    
    I do remember a file with a extension of .lb on the extras disk
     in some directory.
    
    MaTt
    
2172.10...found...NZOV01::MCKENZIENuke the Leprechaun!Sun Feb 12 1989 17:369
    ok - got the file names: ,they are as follows
    
    
         DOS.BMAP
         GRAPHICS.BMAP
         EXEC.BMAP
    
    the LIBRARY commands use these files - locate these on your extras
    disk and copy to your program disk.
2172.11GUCCI::HERBMon Feb 13 1989 21:4218
    This is a part of my program. Is it right?
    
    
    999 end
    1000 rem
    
    main:
    
    dim [3 dim statement]
            
    
    library "dos.library"    <-- this is where the error occurs
    library "exec.library"
    library "graphics.library"
                                                               
    matt
    {_
    
2172.12NZOV01::MCKENZIENuke the Leprechaun!Mon Feb 13 1989 21:593
    move any DIM or DECLARE statements to the TOP of your program so
    that they are only run once - you cant re-dimension arrays in basic.
    otherwise - all ok
2172.13:-) to :-(GUCCI::HERBWed Feb 15 1989 09:5311
    I finally got the picture on the screen in basic after I moved 3
    dim statements to the top of the program and copied the bmaps outside
    of the basicdemos directory.  I still have a problem. After the
    picture appears it just stays there. I want the program to get rid
    of the picture after a couple seconds and move to the bottom of
    the program (that is were the rest of my program is).  The program
    is still running after it shows the picture. Is the acbm program
    running in circles?
    
    Matt
    
2172.14so close...NZOV01::MCKENZIENuke the Leprechaun!Wed Feb 15 1989 17:3720
    if the abcm program (around the Mcleanup: tags) is an END statement
    
    what I id is replace END with 
    
    A$=INKEY$: IF A$ = "" then goto [this line number]
    RETURN

    alternatively you gould RETURN after a time delay
    
    FOR X = 1 to 5000:next X <------- waits about 1 1/2 seconds
     
    then just after the GOSUB if your program that goes to MAIN: for
    the load ACBM bit GOTO the next part of YOUR program.
    
    Best Regards and good luck
    
    Phil (you played ZK at all??)
    

    
2172.15Just what mother warned against :-)WJG::GUINEAUWed Feb 15 1989 19:1214

re .-1

>     
>    FOR X = 1 to 5000:next X <------- waits about 1 1/2 seconds
>

ARGH!  On a 68000 maybe, but not on future products (68030 will make mince
meat of that loop!)

Something like sleep(x) is better (Does AmigaDOS have this??)

John
2172.16DelayTLE::RMEYERSRandy MeyersWed Feb 15 1989 22:217
Re: .15

>Something like sleep(x) is better (Does AmigaDOS have this??)

Their is a Delay function in the DOS.library that takes a single
integer argument: the number of 0.02 second intervals to wait (eg,
Delay(50) sleeps for a second).
2172.17What is ZK?GUCCI::HERBThu Feb 16 1989 00:3114
    Now I am trying to have a second picture displayed. The error I
    have now is at this part:
    
    LIBRARY "graphics.library"
    
    The error is "Too many files"
    
    My second gosub is at the end of my program and I gosub to main:
    just like the first time.
    
    What did I do wrong now?
    
    Matt
    
2172.18I think I will play a game of Falcon and go sleepGUCCI::HERBThu Feb 16 1989 01:0114
    I just got around that problem by gosubing to a place right after
    the library statement.
    
    Now I have the "Illeagle function call" error on the WINDOW statement
    . My WINDOW statement looks like this
    
    SCREEN 2,scrwidth%,scrheight%,idepth%,kk
    WINDOW 2,"loadacbm",,7,scr%
    scr%=scr%+1
    
    What did I do wrong this time?
    
    Matt
    
2172.19RDCV01::RANDREWSI have a cunning planThu Feb 16 1989 01:0913
    >Now I have the "Illeagle function call" error on the WINDOW statement
    First thing you gotta do is take your bird to the doctor! ;-)
    
    >    . My WINDOW statement looks like this
    >    
    >    SCREEN 2,scrwidth%,scrheight%,idepth%,kk
    >    WINDOW 2,"loadacbm",,7,scr%
    What's the value of scr% when you get to this line?  Try doing a
    print scr% just before this line.  I don't remember if you can use
    a value of 0 for the screen.  I think if you want the workbench
    screen you use -1 or the screen number for a custom screen
    
    
2172.20NZOV01::MCKENZIENuke the Leprechaun!Thu Feb 16 1989 18:0311
    every new window/screen statement must have a unique number - thats
    why I substituted SCR% in the WINDOW and SCREEN statements rather
    than hard-coding a value
    
    just increment scr% by 1 every time you want a new screen
    
    ACBMNAME$ = "DF0:ROCK" <--- or whatever
    SCR% = SCR% + 1
    Gosub [whatever the line number or tag is that starts the LOADACBM]
    
    Phil
2172.21I have 2 pictures in my programGUCCI::HERBThu Feb 16 1989 18:145
    How many pictures can I have in one program? Can I take the picture
    out of memory after I use it?
    
    Matt
    
2172.22more questionsGUCCI::HERBFri Feb 17 1989 00:214
    Can I use the pictures as a background for my bobs & sprites?
    
    Matt
    
2172.23NZOV01::MCKENZIENuke the Leprechaun!Sun Feb 19 1989 17:589
    to be quite honest - I really dont know the answers to either .-1
    or .-2 
    
    I do know that the window close and screen close statements dont
    seem to work with more than one picture loaded so I really dont know
    
    anyone else out there able to help????
    
    Phil
2172.24Matt Herb (member of the Mutated Minds)GUCCI::HERBTue Feb 28 1989 01:265
    Yes!!!You can use shapes on a Deluxe Paint!!!!
    
    Matt (who will show the world that you can make professional quality
    with Amigabasic and a compiler)