English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 22 May 2020, 19:14   #1
Nightshft
Registered User

Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Age: 45
Posts: 357
Amiblitz3 programs on OCS Amiga 500

I'm writing programs with AB3.7.3 and - thanks to svens upgrade - in general these programs run fine on an A1200 (with or without Acc., with or without FPU).

Now I'm somewhat surprised/shocked that nearly all those programs dont run on an OCS Amiga 500.

I get "failure 8000 0003", "failure 8000 0004", "guru 8000 0020" and the like.
Even the simple program below wont run.
I just spent some hours to test a lot of programs, both on Winuae A500 and real A500 and they just crash.
Also tested AB 3.7.1 instead of 3.7.3 and it's the same.
Attached code compiled with BB2.1 runs fine on A500.
Am I missing something or does the AB3.7 compiler currently not produce working code for A500 target?

Can someone compile the below code on Amiblitz 3 producing a program that runs on OCS?

Testsystems:
Winuae: A500, OCS, Kick 3.1, Boot classicWb68K from Hdd, 1MB Chip and some Fastram
real: A500, OCS, Kick3.1, Boot classicWB68K from Hdd, Aca500+, 1MB Chipram and 4MB Fastram
(I also once tried a program on a naked WB3.1, same same.)

Code:
WBStartup
VWait 100  ;wait for disk drives
BLITZ
BitMap 0, 320,256, 4
Slice 0,42,4  ;define slice 0
Show  0       ;show bitmap 0
Repeat
  x=Rnd(320-26)
  y=Rnd(256-26)
  w=Rnd(20)+5
  c=Rnd(15)+1
  Boxf x,y, x+w,y+w, c
Until Joyb(0)>0
End
Nightshft is offline  
Old 25 May 2020, 14:10   #2
Nightshft
Registered User

Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Age: 45
Posts: 357
I a little further testing on target A500

- a simple hello world to console works
- "Blitz" without further commands works too
- "Initcoplist" works too
- The "Bitmap" command to initialize a bitmap seems to make the OCS machine freeze. It is from bitmaplib.

Dont have time for further testing at the moment.
Nightshft is offline  
Old 25 May 2020, 15:04   #3
Zener
Registered User
Zener's Avatar
 
Join Date: Jan 2009
Location: Barcelona / Spain
Posts: 287
Do you have enough free memory for the bitmap?
Zener is offline  
Old 26 May 2020, 00:23   #4
Nightshft
Registered User

Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Age: 45
Posts: 357
Yes for sure.
It was just a small 320x256x2 bitmap (needs about 20kB IIRC) and the systems just bootet with nearly all their chipram free.
Program either freezes (blank screen) or error message "program failed 8000 0003" appears.

I can reproduce it with the following code (this is the whole program)
Code:
Bitmap 0,320,256,2
End
Maybe someone wants to compile this with AB3 and try on a System with 000 cpu (emulated or real).

To me it looks like AB3 compiles the Bitmap command in a way that makes 000 cpus (or OCS/ECS systems) crash (Had it happen on Winuae A500, real A500 and real A600).
Nightshft is offline  
Old 26 May 2020, 11:53   #5
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,660
Yeah, I can confirm it happens that way. It's also been that way since AmiBlitz 2, which is where the FPU requirements came into things too. There are a few cases like this that I've come across, where it appears there are some '020-specific operations going on, e.g. non-word-aligned accesses, which are fine on an '020+, but illegal on an '000, even though all the instructions might be 68000-compatible. Such bugs can be tricky to find, but maybe Sven might be able to do that

In the meantime, you can work around it by manually allocating the bitmap (which will ensure it's always word-aligned) and using CludgeBitmap to assign it a bitmap object number. This is tested in WinUAE on an A600 config:

Code:
WBStartup
VWait 100  ;wait for disk drives
BLITZ

mem.l = AllocMem(320 * 256 / 2, 2)
If mem
  CludgeBitMap 0, 320,256, 4, mem

  Slice 0,42,4  ;define slice 0
  Show  0       ;show bitmap 0
  Repeat
    x=Rnd(320-26)
    y=Rnd(256-26)
    w=Rnd(20)+5
    c=Rnd(15)+1
    Boxf x,y, x+w,y+w, c
  Until Joyb(0)>0
  FreeMem mem, 320 * 256 / 2
Else
  NPrint "Error allocating memory!"
End If
End
This is slightly more involved because you need to manually allocate and free the memory involved, and if you mess it up, very bad things will happen. But it also allows you to check if there's actually enough memory, and exit gracefully instead of crashing as Blitz would otherwise do.

The AllocMem call takes the size of the memory required, and the second parameter is the type of RAM, as per the OS flags. 2 is chip RAM, 0 is any (usually fast, or chip if fast isn't available), or if you include the amigalibs.res file you can use the OS flags, e.g. #MEMF_ANY, #MEMF_CHIP, #MEMF_PUBLIC etc.
Daedalus is online now  
Old Yesterday, 02:08   #6
Nightshft
Registered User

Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Age: 45
Posts: 357
Thanks Daedalus that's very interesting and helpful.

And as 000 cpus dont support an fpu (support started with 020 AFAIK) nobody could know or test that the binaries wouldn't run there...
and of course no one would talk about it because the fpu requirement was the more virulent problem.

Is "bitmap" the only command affected - do you know others?

If Sven could fix this it would be awesome. It would mean that then AB3 could be used for target OCS again finally.

PS: I compiled your "workaround" code with AB3 and it works very well on A500, thanks.
Nightshft is offline  
Old Yesterday, 09:41   #7
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,660
No problem. Don't forget to change the size of the allocation if you change the size (including depth) of your bitmap. This won't be checked for you!

I'm trying to remember now - I'm sure I came across something else ages ago that crashed on an '000, but I can't remember. It's possible that there are other commands that use a common memory allocation routine that are also affected, maybe other graphics initialisation code like shapes, or audio object setup?
Daedalus is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Port Wolfenstein on Amiga 500 / 1000 OCS Miggy4eva Retrogaming General Discussion 191 03 April 2019 18:51
Blanck buffer with VASM and dcb or blk on amiga 500 OCS prb28 Coders. Asm / Hardware 19 04 January 2019 18:48
Amiga 500 Rev.6A VS Amiga 500 Plus with 2MB chip and ACA 500 turrican9 support.Hardware 0 24 December 2016 02:16
Amiga 500. OCS or ECS? trydowave support.Hardware 10 25 May 2013 21:58

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.11127 seconds with 14 queries