3-17-2016
Hi Bryant,
This is what I got from my code below:
#1...........
jack@jack-myheadache ~/nasmfld $ nasm -f elf64 demo64.asm -o demo64.o
jack@jack-myheadache ~/nasmfld $ gcc -o demo64 demo64.o -lcurses
demo64.o: In function `get_user_input.err1':
demo64.asm:(.text+0x4b8): undefined reference to `get_cur_coord'
collect2: error: ld returned 1 exit status
jack@jack-myheadache ~/nasmfld $
extern get_cur_coord ; have no idea how or where to define this
extern wchgat
%define BLACK_ON_YELLOW 2
call get_cur_coord
mov r8, 0 ; curses requires the "opts" parameter for future features
; that aren't currently implemented. so we just set it to 0.
mov rcx, BLACK_ON_YELLOW ; or whatever you named the color pair index using
; init_color
mov rdx, 0 ; the string attribute; 0 for normal, and 200000h for bold
mov rsi,42 ; the length of the error message you printed.
mov rdi, [hWindow] ; the window your string was printed on.
call wchgat
; call draw_child_window3
mov rdx,50 ; X
mov rsi,11 ; Y
; mov rdi,[hChildWindow3]
mov rdi,[hWindow]
call wmove
;*****************
#2................
also never got this to work.
trying to run NASM from a HD not containing the OS.
jack@jack-myheadache ~ $ sudo mount -o remount,exec /media/jack/nasm/nasmfld
[sudo] password for jack:
mount: can't find /media/jack/nasm/nasmfld in /etc/fstab or /etc/mtab
jack@jack-myheadache ~ $
; *****************
#3...................
In MASM32 we have macro called "ATODW".
It converts a decimal string into a dw value.
CkBal db ' 4321',0
mathhold dd 0
I thought this was what "atoi" did....
more about this problem below.
; the user keys in "aa" incorrectly
hChildWindow dq 0
msg dw 0 ; converted user input ??
szUserInput db ' ',0
mov rdx,2
mov rsi,szUserInput
mov rdi,[hChildWindow]
call wgetnstr ; reads 2 characters good or bad
;; convert string to integer
mov rdi,szUserInput
call atoi ; result in rax
mov [msg],ax ; preserve keyed in value ??
cmp byte[msg+1],016h ; This does not work!!!!!!!!!
; value should not be > 22 decimal
jg .err1
jmp .out1 ; good input
; never gets here.............
.err1:
call draw_child_window3
mov rdx,50 ; X
mov rsi,11 ; Y
mov rdi,[hChildWindow3]
call wmove
;msg6 db 'value keyed in is invalid - reenter ',0
mov rsi,msg6
mov rdi,[hChildWindow3]
call waddstr
;; The command wrote a string in the window buffer,
;; now we need to display the buffer on the screen.
mov rdi,[hChildWindow3]
call wrefresh