1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/vm/in/MISC

175 lines
3.2 KiB
Plaintext
Raw Normal View History

2019-06-23 12:40:18 +02:00
# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
2019-07-17 20:26:03 +02:00
#---------------------------------------------------------------------------#
# Debugging instructions #
#---------------------------------------------------------------------------#
#
# Breakpoint instruction (BREAK)
#
# (cause register dump on standard error)
# (wait for user input before proceeeding)
#
break
#
# Enable/disable instruction dumping (DUMP)
#
# IF $1 == 0 THEN
# (disable instruction dumping)
# ELSE
# (enable instruction dumping)
# FI
#
dump ri
2019-06-23 12:40:18 +02:00
#---------------------------------------------------------------------------#
# Misc. instructions #
#---------------------------------------------------------------------------#
#
# Do nothing (NOOP)
#
# (nothing)
#
# Throws:
# (nothing)
#
# Preserves all flags
#
nop
#
# Pause the CPU for a very short amount of time (PAUSE)
# Used in spin-like loops
#
pause
#
# Pause the CPU for a relatively long time (XPAUSE)
#
# Throws:
# #SYS if not in supervisor mode
#
xpause
#
# Get timestamp in seconds
#
2019-07-04 20:33:49 +02:00
time r
2019-06-23 12:40:18 +02:00
2019-07-11 18:34:21 +02:00
#
# $1 = seconds since start of month
# $2 = current month
# $3 = current year
#
ytime r r r
2019-06-23 12:40:18 +02:00
#
# Get timestamp in µseconds
#
2019-07-04 20:33:49 +02:00
utime r
2019-06-23 12:40:18 +02:00
#
# CPU Identification Number
#
# Does nothing (for now)
#
cpuid
#---------------------------------------------------------------------------#
# Clean-up misc. instructions #
#---------------------------------------------------------------------------#
#
2019-07-10 17:17:45 +02:00
# Clear all GPR registers except RBP/RSP
2019-06-23 12:40:18 +02:00
#
2019-07-10 17:17:45 +02:00
cls
#
# Clear base registers except RBP/RSP (CLR)
2019-06-23 12:40:18 +02:00
#
clr
#
# Clear argument registers (CLA)
#
cla
2019-07-10 17:17:45 +02:00
#
# Clear nonvolatile registers (CLN)
#
cln
2019-07-17 20:26:03 +02:00
#---------------------------------------------------------------------------#
# Flag manipulation instructions #
#---------------------------------------------------------------------------#
#
# Clear or set interrupt flag (CLI/STI)
#
# Throws:
# #SYS if not in supervisor mode
#
cli
sti
#
# Clear or set direction flag (CLD/STD)
#
cld
std
#
# Complement, clear or set carry flag (CMC/CLC/STC)
#
cmc
clc
stc
2019-06-23 12:40:18 +02:00
#---------------------------------------------------------------------------#
# Byte-wise / bit-wise manipulation instructions #
#---------------------------------------------------------------------------#
#
# Byte/word/dword swap (xSWAP)
#
# Change endianness
#
2019-07-04 20:33:49 +02:00
bswap r r
wswap r r
dswap r r
2019-06-23 12:40:18 +02:00
2019-07-17 20:26:03 +02:00
#---------------------------------------------------------------------------#
# I/O instructions #
#---------------------------------------------------------------------------#
#
# Send a character to standard output (PRN)
#
prn rim
#
# Print a string to standard output (PRN)
#
# COMPARE([%1], 0)
#
# IF (ZF == 0) THEN
# PRN([%1])
# IF (DF == 0) THEN
# %1 = %1 + 1
# ELSE
# %1 = %1 - 1
# FI
# FI
#
#
prns r
#
# Scan a character from standard input (SCAN)
#
scan r