FC4 and Assembly Language Program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi list
i am about to make a bootable floppy for test
but i am being unable to get it done
please review the code below and tell me if there is any problem with it
----------------------------------------------------------------------------------------------------------------------------------
.code16		#assembler directive to start 16-bit real mode for execution
.text		/*assembler directive to tell the start of 'read-only'
		code segment*/
.org 0x00	/*assembler directive to set the origon to sector 0
		needed to copy the program to the very first sector
		of the floppy disk*/

.global _start	/*assembler directive to export the start section to
		all other programs, i.e. to make it visible to programs
		like linker or other user programs*/

_start:				#label of the start routine
	mov 0x07C0, %ax		/*move immidiate operand 07C0 to the
				accumulator register ax, so that it can be
				transfered to data segment register*/
	mov %ax, %ds		/*move contents of register ax to register ds*/
	call _boot		#call the boot section
	ret			#return the control to the caller routine

_boot:				#label of the boot section
	mov $msg, %si		/*move the address of the character string
				constant 'msg' to the source index register*/
	call _disp		#call subroutine disp
	ret			#return the control to the caller routine

_disp:				#label of the disp routine
	cld			/*clear direction flag, to permit string
				instructions to increment index registers
				by their own*/
	lodsb			/*load the string pointed by ds:si in a
				byte by byte manner into the accumulator*/
	or %al, %al		/*check if the entire string has been loaded
				byte-wise by oring al to al, if the result is
				zero, it shows there are no more byte to load*/
	jz ret			#jump if al zero to return
	mov $0xE, %ah		/*else put code for 'write a character on the
				screen and move forward' into the ah*/
	mov $7, %bh		/*enable normal attribute for all the blank
				lines on the screen*/
	int $0x10		/*call interupt 0x10, which is responsible
				for the video display, it will take codes
				from ah and bh*/
	jmp _disp

msg:				#label of the string definition
	.ascii "My Boot System"	#definition of the string

.org 510			#set origon to 510
.word 0xAA55			#
--------------------------------------------------------------------------------------------------------------------------------------

saved the file with the name myos.s
then

#as myos.s -o myos.o
#objcopy -O binary myos.o BOOT
#dd if=./BOOT of=/dev/fd0 bs=512 count=1
-------------------------------------------------------------------------------------------------------------------------------------
the system tries to boot from the floppy and it boots (as it doesnt give an error or it doesnt go to the next boot device. but it doesnt display the string that i had to show from the string

please check it and tell me about any possible errors in the code

Regards
Azeem

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux