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/STRING
julianb0 89ed8fdc0d
vm
2019-08-03 17:41:44 +02:00

52 lines
1.2 KiB
Plaintext

# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
#---------------------------------------------------------------------------#
# String manipulation instructions #
#---------------------------------------------------------------------------#
#
# Store value into string (STOSx)
#
# [%1] = $2
# IF (DF == 0) THEN
# %str = %str + sizeof(x)
# ELSE
# %str = %str - sizeof(x)
# FI
#
stosb 2
stosw 2
stosd 2
stosq 2
#
# Scan string for a particular value (SCASx)
#
# CMP([%1], $2)
#
# IF ([%1] == 0) THEN
# ZF = 1
# ELIF (ZF == 0) THEN
# IF (DF == 0) THEN
# %1 = %1 + sizeof(x)
# ELSE
# %1 = %1 - sizeof(x)
# FI
# FI
#
# Sets CF, OF and SF according to the result of the comparison
# Sets ZF according to whether [%1] and $2 are equal, OR if [%1] is null
#
# Notes:
# - Does not move past the value when found
# - 'SCASB.REP.NZ reg ch' is a short 'strchnul()'
#
scasb 2
scasw 2
scasd 2
scasq 2
#---------------------------------------------------------------------------#