This commit is contained in:
gfdgd xi 2023-11-05 20:03:00 +08:00
parent c5ccbb8d6d
commit a3c54c48fe
4 changed files with 93 additions and 0 deletions

12
build.sh Executable file

@ -0,0 +1,12 @@
#!/bin/bash
#cd `dirname $0`
bin=$1
nasm -f bin $1 -o `basename $1`.bin
if [[ $? != 0 ]];then
exit
fi
sudo modprobe nbd 8
sudo qemu-nbd `dirname $0`/test.qcow2 --connect /dev/nbd0
sudo dd if=`basename $1`.bin of=/dev/nbd0
sudo qemu-nbd -d /dev/nbd0
kvm --hda `dirname $0`/test.qcow2 -rtc base=localtime

@ -74,6 +74,87 @@ showTailText:
mov al,[ds:si]
mov byte [es:di],al
loop showTailTextLoop
get_data:
mov di,80*2*25-2
; 读取秒
mov al,0x00
call read_time
mov byte [es:di-4],':'
mov byte [es:di-2],ah
mov byte [es:di],al
; 读取分钟
mov al,0x02
call read_time
mov byte [es:di-10],':'
mov byte [es:di-8],ah
mov byte [es:di-6],al
; 读取小时
mov al,0x04
call read_time
mov byte [es:di-14],ah
mov byte [es:di-12],al
; 读取日
mov al,0x07
call read_time
mov byte [es:di-22],'.'
mov byte [es:di-20],ah
mov byte [es:di-18],al
; 读取月
mov al,0x08
call read_time
mov byte [es:di-28],'.'
mov byte [es:di-26],ah
mov byte [es:di-24],al
; 读取年
mov al,0x09
call read_time
mov byte [es:di-32],ah
mov byte [es:di-30],al
mov cx,showTipsStr-tipsStr
sub di,30
mov ax,tipsStr
mov ds,ax
; 先跳过文本显示
jmp near showTipsStrEnd
; 显示提示文本
tipsStr: db 'Time:20'
showTipsStr:
mov di,cx
add di,showTipsStr+0x7c0
mov dl,[ds:di]
mov di,80*2*25-36
sub di,cx
mov byte [es:di],dl
loop showTipsStr
showTipsStrEnd:
jmp near get_data
read_time:
out 0x70,al
in al,0x71
call bcd_to_ascii
ret
; 用于编码转换BCD=》ASCII
; 输入AL=bcd码
; 输出AX=ascii
bcd_to_ascii:
mov ah,al
and al,0x0f
add al,0x30
shr ah,4
and ah,0x0f
add ah,0x30
ret
poweroff:
; 跳过关机

Binary file not shown.

BIN
test.qcow2 Normal file

Binary file not shown.