Page 1 of 1
Animage memory.inc PointerToPalette
Posted: Sun May 25, 2014 12:58 pm
by seppe
I examine the "Animage" application in order to learn the Kolibri programming environment.
In memory.inc I see the following:
mov eax,[ScreenPointer]
add eax,(1200*100*3)+50*(20*20*3)+1
mov [PointerToPalette],eax
Should that not be:
mov eax,[ScreenPointer]
add eax,(1200*1000*3)+50*(20*20*3)+1
mov [PointerToPalette],eax
I join a scan of my notes.
I hope that developer "Mario" or anyone else is willing to help me.
If not, I can as well examine another application.
Re: Animage memory.inc PointerToPalette
Posted: Sun May 25, 2014 1:06 pm
by hidnplayr
I dont know the answer to your question, but I can tell you this:
It's always a bad idea to use 'magic numbers' in source code.
Use data structures where applicable, and constants otherwise.
It increases the readability of the code, flexibility for changes and minimizes the chances for situtations like this.
Re: Animage memory.inc PointerToPalette
Posted: Sun May 25, 2014 8:13 pm
by Mario_r4
seppe wrote:I examine the "Animage" application in order to learn the Kolibri programming environment.
Animage - this is not the best choice for a beginner to learn programming for KolibriOS. Application code requires a complete refactoring and rewriting using libraries.
seppe wrote:I hope that developer "Mario" or anyone else is willing to help me.
I can help answer some of the questions that will be within my competence (not to deceive hopes, I should note - I'm not the one of best developer in the project). Note, however, that during the summer I have the opportunity to do it only in the evening after 21.00 (GMT +4). I am busy for building my new house and it takes a lot of time and effor.
seppe wrote:If not, I can as well examine another application.
In any case, the choice is yours.
P.S. Today, when I'm free from work, I will try to answer your question.
Re: Animage memory.inc PointerToPalette
Posted: Sun May 25, 2014 11:22 pm
by Mario_r4
seppe wrote:
In memory.inc I see the following:
mov eax,[ScreenPointer]
add eax,(1200*100*3)+50*(20*20*3)+1
mov [PointerToPalette],eax
Should that not be:
mov eax,[ScreenPointer]
add eax,(1200*1000*3)+50*(20*20*3)+1
mov [PointerToPalette],eax
I join a scan of my notes.
I think this is the correct record. You need to examine the commented code in
init_data.inc
Spoiler:
Code: Select all
; mov [ScreenPointer],I_END ; S = 0, L = 3600000 + 60000 + 500000 = 4160000 = 3,97 Mb
; mov [PointerToPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000 ; S = 4160000, L = 768000 = 750 Kb
; mov [PointerToCopyPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3) ; S = 4928000, L = 768000 = 750 Kb
; mov [PointerToCopyPicture2],I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*2 ; S = 5696000, L = 768000 = 750 Kb
; mov [PointerToEditBufer], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*3 ; S = 6464000, L = 768000 = 750 Kb
; mov [PointerToSpriteBufer], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*4 ; S = 7232000, L = 768000 = 750 Kb
; mov [PointerToPalette], I_END+(1200*100*3)+50*(20*20*3)+1 ; S = 420001
; mov [ReserveArray], I_END+(1200*1000)*3+50*(20*20*3)+8 ; S = 3660008
This code is not used and is obsolete, because at the current moment the program uses f.68 for memory management, but it is describes the map of regions from the memory page.
Re: Animage memory.inc PointerToPalette
Posted: Mon May 26, 2014 12:26 am
by seppe
Mario_r4 wrote:This code is not used and is obsolete
Uh?? MTDbg proves that the code is executed.
Mario_r4 wrote:The program uses f.68 for memory management..
Yes indeed.
Mario_r4 wrote:It describes the map of regions from the memory page
add eax,(1200*100*3)+50*(20*20*3)+1 ; mov [PointerToPalette], I_END+(1200*100*3)+50*(20*20*3)+1 ; S = 420001
It still seems to me that the it should be
1000 in stead of
100. But . . . never mind. I'll figure it out.
Mario_r4 wrote:Animage is not the best choice for a beginner to learn programming for KolibriOS.
I wrote my first assembly program in 1970. So .. But most kolibri code is poorly documented, and help is appreciated.
Mario_r4 wrote:I am busy for building my new house and it takes a lot of time and effort.
I wish you successful building. I will limit my questions to the bare minimum.
Thank you.
Re: Animage memory.inc PointerToPalette
Posted: Mon May 26, 2014 2:16 am
by Mario_r4
seppe wrote:Mario_r4 wrote:This code is not used and is obsolete
Uh?? MTDbg proves that the code is executed.
I meant the piece of code that comments by ";". I specifically quoted in its to my previous comment.
seppe wrote:I wrote my first assembly program in 1970
Ha-ha! Then I was not even foreseen in the plans of my parents.
seppe wrote:Mario_r4 wrote:I am busy for building my new house and it takes a lot of time and effort.
I wish you successful building. I will limit my questions to the bare minimum.
You can ask any questions and in any amount, but answers will not appear very quickly and you are likely to have time to solve half of the questions before I have time to answer.
You are welcome!