China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-26 22:02
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Assembly language compiler usage 2 View 2,266 Replies 10
Original Poster Posted 2010-04-06 21:33 ·  中国 陕西 西安 电信
初级用户
Credits 88
Posts 32
Joined 2010-03-27 14:30
16-year member
UID 163163
Gender Male
Status Offline
The title is to transfer the data in buff1 to buff2. The source program is as follows:

DSEG SEGMENT
buff1 db 0,1,2,3,4,5,6,7,8,9,
db 11,12,13,14,15,16,17,18,19,20
buff2 db 20 dup(?)

DSEG ENDS


CSEG SEGMENT
assume cs:CSEG, ds:DSEG



MAIN PROC FAR ;Main program entry

mov ax, dseg
mov ds, ax
mov ax,eseg
mov es, ax
mov cx,20
lea si,buff1
lea di,buff2
cycle:mov al,
mov ,al
inc si
inc di
loop cycle
mov ax, 4c00h ;Program ends, return to the operating system
int 21h
MAIN ENDP

CSEG ENDS

END MAIN
After compilation
The following error occurs
Unable to open input file: transformdata.asm
Experts, please give guidance
Floor 2 Posted 2010-04-07 11:59 ·  中国 黑龙江 哈尔滨 联通
高级用户
★★
苏醒的沉睡者
Credits 659
Posts 217
Joined 2003-02-15 00:00
23-year member
UID 930
Gender Male
From 福建
Status Offline
The English means: Cannot open input file: transformdata.asm
好久没碰Dos,手都生了,赶紧回来练练.嘿嘿
Floor 3 Posted 2010-04-07 12:17 ·  中国 黑龙江 哈尔滨 联通
高级用户
★★
苏醒的沉睡者
Credits 659
Posts 217
Joined 2003-02-15 00:00
23-year member
UID 930
Gender Male
From 福建
Status Offline
I used MASM 5.0 to compile, and it prompted a.asm(2): warning A4101: Missing data; zero assumed

And where is eseg in the 18th line of the code.. mov ax,eseg?
好久没碰Dos,手都生了,赶紧回来练练.嘿嘿
Floor 4 Posted 2010-04-07 20:56 ·  中国 陕西 西安 电信
初级用户
Credits 88
Posts 32
Joined 2010-03-27 14:30
16-year member
UID 163163
Gender Male
Status Offline
Is this format correct? I wrote it like this because it's like that in the book, and when entering tables, it's also written like that in the book. Is it that some versions of MASM don't support it?
Floor 5 Posted 2010-04-08 09:12 ·  中国 江苏 苏州 电信
银牌会员
★★★
Credits 2,227
Posts 790
Joined 2005-01-27 00:00
21-year member
UID 35703
Gender Male
Status Offline
As pointed out by building 3, there are 2 errors. Correspondingly, remove the comma at the end of line buff1 and change eseg to dseg. "Cannot open input file: transformdata.asm" indicates that the filename of your source program should not be transformdata.asm, that is, rename it to transformdata.asm, and it will be okay.
my major is english----my love is dos----my teacher is the buddha----my friends--how about U
Floor 6 Posted 2010-04-08 12:12 ·  中国 黑龙江 哈尔滨 教育网
高级用户
★★
苏醒的沉睡者
Credits 659
Posts 217
Joined 2003-02-15 00:00
23-year member
UID 930
Gender Male
From 福建
Status Offline
The original error was at the end, the problem... I didn't notice this.
好久没碰Dos,手都生了,赶紧回来练练.嘿嘿
Floor 7 Posted 2010-04-08 21:46 ·  中国 陕西 西安 电信
初级用户
Credits 88
Posts 32
Joined 2010-03-27 14:30
16-year member
UID 163163
Gender Male
Status Offline
Many thanks
Floor 8 Posted 2010-04-20 20:50 ·  中国 黑龙江 伊春 联通
新手上路
Credits 10
Posts 5
Joined 2010-04-14 16:45
16-year member
UID 164593
Gender Male
Status Offline
Floor 9 Posted 2010-04-24 22:02 ·  中国 陕西 西安 电信
初级用户
Credits 88
Posts 32
Joined 2010-03-27 14:30
16-year member
UID 163163
Gender Male
Status Offline
Are you also learning assembly?
Floor 10 Posted 2010-04-25 11:27 ·  中国 黑龙江 哈尔滨 联通
高级用户
★★
苏醒的沉睡者
Credits 659
Posts 217
Joined 2003-02-15 00:00
23-year member
UID 930
Gender Male
From 福建
Status Offline
chrise, why are there no new questions recently... I'm not used to it.
好久没碰Dos,手都生了,赶紧回来练练.嘿嘿
Floor 11 Posted 2010-06-30 16:01 ·  中国 福建 厦门 电信
高级用户
★★★
Credits 741
Posts 366
Joined 2007-07-25 19:11
18-year member
UID 94024
Gender Male
Status Offline
Will it be better to write like this? Moreover, it is not easy to have problems when modifying the data.
DSEG  SEGMENT
buff1 db 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20
datalen equ $-buff1; It is better to use common pseudo-instructions to make the program easier to modify.
buff2 db datalen dup(?)
DSEG ENDS
CSEG SEGMENT
assume cs:CSEG,ds:DSEG
MAIN PROC FAR; Main program entry
mov ax,seg DSEG
mov ds,ax
mov es,ax
cld
mov si,offset buff1
mov di,offset buff2
mov cx,datalen
rep movsb; String COPY operation is frequently used in software, so the smaller the loop body, the better.
mov ax,4c00h; Program ends and returns to the operating system
int 21h
MAIN ENDP
CSEG ENDS
END MAIN


[ Last edited by netwinxp on 2010-7-6 at 19:39 ]
Forum Jump: