|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 兰陵月 于 2017-12-5 21:55 编辑
第9章 中断和动态时钟显示
例程理解学习
二、BIOS中断演示程序
- ;代码清单9-2
- ;文件名:c09_2.asm
- ;文件说明:用于演示BIOS中断的用户程序
- ;创建日期:2012-3-28 20:35
- ;===============================================================================
- SECTION header vstart=0 ;定义用户程序头部段
- program_length dd program_end ;程序总长度[0x00]
- ;用户程序入口点
- code_entry dw start ;偏移地址[0x04]
- dd section.code.start ;段地址[0x06]
- realloc_tbl_len dw (header_end-realloc_begin)/4
- ;段重定位表项个数[0x0a]
- realloc_begin:
- ;段重定位表
- code_segment dd section.code.start ;[0x0c]
- data_segment dd section.data.start ;[0x14]
- stack_segment dd section.stack.start ;[0x1c]
- header_end:
- ;===============================================================================
- SECTION code align=16 vstart=0 ;定义代码段(16字节对齐)
- start:
- mov ax,[stack_segment]
- mov ss,ax
- mov sp,ss_pointer
- mov ax,[data_segment]
- mov ds,ax
- mov cx,msg_end-message
- mov bx,message
- .putc:
- mov ah,0x0e
- mov al,[bx]
- int 0x10
- inc bx
- loop .putc
- .reps:
- mov ah,0x00
- int 0x16
- mov ah,0x0e
- mov bl,0x07
- int 0x10
- jmp .reps
- ;===============================================================================
- SECTION data align=16 vstart=0
- message db 'Hello, friend!',0x0d,0x0a
- db 'This simple procedure used to demonstrate '
- db 'the BIOS interrupt.',0x0d,0x0a
- db 'Please press the keys on the keyboard ->'
- msg_end:
- ;===============================================================================
- SECTION stack align=16 vstart=0
- resb 256
- ss_pointer:
- ;===============================================================================
- SECTION program_trail
- program_end:
复制代码
|
|