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

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

By hit9918

Prophet (2927)

hit9918's picture

24-01-2015, 19:17

I got no idea. maybe some listing is different. did you use sdcc 3.4.0

By hit9918

Prophet (2927)

hit9918's picture

24-01-2015, 19:39

the screen8() function does clear the screen with otir. does the screen clear happen?
does the VDP mode change happen? (bluemsx has screen mode indicator)

By hit9918

Prophet (2927)

hit9918's picture

24-01-2015, 19:40

and another question: did you use exactly my files?

By sp4

Master (214)

sp4's picture

24-01-2015, 20:14

hit9918 wrote:

I got no idea. maybe some listing is different. did you use sdcc 3.4.0

I use the SDCC 3.2.1 not the your. Maybe this the problem.

By hit9918

Prophet (2927)

hit9918's picture

24-01-2015, 21:20

you could try same compiler version. and you could post your scripts and sources. else I got no idea.

By sp4

Master (214)

sp4's picture

25-01-2015, 14:41

It appair the SCREEN 1 not the SCREEN 8
What's your bluemsx's version? The mine is bluemsx 2.6.1.

By sp4

Master (214)

sp4's picture

25-01-2015, 14:48

My app.c:

#include "graphic.h"
#include "cio.h"
#include "z80.h"
#include 
#include 
//#include "sound.h"


#include "string.h"

void vdp(int n) { otir(0x99, 2, (char*)&n); } //use address range 0x4000 for setting vram write mode

void vpoke64(size_t n, unsigned char c) { di(); vdp(0x8E00 + (n >> 14)); vdp((n & 0x3FFF) | 0x4000); ei(); out(0x98, c); }
void pset(unsigned char x, unsigned char y, unsigned char c) {
	di();
	out(0x99, y >> 6); out (0x99, 0x8e);
	out(0x99, x); out (0x99, (y & 0x3f) | 0x40);
	ei();
	out (0x98,c);
	//vpoke64(((size_t)y << 8) + x, c);
}

	char screen8arr[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };

void screen8() {
	int i;

	di();
	vdp(0x800E);
	vdp(0x8160);
	vdp(0x821f);
	vdp(0x8380);
	vdp(0x8401);
	vdp(0x85F7);
	vdp(0x861e);
	vdp(0x8700);
	ei();
	vpoke64(0,0);
	for (i = 0; i < (256 / sizeof(screen8arr) * 212); i++) {
		otir(0x98, sizeof(screen8arr), &screen8arr[0]);
	}
}




void (*beep)() = (void (*)())0xc0;

void main() {
	int i;

	for (i = 0; i < 10; i++) {
		beep();
	}

	screen8();

	for (i = 0; i < 212 ; i++) {
		pset(i*1,i*1,i);
	}

	di(); halt();
}

my cio.c:

//module for input and output functions
#include "cio.h"
#include 
#include 


//function for erase the screen
void cls(void)
{
  putchar(0x1b);
  putchar(0x45);
}



//function for read a vram address
char vpeek(int address)
{
__asm
push ix
ld ix,#0x00
add ix,sp
ld l,4(ix)
ld h,5(ix)
call 0x004a ;BIOS call for read a VRAM value 004AH RDVRM 07D7H Read byte from VRAM
ld h,#0x00
ld l,a
pop ix
__endasm;
}

//function for write a vram address
void vpoke(int address, char value)
{
__asm
push ix
ld ix,#0x00
add ix,sp
ld l,4(ix)
ld h,5(ix)
ld a,6(ix)
call 0x004d ;BIOS call for write a VRAM value 004DH WRTVRM 07CDH Write byte to VRAM
pop ix
__endasm;
}


//function for write a character in the screen
void putchar(char chr)
{
__asm
push ix
ld ix,#0x00
add ix,sp
ld a, 4(ix) ;reg for display the character
call 0x00A2 ;BIOS call for display the character
pop ix
__endasm;
}

//function for print a string in the screen
void print(char *string)
{
while( *string )
{
putchar( *string++ );
}
}

//function for read one caracter from the keyboard
char inkey(void)
{
__asm
push af
call 0x009F ;BIOS call to read a keyboard character
ld h,#0x00
ld l,a ;reg to put a readed character
pop af
__endasm;
}

//function for put the cursor in the x and y coordinates
void locate(char x,char y)
{
__asm
push ix
ld ix,#0x00
add ix,sp
ld l,4(ix) ;put the coordinate x in the reg l
ld h,5(ix) ;put the coordinata y in the reg h
call 0x00C6 ;BIOS call to move the cursore
pop ix
__endasm;
}




//function for move only the row position in the screen
void tab(char x)
{
   __asm
    ld l, 4(ix)  ;put the x coordinate in the reg l
    call 0x00C6 ;BIOS call for move the cursore
   __endasm;
}

//function for input one caracter with eco
void input(char var)
{
    var=inkey();
    putchar(var);
}

//function for set the mode screen
void screen(unsigned char mode)
{
  __asm

  ld a,4(ix)
  call 0x005F ; --- go to screen mode
  call 0x00CC ; --- erase function keys

  __endasm;
}

my graphic.c:

#include "graphic.h"
#include "z80.h"
#include "stdio.h"
#include "string.h"


void color(char fg, char bg, char bd){
  _asm

  ld hl,#0xf3e9
  ld a,4(ix)
  ld (hl),a

  inc hl
  ld a,5(ix)
  ld (hl),a

  inc hl
  ld a,6(ix)
  ld (hl),a

  call 0x0062 ; --- change color

  __endasm;
}

void pset(unsigned char x, unsigned char y, unsigned char c)
{
  di();
	out(0x99, y >> 6);
  out (0x99, 0x8e);
	out(0x99, x);
  out (0x99, (y & 0x3f) | 0x40);
	ei();
	out (0x98,c);
}

/*
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
  }
}

*/

my z80.c:

#include "z80.h"

void di() __naked {
	__asm
	di
	ret
	__endasm;
}
void ei() __naked {
	__asm
	ei
	ret
	__endasm;
}
void halt() __naked {
	__asm
	halt
	ret
	__endasm;
}

void out(char port, char n) __naked {
	port; n;

	__asm
	pop hl
	pop bc
	push bc
	out (c),b
	jp (hl)
	__endasm;
}

char in(char port) __naked {
	port;

	__asm
	pop hl
	pop bc
	push bc
	push hl
	in l,(c)
	ret
	__endasm;
}

void otir(char port, unsigned char count, char *p) __naked {
	p; port; count;

	__asm
	pop de
	pop bc
	pop hl
	push hl
	push bc
	push de
	otir
	ret
	__endasm;
}

//for MSX1 VDP , 29 cycles
void otir29(char port, unsigned char count, char *p) __naked {
	p; port; count;

	__asm
	pop de
	pop bc
	pop hl
	push hl
	push bc
	push de
00001$:
	outi
	jp nz,00001$
	ret
	__endasm;
}

void inir(char port, unsigned char count, char *p) __naked
{
	p; port; count;

	__asm
	pop de
	pop bc
	pop hl
	push hl
	push bc
	push de
	inir
	ret
	__endasm;
}

void inir29(char port, unsigned char count, char *p) __naked
{
	p; port; count;

	__asm
	pop de
	pop bc
	pop hl
	push hl
	push bc
	push de
00001$:
	ini
	jp nz,00001$
	ret
	__endasm;
}

my script comp.bat:

@sdasz80 -g -o crt0msxrom.rel crt0msxrom.s
@echo -------------- compilermessages -----------------
@sdcc -mz80 -c app.c
@rem  sdcc in linker mode, only tell .rel files in this line, no .c, no .asm
@sdcc -mz80 --no-std-crt0 --code-loc 0x4000 --data-loc 0xc000 -o linkresult.ihx crt0msxrom.rel app.rel
@echo -------------------------------------------------
@hex2bin 4000 linkresult.ihx
@copy linkresult.bin ROM.ROM

my crt0msxrom.s

.module crt0
       	.globl _main
	.globl _romheader
	.globl _runrom

	;; Ordering of segments for the linker.
	.area	_HOME
	.area	_CODE
        .area   _GSINIT
        .area   _GSFINAL
	.area	_INITIALIZER
	
	.area	_DATA
	.area	_INITIALIZED
	.area	_BSEG
        .area   _BSS
        .area   _HEAP



	.area	_CODE
_romheader:
	.db 0x41
	.db 0x42
	.dw _runrom
	.dw 0,0,0,0,0,0,0,0
_runrom:
        call    gsinit
	call	_main
	ret


	.area   _GSINIT
gsinit::
	ld	bc, #l__INITIALIZER
	ld	a, b
	or	a, c
	jr	Z, gsinit_next
	ld	de, #s__INITIALIZED
	ld	hl, #s__INITIALIZER
	ldir
gsinit_next:

	.area   _GSFINAL
	ret

my link.lnk:

--
-m
-j
-x
-i linkresult
-b _CODE = 0x4000
-b _DATA = 0xc000
-k D:\MSX\SDCC\bin\z80.lib
-l z80.lib
crt0msxrom.o
app.o


-e

I replace the compilator SDCC with version 3.4.0 but the didn't appair.
Tell me please where is the problem.

By sp4

Master (214)

sp4's picture

25-01-2015, 15:13

Do you know how to insert the subrom in bluemsx ?

By hit9918

Prophet (2927)

hit9918's picture

25-01-2015, 20:40

you have modified every file, added some other stuff, and then ask why it does not run.

This no more is a tech problem, this communication mode does not work.
You only say "I see no line" and hide all the other answers. answers like

yes I changed all the files
the compiler makes piles of error messages
the MSX does reset

By sp4

Master (214)

sp4's picture

25-01-2015, 21:07

hit9918 wrote:

you have modified every file, added some other stuff, and then ask why it does not run.

This no more is a tech problem, this communication mode does not work.
You only say "I see no line" and hide all the other answers. answers like

yes I changed all the files
the compiler makes piles of error messages
the MSX does reset

I replace my code with yours and it work !!! Smile but now I want to use the screen with subrom bios call.
It's possible tu make the screen() and the pset() with subrom bios call ?

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