PrintFormatTimeEx function
The PrintFormatTimeEx function outputs a string containing formatted time, replacing the %h, %m, %s specifiers with the current hours, minutes and seconds. The string address is passed through the stack. The function automatically aligns the stack to 2 bytes.
Parameters (stack): 1. Pointer to the format string.
Return value: The function does not return a value.
Flag state: The function does not modify the flags.
Program source code
Intel 8086 assembly program example demonstrating the use of the PrintFormatTimeEx function to output formatted time.
title .286C .model small .stack 100h data segment public fmtstr db "Current time: [%h:%m:%s]\0" data ends code segment public assume ds:data, cs:code include Handyfar.inc ; Include the file with functions include Handymac.inc ; Include the file with macros main proc call SetDataSegment ; Call the SetDataSegment procedure pushs ds:[fmtstr] ; Push the address of variable fmtstr onto the stack call PrintFormatTimeEx ; Call procedure PrintFormatTimeEx(fmtstr) push 0 ; Push the byte return code onto the top of the stack call ExitProcessEx ; Call the ExitProcessEx(0) procedure main endp code ends end main
Current time: [20:32:41]
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".