Skip to content

Commit

Permalink
Use new sleep instruction in clock example
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed Jun 1, 2024
1 parent 04149fe commit 3fe2a03
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
5 changes: 1 addition & 4 deletions Example Programs/C# Interop/Clock.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ASMX_LDA :ASSEMBLY_NAME

:CLOCK_LOOP
CallExternalFunction(:CLOCK_METHOD_NAME, :&DATETIME_FORMAT)
CallExternalFunction(:SLEEP_METHOD_NAME, 500) ; 500ms/0.5s
EXTD_SLP 500 ; 500ms/0.5s

WCC '\r' ; Return to start of line

Expand All @@ -26,9 +26,6 @@ JMP :CLOCK_LOOP
:CLOCK_METHOD_NAME
%DAT "PrintFormattedDateTime\0"

:SLEEP_METHOD_NAME
%DAT "Sleep\0"

:DATETIME_FORMAT
%DAT "yyyy-MM-dd HH:mm:ss\0"

Expand Down
9 changes: 0 additions & 9 deletions Example Programs/C# Interop/Clock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,4 @@ public static void PrintFormattedDateTime(byte[] memory, ulong[] registers, ulon
string format = GetStringFromMemory(memory, passedValue.Value);
Console.Write(DateTime.Now.ToString(format, System.Globalization.CultureInfo.InvariantCulture));
}

public static void Sleep(byte[] memory, ulong[] registers, ulong? passedValue)
{
if (passedValue is null)
{
throw new ArgumentException("This method requires a number of milliseconds to sleep");
}
System.Threading.Thread.Sleep((int)passedValue);
}
}

0 comments on commit 3fe2a03

Please sign in to comment.