I have tried to assemble the following code in TASM and Flat Assembler, but they both give an error for every line of code. What is going on? How can I get the assemblers to assemble the * code?? Thanks for any help you can provide.

[BITS 16]
[ORG 0]

jmp start

	bootdrv 	db 0
	bootmsg 	db 'Boot Sector Example',13,10,0

	rebootmsg    db 'Press any key to reboot',13,10,0

	processormsg	db 'Checking for 386+ processor: ',0
	need386 	db 'Sorry... 386+ required!',13,10,0
	found386	db 'Found!',13,10,0

	whatever	db 'Now we insert our code here to do something, and we have an OS!',13,10,0

	detect_cpu:
		mov si, processormsg
		call message

		pushf
		
		xor ah,ah
		push ax
		popf
		
		pushf
		pop ax	     
		and ah,0f0h
		cmp ah,0f0h
		je no386

		; check for a 286 (bits 12-15 are clear)
		mov ah,0f0h
		push ax
		popf
		
		pushf
		pop ax
		and ah,0f0h
		jz no386
		popf
		
		mov si, found386
		call message
		
		ret
	 no386:
		mov si,need386
		call message
		jmp reboot

	message:
		lodsb
		or al,al
		jz done
		mov ah,0eh
		mov bx,0007
		int 0x10
		jmp message
	done:
		ret

	getkey:
		mov ah, 0
		int 016h
		ret

	reboot:
		mov si, rebootmsg
		call message
		call getkey

		db 0EAh

		dw 0000h
		dw 0FFFFh
		
start:
	mov ax,0x7c0
	mov ds,ax
data

	mov [bootdrv], dl

	cli
	mov ax,0x9000
	mov ss,ax
	mov sp,0xffff
	sti
	
	mov si,bootmsg
	call message

	call detect_cpu

.386

	mov si,whatever
	call message
	call getkey
	
	call reboot

	times 510-($-$$) db 0
	dw 0xAA55

You have failed to use the proper directives to organize your code and data. Please read TASM's documentation.

I should note also that you've got some pretty egregious errors there, particularly when calling and not returning.

Hope this helps.

I see, after really looking through it, I got rid of some errors, and it took care of the rest.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.