Greetings here in post
I have been trying to make a print function work between files and soon realized how particular the code can be.
Here my objectives were
1. make a (a)buffer or (b)buffering loop for the string
2. keep the version control steady to integrate between files & watch the program behavior
3. fix the print call between multiple files
Originally I got the first 2 steps to work using the dereference parenthesis however I can not check this in gdb due to a random SIGSEVI block for 90% cases.
If I try to combine methods other than mov ,[] such as{LEA,LDS,(bp,sp) stack buffer} I need to have this design code for addressing
Now I did in fact find one instance where I glimpsed into [] however I try restructuring my code to put all in the global print label and now
the code works only if I don't return from the settings function and run through the settings block instead.
The most frustrating part is that these sections are DUPLICATES of each other (post settings Call == print_string2 label)so I really have no clue anymore.
The programs files were made standard using a .bin for screening and .elf to debug in gdb where I am also adding the compiler commands.
I would really be avid if anyone else could show an answer about this and thank y'all for your time on this.
nasm -f bin print2.asm -o print2.bin
nasm -f elf print2.asm -o print2.o
ld -m elf_i386 -o print2 print2.o -e print
section .data
debugTest: db "debug test script",0
msgSeg3: db ?
length2: equ $-msgSeg3
placer equ 0x7c00
section .text
global print
print:
call settings
mov cx,[bx+si]
mov [placer+msgSeg+esi],cl
inc si
cmp cx,0x00
jnz print
mov esi,0
call continue
jmp loop
settings:
mov ebx,ecx
mov ax,0A000h
lea bx,msgTest1
add bx,placer
add dx,placer
mov ebp,esp
mov ah,0x0E
mov esi,0
print_string2:
mov cx,[bx+si]
mov [placer+msgSeg+esi],cl
inc si
cmp cx,0x00
jnz print_string2
push esi
mov esi,0
jmp continue
print_string:
mov ecx,[bx]
mov [placer+msgSeg+esi],cl
inc ebx
inc si
cmp cl,0x00
jnz print_string
push esi
mov esi,0
jmp continue
continue2:
mov al,[bp+si]
inc esi
int 0x10
cmp al,0x00
jnz continue2
continue3:
mov al,[es:esi]
inc esi
int 0x10
inc bp
mov cx,[placer+msgSeg+esi]
cmp al,0x00
jnz continue3
continue:
mov al,[placer+msgSeg+esi]
inc esi
int 0x10
inc bp
mov cx,[placer+msgSeg+esi]
cmp al,0x00
jnz continue
ret
.done:
pop esi
pop esi
ret
ret
loop:
jmp $
msgTest1: db "Testing the print",0
testLength: equ $-msgTest1
msgTest2: db "Text",0
testLength2: equ $-msgTest2
msgSeg: db ?
length: equ $-msgSeg
msgSeg2: db length
times 510 - ($-$$) db 0
dw 0xaa55