Problem with SDCC compiler, dd.exe and makefile.exe

Page 1/9
| 2 | 3 | 4 | 5 | 6

By sp4

Master (214)

sp4's picture

15-01-2015, 18:37

Hi, I wrote a simple program with SDCC than design a simple pixel in the screen, this is the code:

#include "graphic.h"
#include "cio.h"

int main()
{
    screen(2);
    pset(100,50);
    while(1){};
	  return 0;
}

This is the code's library for pset():

#include "graphic.h"

void pset(unsigned char x, unsigned char y)
{
  __asm
  {
       ld h, 4(ix)
       ld l, 5(ix)
       call #0x006D    ; ---> BIOS call for design a pixel in the screen
  }
}


void paint(unsigned char x, unsigned char y)
{
  __asm
  {
       ld h, 4(ix)
       ld l, 5(ix)
       call #0x0069    ; ---> BIOS call for color the screen
  }
}


char vpeek(int address){
  _asm
   {
      ld l,4(ix)
      ld h,5(ix)
      call 0x004a         ;BIOS call for read a VRAM value
      ld h,#0x00
      ld l,a
   }
}

void vpoke(int address, char value){
  _asm
  {
      ld l,4(ix)
      ld h,5(ix)
      ld a,6(ix)
      call 0x004d         ;BIOS call for write a VRAM value
  }
}

I compiled with the follow script .bat:

sdcc –debug –no-std-crt0 -mz80 –code-loc 0×0200 –data-loc 0x8000 -o main.ihx main.c graphic.c cio.c crt0msx.s
makebin -s 65536 main.ihx main.mem
dd if=main.mem of=main.rom bs=16384 skip=1 count=2

and i obtained a main.rom file than didn't start with Bluemsx, it didn't show the pixel in the screen.
Nobody can help me about this problem?

Login or register to post comments

By Daemos

Paragon (2044)

Daemos's picture

15-01-2015, 19:28

it continues into msx basic?

By sp4

Master (214)

sp4's picture

15-01-2015, 19:59

Yes it continue into msx basic and it didn't show the pixel in the screen.
Can you help me to resolve this problem and help me to understan why with this script .bat the main.rom generated,
don't show the pixel ?

By Daemos

Paragon (2044)

Daemos's picture

15-01-2015, 23:57

can you send me the main.rom? Ill check it in the debugger.

By samsaga2

Resident (62)

samsaga2's picture

16-01-2015, 08:12

–code-loc 0×0200
This is correct? It not should be 0x4000?

From http://andrear.altervista.org/contents/msx/inertia/howto/
sdcc --data-loc 0xc000 --code-loc 0x4020 -mz80 -omain.ihx msx.o msxvideo.o msxaudio.o msxutil.o starship.o main.c

By sp4

Master (214)

sp4's picture

16-01-2015, 09:10

Daemos can you give me your email address, so I can send you my main.rom.
Thank you.

By sp4

Master (214)

sp4's picture

16-01-2015, 09:11

My email address is newbie75@libero.it

By giangiacomo.zaffini

Champion (267)

giangiacomo.zaffini's picture

16-01-2015, 13:56

It seems to me that something is missing:
1. when You link your project objects with 'sdcc –debug –no-std-crt0 -mz80 –code-loc 0×0200 –data-loc 0x8000 -o main.ihx main.c graphic.c cio.c crt0msx.s'
everything but one '.c' source should be compiled, for instance like this:
'sdcc –debug –no-std-crt0 -mz80 –code-loc 0×8000 –data-loc 0x8000 -o main.ihx main.c graphic.rel cio.rel crt0msx.rel'

2. dd call should be like this: 'dd if=main.mem of=main.rom bs=16384 skip=2 count=1' to obtain a 16kByte rom
At first sight.

By sp4

Master (214)

sp4's picture

16-01-2015, 15:50

I made as you had specify in the post but Bluemsx didn't show the pixel.
Why this problem? I don't understand why.

By Daemos

Paragon (2044)

Daemos's picture

16-01-2015, 16:04

I have send you mail and am sitting right behind my computer. send me the rom and I will have a look.

By hit9918

Prophet (2927)

hit9918's picture

16-01-2015, 16:16

Shouldnt a "crtxx" kind of file be at the begining?

The bios calls dont work. They are subrom.
Now the C beginner would be asked page 0 slot things that asm coders struggeled with for years Tongue

My recommendations:
basing things on functions like out(), in(), di(), ei()
in the end you can do more things with less frustration.

second, I would throw out a lot command line frustration by simply doing

#include "library.c"

MSX has no DLL and the gigahertz crosscompiler makes 64k in no time, linking is not needed.

with things like in() out() and include .c, the style changes from
hours commandline frustration
to
forum snippets run out of the box, maybe even on a different compiler, whoops.
someone tried DOS, and the out() worked, while subrom again would be different.
and so on.

is there some common spec or should it be done now.

void ei();
void di();
void halt();
void out(char port, char n);
char in(char port);
void ldir(char *dest, char *src, size_t count); /*first dest parameter like memcpy() strcpy()*/
void lddr(char *dest, char *src, size_t count);
void otir(char port, char *src, char count);
void otdr(char port, char *src, char count);
void inir(char port, char *dst, char count);
void indr(char port, char *dst, char count);

about char on some compilers being unsigned on some signed, I dont know.
would specifying unsigned char do any more than compiler complaining more often, while not really fixing things?
the question is about "count", with portnumbers one doesn't do arithmetics, can be char.

vpoke() basing on out(), pset() basing on vpoke(), thing would long be done without subrom issues.
aside that once you did e.g. out() or otir() images to screen 8, you never look back at the slow pset().
starting the blitter too can be done with out() or otir().

Page 1/9
| 2 | 3 | 4 | 5 | 6