[BITS 16]
[org 0]
[section .text]

start:
	mov ax,cs
	mov ds,ax
	mov es,ax

	mov ah,03
	mov bh,0
	int 10h

	call _main

	jmp 0x1000:0

global _main
global _print
global _get_time_hours
global _get_time_min
global _get_time_sec
global _get_time_day
global _get_time_month
global _get_time_cent
global _get_time_year
global _tohex

[segment .text]

%include "io.asm"


%define _t -2

_main:
	push bp
	mov bp,sp
	sub sp,word 2
	push C0
	call _print
	add sp,word 2
	call _get_time_cent
	mov [bp+_t],ax
	push word [bp+_t]
	call _tohex
	add sp,word 2
	push C1
	call _print
	add sp,word 2
	call _get_time_year
	mov [bp+_t],ax
	push word [bp+_t]
	call _tohex
	add sp,word 2
	push C2
	call _print
	add sp,word 2
	call _get_time_month
	mov [bp+_t],ax
	push word [bp+_t]
	call _tohex
	add sp,word 2
	push C3
	call _print
	add sp,word 2
	call _get_time_day
	mov [bp+_t],ax
	push word [bp+_t]
	call _tohex
	add sp,word 2
	push C4
	call _print
	add sp,word 2
	call _get_time_hours
	mov [bp+_t],ax
	push word [bp+_t]
	call _tohex
	add sp,word 2
	push C5
	call _print
	add sp,word 2
	call _get_time_min
	mov [bp+_t],ax
	push word [bp+_t]
	call _tohex
	add sp,word 2
	push C6
	call _print
	add sp,word 2
	call _get_time_sec
	mov [bp+_t],ax
	push word [bp+_t]
	call _tohex
	add sp,word 2
	mov ax,word 0
	leave
	ret
%undef _t



[section .data]

C0: db 'CENTURY: ',0
C1: db 'YEAR: ',0
C2: db 'MONTH: ',0
C3: db 'DAY: ',0
C4: db 'HOUR: ',0
C5: db 'MINUTE: ',0
C6: db 'SECOND: ',0

[section .bss]

answer: resb 20
_t_buffer: resb 1
