Peter JakackiPeter Jakacki Posts: 8,644
edited 2018-04-27 - 14:17:57 in Propeller 2
The other day when in I was in a conference call with Cluso and Chip regarding the boot ROM, out of curiosity I wanted to understand the mechanism inside the P2 before it even calls the ROM code at $FC000 since this ROM is copied into hub RAM and then write protected. Chip pasted a screenshot onto the end of the P2 document of a handful of instructions that are hardwired in cog 0 only that is used to sequentially read the internal non-memory mapped "ROM" into hub RAM and then run it.

The instructions only exists as hardwired 1s and 0s but it helped me to understand how the P2 got to start (but not really start) executing instructions at $FC000 and which mode it was in, which from the listing you can deduce from the coginit. btw, PTRA is hardware preset to $FC000 and PTRB is preset to $4000.
''  wire [15:0][31:0] booti = {
		'' cold boot rom - only cog0 on startup
		wrfast	#0,ptra		' begin write at $FC000 (preset)
		rep 	#1,ptrb		' write $4000 bytes (preset)
		wfbyte	0		' write rom byte to hub ram
		wrfast	#0,ptra 	' finish write
		coginit #0,ptra 	' restart at $FC000
		coginit #0,ptra		' not used
		coginit #0,ptra		' not used
		coginit #0,ptra		' not used

		'' warm boot rom - via coginit
		mov 	outa,#0		' clear port shadow registers
		mov 	outb,#0
		mov 	ina,#$1F8	' point ina/ijmp0 to cog's initial int0 handler
		setq 	#$1F7		' if !hubs, load $1F8 longs from ptrb
		rdlong 	0,ptrb
		jmp 	dirb/ptrb 	' if !hubs, jump to $000 (dirb=0), else ptrb
		jmp 	dirb/ptrb	' not used
		jmp 	dirb/ptrb	' not used
''  };

'' wire [7:0][31:0] debugi = {

		'' debug rom - executes in $001F8..$001FF
		setq	#$0F		' ready to save registers $000..$00F
		wrlong 	0,ptra 		' ptra reads %1111_1111_1ccc_c000_0000
		setq 	#$0F		' ready to load program into $000..$00F
		rdlong 	0,ptrb 		' ptrb reads %1111_1111_1ccc_c100_0000
		jmp 	#0 		' jump to loaded program
		setq 	#$0F		' ready to load program into $000..$00F
		rdlong 	0,ptra 		' ptra reads %1111_1111_1ccc_c000_0000
		reti0 			' calld inb,inb wcz
''  };

Tachyon Forth - compact, fast, forthwright and interactive
--->CLICK THE LOGO for more links<---
P1 +++++ Latest Tachyon includes EASYFILE +++++ Tachyon Forth News Blog
Brisbane, Australia
1121 x 594 - 26K
Sign In or Register to comment.