hi, there
today, I use nasm write a dos programme, nasm + (ms)link5.0
but there is something wrong, example is here:
[bits 16]
segment data
BUF: db 45, 61, 70, 86, 75, 100, 69, 88, 81
n equ $ - BUF
RESULT: resb 2
[bits 16]
segment stack
st resb 100
[bits 16]
segment code
..start:
mov ax, stack
mov ss, ax
mov sp, 100
mov ax, data
mov ds, ax
mov cx, n
mov si, BUF
mov di, RESULT
mov ah, 0
mov bh, 0
.0:
mov al, [si]
cmp al, 60
jb .1
inc ah
jmp .2
.1:
inc bh
.2:
inc si
dec cx
cmp cx, 0
jz .exit
jnz .0
mov [di], ah
mov [di+1], bh
.exit:
mov ax, 0x4c00
int 0x21
simple, but when i use debug.exe run it, result is here
-r
AX=0000 BX=0000 CX=00AA DX=0000 SP=0000 BP=0000 SI=0000 DI=0000
DS=14A1 ES=14A1 SS=14B1 CS=14B7 IP=000F NV UP EI PL NZ NA PO NC
14B7:000F B8B114 MOV AX,14B1
-t
AX=14B1 BX=0000 CX=00AA DX=0000 SP=0000 BP=0000 SI=0000 DI=0000
DS=14A1 ES=14A1 SS=14B1 CS=14B7 IP=0012 NV UP EI PL NZ NA PO NC
14B7:0012 8ED0 MOV SS,AX
-t
AX=14B1 BX=0000 CX=00AA DX=0000 SP=0064 BP=0000 SI=0000 DI=0000
DS=14A1 ES=14A1 SS=14B1 CS=14B7 IP=0017 NV UP EI PL NZ NA PO NC
14B7:0017 B8B114 MOV AX,14B1
-t
AX=14B1 BX=0000 CX=00AA DX=0000 SP=0064 BP=0000 SI=0000 DI=0000
DS=14A1 ES=14A1 SS=14B1 CS=14B7 IP=001A NV UP EI PL NZ NA PO NC
14B7:001A 8ED8 MOV DS,AX
ds equal es
but as we know
code is :
mov ax, stack
mov ss, ax
mov sp, 100
mov ax, data
what's wrong ??
welcome to talk to me.