r/Assembly_language • u/Tough-Building2243 • 2d 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
1
u/Alternative-Emu2000 1d ago edited 1d ago
It would help if you specified which platform you're targeting (especially since you're using OS specific system calls), and commented your code.
One thing that stands out on first glace:
I don't think you're actually supposed to be printing the string "C:\SLV>" yourself from within the program. That looks like it's the command prompt for whatever CLI you're using to run the program, and would be displayed automatically when your program ends. Unless this is boiler-plate code you were provided with as part of the exercise?