遊客:  註冊 | 登錄 | 幫助





標題: [求助] Somebody know Assembly language?
  yoman2046     Rank: 2Rank: 2
藍之初
性別 男
UID 6164

精華 0
帖子 2
積分 100   詳情

閱讀權限 30
註冊 2006-8-13
來自
狀態 離線

 
 
 
 
發表於 2006-8-28 05:09 PM  資料  個人空間  短訊  加為好友 
Somebody know Assembly language?

Is somebody know who to write a assembler program. I need to read a character from the keyboard and display it at the beginning of the next line.

頂部

mickeyGoUp     Rank: 7Rank: 7Rank: 7
版主
性別 男
UID 5

精華 0
帖子 35511
積分 5235   詳情

閱讀權限 150
註冊 2006-3-24
來自 美國滴滴尼
狀態 離線

 
 
 
 
發表於 2006-8-29 12:05 AM  資料  個人空間  短訊  加為好友 
Although I am not familiar with assembler, I found the following codes for you.  Let me know if that helps.

.model small
.stack 100h
.code
start:

; read character from keyboard
mov ah, 1h ; keyboard input subprogram
int 21h ; read character into al

; save character while we display a Return and Line-feed
mov bl, al ; save character in bl

;display Return
mov dl, 13d ; dl = CR
mov ah, 2h ; display subprogram
int 21h ; display CR

;display Line-feed
mov dl, 10d ; dl = LF
mov ah, 2h ; display subprogram
int 21h ; display LF

; display character read from keyboard
mov dl, bl ; copy character to dl
mov ah, 2h ; display subprogram
int 21h ; display character in dl

mov ax, 4c00h ; return to ms-dos
int 21h
end start


頂部



  yoman2046     Rank: 2Rank: 2
藍之初
性別 男
UID 6164

精華 0
帖子 2
積分 100   詳情

閱讀權限 30
註冊 2006-8-13
來自
狀態 離線

 
 
 
 
發表於 2006-8-29 03:31 PM  資料  個人空間  短訊  加為好友 
good
Thank you so much, it really help me, how can you do that? Are you study CS?

頂部

mickeyGoUp     Rank: 7Rank: 7Rank: 7
版主
性別 男
UID 5

精華 0
帖子 35511
積分 5235   詳情

閱讀權限 150
註冊 2006-3-24
來自 美國滴滴尼
狀態 離線

 
 
 
 
發表於 2006-8-29 07:06 PM  資料  個人空間  短訊  加為好友 
You are welcome.    I am glad that it helped.  I just found it from the web.  But yes, I am a CS major.  How about you?  

頂部

  newbie     Rank: 2Rank: 2
藍之初
性別 保密
UID 10176

精華 0
帖子 13
積分 121   詳情

閱讀權限 30
註冊 2006-8-30
來自 USA
狀態 離線

 
 
 
 
發表於 2006-9-16 01:19 AM  資料  個人空間  短訊  加為好友 


QUOTE:
原帖由 mickeyGoUp 於 2006-8-29 12:05 AM 發表
Although I am not familiar with assembler, I found the following codes for you.  Let me know if that helps.


.model small
.stack 100h
.code
start:

; read character from keyboard
mov ah,  ...

This is a good example but not sure if it still works in WinXP world. Instead doing int calls, you may need to change them to system calls.

頂部

  CoolQQ     Rank: 3
青出藍
性別 保密
UID 301

精華 0
帖子 247
積分 474   詳情

閱讀權限 40
註冊 2006-6-28
來自
狀態 離線

 
 
 
 
發表於 2007-1-21 05:41 PM  資料  個人空間  短訊  加為好友 
I have written a program with assembly lang before

i used:
MOV AH,0       
INT 16

sometimes INT 21 won't work in some case
i feel this one works fine.

for display:
MOV AH, 09
INT 21

頂部

快速美言
           


當前時區 GMT+8, 現在時間是 2024-5-6 07:46 AM

    Powered by Discuz!  © 2001-2007 Comsenz Inc.   
Processed in 0.016194 second(s), 7 queries

清除 Cookies - 聯繫我們 - LIPS Corner 新天藍 - Archiver