Hello world. It works, but... (controller interrupts?)
Moderator: BigEvilCorporation
-
- Interested
- Posts: 18
- Joined: Fri Aug 07, 2009 4:07 am
Hello world. It works, but... (controller interrupts?)
So I finally got a little hello world working in emulators, thought I'd try it on hardware via Everdrive, and to my delight, it worked!
A little HELLO WORLD is printed in the top left of plane a
However, for some reason, the Licensed by Sega Enterprises Ltd remains in the middle of the screen. Not only that, but it's fontset is replaced by mine (loaded into VRAM:0).
Is it my responsibilty to clear the message off the screen? Is it a requirement to initialise VRAM always?
Thanks
A little HELLO WORLD is printed in the top left of plane a
However, for some reason, the Licensed by Sega Enterprises Ltd remains in the middle of the screen. Not only that, but it's fontset is replaced by mine (loaded into VRAM:0).
Is it my responsibilty to clear the message off the screen? Is it a requirement to initialise VRAM always?
Thanks
Last edited by colonthree on Sat Apr 02, 2011 1:34 am, edited 3 times in total.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
on MD1 you indeed have to clear up everything otherwise nothing will work
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Have you tried Everdrive SDK ?So I finally got a little hello world working in emulators, thought I'd try it on hardware via Everdrive, and to my delight, it worked!
http://krikzz.com/pub/support/everdrive ... dk-v1.0.7z
It's very to install and it took me less than 5 minutes to compile my first app, by copying one of the example and adapt to your project. There are some basic functions to call in main() then you are set.
Here is a basic Hello world for example:
Code: Select all
int main()
{
VDP_init();
VDP_loadFont(font_base, 0);
VDP_setPaletteColor(0, 15, 0xfff);//font color (white)
VDP_setPaletteColor(0, 0, 0x505);//bg color (purple)
//clean screen
VDP_fillTileRect(APLAN, 0, 0, 0, 40, 27);
VDP_fillTileRect(BPLAN, 0, 0, 0, 40, 27);
VDP_drawText(APLAN, "Hello World !", 0, 2, 10);
while(1) VDP_waitVSync();
return 0;
}
-
- Interested
- Posts: 18
- Joined: Fri Aug 07, 2009 4:07 am
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
because ASM rules
More likely because ASM is faster and its useful for some intensive tasks.
More likely because ASM is faster and its useful for some intensive tasks.
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Interested
- Posts: 18
- Joined: Fri Aug 07, 2009 4:07 am
I'm familiar with the potential for efficiency when coding with asm, otherwise probably no one would still use it (?)
I was asking why there are asm compilers bundled with the sdk, considering all of the code files are written in c. Are the asm comilers still required to compile c to binary somewhere inbetween? (I've only ever compiled C on windows outputting to the command prompt.)
Oh yeah and another question came to mind;
I was asking why there are asm compilers bundled with the sdk, considering all of the code files are written in c. Are the asm comilers still required to compile c to binary somewhere inbetween? (I've only ever compiled C on windows outputting to the command prompt.)
Oh yeah and another question came to mind;
What do you have to do without the TMSS? I used to have a commented disassembly of the MD2 'OS' which I guess would answer this (but I can only seem to find the bindump of it) anyone have a copy of a commented one? THanks againIf it wasn't for the TMSS in the "newer" MegaDrives, you would really HAVE to do EVERYTHING yourself.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
No such thing as an "asm compiler", but there are assemblers. The assembler converts assembly language into machine language. And yes, an assembler is needed because the compiler outputs assembly language.colonthree wrote:I'm familiar with the potential for efficiency when coding with asm, otherwise probably no one would still use it (?)
I was asking why there are asm compilers bundled with the sdk, considering all of the code files are written in c. Are the asm comilers still required to compile c to binary somewhere inbetween? (I've only ever compiled C on windows outputting to the command prompt.)
What do you have to do? Everything, of course.Oh yeah and another question came to mind;What do you have to do without the TMSS?If it wasn't for the TMSS in the "newer" MegaDrives, you would really HAVE to do EVERYTHING yourself.
Regardless of TMSS, you should always just do EVERYTHING. Clear work ram, clear vram, clear the PSG, clear the FM, set up the VDP, yada, yada, yada...
http://www.atariage.com/forums/topic/98 ... p__1193987I used to have a commented disassembly of the MD2 'OS' which I guess would answer this (but I can only seem to find the bindump of it) anyone have a copy of a commented one? THanks again
-
- Interested
- Posts: 18
- Joined: Fri Aug 07, 2009 4:07 am
Ah yes, I initially wrote "assembler" and for some reason it didn't look right so I changed it....Chilly Willy wrote:No such thing as an "asm compiler", but there are assemblers. The assembler converts assembly language into machine language. And yes, an assembler is needed because the compiler outputs assembly language.
And good to clear that up, I assumed the C was somehow compiled directly into correctly formatted binary.
Ah so if I code with MD2 in mind, doing all the proper clearing/initialising, it should be more or less 'backwards compatible' with MD1? I'm sure there will be differences in some areas that I've read about but forgot now! >_<Chilly Willy wrote:Regardless of TMSS, you should always just do EVERYTHING. Clear work ram, clear vram, clear the PSG, clear the FM, set up the VDP, yada, yada, yada...
Clearly, I still have much to learn
And thanks for the link, that's where I'd originally found it
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Lots of words that look "funny" in programming.colonthree wrote:Ah yes, I initially wrote "assembler" and for some reason it didn't look right so I changed it....Chilly Willy wrote:No such thing as an "asm compiler", but there are assemblers. The assembler converts assembly language into machine language. And yes, an assembler is needed because the compiler outputs assembly language.
And good to clear that up, I assumed the C was somehow compiled directly into correctly formatted binary.
And there are some compilers that do output machine code... and others that output some odd intermediate language that's neither assembly, nor a "normal" language.
And emulators as well.Ah so if I code with MD2 in mind, doing all the proper clearing/initialising, it should be more or less 'backwards compatible' with MD1? I'm sure there will be differences in some areas that I've read about but forgot now! >_<Chilly Willy wrote:Regardless of TMSS, you should always just do EVERYTHING. Clear work ram, clear vram, clear the PSG, clear the FM, set up the VDP, yada, yada, yada...
No problemo.And thanks for the link, that's where I'd originally found it
-
- Interested
- Posts: 18
- Joined: Fri Aug 07, 2009 4:07 am
Thanks again Chilly Willy!
I have other more general questions relating to programming in assembly. Probably best not to start a new thread since it follows on from my hello world thing.
I'm wondering about why programmers seem to do things like use bsr for subroutines that are only run once at the start of the ROM to initialise parts of hardware, why not just code inline? And I read it is best to use registers whenever possible over RAM access, but if you're just doing one operation to the data before putting it back into RAM, isn't it going to actually take longer?
example:
I have seen things similar to that^ in code, but for this particular example is it not more efficient to avoid registers and just use:
i.e. how do you decide when it is best to use registers over RAM access?
I have lots of little questions like this, since this is my first asm language!
too long/noob questions/didn't read above:
How did you guys learn good asm coding practices? from example/others' work? by reading lots of asm docs? trial and error?
Any links to materials on this much appreciated! If not I'll have to keep bugging you all with noob questions!!
I've read quite a bit of md asm docs a lot of them might mention that it's better to use one programming method over another, but not fully go in detail why.
I have other more general questions relating to programming in assembly. Probably best not to start a new thread since it follows on from my hello world thing.
I'm wondering about why programmers seem to do things like use bsr for subroutines that are only run once at the start of the ROM to initialise parts of hardware, why not just code inline? And I read it is best to use registers whenever possible over RAM access, but if you're just doing one operation to the data before putting it back into RAM, isn't it going to actually take longer?
example:
Code: Select all
move.l $ff0000, d0
addq.l #1, d0
move.l d0, $ff0000
Code: Select all
addq.l #1, $ff0000
I have lots of little questions like this, since this is my first asm language!
too long/noob questions/didn't read above:
How did you guys learn good asm coding practices? from example/others' work? by reading lots of asm docs? trial and error?
Any links to materials on this much appreciated! If not I'll have to keep bugging you all with noob questions!!
I've read quite a bit of md asm docs a lot of them might mention that it's better to use one programming method over another, but not fully go in detail why.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
The example may be compiled code - compilers often generate code that may look "odd" in assembly. Back when I worked on the Amiga, I could tell which compiler someone used just by looking at the assembly code. Compilers like to leave intermediate results in registers just in case they're used elsewhere. In the above example, maybe $ff0000 + 1 was used in the code a little further down, so it saved time OVERALL to add 1 in d0 instead of adding 1 to the memory.colonthree wrote: I'm wondering about why programmers seem to do things like use bsr for subroutines that are only run once at the start of the ROM to initialise parts of hardware, why not just code inline? And I read it is best to use registers whenever possible over RAM access, but if you're just doing one operation to the data before putting it back into RAM, isn't it going to actually take longer?
example:I have seen things similar to that^ in code, but for this particular example is it not more efficient to avoid registers and just use:Code: Select all
move.l $ff0000, d0 addq.l #1, d0 move.l d0, $ff0000
i.e. how do you decide when it is best to use registers over RAM access?Code: Select all
addq.l #1, $ff0000
All of the above.I have lots of little questions like this, since this is my first asm language!
too long/noob questions/didn't read above:
How did you guys learn good asm coding practices? from example/others' work? by reading lots of asm docs? trial and error?
Practice... lots and lots of practice.
I just tell people to get the user manual for the CPU, then look at open source that's available.Any links to materials on this much appreciated! If not I'll have to keep bugging you all with noob questions!!
I've read quite a bit of md asm docs a lot of them might mention that it's better to use one programming method over another, but not fully go in detail why.
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
I had prior ASM knowledge before doing 68K so it was easier for me. I started with programming in QB45 but my programs were not always fastest so I needed something to enhance them and found out how to use x86 ASM in the programs. I used some tutorials specifically made to get ASM work in the programs. Simple stuff and well written, good for me ^^
Then when I looked at MD I saw BEX and tried it but did not like it as its too far form QB45 so I went with ASM. I grabbed a bunch of Amiga newbie docs to see how code looks like and what is possible and here I am
Then when I looked at MD I saw BEX and tried it but did not like it as its too far form QB45 so I went with ASM. I grabbed a bunch of Amiga newbie docs to see how code looks like and what is possible and here I am
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen