Open main menu

This page is a work-in-progress document listing VM opcodes of the Kyrandia games. Unless otherwise noted, these opcodes are based on Kyrandia 1. Cyx created the list of Cmd functions, clem and Lordhoto will try to fill in parameters and usage notes. If you have any additions, contact the ScummVM team on IRC.

Hint: To disable an opcode/command pair in the compiled scripts, overwrite it with 4C 00 (add sp,00).

Opcodes

There are more complete disassemblers around, will add their info ASAP.

 44 = push
 45 = ? compare [sp], [xx] ?
 49 = ? copy [xx], [sp] ?
 4C = add sp,xx   ; what would be dec sp,xx? maybe 4B or 4E?
 4E = execute command (see below)

Commands

There's still a little confusion about the numbering, so don't take anything below for granted.

 00	Cmd_Magic_In_Mouse_Item
 01	Cmd_Character_Says			3 args (unk, unk, stringID) - also see 34
 02	Cmd_Pause_Ticks
 03	Cmd_Draw_Scene_Anim_Shape
 04	Cmd_Query_Game_Flag
 05	Cmd_Set_Game_Flag
 06	Cmd_Reset_Game_Flag
 07	Cmd_Run_NPC_Script
 08	Cmd_Set_Special_Exit_List
 09	Cmd_Block_In_Walkable_Region
 0A	Cmd_Block_Out_Walkable_Region
 0B	Cmd_Walk_Player_To_Point		4 args (unk, x, x, y) - x may be be greater than 0xFF, y must not, so only 1 byte for that
 0C	Cmd_Drop_Item_In_Scene
 0D	Cmd_Draw_Anim_Shape_Into_Scene
 0E	Cmd_Create_Mouse_Item			1 arg  (itemID) - ie mousecursor=item id
 0F	Cmd_Save_Page_To_Disk
 10	Cmd_Load_Page_From_Disk
 11	Cmd_Scene_Anim_On
 12	Cmd_Scene_Anim_Off
 13	Cmd_Elapsed_Seconds
 14	Cmd_Mouse_Is_Pointer
 15	Cmd_Destroy_Mouse_Item
 16	Cmd_Run_Scene_Anim_Until_Done
 17	Cmd_Fade_Special_Palette
 18	Cmd_Play_AdLib_Sound
 19	Cmd_Play_AdLib_Score
 1A	Cmd_Phase_In_Same_Scene
 1B	Cmd_Set_Scene_Phasing_Flag
 1C	Cmd_Reset_Scene_Phasing_Flag
 1D	Cmd_Query_Scene_Phasing_Flag
 1E	Cmd_Scene_To_Direction
 1F	Cmd_Set_Birthstone_Gem
 20	Cmd_Place_Item_In_Generic_Map_Scene
 21	Cmd_Set_Brandon_Status_Bit
 22	Cmd_Pause_Seconds
 23	Cmd_Get_Characters_Location
 24	Cmd_Run_NPC_Subscript
 25	Cmd_Magic_Out_Mouse_Item
 26	Cmd_Internal_Anim_On
 27	Cmd_Force_Brandon_To_Normal
 28	Cmd_Poison_Death_Now
 29	Cmd_Set_Scale_Mode
 2A	Cmd_Open_WSA_File
 2B	Cmd_Close_WSA_File
 2C	Cmd_Run_WSA_From_Beginning_To_End
 2D	Cmd_Display_WSA_Frame
 2E	Cmd_Enter_New_Scene
 2F	Cmd_Set_Special_Enter_X_And_Y
 30	Cmd_Run_WSA_Frames
 31	Cmd_Pop_Brandon_Into_Scene
 32	Cmd_Restore_All_Object_Backgrounds
 33	Cmd_Set_Custom_Palette_Range
 34	Cmd_Custom_Print_Talk_String		4 args (color, unk, unk, stringid) - see also 01
 35	Cmd_Restore_Custom_Print_Background	0 args
 36	Cmd_Hide_Mouse				0 args
 37	Cmd_Show_Mouse				0 args
 38	Cmd_Get_Character_X
 39	Cmd_Get_Character_Y
 3A	Cmd_Change_Characters_Facing
 3B	Cmd_Copy_WSA_Region
 3C	Cmd_Text_Print
 3D	Cmd_Random
 3E	Cmd_Load_Sound_File
 3F	Cmd_Display_WSA_Frame_On_HidPage
 40	Cmd_Display_WSA_Sequential_Frames
 41	Cmd_Draw_Character_Standing
 42	Cmd_Internal_Anim_Off
 43	Cmd_Change_Characters_X_And_Y
 44	Cmd_Clear_Scene_Animator_Beacon
 45	Cmd_Query_Scene_Animator_Beacon
 46	Cmd_Refresh_Scene_Animator
 47	Cmd_Place_Item_In_Off_Scene
 48	Cmd_Wipe_Down_Mouse_Item
 49	Cmd_Place_Character_In_Other_Scene
 4A	Cmd_Get_Key
 4B	Cmd_Specific_Item_In_Inventory
 4C	Cmd_Pop_Mobile_NPC_Into_Scene
 4D	Cmd_Mobile_Character_In_Scene
 4E	Cmd_Hide_Mobile_Character
 4F	Cmd_Unhide_Mobile_Character
 50	Cmd_Set_Characters_Location
 51	Cmd_Walk_Character_To_Point
 52	Cmd_Special_Event_Display_Brynns_Note
 53	Cmd_Special_Event_Remove_Brynns_Note
 54	Cmd_Set_Logic_Page
 55	Cmd_Fat_Print
 
 Cmd_Preserve_All_Object_Backgrounds		// 0x57
 Cmd_Update_Scene_Animations			// 0x58
 Cmd_Scene_Animation_Active			// 0x59
 Cmd_Set_Characters_Movement_Delay		// 0x5A
 Cmd_Get_Characters_Facing			// 0x5B
 Cmd_Bkgd_Scroll_Scene_And_Masks_Right		// 0x5C
 Cmd_Find_Brightest_Fireberry			// 0x5D
 Cmd_Set_Fireberry_Glow_Palette		// 0x5E
 Cmd_Set_Death_Handler_Flag			// 0x5F
 Cmd_Drink_Potion_Animation			// 0x60
 Cmd_Make_Amulet_Appear			// 0x61
 Cmd_Draw_Item_Shape_Into_Scene		// 0x62
 Cmd_Set_Characters_Current_Frame		// 0x63
 Cmd_Wait_For_Confirmation_Mouse_Click		// 0x64
 Cmd_Page_Flip					// 0x65
 Cmd_Set_Scene_File				// 0x66
 Cmd_What_Item_In_Marble_Vase			// 0x67
 Cmd_Set_Item_In_Marble_Vase			// 0x68
 Cmd_Add_Item_To_Inventory			// 0x69
 Cmd_Int_Print					// 0x6A
 Cmd_Shake_Screen				// 0x6B
 Cmd_Create_Amulet_Jewel			// 0x6C
 Cmd_Set_Scene_Anim_Curr_XY			// 0x6D
 Cmd_Poison_Brandon_And_Remaps			// 0x6E
 Cmd_Fill_Flask_With_Water			// 0x6F
 Cmd_Get_Characters_Movement_Delay		// 0x70
 Cmd_Get_Birthstone_Gem			// 0x71
 Cmd_Query_Brandon_Status_Bit			// 0x72
 Cmd_Play_Flute_Animation			// 0x73
 Cmd_Play_Winter_Scroll_Sequence		// 0x74
 Cmd_Get_Idol_Gem				// 0x75
 Cmd_Set_Idol_Gem				// 0x76
 Cmd_Total_Items_In_Scene			// 0x77
 Cmd_Restore_Brandons_Movement_Delay		// 0x78
 Cmd_Set_Mouse_Pos				// 0x79
 Cmd_Get_Mouse_State				// 0x7A
 Cmd_Set_Entrance_Mouse_Cursor_Track		// 0x7B
 Cmd_Item_Appears_On_Ground			// 0x7C
 Cmd_Set_No_Draw_Shapes_Flag			// 0x7D
 Cmd_Fade_Entire_Palette			// 0x7E
 Cmd_Item_On_Ground_Here			// 0x7F
 Cmd_Query_Cauldron_State			// 0x80
 Cmd_Set_Cauldron_State			// 0x81
 Cmd_Query_Crystal_State			// 0x82
 Cmd_Set_Crystal_State				// 0x83
 Cmd_Set_Palette_Range				// 0x84
 Cmd_Shrink_Brandon_Down			// 0x85
 Cmd_Grow_Brandon_Up				// 0x86
 Cmd_Set_Brandon_Scale_X_And_Y			// 0x87
 Cmd_Reset_Scale_Mode				// 0x88
 Cmd_Get_Scale_Depth_Table_Value		// 0x89
 Cmd_Set_Scale_Depth_Table_Value		// 0x8A
 Cmd_Message					// 0x8B - set room name/status text (unk, stringID)
 Cmd_Check_Click_On_NPC			// 0x8C
 Cmd_Get_Foyer_Item				// 0x8D
 Cmd_Set_Foyer_Item				// 0x8E
 Cmd_Dispel_Magic_Animation			// 0x8F
 Cmd_Set_No_Item_Drop_Region			// 0x90
 Cmd_Walk_Malcolm_On				// 0x91
 91	Cmd_Passive_Protection		0 args	// 0x92
 Cmd_Set_Playing_Loop				// 0x93
 93	Cmd_Brandon_To_Stone_Sequence	0 args	// 0x94
 Cmd_Brandon_Healing_Sequence			// 0x95
 Cmd_Protect_Command_Line			// 0x96
 Cmd_Pause_Music_Seconds			// 0x97
 Cmd_Reset_Mask_Region				// 0x98
 Cmd_Set_Palette_Change_Flag			// 0x99
 Cmd_Fill_Rect					// 0x9A
 Cmd_Dummy					// 0x9B

still needs to be incorporated into above list:

 01              3 arguments     ; output string std color? (unk, unk, stringid) (see also 34)
 0B              4               ; walk to coordinates (unk, x,x,y) Cmd_Walk_Player_To_Point ?
 0D              4               ; remove item from screen? (removes note from desk)
 0E              1               ; pick up item (ie mousecursor=item id)
 29              4               ; play WSA file? (or just load it? coords?)
 34              4               ; output string defined color? (color, unk, unk, stringid) (see also 01)
 35              0               ; restore text background?
 36              0               ; disable mouse cursor
 37              0               ; enable mouse cursor
 8B              2               ; set room name/status text (unk, stringID)
 91              0               ; copyprotection box pops up
 93              0               ; Brandon turns to stone anim?