![]() |
![]() |
#1 |
Registered User
Join Date: May 2018
Location: France
Posts: 246
|
Blanck buffer with VASM and dcb or blk on amiga 500 OCS
In Photon's tutorial, there is a blank buffer after an imported logo, my adapted code is:
Code:
Logo: INCBIN "sky.178x67x3.raw" LogoEnd: Blank: dcb.w LOGO_LINE_FULLBPL_W_B*6,$0 BlankEnd: I've tried these variants with the same result: Code:
dcb.w LOGO_LINE_FULLBPL_W_B*6 dcb.w LOGO_LINE_FULLBPL_W_B*6,$0000 blk.w LOGO_LINE_FULLBPL_W_B*6 Code:
dcb.w LOGO_LINE_FULLBPL_W_B*6,$f Someone as a clue on what's happening? (I have some doubts during my variant tests on my gotek drive: I don't know it it puts something in cache that would mess with my disk selection) |
![]() |
![]() |
#2 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
dcb.w size,value is fine and if value is 0 the memory is cleared. If you see some garbage there is most probably a bug in your code (buffer size too small for example), i.e. it doesn't have to do with the assembler. Check that your buffers have the correct size and that you don't write outside any of the buffers.
I would use ds.b to create a cleared memory block though. |
![]() |
![]() |
#3 |
Registered User
Join Date: May 2018
Location: France
Posts: 246
|
I may have some bug, but the rest of the code is constant: setting $f to the buffer gives me some colored stripes (as expected), with 0: it's not cleaned (wild pixels).
In the vasm documentation ds.b is equivalent to dsb.b <exp>,0 and in my case it does the same result. |
![]() |
![]() |
#4 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,437
|
Some assemblers automatically remove zeroes at the end of a file unless a specific flag (see the manual of the assembler for what flag to change) is added. This could explain what you see if the blank area is at the end of the file.
|
![]() |
![]() |
#5 |
Registered User
Join Date: May 2018
Location: France
Posts: 246
|
Yes !
You are right, it's the last bytes of the program. After I have a BSS_C section that is allocated at runtime. I've added a dummy byte after the buffer and it works. thks ! |
![]() |
![]() |
#6 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
Yes, it does exactly the same. blk/dcb always remind me of old and (mostly) horrible SEKA sources hence I wouldn't use these in new code (for dcb this is only valid if it is used to create a cleared block of course). Another note regarding this, hese executables don't work on 1.3, they require Kickstart 2.0+. |
|
![]() |
![]() |
#7 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
Quote:
![]() I've never experienced such a thing, but I've used vasm only few times and it has never happened to me with any other assembler. In any case, I consider it a bad choice, if I have allocated a block of zeros is because I need it.. |
|
![]() |
![]() |
#8 |
Registered User
Join Date: May 2018
Location: France
Posts: 246
|
|
![]() |
![]() |
#9 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
To be clear: are you talking about the bss part of the code/data segments?
Because if this the case, yes, in 1.3 they are not zeroed. (but this bss part are not allocated with dc.x or dcb.x) |
![]() |
![]() |
#10 | |
Registered User
Join Date: May 2018
Location: France
Posts: 246
|
Quote:
I know, that the bss, allocated at runtime, is not cleared. |
|
![]() |
![]() |
#11 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
The executables with a "small" BSS hunk require OS 2.0+. If your executable works on 1.3 then the reason for your problems is not the thing roondar mentioned! It is then most likely indeed a too small buffer as I have guessed before. |
|
![]() |
![]() |
#12 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
Quote:
Code:
SECTION NAME,BSS DS.B 8 What do you mean by "allocated at runtime"? This is the real difference (at least for me) for DCB and DS. With DS at the CODE/DATA SECTION end i'm expectiong a proper constructed CODE/DATA hunk for the exe. If I use DCB dim,0 then no BSS space should be used and the exe would work properly in every kickstart. A flag in the assembler can be acceptable to change this behaviour but not as default.. |
|
![]() |
![]() |
#13 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,437
|
Quote:
It may have been an error on my part (as in, maybe I put the wrong arguments into the assembler/linker in some way - I am not claiming to be a complete expert on Amiga OS's hunk system in any way so me screwing up is certainly possible), but when using vlink I had to add the -Z flag to keep zeroes at the end of the file (whether in BSS or in non-BSS section). For reference, prior to running into this issue, I tended to use: Code:
vasm -kick1hunks -Fhunk -m68000 vlink -bamigahunk -s -sc -mrel ![]() It seems logical to me that other assemblers/linkers may also use similar tactics to optimise file size. For reference, the resulting binaries actually worked on Kickstart 1.3 just fine but would miss the trailing zeroes (and thus could have broken graphics etc). Adding the -Z flag made them work. Last edited by roondar; 04 January 2019 at 17:26. |
|
![]() |
![]() |
#14 | |
Registered User
Join Date: May 2018
Location: France
Posts: 246
|
I thought the BSS section was not bundled in the file, I was wrong.
Quote:
Code:
SECTION MyDemoData,DATA_C ... some copper allocation .... Logo: INCBIN "sky.178x67x3.raw" LogoEnd: Blank: ds.b LOGO_LINE_FULLBPL_W_B*6 BlankEnd: SECTION MyDemoBSS,BSS_C Screen: ds.b SCREEN_SZ_B Code:
ds.b LOGO_LINE_FULLBPL_W_B*6 |
|
![]() |
![]() |
#15 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
@roondar
Well, could be that vlink simply was born with 2.0+ feature in mind. The use of the bss part in the CODE/DATA segments is very convenient but it implies understanding the differences in behavior between KS1.x and KS2.0+ otherwise you go in search of problems ![]() I usually (if I know that the exe should be run in KS1.x) I manually clear the end part of the section (if I need zeroed). |
![]() |
![]() |
#16 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
Quote:
To avoid this problematic simply use a further SECTION MyDemoBSS2,BSS and insert all you zeroed space. Or use as is and clear manually. No problems ever ![]() |
|
![]() |
![]() |
#17 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,437
|
Quote:
![]() Quote:
There are exceptions to this in my code, but it's how I 'like' to implement such things. |
||
![]() |
![]() |
#18 |
Registered User
Join Date: May 2018
Location: France
Posts: 246
|
Do you have some links to documentations on the web?
Just one more question, when clearing this memory at initialization, am I writing on an unallocated region, or is it safe allocated buffer even if it is stripped from the exe? |
![]() |
![]() |
#19 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
|
Quote:
I understand that it is not optimal to expect every developer to be aware of the differences between Kickstart 1.x and 2.0. But changing that now would be even more confusing. When you create a hunk-executable with vasm (-Fhunkexe) you have to enable this feature by the -databss option, but vlink does it always, unless -Z was specified. Yes... I'm not happy about these choices myself. ![]() There is not much about the hunk-format. Best source for me was the Amiga Guru Book. Quote:
|
||
![]() |
![]() |
#20 |
Registered User
Join Date: May 2018
Location: France
Posts: 246
|
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Port Wolfenstein on Amiga 500 / 1000 OCS | Miggy4eva | Retrogaming General Discussion | 191 | 03 April 2019 18:51 |
Amiga 500 Rev.6A VS Amiga 500 Plus with 2MB chip and ACA 500 | turrican9 | support.Hardware | 0 | 24 December 2016 02:16 |
Sound buffer full when switching Amiga screen modes | Leandro Jardim | support.WinUAE | 1 | 01 September 2015 11:16 |
Amiga 500. OCS or ECS? | trydowave | support.Hardware | 10 | 25 May 2013 21:58 |
|
|