Hi I tried to create a asm code which will just print "My name" and "id".
; To assemble and run:
; nasm -f bin -o boot.bin boot.asm
; dd if=boot.bin of=/dev/sdb bs=512 count=1
; (replace /dev/sdb with the appropriate device file for your USB drive)
section .text
global _start
_start:
; Print "Hello, my name is "
mov rax, 0x1301
mov rbx, 0x0003
mov rcx, 22
mov rdx, msg ;
int 0x10 ;call the kernel
; Print " and my roll number is "
mov rax, 0x1301
mov rbx, 0x0003
mov rcx, 23
mov rdx, msg2
int 0x10
; Print "123456"
mov rax, 0x1301
mov rbx, 0x0003
mov rcx, 6
mov rdx, msg3
int 0x10
; Wait for a key press
mov rax, 0x16
int 0x10
; Return to boot loader
mov rax, 0x0000
int 0x18
section .data
msg db "Hello, my name is ManuJain " ;message is kind of a variable, db - define bits
msg2 db " My College number is "
msg3 db "1234567"
this is command
ld test.o -o test -demangle -dynamic -macosx_version_min 11.0 -L/usr/local/lib -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -lSystem -no_pie
When I running this on terminal I am getting this message
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64