1.实验步骤5
通过Linux下NASM验证16位DOS平台的信息显示程序(教材例8-1),编写为完整程序exp8_3.s,并运行正确。
(1)在ZZUMASH文件夹中创建exp8_3.s,编写下方代码
%include "io16.inc"
section .data
msg db "Hello,Assembly!",13,10,0
section .code
..start:
mov ax,data
mov ds,ax
mov eax,offset msg
call dispmsg
exit 0
(2)在ZZUMASM文件下打开终端,汇编.obj文件: nasm -f obj -o exp8_3.obj ./exp8_3.s
(3)打开dosbox文件:
(4) 依次输入下方的代码:
mount c: /headless/Desktop/ZZUassembly/ZZUMASM
c:
bin\link16
(5)j接下来注意:输入对应的.obj文件
用到子程序的文件,需要在这加上io16.lib
以下步骤只提供代码,不复述上述内容
2.实验步骤6:
编写教材习题8.6所要求的程序,将编写好的程序命名为exp8_4.s,并运行正确。
org 100h
section .data
prompt db "Press ESC to Exit", 13, 10, '$'
section .text
start:
mov ax, cs
mov ds, ax
mov dx, prompt
mov ah, 09h
int 21h
wait_for_key:
mov ah, 01h
int 21h
cmp al, 1Bh
je exit_program
jmp wait_for_key
exit_program:
mov ax, 4C00h
int 21h
3.实验步骤7:
通过Linux下NASM验证16位DOS平台的信息显示程序(教材例8-2),编写为完整程序exp8_5.s,并运行正确。
.model small
.stack
.data
msg db 'Hello,Assembly!',13,19,'$'
.code
start:
mov ax,@data
mov ds,ax
mov ah,9
mov dx,offset msg
int 21h
mov ax,4c00h
int 21h
end start
4.实验步骤8:
参考读取CMOS RAM数据程序(教材例8-7),编写完整显示时间的程序(教材习题8.14),将编写好的程序命名为exp8_6.s,并运行正确。
输出格式:25-05-18-Sunday-14-14-14(仅供参考格式)
注意:
1、星期X需要显示为对应的英文单词
2、输出的时间为Linux系统实时时间(可在页面右上角查看,用来与运行结果核对),与电脑时间不一致。
%include "io16.inc"
section .data
days db "Sunday Monday Tuesday WednesdayThursday Friday Saturday "
section .text
..start:
mov al, 7
out 70h, al
in al, 71h
call disphb
mov al, '-'
call dispc
mov al, 8
out 70h, al
in al, 71h
call disphb
mov al, '-'
call dispc
mov al, 9
out 70h, al
in al, 71h
call disphb
mov al, '-'
call dispc
mov al, 6
out 70h, al
in al, 71h
and al, 0Fh
mov bl, 9
mul bl
mov si, days
add si, ax
mov cx, 9
print_day:
mov al, [si]
call dispc
inc si
loop print_day
mov al, '-'
call dispc
mov al, 4
out 70h, al
in al, 71h
call disphb
mov al, '-'
call dispc
mov al, 2
out 70h, al
in al, 71h
call disphb
mov al, '-'
call dispc
mov al, 0
out 70h, al
in al, 71h
call disphb
exit 0