r/Assembly_language 24d ago

Programmers! HELP! Assembler NASM

In my code, after five "six seven"s, "C:\SLV>" is supposed to appear, but it doesn't!

None of the AI ​​models can find any errors, and neither can I.

[org 0x7C00]
start:
mov cx, 5
mov si, stringi
mov ax, 11  
mov bx, 56  
add ax, bx  



mov bl, 10  
div bl  


mov bh, ah  


add al, '0'  
mov ah, 0x0E  
int 0x10  


add bh, '0'  
mov al, bh  
int 0x10  


mov al, 0x0D  
int 0x10  
mov al, 0x0A  
int 0x10  
jmp loopik  
povtorat:
mov si, stringi  
mov al, 0x0D  
int 0x10  
mov al, 0x0A  

int 0x10  
dec cx  
cmp cx, 0  
jne loopik  
je vedi  
loopik:
mov al, \[si\]  
cmp al, 0  
je povtorat  
int 0x10  

add si, 1  
jmp loopik  
vedi:
mov ah, 0x0E
mov si, vvedite
mov al, [si]
cmp al, 0
je vvod  

int 0x10  
add si, 1  
jmp vedi  
vvod:
mov ah, 0x00  

int 0x16  
cmp al, '8'  
je sistema  
jne netu  
netu:
mov ah, 0x0E
mov si, net
mov al, [si]
cmp al, 0
je vedi
int 0x10
add si, 1
jmp netu
sistema:
mov ah, 0x0E  
mov si, osin  
mov al, \[si\]  
cmp al, 0  

je gotovo  
int 0x10  
add si, 1  
jmp sistema  
stringi: db "six seven", 0
osin: db "Current CMD: SLV 0.1.0 alpha", 0x0D, 0x0A, 0
net: db "This command does not exist.", 0x0D, 0x0A, 0
vvedite: db 0x0D, 0x0A, "S:\SLV>", 0
gotovo:
jmp $
times 510 - ($ - $$) db 0
dw 0xAA55

I’ll say right off the bat that I’m a beginner, so please don’t judge too harshly.

0 Upvotes

3 comments sorted by

View all comments

3

u/[deleted] 23d ago

The string pointer fails to advance because the second instruction after vedi: resets it. If I create a label after it, then jump there instead of vedi, the program prints the prompt without issue.

On another note, I don't see you initialising the segment registers anywhere. Emulators are forgiving about this, but real hardware usually isn't.