80x86 語言程式高手請近~ 求問 - 第2頁 - PCZONE 討論區

返回   PCZONE 討論區 > ▲ -- 網 路 生 活 分 享 區 > -- 閒 話 家 常 灌 水 版


PCZONE 討論區



通知

-- 閒 話 家 常 灌 水 版 上 面 那 些 硬 梆 梆 的 專 業 話 題 插 不 上 話 ?? 那 就 來 這 邊 就 你 周 遭 網 路 上 或 生 活 上 的 話 題 來 哈 拉 一 下

散人

一點建議,最好對那個組合語言的CPU硬體架構也要有個瞭解會比較好運用。
否則會丈二金剛摸不著頭的感覺。

回覆
風来坊

引用:
最初由 TonyYang 發表
小弟以前在學X86語言的時候做的,雖然跟要求的不同,不過類似
希望釧甡飢U
語法:
	.MODEL	SMALL
	.CODE
BEGIN:
	MOV AH, 01H	;鍵盤字元輸入
	INT 21H

	MOV DL, AL        ;把剛輸入的字元送到DL,準備輸出該字元
	MOV AH, 02H	;字元輸出於螢幕上
	INT 21H

	MOV AH, 4CH	;程式結束
	INT 21H
	.STACK
	END BEGIN
原本小弟寫組語一動到鍵盤就會比較頭痛
因為要去處理interrupt
還有字串及字元的處理方法也不盡相同
不過後來老師改用了這本書就方便多了
Assembly Language for Intel-Based Computers (4th Edition)
by Kip R. Irvine

裡頭有附一個Irvine.inc的檔案
在寫組語時可以include進來後
你要處理input或output時
直接用書上寫的指令函式就可以了
像是:
ReadChar
WriteChar
ReadString
WriteString
裡頭也有提供相關函式處理後
要去動哪個register才能找得到資料之類的
有興趣的話
可以買來看看
小弟覺得這本組語原文書蠻不錯的說!
目前全華圖書也有出中譯本了
不過小弟還是建議買原文書啦!
回覆
會員

The following code is just giving you an ideal how to use the program

and modify it to fit your needs.check the


int 21h, there are at lease more than 100 instructions ( ah = xx , int 21h) you can use to get a char or a string from the key board and output the data to screen.


PS : this is the program I wrote in the past. you have to modify it to fit your needs.


page 60,132
title program
big macro num1,num2
sub ax,ax
sub dx,dx
mov al,num1
mov dl,num2
.if al >= dl
mov temp,al
.else mov temp,dl
.endif
endm
print macro
mov ah,09h
int 21h
endm
prtch macro
mov ah,02h
int 21h
endm

.model small
.stack 64
.data
data db 0ah
x db ?
y db ?
msg1 db 'Please enter two numbers from 0 to 9',0ah,0dh,'$'
msg2 db 'Please enter the second number',0ah,0dh,'$'
msg3 db ' ',0ah,0dh,'$'
temp db ?
msg4 db 'The biggest number is ',0ah,0dh,'$'
.code
main proc near
mov ax,@data
mov ds,ax
sub ax,ax
sub cx,cx
lea dx,msg1
print
mov ah,01
int 21h
mov x,al
lea dx,msg3
print
lea dx,msg2
print
mov ah,01
int 21h
mov y,al
big x,y
mov dl,temp
prtch
mov ah,4ch
int 21h
main endp
end main
回覆
會員

請問那個是?????????
回覆
會員

請問如果要改成題目原意~
要怎樣改才正確呢???
勞請指教



((這是我自己要問的))
回覆
會員

我也是用第四英文版的書
回覆
會員

好像大家都有學過齁~
好好喔~
不像我~連改都不會改~

回覆


類似的主題
主題 主題作者 討論版 回覆 最後發表
問題大總合!!!!! [求問] 聰明的豬 -- 閒 話 家 常 灌 水 版 1 2003-09-18 12:32 AM
求問..WIN ME架設區域網路 DNAX -- 網 路 硬 體 版 2 2001-10-28 08:10 AM






 XML   RSS 2.0   RSS 
本站使用 vBulletin 合法版權程式
站務信箱 : [email protected]

本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。