我正在尝试使用 kip irvine 库创建一个模拟闹钟,但我完全不知道如何实际放置时钟的刻度盘。
到目前为止,我已经制作了时钟的主体并设法获取系统时间并将其转换并将其放入相关变量中。我现在要做的是打印一个箭头来代表时针,然后根据当前时间将该箭头旋转一定程度。有什么方法可以旋转打印的箭头还是我尝试了不同的方法?
Include irvine32.inc
.model large ;define small model
.stack 100h
.data
var1 byte "1",0
dh_store byte ? ;stores dh in case dh gets overwritten
dl_store byte ? ;stores dl in case dl gets overwritten
hours_midnight dword ?
minutes dword ?
seconds dword ?
time dword ?
var2 dword 3600000
var3 dword 60000
var7 dword 1000
totalHours dword ?
var4 byte "10",0
var5 byte "11",0
var6 byte "12",0
.code
main proc
mov dh,9 ;move cursor to row 9 and column 20 and print numbers from 1 to 3 using loop l1
mov dl,20
mov ecx,3
l1:
call gotoxy
mov dh_store,dh
mov dl_store,dl
mov edx,offset var1
call writestring
mov dh,dh_store
mov dl,dl_store
inc dh
add dl,5
inc var1
loop l1
mov ecx,3
mov dh,12
mov dl,25
l2: ; loop l2 prints from 4 to 6
call gotoxy
mov dh_store,dh
mov dl_store,dl
mov edx,offset var1
call writestring
mov dh,dh_store
mov dl,dl_store
inc dh
sub dl,5
inc var1
loop l2
mov ecx,3
mov dh,13
mov dl,10
l3: ;l3 prints from 7 to 9
call gotoxy
mov dh_store,dh
mov dl_store,dl
mov edx,offset var1
call writestring
mov dh,dh_store
mov dl,dl_store
dec dh
sub dl,5
inc var1
loop l3
;printing 10,11 and 12 without ASCII because ASCII code ends at 9
mov dh,10
mov dl,5
call gotoxy
mov edx,offset var4
call writestring
mov dh,9
mov dl,10
call gotoxy
mov edx,offset var5
call writestring
mov dh,8
mov dl,15
call gotoxy
mov edx,offset var6
call writestring
mov dh,15
mov dl,0
call gotoxy
;time starts from here
call getmseconds
mov time,eax
mov edx,0
div var2 ;we are dividing the time since midnight by 3600000 to convert it into hours.
mov hours_midnight,eax
mov totalHours,hours_midnight
add totalHours,edx
mov eax,edx ;the remainder from previous division is stored in edx, we use the remainder to find minutes
mov edx,0
div var3
mov minutes,eax
call dumpregs
mov eax,edx;again we use the remainder to find seconds
mov edx,0
div var7
mov seconds,eax
call dumpregs
call waitmsg
Exit ;termination of program
main endp
end main