Compiling OK, Build fail, where is the problem ???

Since we do not have native C compilers on the Oric, this forum will be mostly be used by people using CC65 or the OSDK. But any general C related post will be welcome !
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Compiling OK, Build fail, where is the problem ???

Post by waskol »

I rewrote oric kong into C
The basic program was an horrible thing, the resulting C code is kind of hugly too (but without POP, goto outside a sub procedure, etc...).
Anyway, this is the output when I build the thing :

Code: Select all

Building the program ORICKONG at adress $800
Compiling main.C
  - preprocess
  - compile
  - convert C to assembly code
  - cleanup output
Assembling fplot.S
Linking
C:\OSDK\mesprogs\orickong
Assembling
 EQ0W_C(15,Lmain431)
C:\OSDK\mesprogs\orickong\main.s(9474):  45fa:Syntax error
 EQ0W_C(50,Lmain638)
C:\OSDK\mesprogs\orickong\main.s(16791):  7504:Label defined error
 EQ0W_C(14,Lmain688)
C:\OSDK\mesprogs\orickong\main.s(18407):  7f46:Label defined error
ERROR : Build failed.
what's the problem doctor ?
could you help me to sort it out ?
many tanks.

here are the file :
orickong_c.zip
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Compiling OK, Build fail, where is the problem ???

Post by Dbug »

What that means is that the compiler generated a EQ0W_C "pseudo" instruction which is not defined in osdk/macro/macros.h

There is a bunch of variants, but not that one.

For reference, here are how some of these are implemented:

Code: Select all

#define EQ0W_D(tmp,label)\
	lda tmp ;\
	ora tmp+1 ;\
	bne *+5 ;\
	jmp label ;\

#define EQ0W_I(ptr,y2,label)\
	ldy #y2 ;\
	lda ptr,y ;\
	iny ;\
	ora ptr,y ;\
	bne *+5 ;\
	jmp label ;\
Based on what the code does, I would say that EQ0W_D checks if a 16 bit value is equal to zero, and if not jumps to a label, while EQ0W_I checks the nullity of something based on a pointer+offset (ptr+y2).

Based on some other examples of instructions with _C (constant), we may imagine the missing code.
So let see:

Code: Select all

#define LEAVEW_C(cte1)\
	ldx #<(cte1) ;\
	lda #>(cte1) ;\
	jmp leave ;\

#define RETW_C(cte1)\
	ldx #<(cte1) ;\
	lda #>(cte1) ;\
	rts ;\

#define ARGW_C(cte,ptr,y2)\
	lda #<(cte) ;\
	ldy #y2 ;\
	sta ptr,y ;\
	iny ;\
	lda #>(cte) ;\
	sta ptr,y ;\

#define FLOAD1_C(tmp)\
	lda #<(tmp) ;\
	ldy #>(tmp) ;\
	jsr load_acc1 ;\
based on that, I would give a shot at implementing it like that:

Code: Select all

#define EQ0W_C(tmp,label)\
	lda #<(tmp) ;\
	ora #>(tmp) ;\
	bne *+5 ;\
	jmp label ;\
Could you try and tell us if that works ?
User avatar
waskol
Flight Lieutenant
Posts: 414
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Re: Compiling OK, Build fail, where is the problem ???

Post by waskol »

It works ! :D
Post Reply