package mtmc.os import java.util.* enum class SysCall(value: Int) { EXIT(0x00), RINT(0x01), WINT(0x02), RSTR(0x03), WCHR(0x04), RCHR(0x05), WSTR(0x06), PRINTF(0x07), ATOI(0x08), RFILE(0x10), WFILE(0x11), CWD(0x12), CHDIR(0x13), DIRENT(0x14), DFILE(0x15), RND(0x20), SLEEP(0x21), TIMER(0x22), FBRESET(0x30), FBSTAT(0x31), FBSET(0x32), FBLINE(0x33), FBRECT(0x34), FBFLUSH(0x35), JOYSTICK(0x3A), SCOLOR(0x3B), MEMCPY(0x40), DRAWIMG(0x50), DRAWIMGSZ(0x51), DRAWIMGCLIP(0x52), ERROR(0xFF); val value: Byte init { this.value = value.toByte() } companion object { fun isSysCall(call: String): Boolean { try { valueOf(call.uppercase(Locale.getDefault())) return true } catch (e: IllegalArgumentException) { return false } } @JvmStatic fun getValue(call: String): Byte { return valueOf(call.uppercase(Locale.getDefault())).value } fun getString(syscallCode: Byte): String? { for (o in entries) { if (o.value == syscallCode) { return o.name.lowercase(Locale.getDefault()) } } return null } } }