30 lines
408 B
NASM
Executable file
30 lines
408 B
NASM
Executable file
cs push \ copy code segment to data segment
|
|
ds pop
|
|
|
|
ax 0 # mov
|
|
\ print number
|
|
\ in: ax = number
|
|
\ clobbers: ax, bx, cx, dx
|
|
cx 10 # mov
|
|
bx bx xor
|
|
|
|
:> moredigits
|
|
bx inc
|
|
dx dx xor
|
|
cx div
|
|
dx push
|
|
ax 0 # cmp
|
|
moredigits jne
|
|
|
|
:> moredigits
|
|
dx pop
|
|
dl 48 # add
|
|
ax &h0200 # mov
|
|
&h21 int
|
|
bx dec
|
|
moredigits jne
|
|
|
|
0 .EXIT
|
|
|
|
cx 11 # mov
|