Is there any C cross compiler that generates ROM files? (Development Foros MSX)MSX Resource Center            
                       
English Nederlands Espa�ol Portugu�s Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 56 invitados y 3 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - Is there any C cross compiler that generates ROM files?

Ir a la página ( Página anterior 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 Siguiente página )
Autor

Is there any C cross compiler that generates ROM files?

Huey
msx professional
Mensajes: 672
Publicado: Abril 08 2006, 15:21   
Quote:

when I mean online I mean on command line !
You can run ZC in a msdos command line while edinting the .c text in a different window with your own editor.



Ok, ive got the commandline compiler.


Quote:


ZC -L-Pxram=8000h/20000h -A8010,8FFF,8010 test.obj xv.obj
I'm not sure about the other parameters but could work



It is not working. I if I use text=xram the header is placed after the code.
If I use bss=xram then I get an error 'unknown psecr: xram
ARTRAG
msx master
Mensajes: 1802
Publicado: Abril 09 2006, 10:56   
About libs at http://jannone.org/gfxlib :
The argument passing conventions between the hitech C for CPM (used by jannone) and the
hitech C crosscompiler v7.5 /7.8 are changed.
You can modify the jannone's lib in order to the called by the new C compiler

Huey
msx professional
Mensajes: 672
Publicado: Abril 09 2006, 15:43   
I thought it would be easy to load some data to the VDP but it's not working for me....
VDP register initialization works but I think the problem is the vwrite() function.
If i use printf's instead of the actual writes to v98 it seems that the values written are ok.

Can anybody see the problem?


/*
* Project Hunter for MSX1 32kb ROM
*/
#include <stdlib.h>
//#include <stdio.h>

/*
* DEFINITIONS
*/
#define u_int unsigned int
#define u_char unsigned char
#define u_short unsigned short
#define bool char
#define true 1
#define false 0

/*
* SCREEN 2 DEFINITIONS HARDCODED
*/
u_int SCREEN2_MAX = 768; // # Patterns in one screen
u_short PNT = 14336; // Pattern Name Table
u_short PGT = 0; // Pattern Generator Table
u_short PCT = 6144; // Pattern Color Table
u_short SAT = 15360; // Sprite Attribute Table
u_short SPT = 12288; // Sprite Pattern Table


/*
* PORT mappings
*/
static port u_char v99 @ 0x99; // VDP: Command and status register
static port u_char v98 @ 0x98; // VDP: Video RAM data
static port u_char va2 @ 0xa2; // PSG: Data read
static port u_char va1 @ 0xa1; // PSG: Data write
static port u_char va0 @ 0xa0; // PSG: Address latch

extern u_char back1[8];
extern u_char back1_color[8];
extern u_char vdpregs[8];

/*
* VPD functions
*/
void init_vpd(u_char *source) {
u_int x;
for (x=0; x < 8; x++) {
v99 = source[x];
v99 = x+128;
// printf("Reg %d : %d \n",x,source[x]);
}
}

void vwrite(u_short addr, u_char *source, u_int count) {
div_t x;
x = div(addr,256);
// printf("Set vdp write byte 1 : %d \n",x.rem);
// printf("Set vdp write byte 2 : %d \n",x.quot+64);
asm("di" );
v98 = x.quot+64;
v98 = x.rem;
for (;count > 0;count--){
v98 = source[count]; //write byte to port 98
// printf("Writing %d : %d\n",count,source[count]);
}
asm("ei" );
}

main()
{
u_int t;
u_char room[768];
init_vpd(vdpregs);

for (t=0;t < 768; t++) {
room[t]= t&255;
}
vwrite(PGT, back1, 8);
vwrite(PCT, back1_color, 8);
vwrite(PNT, room, SCREEN2_MAX);

while(true) {
}
}

// Data segement
#asm
psect data
global _vdpregs
_vdpregs:
defb 00000010B // Reg# 0 000000[M3][EV]
defb 11100010B // Reg# 1 [4/16k][BLANK][IE][M1][M2]0[SIZE][MAG]
defb 00001110B // Reg# 2 0000[NAME TABLE BASE ADDRESS] = 3C00h
defb 01100000B // Reg# 3 [COLOR BASE ADDRESS] 3000h
defb 00000000B // Reg# 4 00000[PATTERN GENERATOR BASE ADDRESS] 1800h
defb 01111000B // Reg# 5 0[SPRITE ATTRIBUTE TABLE BASE ADDRESS] 3C80h
defb 00000110B // Reg# 6 00000[SPRITE PTRN GNRTR BASE ADDRESS] 3800h
defb 11100000B // Reg# 7 [TEXT COLOR 4bts][BACKDROP COLOR 4bts]

global _back1
_back1:
defb 00011100B
defb 00110110B
defb 11000011B
defb 11010011B
defb 11001011B
defb 11000011B
defb 01100110B
defb 00111100B
global _back1_color
_back1_color:
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B

#endasm

Edwin
msx professional
Mensajes: 635
Publicado: Abril 09 2006, 16:34   
Quote:


v98 = x.quot+64;
v98 = x.rem;



Those should be written to $99 and the other way around.
ARTRAG
msx master
Mensajes: 1802
Publicado: Abril 09 2006, 16:36   
Try this:

/*
* Project Hunter for MSX1 32kb ROM
*/
#include <stdlib.h>
#include <intrpt.h>

/*
* DEFINITIONS
*/
#define u_int   unsigned int
#define u_char  unsigned char
#define u_short unsigned short
#define bool    char
#define true    1
#define false   0

/*
* SCREEN 2 DEFINITIONS HARDCODED
*/
u_int   SCREEN2_MAX = 768;  // # Patterns in one screen
u_short PNT = 14336;        // Pattern Name Table
u_short PGT = 0;            // Pattern Generator Table
u_short PCT = 6144;         // Pattern Color Table
u_short SAT = 15360;        // Sprite Attribute Table
u_short SPT = 12288;        // Sprite Pattern Table


/*
* PORT mappings
*/
static port u_char v99 @ 0x99; // VDP: Command and status register
static port u_char v98 @ 0x98; // VDP: Video RAM data

static port u_char va2 @ 0xa2; // PSG: Data read
static port u_char va1 @ 0xa1; // PSG: Data write
static port u_char va0 @ 0xa0; // PSG: Address latch

extern u_char back1[8];
extern u_char back1_color[8];
extern u_char vdpregs[8];

/*
* VPD functions
*/
void init_vpd(u_char *source) {
    u_char x;
    di();
    for (x=0; x < 8; x++) {
        v99 = source[x];
        v99 = x | 128;
    }
    ei();
}

void vwrite(u_short addr, u_char *source, u_int count) {
    di();
    v99 = addr & 255;
    v99 = (addr>>8) | 64;

    for (;count > 0;count--){
        v98 = source[count]; 
    }
    ei();
}

main()
{
     u_int t;
     u_char room[768];
     init_vpd(vdpregs);

     for (t=0;t < 768; t++) {
         room[t]= t&255;
     }
     vwrite(PGT, back1, 8);
     vwrite(PCT, back1_color, 8);
     vwrite(PNT, room, SCREEN2_MAX);

     while(true) {
     }
}

// Data segement
#asm
psect data
global _vdpregs
_vdpregs:
defb 00000010B // Reg# 0 000000[M3][EV]
defb 11100010B // Reg# 1 [4/16k][BLANK][IE][M1][M2]0[SIZE][MAG]
defb 00001110B // Reg# 2 0000[NAME TABLE BASE ADDRESS] = 3C00h
defb 01100000B // Reg# 3 [COLOR BASE ADDRESS] 3000h
defb 00000000B // Reg# 4 00000[PATTERN GENERATOR BASE ADDRESS] 1800h
defb 01111000B // Reg# 5 0[SPRITE ATTRIBUTE TABLE BASE ADDRESS] 3C80h
defb 00000110B // Reg# 6 00000[SPRITE PTRN GNRTR BASE ADDRESS] 3800h
defb 11100000B // Reg# 7 [TEXT COLOR 4bts][BACKDROP COLOR 4bts]

global _back1
_back1:
defb 00011100B
defb 00110110B
defb 11000011B
defb 11010011B
defb 11001011B
defb 11000011B
defb 01100110B
defb 00111100B
global _back1_color
_back1_color:
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B

#endasm

Huey
msx professional
Mensajes: 672
Publicado: Abril 09 2006, 17:03   
Man! what stupid Thanks. This has been bugging me for 2 day's now.........
ARTRAG
msx master
Mensajes: 1802
Publicado: Abril 09 2006, 17:07   
try this also:

bool get_trigger(u_char id) {
#asm
    f_gttrig equ 0D8h
    push    ix
    push    iy
    ld a,e
    rst 030h
    defb    0
    defw    f_gttrig
    ld l,a
    pop     iy 
    pop     ix
    ret
#endasm

}


and this

     while(!get_trigger(0)) {
     }

ARTRAG
msx master
Mensajes: 1802
Publicado: Abril 09 2006, 17:09   

@huey: what about developing this for msx1:
http://www.msxgamesbox.com/karoshi/index.php?topic=30.0
ARTRAG
msx master
Mensajes: 1802
Publicado: Abril 09 2006, 18:09   
I was tryng this, but something in your VRAM mapping is wrong

/*
* Project Hunter for MSX1 32kb ROM
*/
#include <stdlib.h>
#include <intrpt.h>

/*
* DEFINITIONS
*/
#define u_int   unsigned int
#define u_char  unsigned char
#define u_short unsigned short
#define bool    char
#define true    1
#define false   0

/*
* SCREEN 2 DEFINITIONS HARDCODED
*/
u_int   SCREEN2_MAX = 768;  // # Patterns in one screen
u_short PNT = 0x3800;       // Pattern Name Table
u_short PGT = 0x0000;       // Pattern Generator Table
u_short PCT = 0x1800;       // Pattern Color Table
u_short SAT = 0x3c00;       // Sprite Attribute Table
u_short SPT = 0x3000;       // Sprite Pattern Table


/*
* PORT mappings
*/
static port u_char v99 @ 0x99; // VDP: Command and status register
static port u_char v98 @ 0x98; // VDP: Video RAM data

static port u_char va2 @ 0xa2; // PSG: Data read
static port u_char va1 @ 0xa1; // PSG: Data write
static port u_char va0 @ 0xa0; // PSG: Address latch

extern u_char back1[8];
extern u_char back1_color[8];
extern u_char vdpregs[8];

/*
* VPD functions
*/
void init_vpd(u_char *source) {
    u_int x;
    di();
    for (x=0; x < 8; x++) {
        v99 = source[x];
        v99 = x | 128;
    }
    ei();
}

void vwrite(u_short addr, u_char *source, u_int count) {
    di();
    v99 = addr & 255;
    v99 = (addr>>8) | 64;

    for (;count > 0;count--){
        v98 = source[count]; 
    }
    ei();
}

bool get_trigger(u_char id) {
#asm
    f_gttrig equ 0D8h
    push    ix
    push    iy
    ld a,e
    rst 030h
    defb    0
    defw    f_gttrig
    ld l,a
    pop     iy 
    pop     ix
    ret
#endasm

}

main()
{
     u_int  t;
     u_char room[768];
     
     init_vpd(vdpregs);

     for (t=0;t < 768; t++) {
         room[t]= t&255;
     }
     vwrite(PGT, back1, 8);
     vwrite(PCT, back1_color, 8);
     vwrite(PNT, room, SCREEN2_MAX);

     while(!get_trigger(0)) {
     }
}

// Data segement
#asm
psect data
global _vdpregs
_vdpregs:
defb 00000010B // Reg# 0 000000[M3][EV]
defb 11100010B // Reg# 1 [4/16k][BLANK][IE][M1][M2]0[SIZE][MAG]
defb 00001110B // Reg# 2 0000[NAME TABLE BASE ADDRESS] = 3C00h
defb 01100000B // Reg# 3 [COLOR BASE ADDRESS] 3000h
defb 00000000B // Reg# 4 00000[PATTERN GENERATOR BASE ADDRESS] 1800h
defb 01111000B // Reg# 5 0[SPRITE ATTRIBUTE TABLE BASE ADDRESS] 3C80h
defb 00000110B // Reg# 6 00000[SPRITE PTRN GNRTR BASE ADDRESS] 3800h
defb 11100000B // Reg# 7 [TEXT COLOR 4bts][BACKDROP COLOR 4bts]

global _back1
_back1:
defb 00011100B
defb 00110110B
defb 11000011B
defb 11010011B
defb 11001011B
defb 11000011B
defb 01100110B
defb 00111100B

global _back1_color
_back1_color:
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B

#endasm

Huey
msx professional
Mensajes: 672
Publicado: Abril 09 2006, 21:55   
Quote:


@huey: what about developing this for msx1:
http://www.msxgamesbox.com/karoshi/index.php?topic=30.0



Well I think it is way out of my league for now. I don't have al lot of experience or free-time.
We'll see what comes out if this little project. For now I don't even get the gfx on screen.
Thanks for your help with that. I really appreciate it.

I 'll adjust the code right away....
Huey
msx professional
Mensajes: 672
Publicado: Abril 10 2006, 00:10   
Is there anything special about the color name table?
I see that the pattern table is loaded (after altering the vwrite funct becaue the counter was going backwards making the patterns up side down) but the colors are all out of place?
As data I use the asm output from polka!

The color data for testing is 256 times:
db 0x0f,0x0F,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f

This is the image i get:


This is the image i should be (except the colors):

Edwin
msx professional
Mensajes: 635
Publicado: Abril 10 2006, 00:40   
You can save the state of the emulator with the "save_all [folder]" command from the console. I usually have a folder called save in my folder for this. You can hexview the VRAM.SAV file to check its contents and maybe make some sense of it.
ARTRAG
msx master
Mensajes: 1802
Publicado: Abril 10 2006, 00:48   
This works, try my code:

/*
* Project Hunter for MSX1 32kb ROM
*/
#include <stdlib.h>
#include <intrpt.h>

/*
* DEFINITIONS
*/
#define u_int   unsigned int
#define u_char  unsigned char
#define u_short unsigned short
#define bool    char
#define true    1
#define false   0

/*
* SCREEN 2 DEFINITIONS HARDCODED
*/

#define PNT  0x1800       // Pattern Name Table
#define PGT  0x0000       // Pattern Generator Table
#define PCT  0x2000       // Pattern Color Table
#define SAT  0x1b00       // Sprite Attribute Table
#define SPT  0x3800       // Sprite Pattern Table


/*
* PORT mappings
*/
static port u_char v99 @ 0x99; // VDP: Command and status register
static port u_char v98 @ 0x98; // VDP: Video RAM data

static port u_char va2 @ 0xa2; // PSG: Data read
static port u_char va1 @ 0xa1; // PSG: Data write
static port u_char va0 @ 0xa0; // PSG: Address latch

extern u_char back1[8];
extern u_char back1_color[8];
extern u_char vdpregs[8];

/*
* VPD functions
*/
void init_vpd(u_char *source) {
    u_int x;
    di();
    for (x=0; x < 8; x++) {
        v99 = source[x];
        v99 = x | 128;
    }
    ei();
}

void vwrite(u_short addr, u_char *source, u_int count) {
    di();
    v99 = addr & 255;
    v99 = (addr>>8) | 64;
    ei();
    
    for (;count > 0;count--){
        v98 = *source++; 
    }
}

void vfill(u_short addr, u_char value, u_int count) {
    di();
    v99 = addr & 255;
    v99 = (addr>>8) | 64;
    ei();
    
    for (;count > 0;count--){
        v98 = value; 
    }
}


bool get_trigger(u_char id) {
#asm
    f_gttrig equ 0D8h
    push    ix
    push    iy
    ld a,e
    rst 030h
    defb    0
    defw    f_gttrig
    ld l,a
    pop     iy 
    pop     ix
    ret
#endasm

}

main()
{
     u_int  t;
     u_char room[768];
     
     init_vpd(vdpregs);
     for (t=0;t < 768; t++) {
         room[t]= t&255;
     }
     vfill(PCT, 0xf5, 256*8*3);

     
     vwrite(PGT, back1, 8);
     vwrite(PCT, back1_color, 8);
     vwrite(PNT, room, 768);

     while(!get_trigger(0)) {
     }
}

// Data segement
#asm
psect data
global _vdpregs
_vdpregs:
defb 0x02 //00000010B // Reg# 0 000000[M3][EV]
defb 0x60 //11100010B // Reg# 1 [4/16k][BLANK][IE][M1][M2]0[SIZE][MAG]
defb 0x06 //00001110B // Reg# 2 0000[NAME TABLE BASE ADDRESS] = 3C00h
defb 0xff //01100000B // Reg# 3 [COLOR BASE ADDRESS] 3000h
defb 0x03 //00000000B // Reg# 4 00000[PATTERN GENERATOR BASE ADDRESS] 1800h
defb 0x36 //01111000B // Reg# 5 0[SPRITE ATTRIBUTE TABLE BASE ADDRESS] 3C80h
defb 0x07 //00000110B // Reg# 6 00000[SPRITE PTRN GNRTR BASE ADDRESS] 3800h
defb 0x01 //11100000B // Reg# 7 [TEXT COLOR 4bts][BACKDROP COLOR 4bts]

global _back1
_back1:
defb 00011100B
defb 00110110B
defb 11000011B
defb 11010011B
defb 11001011B
defb 11000011B
defb 01100110B
defb 00111100B

global _back1_color
_back1_color:
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B
defb 00001111B

#endasm


Note that I moved to the standard screen 2 memory map to be sure it was rigth.
I added vfill and changed your vwrite and now anything works.
manuel
msx guru
Mensajes: 3637
Publicado: Abril 10 2006, 09:07   
Huey, please upgrade your openMSX! openMSX 0.4.0 is ancient (about 2 years old)! 0.6.0 is the latest release, from January 2006.
Huey
msx professional
Mensajes: 672
Publicado: Abril 10 2006, 10:14   
@ARTRAG: It's working now. Must have been something with the table base adresses......

@manuel: I will upgrade..thanks

@edwin: Thanks. I'll experiment with it using other games and sort.
 
Ir a la página ( Página anterior 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 Siguiente página )
 







(c) 1994 - 2009 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation