• Please review our updated Terms and Rules here

Code in Boot Sector

per

Veteran Member
Joined
Jan 21, 2008
Messages
3,052
Location
Western Norway
I was looking at a disk image for the Tiki-100 the other day, and one thing that struct me is that in the end of the boot sector of the latest version of the system there's always the following code-snipplet:

Code:
					isk		      *
;	* Forms:					      *
;	*   JUMP <adr>		Call at <adr>;<adr> is in HEX *
;	*******************************************************
JUMP:
	CALL	HEXNUM		;GET LOAD ADDRESS IN HL
	JR	CALLPROG	;PERFORM CALL
;
;	****************************************************************
;	* Command: GO						       *
;	* Function: To Call the program in the TPA without loading     *
;	*	    loading from disk. Same as JUMP 100H, but much     *
;	*	    more convenient, especially when used with	       *
;	*	    parameters for programs like STAT. Also can be     *
;	*	    allowed on remote-access systems with no problems. *
;	*							       *
;	* Form: 						       *
;	*   GO <parameters like for COMMAND>			       *
;	****************************************************************
;
GO:	LXI	H,TPA		;Always to TPA
	JR	CALLPROG	;Perform call
;
;	********************************************
;	* Command: COM file processing		   *
;	* Function: To load the specified COM file *
;	*	    from disk and execute it	   *
;	* Forms:				   *
;	*   <command>				   *
;	********************************************
COM:
	LDA	FCBFN		;ANY COMMAND?
	CPI	' '		;' ' MEANS COMMAND WAS 'D:' TO SWITCH
	JRNZ	COM1		;NOT <SP>, SO MUST BE TRANSIENT OR ERROR
	LDA	TEMPDR		;LOOK FOR DRIVE SPEC
	ORA	A		;IF ZERO, JUST BLANK
	JZ	RCPRNL
	DCR	A		;ADJUST FOR LOG IN
	STA	TDRIVE		;SET DEFAULT DRIVE
	CALL	SETU0D		;SET DRIVE WITH USER 0
	CALL	LOGIN		;LOG IN DRIVE
	CALL	USRNUM		;GET USER #, IF ANY
	MOV	E,A		;GET IT READY FOR BDOS
	LDA	FCBFN		;SEE IF # SPECIFIED
	CPI	' '
	JRNZ	SUSER		;SELECT IF WANTED
	JMP	RCPRNL		;RESTART CPR
COM1:
	LDA	FCBFT		;FILE TYPE MUST BE BLANK
	CPI	' '
	JNZ	ERROR
	LXI	H,COMMSG	;PLACE DEFAULT FILE TYPE (COM) INTO FCB
tryLOAD:
	LXI	D,FCBFT 	;COPY INTO FILE TYPE
	LXI	B,3		;3 BYTES
	LDIR
	LXI	H,TPA		;SET EXECUTION/LOAD ADDRESS
	PUSH	H		;SAVE FOR EXECUTION
	CALL	MEMLOAD 	;LOAD MEMORY WITH FILE SPECIFIED IN CMD LINE
				; (NO RETURN IF ERROR OR TOO BIG)
	POP	H		;GET EXECUTION ADDRESS
;
;	CALLPROG IS THE ENTRY POINT FOR THE EXECUTION OF THE LOADED
;	PROGRAM. ON ENTRY TO THIS ROUTINE, HL MUST CONTAIN THE EXECUTION
;	ADDRESS OF THE PROGRAM (SUBROUTINE) TO EXECUTE
;
CALLPROG:
	SHLD	EXECADR 	;PERFORM IN-LINE CODE MODIFICATION
	call	resdsus 	;Restore default disk/user
	CALL	SCANER		;SEARCH COMMAND LINE FOR NEXT TOKEN
	LXI	H,TEMPDR	;SAVE PTR TO DRIVE SPEC
	PUSH	H
	MOV	A,M		;SET DRIVE SPEC
	STA	FCBDN
	LXI	H,FCBDN+10H	;PT TO 2ND FILE NAME
	CALL	SCANX		;SCAN FOR IT AND LOAD IT INTO FCBDN+16
	POP	H		;SET UP DRIVE SPECS
	MOV	A,M
	STA	FCBDM
	XRA	A
	STA	FCBCR
	LXI	D,TFCB		;COPY TO DEFAULT FCB
	LXI	H,FCBDN 	;FROM FCBDN
	LXI	B,33		;SET UP DEFAULT FCB
	LDIR
	LXI	H,CIBUFF-1
COM4:
	INX	H
	MOV	A,M		;SKIP TO END OF 2ND FILE NAME
	ORA	A		;END OF LINE?
	JRZ	COM5
	CPI	' '		;END OF TOKEN?
	JRNZ	COM4
;
;	LOAD COMMAND LINE INTO TBUFF
COM5:
	MVI	B,-1		;SET CHAR COUNT
	LXI	D,TBUFF 	;PT TO CHAR POS
	DCX	H
COM6:
	INR	B		;INCR CHAR COUNT
	INX	H		;PT TO NEXT
	INX	D
	MOV	A,M		;COPY COMMAND LINE TO TBUFF
	STAX	D
	ORA	A		;DONE IF ZERO
	JRNZ	COM6
;
;	RUN LOADED TRANSIENT PROGRAM
COM7:
	MOV	A,B		;SAVE CHAR COUNT
	STA	TBU

Is this something anyone recognize? Looks like some CP/M BDOS-like implementation. For those who doesn't know, the Tiki-100 was using a "custom" CP/M clone, and from this it seems to me they forgot to flush the memory between assembling and writing the boot-sector. What I am curious about, is if this code is taken from something else or if it may be developed in-house at Tiki-Data. Other source code they released as sample-code were done with Norwegian comments and lables.

At one point early in the machine's timeline, there were rumors that Tiki-Data had outright copied CP/M. To avoid further association with Digital Research, they ended up changing the name from "KP/M" to "TIKO". They never mentioned anything about maybe they had borrowed bits and pieces from elsewhere, and always claimed it to be their own product.
 
Back
Top