1 ; Argument Test Program (v1.0, July 6 2010)
2 ; Written by Ian Seyler
5 ; nasm argtest.asm -o argtest.app
9 [ORG 0x0000000000200000]
13 start: ; Start of program label
15 call b_get_argc
; Get the number of arguments that were passed
16 cmp al, 1 ; Was the number 1?
17 je noargs
; If so then bail out. The first argument is the program name
18 mov rsi
, hello_message
; Load RSI with memory address of string
19 call b_print_string
; Print the string that RSI points to
20 mov al, 1 ; Argument values start at 0 so we want the second one
21 call b_get_argv
; Set RSI to point to the second argument
22 call b_print_string
; Print the string
23 call b_print_newline
; Print a new line
24 jmp fin
; Skip to the end
27 mov rsi
, noargs_message
; Print the error message
34 hello_message: db 'Hello, ', 0
35 noargs_message: db 'Abort: No arguments supplied.', 13, 0