804804-- TR: trigonometric syntax operand
805805-- OL: old mnemonic for the instruction
806806-- BL: instruction supports block prefix
807+ -- PR: privileged opcode but with custom handler(for example, if it needs to get a value to write to an operand)
807808-- Op1 - operand 1 name
808809-- Op2 - operand 2 name
809810
824825-- INT: 48-bit signed integer
825826
826827CPULib .InstructionTable = {}
827- local W1 ,R0 ,OB ,UB ,CB ,TR ,OL ,BL = 1 ,2 ,4 ,8 ,16 ,32 ,64 ,128
828+ local W1 ,R0 ,OB ,UB ,CB ,TR ,OL ,BL , PR = 1 ,2 ,4 ,8 ,16 ,32 ,64 ,128 , 256
828829
829830local function Bit (x ,n ) return (math.floor (x / n ) % 2 ) == 1 end
830831local function Entry (Set ,Opc ,Mnemonic ,Ops ,Version ,Flags ,Op1 ,Op2 ,Reference )
@@ -846,6 +847,7 @@ local function Entry(Set,Opc,Mnemonic,Ops,Version,Flags,Op1,Op2,Reference)
846847 Trigonometric = Bit (Flags ,TR ),
847848 Old = Bit (Flags ,OL ),
848849 BlockPrefix = Bit (Flags ,BL ),
850+ PrivilegedRequester = Bit (Flags ,PR )
849851 })
850852end
851853local function CPU (...) Entry (" CPU" ,... ) end
@@ -880,7 +882,8 @@ CPULib.FlagLookup = {
880882 [" CB" ] = CB ,
881883 [" TR" ] = TR ,
882884 [" OL" ] = OL ,
883- [" BL" ] = BL
885+ [" BL" ] = BL ,
886+ [" PR" ] = PR
884887}
885888
886889-- Parses an array of flags into a single number from a lookup table by name
@@ -1099,7 +1102,7 @@ CPU(012, "MUL", 2, 1.00, 0, "X", "Y", "X = X * Y"
10991102CPU (013 , " DIV" , 2 , 1.00 , 0 , " X" , " Y" , " X = X / Y" )
11001103CPU (014 , " MOV" , 2 , 1.00 , 0 , " X" , " Y" , " X = Y" )
11011104CPU (015 , " CMP" , 2 , 1.00 , 0 , " X" , " Y" , " Compare X and Y. Use with conditional branching instructions" )
1102- CPU (016 , " RD" , 2 , 1.00 , R0 + OB , " X" , " PTR" , " Read value from memory by pointer PTR" )
1105+ CPU (016 , " RD" , 2 , 1.00 , PR + OB , " X" , " PTR" , " Read value from memory by pointer PTR" )
11031106CPU (017 , " WD" , 2 , 1.00 , R0 + OB , " PTR" , " Y" , " Write value to memory by pointer PTR" )
11041107CPU (018 , " MIN" , 2 , 1.00 , 0 , " X" , " Y" , " Set X to smaller value out of X and Y" )
11051108CPU (019 , " MAX" , 2 , 1.00 , 0 , " X" , " Y" , " Set X to bigger value out of X and Y" )
@@ -1235,7 +1238,7 @@ CPU(117, "LEAVE", 0, 10.00, 0, "", "", "Leave subr
12351238CPU (118 , " STM" , 0 , 10.00 , R0 , " " , " " , " Enable extended memory mode" )
12361239CPU (119 , " CLM" , 0 , 10.00 , R0 , " " , " " , " Disable extended memory mode" )
12371240---- Dec 12 -------------------------------------------------------------------------------------------------------------------------------------
1238- CPU (120 , " CPUGET" , 2 , 5.00 , R0 , " X" , " IDX" , " Read internal processor register IDX" )
1241+ CPU (120 , " CPUGET" , 2 , 5.00 , PR , " X" , " IDX" , " Read internal processor register IDX" )
12391242CPU (121 , " CPUSET" , 2 , 5.00 , R0 , " IDX" , " Y" , " Write internal processor register IDX" )
12401243CPU (122 , " SPP" , 2 , 5.00 , R0 + BL , " PAGE" , " IDX" , " Set page flag IDX" )
12411244CPU (123 , " CPP" , 2 , 5.00 , R0 + BL , " PAGE" , " IDX" , " Clear page flag IDX" )
@@ -1248,7 +1251,7 @@ CPU(129, "CMPOR", 2, 6.00, 0, "X", "Y", "Compare X
12481251---- Dec 13 -------------------------------------------------------------------------------------------------------------------------------------
12491252CPU (130 , " MSHIFT" , 2 , 7.00 , 0 , " COUNT" , " OFFSET" ," Shift (and rotate) data pointed by ESI by OFFSET bytes" )
12501253CPU (131 , " SMAP" , 2 , 8.00 , R0 + BL , " PAGE1" , " PAGE2" , " Remap PAGE1 to physical page PAGE2" )
1251- CPU (132 , " GMAP" , 2 , 8.00 , R0 , " X" , " PAGE" , " Read what physical page PAGE is mapped to" )
1254+ CPU (132 , " GMAP" , 2 , 8.00 , PR , " X" , " PAGE" , " Read what physical page PAGE is mapped to" )
12521255CPU (133 , " RSTACK" , 2 , 9.00 , 0 , " X" , " IDX" , " Read value from stack at offset IDX (from address SS+IDX)" )
12531256CPU (134 , " SSTACK" , 2 , 9.00 , 0 , " IDX" , " Y" , " Write value to stack at offset IDX (to address SS+IDX)" )
12541257CPU (135 , " ENTER" , 1 , 10.00 , 0 , " SIZE" , " " , " Enter stack frame and allocate SIZE bytes on stack for local variables" )
0 commit comments