兰陵月 发表于 2017-11-2 21:20:02

X86汇编语言-从实模式到保护模式—笔记(12)

本帖最后由 兰陵月 于 2017-12-5 21:55 编辑

第9章中断和动态时钟显示
例程理解学习

二、BIOS中断演示程序
         ;代码清单9-2
         ;文件名:c09_2.asm
         ;文件说明:用于演示BIOS中断的用户程序
         ;创建日期:2012-3-28 20:35

;===============================================================================
SECTION header vstart=0                     ;定义用户程序头部段
    program_lengthdd program_end          ;程序总长度

    ;用户程序入口点
    code_entry      dw start                ;偏移地址
                  dd section.code.start   ;段地址

    realloc_tbl_len dw (header_end-realloc_begin)/4
                                          ;段重定位表项个数

    realloc_begin:
    ;段重定位表
    code_segment    dd section.code.start   ;
    data_segment    dd section.data.start   ;
    stack_segment   dd section.stack.start;

header_end:

;===============================================================================
SECTION code align=16 vstart=0         ;定义代码段(16字节对齐)
start:
      mov ax,
      mov ss,ax
      mov sp,ss_pointer
      mov ax,
      mov ds,ax

      mov cx,msg_end-message
      mov bx,message

.putc:
      mov ah,0x0e
      mov al,
      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:
页: [1]
查看完整版本: X86汇编语言-从实模式到保护模式—笔记(12)