I'm new to Assembly and learning the basics, but i've been stuck for a while on this and don't know how to get past it. The code below works, but not using the required base addressing mode.
I have to copy the fifth character from String into the variable N, using the base addressing mode. The way I went about it (not using base addressing mode) is by using base with offset. I'm not sure how I would achieve this doing base addressing mode, any help would be appreciated.
;Initialized data
section .data
msg1: db "Input a string: ",10
msg1_L: equ $-msg1 ;calculate size of msg1
n_line DB 0AH,0DH,"$"
;Uninitialized data
section .bss
String resb 128
N resb 1
section .text
global _start:
_start:
;Print message
mov eax, 4 ;sys_write
mov ebx, 1 ;stdout
mov ecx, msg1 ;message to write
mov edx, msg1_L ;message length
int 80h
;input message and save
mov eax, 3
mov ebx, 0
mov ecx, String
mov edx, 256
int 80h
;Copy 5th character to N, using base addressing mode
;This is where my problem is
mov bx, [String+4]
mov [N], bx
mov eax, 4 ;sys_write
mov ebx, 1 ;stdout
mov ecx, N ;message to write
mov edx, 1 ;message length
int 80h
;Print new line
mov eax, 4 ;sys_write
mov ebx, 1 ;stdout
mov ecx, n_line ;message to write
mov edx, 1 ;message length
int 80h