CPC Basic

Would you like to react to this message? Create an account in a few clicks or log in to continue.
CPC Basic

Basic cross-compiler for Amstad CPC


2 posters

    compilation problem

    avatar
    poppichicken


    Posts : 16
    Join date : 2012-03-16

    compilation problem Empty compilation problem

    Post  poppichicken Fri Mar 16, 2012 12:52 pm

    Hi Dinoneno.

    Thanks for releasing CPC Basic 3.
    I think the IDE is wonderful - very nostalgic and fun to develop with.

    I'm trying to convert an old type-in from a book into CPC Basic 3, and it is going very well.
    And the speed difference is amazing!

    However, I seem to have found a little problem.
    At one point in the code is this block:

    Code:

    1490 RESTORE 1500
    1491 FOR addr=360 to 366
    1492 READ aa
    1493 POKE addr,aa
    1494 NEXT
    1495 RESTORE
    1496 RETURN
    1500 DATA 205,96,187,50,111,1,201

    When I type RUN into the IDE, it just sits there, frozen.
    It never compiles, and never reports any errors.

    I suspect it is because of line 1491, where the FOR loop is dealing with numbers larger than 255, but I've tried using addr! instead of addr for the loop variable, and that hasn't fixed it.

    I've taken out the other lines and left just the FOR loop, but the problem stays.

    Do you have any suggestions?

    Thanks once again for a great project release!

    [*** EDIT ***]
    Hmmm, this is strange.
    When I run that code in isolation (ie. just a short program containing only that code and a CALL to 1490), it runs!
    Okay, I'll do some more research as to why this might be happening.

    [*** EDIT 2 ***]
    Okay, it looks as though it is to do with the size of the source file.
    I've tried removing lines from the code until I got it to RUN.
    I then put one line back in, and it didn't run.
    I then took a totally different line out, and it ran!

    Is there a limit to how big the source file can be?
    The source file I have is around 4.08KB so far.

    [*** EDIT 3 ***]
    I'm now convinced that the size of the source file is the problem.
    I put the entire program back in, and started deleting lines one by one from the end until it ran.
    It's like it gets stuck when there is too much to process?

    [*** EDIT 4 ***]
    Yes, another edit. Shocked

    I tried increasing the size of the hello.bas program included with CPC Basic 3.
    I copied+pasted the code a few times, block after block, checking each time if it would run.
    Eventually I got it big enough that it failed.
    It was over 4Kb.

    I then tried compiling it via the command line, and it never seemed to finish.
    It just sat there, frozen.
    I pressed Ctrl+C to get back to a command prompt.

    The interesting thing is that hello.ccz80 and hello.bin WERE created, even though the command line compilation seemed to freeze.

    I loaded hello.bin into WinAPE and it worked!
    So it's not the compilation itself that is failing, as it produced a good BIN file.
    It seems that the compiler is failing to return, once the compilation is finished.
    And 4KB seems to be a clue...

    Sorry about all this - I hope you find it useful.
    avatar
    Dinoneno


    Posts : 10
    Join date : 2012-03-11

    compilation problem Empty Re: compilation problem

    Post  Dinoneno Fri Mar 16, 2012 6:23 pm

    Hello Poppichicken.

    Thanks for use CPC Basic and communicate these problems.

    After your research seems the problem is not in the compiler, but the utility that converts the binary code into a CDT, DSK or SNAP, as the output type you selected. What kind of output you have chosen: CDT file, DSK file, SNAP file or running on the emulator? How big is the bin file you generated?

    A detail for those who read this message: change you made to the principle of using the variable DIR! instead of DIR does not work, because if you have not used DEFBYTE variables are of type word, ie use the suffix ! or not it's the same.

    I hope to answer for the problem. A greeting.
    avatar
    poppichicken


    Posts : 16
    Join date : 2012-03-16

    compilation problem Empty Re: compilation problem

    Post  poppichicken Fri Mar 16, 2012 6:35 pm

    Happy to help.
    Cool

    Here is the command line I used:
    Code:
    cpcbasic.exe hello.bas /cpc:464 /out:bin
    hello.bas:4469 bytes
    hello.ccz80 produced during compilation:14652 bytes
    hello.bin: 3675 bytes

    Here is the hello.bas file I used:
    Code:
    10 REM Hello World!
    20 RANDOMIZE TIME
    30 MODE 1
    40 FOR i=1 TO 10
    50 LOCATE RND MOD 29+1,RND MOD 25+1
    60 color=RND MOD 4
    70 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    80 PRINT "Hello World!";
    90 NEXT
    100 PAPER 0:PEN 1:LOCATE 1,1
    110 REM Hello World!
    120 RANDOMIZE TIME
    130 MODE 1
    140 FOR i=1 TO 10
    150 LOCATE RND MOD 29+1,RND MOD 25+1
    160 color=RND MOD 4
    170 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    180 PRINT "Hello World!";
    190 NEXT
    200 PAPER 0:PEN 1:LOCATE 1,1
    210 REM Hello World!
    220 RANDOMIZE TIME
    230 MODE 1
    240 FOR i=1 TO 10
    250 LOCATE RND MOD 29+1,RND MOD 25+1
    260 color=RND MOD 4
    270 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    280 PRINT "Hello World!";
    290 NEXT
    300 PAPER 0:PEN 1:LOCATE 1,1
    310 REM Hello World!
    320 RANDOMIZE TIME
    330 MODE 1
    340 FOR i=1 TO 10
    350 LOCATE RND MOD 29+1,RND MOD 25+1
    360 color=RND MOD 4
    370 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    380 PRINT "Hello World!";
    390 NEXT
    400 PAPER 0:PEN 1:LOCATE 1,1
    510 REM Hello World!
    520 RANDOMIZE TIME
    530 MODE 1
    540 FOR i=1 TO 10
    550 LOCATE RND MOD 29+1,RND MOD 25+1
    560 color=RND MOD 4
    570 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    580 PRINT "Hello World!";
    590 NEXT
    600 PAPER 0:PEN 1:LOCATE 1,1
    10 REM Hello World!
    20 RANDOMIZE TIME
    30 MODE 1
    40 FOR i=1 TO 10
    50 LOCATE RND MOD 29+1,RND MOD 25+1
    60 color=RND MOD 4
    70 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    80 PRINT "Hello World!";
    90 NEXT
    100 PAPER 0:PEN 1:LOCATE 1,1
    110 REM Hello World!
    120 RANDOMIZE TIME
    130 MODE 1
    140 FOR i=1 TO 10
    150 LOCATE RND MOD 29+1,RND MOD 25+1
    160 color=RND MOD 4
    170 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    180 PRINT "Hello World!";
    190 NEXT
    200 PAPER 0:PEN 1:LOCATE 1,1
    210 REM Hello World!
    220 RANDOMIZE TIME
    230 MODE 1
    240 FOR i=1 TO 10
    250 LOCATE RND MOD 29+1,RND MOD 25+1
    260 color=RND MOD 4
    270 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    280 PRINT "Hello World!";
    290 NEXT
    300 PAPER 0:PEN 1:LOCATE 1,1
    310 REM Hello World!
    320 RANDOMIZE TIME
    330 MODE 1
    340 FOR i=1 TO 10
    350 LOCATE RND MOD 29+1,RND MOD 25+1
    360 color=RND MOD 4
    370 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    380 PRINT "Hello World!";
    390 NEXT
    400 PAPER 0:PEN 1:LOCATE 1,1
    510 REM Hello World!
    520 RANDOMIZE TIME
    530 MODE 1
    540 FOR i=1 TO 10
    550 LOCATE RND MOD 29+1,RND MOD 25+1
    560 color=RND MOD 4
    570 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    580 PRINT "Hello World!";
    590 NEXT
    600 PAPER 0:PEN 1:LOCATE 1,1
    610 REM Hello World!
    620 RANDOMIZE TIME
    630 MODE 1
    640 FOR i=1 TO 10
    650 LOCATE RND MOD 29+1,RND MOD 25+1
    660 color=RND MOD 4
    670 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    680 PRINT "Hello World!";
    690 NEXT
    710 REM Hello World!
    720 RANDOMIZE TIME
    730 MODE 1
    740 FOR i=1 TO 10
    750 LOCATE RND MOD 29+1,RND MOD 25+1
    760 color=RND MOD 4
    770 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    780 PRINT "Hello World!";
    790 NEXT
    810 REM Hello World!
    820 RANDOMIZE TIME
    830 MODE 1
    840 FOR i=1 TO 10
    850 LOCATE RND MOD 29+1,RND MOD 25+1
    860 color=RND MOD 4
    870 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    880 PRINT "Hello World!";
    890 NEXT
    910 REM Hello World!
    920 RANDOMIZE TIME
    930 MODE 1
    940 FOR i=1 TO 10
    950 LOCATE RND MOD 29+1,RND MOD 25+1
    960 color=RND MOD 4
    970 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    980 PRINT "Hello World!";
    990 NEXT
    1010 REM Hello World!
    1020 RANDOMIZE TIME
    1030 MODE 1
    1040 FOR i=1 TO 10
    1050 LOCATE RND MOD 29+1,RND MOD 25+1
    1060 color=RND MOD 4
    1070 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    1080 PRINT "Hello World!";
    1090 NEXT
    1110 REM Hello World!
    1120 RANDOMIZE TIME
    1130 MODE 1
    1140 FOR i=1 TO 10
    1150 LOCATE RND MOD 29+1,RND MOD 25+1
    1160 color=RND MOD 4
    1170 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    1180 PRINT "Hello World!";
    1190 NEXT
    1210 REM Hello World!
    1220 RANDOMIZE TIME
    1230 MODE 1
    1240 FOR i=1 TO 10
    1250 LOCATE RND MOD 29+1,RND MOD 25+1
    1260 color=RND MOD 4
    1270 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    1280 PRINT "Hello World!";
    1290 NEXT
    1310 REM Hello World!
    1320 RANDOMIZE TIME
    1330 MODE 1
    1340 FOR i=1 TO 10
    1350 LOCATE RND MOD 29+1,RND MOD 25+1
    1360 color=RND MOD 4
    1370 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    1380 PRINT "Hello World!";
    1390 NEXT
    1410 REM Hello World!
    1420 RANDOMIZE TIME
    1430 MODE 1
    1440 FOR i=1 TO 10
    1450 LOCATE RND MOD 29+1,RND MOD 25+1
    1460 color=RND MOD 4
    1470 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
    1480 PRINT "Hello World!";
    1490 NEXT
    avatar
    Dinoneno


    Posts : 10
    Join date : 2012-03-11

    compilation problem Empty Re: compilation problem

    Post  Dinoneno Fri Mar 16, 2012 7:30 pm

    Ccz80 code is generated correctly, if you choose output file type ccz80 no problem. But if you choose another output for the compiler ccz80 starts and that's where it is locked, if you use the task manager and end the process ccz80, the IDE continues to work.

    If you compile from the command line or from ccz80 IDE the ccz80 file no problem, but if you call the compiler from the IDE ccz80 CPC Basic, it does not work. Perhaps memory problem? I will look slower study .

    Edit: compiling the ccz80 code from the ccz80 IDE don't work, it's also blocked. Then the problem is when an IDE launch the ccz80 compiler. I need to see it.
    avatar
    Dinoneno


    Posts : 10
    Join date : 2012-03-11

    compilation problem Empty Re: compilation problem

    Post  Dinoneno Sat Mar 17, 2012 11:46 pm

    I think this problem is fixed in new version 3.0.3. It happened when the compilation of program ccz80 produced too many text, i.e. when the program has many lines and the ccz80 compiler a warning for each line label not used. Thanks for the help, Poppichiken.
    avatar
    poppichicken


    Posts : 16
    Join date : 2012-03-16

    compilation problem Empty Re: compilation problem

    Post  poppichicken Sun Mar 18, 2012 1:01 am

    Ah, I see.
    Thanks for fixing it!
    My program seems to be working correctly now.

    Sponsored content


    compilation problem Empty Re: compilation problem

    Post  Sponsored content

      Similar topics

      -

      Current date/time is Tue Mar 19, 2024 8:14 pm