Draw clock face

This commit is contained in:
Juhani Krekelä 2022-03-11 22:17:59 +02:00
parent 4396f2935e
commit 05ebcea523
1 changed files with 43 additions and 0 deletions

View File

@ -4,6 +4,7 @@ bits 16
midpoint_x equ 160
midpoint_y equ 100
hour_hand_len equ 50
hour_hand_color equ 7
minute_hand_len equ 80
@ -11,6 +12,10 @@ minute_hand_color equ 7
second_hand_len equ 75
second_hand_color equ 4
face_notch_len equ 8
face_notch_distance equ 90
face_notch_color equ 47
section .code
setup:
@ -28,6 +33,44 @@ setup:
mov ax, 0xa000
mov es, ax
clockface:
xor bx, bx
.loop:
cmp bx, 360
je .done
mov word [line_sx], midpoint_x
mov word [line_sy], midpoint_y
mov word [line_ex], midpoint_x
mov word [line_ey], midpoint_y
mov ax, face_notch_distance
call sinx
add [line_sx], ax
mov ax, face_notch_distance
call cosx
sub [line_sy], ax
mov ax, face_notch_distance + face_notch_len
call sinx
add [line_ex], ax
mov ax, face_notch_distance + face_notch_len
call cosx
sub [line_ey], ax
push bx
mov bl, face_notch_color
call draw_line
pop bx
add bx, 15
jmp .loop
.done:
mainloop:
; Check keyboard
mov ah, 6