学习汇编(14)-系统启动程序

学习汇编(14)-系统启动程序

这个程序用于是程序启动后显示系统时间,但是显示的不对,请大虾帮忙看看
这是这段代码运行效果,显示的年月日都变成秒了

学习汇编(14)-系统启动程序_第1张图片
assume cs:code
code Segment
start:
   cli ;避免在设置堆栈时中断
   mov ax,0             ;mov ax,cs
   mov ss,ax
   mov sp,7c00h
   sti
   mov ax,0
   mov es,ax   ;要读的内存基址
   mov bx,800h ;要读的内存偏移
   
   mov ah,2   ;功能号,读
   mov al,3   ;读三个扇区
   mov ch,0   ;磁道号
   mov cl,2   ;扇区号
   mov dl,0   ;驱动器号
   mov dh,0   ;磁头号(面)
   int 13h   
   
   ;置CS,IP
   mov ax,0
   mov bx,800h
   push ax
   push bx
   retf
   ;凑足一个扇区,主要满足int 19 对'55AA'标志的要求
   db 469 dup('A')
   db 85,170 ;55AA

T:jmp RealPrograme
data db 9,8,7,4,2,0
db '// :: '
RealPrograme:     
      mov ax,cs
      mov ds,ax
      mov si,offset data
      mov di,0
      mov cx,6
s:   
      push cx
      mov al,ds:[si]
      out 70h,al
      in al,71h
      mov ah,al
      mov cl,4
      shr ah,cl
      and al,00001111b
      add ah,30h
      add al,30h
      mov dl,71h
      mov bx,0b800h
      mov es,bx
      mov byte ptr es:[di].[160*12+40*2],ah
      mov byte ptr es:[di].[160*12+40*2+1],dl
      add di,2
      mov byte ptr es:[di].[160*12+40*2],al
      mov byte ptr es:[di].[160*12+40*2+1],dl
      ;inc si
      add di,2
      mov al,ds:[si].[6]
      mov byte ptr es:[di].[160*12+40*2],al
      mov byte ptr es:[di].[160*12+40*2+1],dl
      add di,2
      inc si
      pop cx   
      loop s
   jmp RealPrograme
code ends
end start


 

你可能感兴趣的:(学习汇编(14)-系统启动程序)