Difference between revisions of "Kyra/Opcodes"

From ScummVM :: Wiki
Jump to navigation Jump to search
m (a little formatting)
m (remove outdated information)
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This page is a work-in-progress document listing VM opcodes of the [[kyra|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.
This page is a reference of unused opcodes in Kyrandia 1.


It is assumed that the opcodes stay the same during all revisions of Kyrandia. A quick comparison between English 1.0 and English 1.3 seems to support this. Generally the list is created by analysis of 1.0 script.
==Unimplemented opcodes==
 
{| border="1" width="100%"
Hint: To disable an opcode/command pair in the compiled scripts, overwrite it with '''4C 00''' (add sp,00).
|-
 
!|Opcode #
===Opcodes===
!|Name
 
!|Place of use
There are more complete disassemblers around, will add their info ASAP.
|-
 
|07
<code>
|o1_runNPCScript
  44 = push
|not used
  45 = ? compare [sp], [xx] ?
|-
  49 = ? copy [xx], [sp] ?
|3E
  4C = add sp,xx  ; what would be dec sp,xx? maybe 4B or 4E?
|o1_loadSoundFile
  4E = execute command (see below)
|not used
</code>
|-
 
|4B
===Commands===
|o1_specificItemInInventory
 
|not used
'''A note on arguments:''' parameters are pushed onto the stack before executing the command:
|-
<code>
|4D
  44 FE push FE
|o1_mobileCharacterInScene
  44 00 push 00
|not used
  44 00 push 00 // string ID - the first string in the TEXT segment will be displayed
|-
  4E 01 execute 01 // display string
|4E
  4C 03 add sp, 03 // discard the 3 pushed values
|o1_hideMobileCharacter
</code>
|not used? (many false positives, but since unhide isn't implemented I don't think that exists)
 
|-
The arguments are listed in reverse order in this document (LIFO - last in, first out):
|4F
 
|o1_unhideMobileCharacter
<code>
|not used
  01 Cmd_Character_Says 3 args (stringID, unk, unk)
|-
</code>
|65
 
|o1_pageFlip
 
|not used
There's still a little confusion about the numbering, so don't take anything below for granted.
|-
 
|69
<code>
|o1_addItemToInventory
 
|not used
  00? Cmd_Magic_In_Mouse_Item 00
|-
  01 Cmd_Character_Says 3 args (stringID, unk, unk) - also see 34
|6A
  02? Cmd_Pause_Ticks 02
|o1_intPrint
  03? Cmd_Draw_Scene_Anim_Shape 03
|not used
  04? Cmd_Query_Game_Flag 04
|-
  05? Cmd_Set_Game_Flag 05
|84
  06? Cmd_Reset_Game_Flag 06
|o1_setPaletteRange
  07? Cmd_Run_NPC_Script 07
|not used
  08? Cmd_Set_Special_Exit_List 08
|-
  09? Cmd_Block_In_Walkable_Region 09
|92
  0A? Cmd_Block_Out_Walkable_Region 0A
|o1_setPlayingLoop
  0B Cmd_Walk_Player_To_Point 4 args (y, x, x, unk) - x may be be greater than 0xFF, y must not, so only 1 byte for that
|2 times used (GRAVE.EMC, CAVEB.EMC - only used on failing copy protection, exit to DOS)
  0C? Cmd_Drop_Item_In_Scene 0C
|-
  0D Cmd_Draw_Anim_Shape_Into_Scene 4 args (remove item from screen?) (removes note from desk)
|97
  0E Cmd_Create_Mouse_Item 1 arg  (itemID) - pick up item; ie mousecursor=item id
|o1_resetMaskRegion
  0F Cmd_Save_Page_To_Disk tries to write sth to disk, filename = stringID of last push
|not used
 
|}
  10? Cmd_Load_Page_From_Disk 10
  11? Cmd_Scene_Anim_On 11
  12? Cmd_Scene_Anim_Off 12
  13? Cmd_Elapsed_Seconds 13
  14? Cmd_Mouse_Is_Pointer 14
  15? Cmd_Destroy_Mouse_Item 15
  16? Cmd_Run_Scene_Anim_Until_Done 16
  17? Cmd_Fade_Special_Palette 17
  18? Cmd_Play_AdLib_Sound 18
  19? Cmd_Play_AdLib_Score 19
  1A? Cmd_Phase_In_Same_Scene 1A
  1B? Cmd_Set_Scene_Phasing_Flag 1B
  1C? Cmd_Reset_Scene_Phasing_Flag 1C
  1D? Cmd_Query_Scene_Phasing_Flag 1D
  1E? Cmd_Scene_To_Direction 1E
  1F? Cmd_Set_Birthstone_Gem 1F
 
  20? Cmd_Place_Item_In_Generic_Map_Scene 20
  21? Cmd_Set_Brandon_Status_Bit 21
  22? Cmd_Pause_Seconds 22
  23? Cmd_Get_Characters_Location 23
  24? Cmd_Run_NPC_Subscript 24
  25? Cmd_Magic_Out_Mouse_Item 25 // I think this is really "24", clears mouse cursor, plays magic sound
  26? Cmd_Internal_Anim_On 26
  27? Cmd_Force_Brandon_To_Normal 27
  28? Cmd_Poison_Death_Now 28
  29? Cmd_Set_Scale_Mode 29
 
  28 looks more like "Cmd_Set_Scale_Mode", when executing it Brandon becomes tiny
 
  note: this looks more like 2A, check numbering
  29              4              ; play WSA file? (or just load it? coords?)
 
  2A? Cmd_Open_WSA_File 2A // I think this should be '29', so there's another problem here
  2B? Cmd_Close_WSA_File 2B
  2C? Cmd_Run_WSA_From_Beginning_To_End 2C
  2D? Cmd_Display_WSA_Frame 2D
  2E? Cmd_Enter_New_Scene 2E
  2F? Cmd_Set_Special_Enter_X_And_Y 2F
 
  30? Cmd_Run_WSA_Frames 30
  31? Cmd_Pop_Brandon_Into_Scene 31
  32? Cmd_Restore_All_Object_Backgrounds 32
  33? Cmd_Set_Custom_Palette_Range 33
  34 Cmd_Custom_Print_Talk_String 4 args (stringID, unk, unk, color) - see also 01, color=palette entry
  35 Cmd_Restore_Custom_Print_Background 0 args ; restore text background?
  36 Cmd_Hide_Mouse 0 args
  37 Cmd_Show_Mouse 0 args
  38? Cmd_Get_Character_X 38
  39? Cmd_Get_Character_Y 39
  3A Cmd_Change_Characters_Facing 3 args
  3B? Cmd_Copy_WSA_Region 3B
  3C Cmd_Text_Print 5 args (stringID, x, y, unk, unk)? prints text on brynn's note
  3D? Cmd_Random 3D
  3E? Cmd_Load_Sound_File 3E
  3F? Cmd_Display_WSA_Frame_On_HidPage 3F
 
  40? Cmd_Display_WSA_Sequential_Frames 40
  41? Cmd_Draw_Character_Standing 41
  42? Cmd_Internal_Anim_Off 42
  43? Cmd_Change_Characters_X_And_Y 43
  44? Cmd_Clear_Scene_Animator_Beacon 44
  45? Cmd_Query_Scene_Animator_Beacon 45
  46? Cmd_Refresh_Scene_Animator 46
  47? Cmd_Place_Item_In_Off_Scene 47
  48 Cmd_Wipe_Down_Mouse_Item // destroys picked up item, sets mouse cursor to normal
  49? Cmd_Place_Character_In_Other_Scene 49
  4A? Cmd_Get_Key 4A
  4B? Cmd_Specific_Item_In_Inventory 4B
  4C? Cmd_Pop_Mobile_NPC_Into_Scene 4C
  4D? Cmd_Mobile_Character_In_Scene 4D
  4E? Cmd_Hide_Mobile_Character 4E
  4F? Cmd_Unhide_Mobile_Character 4F
 
  50? Cmd_Set_Characters_Location 50
  51? Cmd_Walk_Character_To_Point 51
  52 Cmd_Special_Event_Display_Brynns_Note 0 args
  53 Cmd_Special_Event_Remove_Brynns_Note 0 args
  54? Cmd_Set_Logic_Page 54
  55? Cmd_Fat_Print 55
 
  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
 
  60 Cmd_Drink_Potion_Animation 3 args
  61 Cmd_Make_Amulet_Appear 0 args // used in altar.emc
  Cmd_Draw_Item_Shape_Into_Scene // 0x62
  Cmd_Set_Characters_Current_Frame // 0x63
  64 Cmd_Wait_For_Confirmation_Mouse_Click // 0x64
  Cmd_Page_Flip // 0x65
  Cmd_Set_Scene_File // 0x66
  Cmd_What_Item_In_Marble_Vase // 0x67
  68 Cmd_Set_Item_In_Marble_Vase 1 arg; (itemID of item in vase in gemcut.emc)
  Cmd_Add_Item_To_Inventory // 0x69
  6A Cmd_Int_Print // prints last pushed value to top left corner? (debug only?)
  6B Cmd_Shake_Screen // 0x6B
  6C Cmd_Create_Amulet_Jewel 1 arg - 01=yellow, 02=red, 03=pink, 04=blue
  Cmd_Set_Scene_Anim_Curr_XY // 0x6D
  6E Cmd_Poison_Brandon_And_Remaps 0 args
  6F Cmd_Fill_Flask_With_Water 2 args, used in fountn.emc
 
  Cmd_Get_Characters_Movement_Delay // 0x70
  Cmd_Get_Birthstone_Gem // 0x71
  Cmd_Query_Brandon_Status_Bit // 0x72
  73 Cmd_Play_Flute_Animation 0 args
  74 Cmd_Play_Winter_Scroll_Sequence 1 arg
  Cmd_Get_Idol_Gem // 0x75
  Cmd_Set_Idol_Gem // 0x76
  Cmd_Total_Items_In_Scene // 0x77
  Cmd_Restore_Brandons_Movement_Delay // 0x78
  79 Cmd_Set_Mouse_Pos // at least 2 args - (x,y) (how to move mouse all way to right though?)
  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
  7E Cmd_Fade_Entire_Palette 2 args (mode, unk)// used at least in potion.emc with mode=02, fadein
  Cmd_Item_On_Ground_Here 2 args? // 0x7F
 
  Cmd_Query_Cauldron_State // 0x80
  81 Cmd_Set_Cauldron_State 1 arg// 0x81 (only in potion.emc? why only once in there?)
  Cmd_Query_Crystal_State // 0x82
  Cmd_Set_Crystal_State // 0x83
  Cmd_Set_Palette_Range // 0x84
  85 Cmd_Shrink_Brandon_Down 1 arg
  86 Cmd_Grow_Brandon_Up 0 args
  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
  8B Cmd_Message 2 args // 0x8B - set room name/status text (stringID, unk)
  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 //92
  Cmd_Set_Playing_Loop // 0x93
  93 Cmd_Brandon_To_Stone_Sequence 0 args //94
  94 Cmd_Brandon_Healing_Sequence 0 args  //0x95 (used [only?] in _npc.emc)
  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
</code>

Latest revision as of 13:47, 1 April 2008

This page is a reference of unused opcodes in Kyrandia 1.

Unimplemented opcodes

Opcode # Name Place of use
07 o1_runNPCScript not used
3E o1_loadSoundFile not used
4B o1_specificItemInInventory not used
4D o1_mobileCharacterInScene not used
4E o1_hideMobileCharacter not used? (many false positives, but since unhide isn't implemented I don't think that exists)
4F o1_unhideMobileCharacter not used
65 o1_pageFlip not used
69 o1_addItemToInventory not used
6A o1_intPrint not used
84 o1_setPaletteRange not used
92 o1_setPlayingLoop 2 times used (GRAVE.EMC, CAVEB.EMC - only used on failing copy protection, exit to DOS)
97 o1_resetMaskRegion not used