Z180 - Port access in page zero startup

Discussion about other targets
Post Reply
tr1p1ea
New member
Posts: 4
Joined: Fri Feb 21, 2020 3:57 am

Z180 - Port access in page zero startup

Post by tr1p1ea »

I'm compiling for a custom Z180 machine that has protected ports that will cause a hardware reset if written to.

Compiling with:

Code: Select all

zcc +z180 --opt-code-speed -vn -lm -clib=new

Code: Select all

#pragma output CRT_MODEL = 0			//; RAM model
#pragma output CRT_ORG_CODE = 0x2000	//; CODE entry point - allow space for library
#pragma output CRT_ORG_DATA = 0		//; DATA appends to CODE
#pragma output CRT_ORG_BSS = 0		//; BSS appends to DATA
#pragma output CRT_ENABLE_EIDI = 0x01	//; Disable interrupts on entrance
#pragma output REGISTER_SP = -1		//; Leave SP unchanged
#pragma output CRT_ON_EXIT = 0x10002	//; return to caller on exit
#pragma output CRT_ENABLE_CLOSE = 0		//; no file handling on close
#pragma output CLIB_MALLOC_HEAP_SIZE = 0	//; no malloc heap
#pragma output CLIB_STDIO_HEAP_SIZE = 0	//; no stdio heap
#pragma output CLIB_FOPEN_MAX = -1		//; no FILE* list
#pragma output CLIB_OPEN_MAX = -1		//; no fd table
#PRAGMA OUTPUT CRT_ENABLE_NMI = 0
My problem is there seems to be some page zero or startup code that is trying to write to port $33 to set up an interrupt handler (which I don't need or want):

Code: Select all

	di
	ld ($D52B),sp
	ld hl,$C54E
	ld bc,$0FDD
	ld e,$00
	call $22C6
	ld a,$00
	ld i,a
	ld a,$00
	out0 ($33),a
	im 1
	call $22D7
	push hl
	pop hl
	ld sp,($D52B)
	ret
Basically I don't want or need an interrupt set up at all and I was wondering if anyone had any ideas on how to remove this?
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Re: Z180 - Port access in page zero startup

Post by dom »

Just sifting through the files, I can see it's being set by crt_set_interrupt_mode.inc

Chasing that around, I think if you set:

Code: Select all

#pragma output CRT_ORG_VECTOR_TABLE = 0x00
then that should disable it.

@feilipu on GitHub uses the z180 target so feel free to raise an issue up there.
tr1p1ea
New member
Posts: 4
Joined: Fri Feb 21, 2020 3:57 am

Re: Z180 - Port access in page zero startup

Post by tr1p1ea »

Thanks heaps, that looks to have taken out the port write.

Appreciate the help! :).
Post Reply