;1.输入
;2.查表
;3.输出
data segment para 'data'
msg1 db 'stock number?', 13, 10, '$'
msg2 db 'Not in table', '$'
stoknin label byte
max db 3
actual db ?
stokn db 3 dup(?)
stoktab db '05',' Excavators '
db '08',' Lifters ' ;以空格补齐
db '09',' Presses '
db '12',' Valves '
db ...

[2011-06-18 22:29] 表格查找
阅读全文 |
评论次数(0) |
浏览次数(442) |
所属类型(asm)
[2011-05-27 12:36] 将变量VAR(无符号字类型)中的二进制数转换成十进制数,并送屏幕显示
sta segment stack
dw 8 dup(?)
sta ends
data segment
var dw 8086h
weight dw 10000, 1000, 100, 10, 1
flag db 0
data ends
code segment
assume cs:code, ds:data
begin: mov ax, data
mov ds, ax
mov ax, sta
mov ss, ax
mov cx, 5
;si --> weight
lea si, weight
mov ax, var
;Unsig...
dw 8 dup(?)
sta ends
data segment
var dw 8086h
weight dw 10000, 1000, 100, 10, 1
flag db 0
data ends
code segment
assume cs:code, ds:data
begin: mov ax, data
mov ds, ax
mov ax, sta
mov ss, ax
mov cx, 5
;si --> weight
lea si, weight
mov ax, var
;Unsig...
阅读全文 |
评论次数(0) |
浏览次数(446) |
所属类型(asm)
[2011-05-23 20:23] 通过堆栈传递参数
dat segment
arr db 40,29,98,76
cnt equ $ - arr
result dw ?
dat ends
std segment
dw 20 dup(?)
top label word
std ends
cod segment
assume cs:cod, ds:dat, ss:std
begin:
mov ax, dat
mov ds, ax
mov ax, std
mov ss, ax
mov sp, offset top
mov ax, offset arr
push ax ...
arr db 40,29,98,76
cnt equ $ - arr
result dw ?
dat ends
std segment
dw 20 dup(?)
top label word
std ends
cod segment
assume cs:cod, ds:dat, ss:std
begin:
mov ax, dat
mov ds, ax
mov ax, std
mov ss, ax
mov sp, offset top
mov ax, offset arr
push ax ...
阅读全文 |
评论次数(0) |
浏览次数(439) |
所属类型(asm)
[2011-05-19 14:30] 关于int 10h的功能调用02h, 07h
;##################################################
;window.asm
;为什么不加段的连接方式public时,link时必须将cls.asm
;放在后面即:link window.obj cls.obj?
;而加上public之后,link cls.obj window.obj就可以了呢?
;不解 ;(
code segment public
assume cs:code
extrn clear_screen:far
begin:
Esc_key equ 27
win_lr equ 8 ;左上角,行 ...
;window.asm
;为什么不加段的连接方式public时,link时必须将cls.asm
;放在后面即:link window.obj cls.obj?
;而加上public之后,link cls.obj window.obj就可以了呢?
;不解 ;(
code segment public
assume cs:code
extrn clear_screen:far
begin:
Esc_key equ 27
win_lr equ 8 ;左上角,行 ...
阅读全文 |
评论次数(0) |
浏览次数(444) |
所属类型(asm)
[2011-05-10 21:21] disp + crlf --> common.asm
code segment
assume cs:code, ds:code
public disp, crlf
;-----------------disp函数------
disp proc near
push ax ;入栈,保护现场
mov ah, 9
int 21h
pop ax ;出栈,恢复现场
ret
disp endp
;----------------crlf回车换行函数------
crlf proc near
push dx ;入栈,保护现场
push ax
mov ah, 2...
assume cs:code, ds:code
public disp, crlf
;-----------------disp函数------
disp proc near
push ax ;入栈,保护现场
mov ah, 9
int 21h
pop ax ;出栈,恢复现场
ret
disp endp
;----------------crlf回车换行函数------
crlf proc near
push dx ;入栈,保护现场
push ax
mov ah, 2...
阅读全文 |
评论次数(0) |
浏览次数(395) |
所属类型(asm)
[2011-05-10 19:54] 统计数据块正负数的个数
data segment
Default db '0', '1', '2', '3'
db 30h, -1, -2, -3
db 4 dup(?)
;------------输入提示信息------
Inmsg1 db "Please enter the quantity of the data "
db "You'd like to input. At most 9 items : $"
Inmsg2 db "There are some default integers in the data segment. "
db "And they are : $"
...
Default db '0', '1', '2', '3'
db 30h, -1, -2, -3
db 4 dup(?)
;------------输入提示信息------
Inmsg1 db "Please enter the quantity of the data "
db "You'd like to input. At most 9 items : $"
Inmsg2 db "There are some default integers in the data segment. "
db "And they are : $"
...
阅读全文 |
评论次数(0) |
浏览次数(411) |
所属类型(asm)
[2011-05-09 19:50] 功能调用 0Bh, 2ah, 2bh, 2ch, 2dh
;-------------------------------------------------------------------
; Function 0bh: 检查标准输入状态,但并不取走字符
; 2ah: Get date 出口参数:CX:DX = 日期 AL = 星期几
; 2bh: Set date 入口参数:CX:DX = 日期 出口参数:AL=00 成功 AL=FF失败
; 2ch: Get time 出口参数:CX:DX = 时间
; 2dh: set time 入口参数:CX:DX = 时间 出口参数:AL=00 成功 AL=FF失败
;--...
; Function 0bh: 检查标准输入状态,但并不取走字符
; 2ah: Get date 出口参数:CX:DX = 日期 AL = 星期几
; 2bh: Set date 入口参数:CX:DX = 日期 出口参数:AL=00 成功 AL=FF失败
; 2ch: Get time 出口参数:CX:DX = 时间
; 2dh: set time 入口参数:CX:DX = 时间 出口参数:AL=00 成功 AL=FF失败
;--...
阅读全文 |
评论次数(0) |
浏览次数(588) |
所属类型(asm)
[2011-04-26 10:34] 功能调用 0ah
;------------------------------------------------
; function 0Ah: 入口参数:DS:DX(存放缓存区开始地址)
; 将键盘输入字符顺序存入缓存区开始地址+2处,
; 输入回车符时返回。输入时,可以像输入命令行那样,
; 使用修改功能。当输入字符填满缓冲区的倒数第二字节时,
; 之后输入的字符被忽略。当输入BEL(07H)时,此码被送到
; 标准输出设备,直到输入 回车为止。
; 使用修改功能时,输入缓冲区指针可以返回,允许输入修改的
; 新内容。并且不会破坏缓冲区原有内容
;
;------...
; function 0Ah: 入口参数:DS:DX(存放缓存区开始地址)
; 将键盘输入字符顺序存入缓存区开始地址+2处,
; 输入回车符时返回。输入时,可以像输入命令行那样,
; 使用修改功能。当输入字符填满缓冲区的倒数第二字节时,
; 之后输入的字符被忽略。当输入BEL(07H)时,此码被送到
; 标准输出设备,直到输入 回车为止。
; 使用修改功能时,输入缓冲区指针可以返回,允许输入修改的
; 新内容。并且不会破坏缓冲区原有内容
;
;------...
阅读全文 |
评论次数(0) |
浏览次数(422) |
所属类型(asm)
[2011-04-25 19:12] dump.asm
;----------------------------------------------------------
; Dump CX bytes from DS:BX
;----------------------------------------------------------
cseg segment
assume cs:cseg, ds:cseg
public dump, hexout, crlfout,putch
;----------------------- dump -------------------------- ...
; Dump CX bytes from DS:BX
;----------------------------------------------------------
cseg segment
assume cs:cseg, ds:cseg
public dump, hexout, crlfout,putch
;----------------------- dump -------------------------- ...
阅读全文 |
评论次数(0) |
浏览次数(469) |
所属类型(asm)
[2011-04-25 19:11] 功能调用 07h, 08 h, 09h
;--------------------------------------------------------------;
;
; function 07h: Direct Console Input(无回显,不检查CTRL-C)
; 08h: Read From Keyboard (无回显,输入CTRL-C时,调用int 23h)
; 09h: Display String (不输出 '$'.输入CTRL-C时,调用int 23h)
;
;--------------------------------------------------------------; ...
;
; function 07h: Direct Console Input(无回显,不检查CTRL-C)
; 08h: Read From Keyboard (无回显,输入CTRL-C时,调用int 23h)
; 09h: Display String (不输出 '$'.输入CTRL-C时,调用int 23h)
;
;--------------------------------------------------------------; ...
阅读全文 |
评论次数(0) |
浏览次数(493) |
所属类型(asm)
『 查看更多文章 』