My crt0calc.s

By sp4

Master (214)

sp4's picture

12-02-2015, 20:38

Hi, hit9918 wrote me the follow code crt0.s.

.module crt0
       	.globl _main

	;; 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	_STACK
	
	
	
	.area	_STACK
	stacksize = 64
	.ds stacksize
stack:


	.area	_CODE
	
	DI
	ld sp,#stack
	
        call    gsinit
	call	_main
	
	di
	halt


	.area   _GSINIT
gsinit::
	ld	bc, #l__INITIALIZER         ;<----    there is an error 
	ld	a, b
	or	a, c
	jr	Z, gsinit_next
	ld	de, #s__INITIALIZED         ;<----    there is an error 
	ld	hl, #s__INITIALIZER         ;<----    there is an error 
	ldir
gsinit_next:

	.area   _GSFINAL
	ret

When I compiled that the compiler told me that there is three errors.
I tried to resolve that errors but I didn' t understand where is the errors and why.
My error message is this:

crt0calc.s:40 Error: <u> undefined symbol encountered during assembly
crt0calc.s:44 Error: <u> undefined symbol encountered during assembly
crt0calc.s:45 Error: <u> undefined symbol encountered during assembly

Anybody can help me?

Login or register to post comments

By andrear1979

Expert (96)

andrear1979's picture

13-02-2015, 01:58

Hi sp4,

look at the end of this thread:
the guy solved by adding three .globl statements. Does it help?

By Vampier

Prophet (2297)

Vampier's picture

13-02-2015, 02:59

and thus another topic is opened for the same program... what he said ^^ Smile

By sp4

Master (214)

sp4's picture

13-02-2015, 13:28

andrear1979 wrote:

Hi sp4,

look at the end of this thread:
the guy solved by adding three .globl statements. Does it help?

Hi andrear1979, I modified like follow:

.module crt0
       	.globl _main

	;; Ordering of segments for the linker.
	.area	_HOME
	.area	_CODE
        .area   _GSINIT
        .area   _GSFINAL
	.globl	l__INITIALIZER
	
	.area	_DATA
	.globl	s__INITIALIZED
	.area	_BSEG
        .area   _BSS
        .area   _HEAP
	.area	_STACK
	
	
	
	.area	_STACK
	stacksize = 64
	.ds stacksize
stack:


	.area	_CODE
	
	DI
	ld sp,#stack
	
        call    gsinit
	call	_main
	
	di
	halt


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

	.area   _GSFINAL
	ret

And the compilation go right, but I see in at the begin of my calc.ROM the follow string "AB " and for my calculator it don't need to put that "AB" but it need to start from 0x0000 but I don't know to make it.
How can I do for make that please?
This is my calc.ROM:

AB                ÍzÍuÉ! 9å!™åÍ  ññÉÍ  ! 9~æo&  Ž	åÍñý! ý9ýn ý~æ?Ë÷gåÍñÍ  ! 9V˜ÕÍ  ñÉÍ  ! 9~æW™ÕÍ  !™ŽãÍ  ñ! 9V™ÕÍ  ñ! 9~æ?Ë÷W™ÕÍ  ñÍ  ! 9V˜ÕÍ  ñÉÝåÝ!  Ý9!øÿ9ù!  9ë¯kb#6 kb##6 kb###6 ! 6 ! 6 ! 6 ! 6 ÕÍ  !€åÍ!`ãÍ!‚ãÍ!€ƒãÍ!„ãÍ!÷…ãÍ!†ãÍ! ‡ãÍñÍ  ¯õ3!  åÍ*ñ3Ñ  kbÅÕå!˜åÍ  ññÑÁyÖ€x?Þš8äÝùÝáÉÍ°!
å>
õ3Íhñ3Í  Ã  ÍÀ þÉ

I want to remove "AB " and I want that the programm begin from 0x0000: how can I do?

By sp4

Master (214)

sp4's picture

13-02-2015, 16:11

No my mistake! My calc.ROM is this:

ó1@ÍÍóv!HAå!ÍÌåÍ  ññþ x±(@! í°É

Sorry !! "AB " don't exist no more but the eeprom programmer don't allow me to load the calc.ROM in the EEPROM memory chip because It begin with 0xFE. Why ?

By hit9918

Prophet (2868)

hit9918's picture

13-02-2015, 17:32

The code must start with a &hF3 byte at address 0.

you funny built in new error.
use this crt0

	.module crt0
       	.globl _main

	.globl	s__INITIALIZER
	.globl	l__INITIALIZER
	.globl	s__INITIALIZED

	;; 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	_STACK
	
	
	
	.area	_STACK
	stacksize = 64
	.ds stacksize
stack:


	.area	_CODE
	
	DI
	ld sp,#stack
	
        call    gsinit
	call	_main
	
	di
	halt


	.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