Overview
Comment: | Add the flip instruction. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f292d8781edba89d978cfb8354372a16 |
User & Date: | user on 2021-03-31 19:26:10 |
Other Links: | manifest | tags |
Context
2021-04-01
| ||
04:00 | Change the sounds.js to use the sound names instead of numbers (although this does not find all of the sounds; also, it may be reverted if needed) check-in: 2b1740ba7c user: user tags: trunk | |
2021-03-31
| ||
19:26 | Add the flip instruction. check-in: f292d8781e user: user tags: trunk | |
07:04 | Remove the unimplemented QueueTurn instruction. check-in: e6516c4496 user: user tags: trunk | |
Changes
Modified class.doc from [f3236ff0c1] to [e05ea8d8f3].
︙ | ︙ | |||
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | =Finished ( number -- ) Write to the Finished variable. Only the low 8-bits are used. When set to nonzero then the beginning and ending phases are skipped (see above), but if IgnoreKey is used, then all phases are skipped, regardless of the value of this flag. FlushClass ( class -- ) ** Resets the Arrived, Busy, Departed, Inertia, Moved, and UserSignal flags of all objects of the specified class to zero. If the class is -1, then all objects are flushed in this way, and during the input phase, it also skips the beginning and ending phases if the class is -1. FlushObj ( -- ) ** | > > > | 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | =Finished ( number -- ) Write to the Finished variable. Only the low 8-bits are used. When set to nonzero then the beginning and ending phases are skipped (see above), but if IgnoreKey is used, then all phases are skipped, regardless of the value of this flag. flip ( mark ... -- mark ... ) Reverses everything above the mark on the stack. FlushClass ( class -- ) ** Resets the Arrived, Busy, Departed, Inertia, Moved, and UserSignal flags of all objects of the specified class to zero. If the class is -1, then all objects are flushed in this way, and during the input phase, it also skips the beginning and ending phases if the class is -1. FlushObj ( -- ) ** |
︙ | ︙ |
Modified exec.c from [6e356ea1be] to [371fab5994].
︙ | ︙ | |||
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 | static inline Uint32 chebyshev(Uint32 a,Uint32 b) { Uint32 i,j; if(a==VOIDLINK || b==VOIDLINK) return 0; i=abs(objects[a]->x-objects[b]->x); j=abs(objects[a]->y-objects[b]->y); return i>j?i:j; } // Here is where the execution of a Free Hero Mesh bytecode subroutine is executed. #define NoIgnore() do{ changed=1; }while(0) #define GetVariableOf(a,b) (i=v_object(Pop()),i==VOIDLINK?NVALUE(0):b(objects[i]->a)) #define GetVariableOrAttributeOf(a,b) (t2=Pop(),t2.t==TY_CLASS?NVALUE(classes[t2.u]->a):(i=v_object(t2),i==VOIDLINK?NVALUE(0):b(objects[i]->a))) #define Numeric(a) do{ if((a).t!=TY_NUMBER) Throw("Type mismatch"); }while(0) #define DivideBy(a) do{ Numeric(a); if(!(a).u) Throw("Division by zero"); }while(0) | > > > > > > > > > > > > > > | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 | static inline Uint32 chebyshev(Uint32 a,Uint32 b) { Uint32 i,j; if(a==VOIDLINK || b==VOIDLINK) return 0; i=abs(objects[a]->x-objects[b]->x); j=abs(objects[a]->y-objects[b]->y); return i>j?i:j; } static inline void v_flip(void) { int p=vstackptr; int n; Value v; while(p-- && vstack[p].t!=TY_MARK); if(!p) Throw("No mark"); p++; for(n=0;n<(vstackptr-p)/2;n++) { v=vstack[p+n]; vstack[p+n]=vstack[vstackptr-n-1]; vstack[vstackptr-n-1]=v; } } // Here is where the execution of a Free Hero Mesh bytecode subroutine is executed. #define NoIgnore() do{ changed=1; }while(0) #define GetVariableOf(a,b) (i=v_object(Pop()),i==VOIDLINK?NVALUE(0):b(objects[i]->a)) #define GetVariableOrAttributeOf(a,b) (t2=Pop(),t2.t==TY_CLASS?NVALUE(classes[t2.u]->a):(i=v_object(t2),i==VOIDLINK?NVALUE(0):b(objects[i]->a))) #define Numeric(a) do{ if((a).t!=TY_NUMBER) Throw("Type mismatch"); }while(0) #define DivideBy(a) do{ Numeric(a); if(!(a).u) Throw("Division by zero"); }while(0) |
︙ | ︙ | |||
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 | case OP_DONE_EC: StackReq(2,0); SetFlagOf(OF_DONE); break; case OP_DROP: StackReq(1,0); Pop(); break; case OP_DROP_D: StackReq(2,0); Pop(); Pop(); break; case OP_DUP: StackReq(1,2); t1=Pop(); Push(t1); Push(t1); break; case OP_EQ: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t2)?1:0)); break; case OP_FINISHED: StackReq(0,1); Push(NVALUE(all_flushed)); break; case OP_FINISHED_E: StackReq(1,0); t1=Pop(); Numeric(t1); all_flushed=t1.u; break; case OP_FLUSHCLASS: NoIgnore(); StackReq(1,0); t1=Pop(); if(t1.t==TY_CLASS) flush_class(t1.u); else if(t1.t==TY_NUMBER && t1.s==-1) flush_all(); else if(t1.t) Throw("Type mismatch"); break; case OP_FLUSHOBJ: NoIgnore(); flush_object(obj); break; case OP_FLUSHOBJ_C: NoIgnore(); StackReq(1,0); i=v_object(Pop()); if(i!=VOIDLINK) flush_object(i); break; case OP_FOR: NoIgnore(); StackReq(3,1); t3=Pop(); t2=Pop(); t1=Pop(); ptr=v_for(code,ptr,t1,t2,t3); break; case OP_FROM: StackReq(0,1); Push(OVALUE(msgvars.from)); break; case OP_FUNCTION: execute_program(classes[0]->codes,functions[code[ptr++]],obj); break; case OP_GE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?0:1)); break; | > | 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | case OP_DONE_EC: StackReq(2,0); SetFlagOf(OF_DONE); break; case OP_DROP: StackReq(1,0); Pop(); break; case OP_DROP_D: StackReq(2,0); Pop(); Pop(); break; case OP_DUP: StackReq(1,2); t1=Pop(); Push(t1); Push(t1); break; case OP_EQ: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t2)?1:0)); break; case OP_FINISHED: StackReq(0,1); Push(NVALUE(all_flushed)); break; case OP_FINISHED_E: StackReq(1,0); t1=Pop(); Numeric(t1); all_flushed=t1.u; break; case OP_FLIP: v_flip(); break; case OP_FLUSHCLASS: NoIgnore(); StackReq(1,0); t1=Pop(); if(t1.t==TY_CLASS) flush_class(t1.u); else if(t1.t==TY_NUMBER && t1.s==-1) flush_all(); else if(t1.t) Throw("Type mismatch"); break; case OP_FLUSHOBJ: NoIgnore(); flush_object(obj); break; case OP_FLUSHOBJ_C: NoIgnore(); StackReq(1,0); i=v_object(Pop()); if(i!=VOIDLINK) flush_object(i); break; case OP_FOR: NoIgnore(); StackReq(3,1); t3=Pop(); t2=Pop(); t1=Pop(); ptr=v_for(code,ptr,t1,t2,t3); break; case OP_FROM: StackReq(0,1); Push(OVALUE(msgvars.from)); break; case OP_FUNCTION: execute_program(classes[0]->codes,functions[code[ptr++]],obj); break; case OP_GE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?0:1)); break; |
︙ | ︙ |
Modified instruc from [44f9c7e8d7] to [0d803850a1].
︙ | ︙ | |||
258 259 260 261 262 263 264 265 266 267 268 269 270 271 | ; Operations with marks mark "_" tmark in nin -mbegin ; Arrays -Array GetArray InitArray SetArray ArrayCell | > | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | ; Operations with marks mark "_" tmark in nin -mbegin flip ; Arrays -Array GetArray InitArray SetArray ArrayCell |
︙ | ︙ |
Modified instruc.h from [f43425eb5f] to [6d4bc1a2f8].
︙ | ︙ | |||
375 376 377 378 379 380 381 | #define OP_YDIR 32953 #define OP_YDIR_C 35001 #define OP_MARK 32954 #define OP_TMARK 32955 #define OP_IN 32956 #define OP_NIN 32957 #define OP_MBEGIN 32958 | > | | | | | | | | | | | | | | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | #define OP_YDIR 32953 #define OP_YDIR_C 35001 #define OP_MARK 32954 #define OP_TMARK 32955 #define OP_IN 32956 #define OP_NIN 32957 #define OP_MBEGIN 32958 #define OP_FLIP 32959 #define OP_ARRAY 32960 #define OP_GETARRAY 32961 #define OP_INITARRAY 32962 #define OP_SETARRAY 32963 #define OP_ARRAYCELL 32964 #define OP_FUNCTION 32965 #define OP_LOCAL 32966 #define OP_LABEL 32967 #define OP_STRING 32968 #define OP_INT16 32969 #define OP_INT32 32970 #define OP_DISPATCH 32971 #define OP_USERFLAG 32972 #ifdef HEROMESH_CLASS static const Op_Names op_names[]={ {"*",8486937}, {"+",8421399}, {"-",8421400}, {"-rot",8421382}, {".",10518528}, {"/",8486938}, {"ANHH",8389394}, {"ARRIVED",8389124}, {"Animate",8421508}, {"AnimateDead",8421509}, {"Arg1",8552565}, {"Arg2",8552566}, {"Arg3",8552567}, {"Array",8683712}, {"ArrayCell",8421572}, {"Arrivals",8618083}, {"Arrived",8618081}, {"Assassinate",8487046}, {"B",9437196}, {"BANG",8389380}, {"BEDOINGNG",8389406}, {"BEEDEEP",8389404}, |
︙ | ︙ | |||
473 474 475 476 477 478 479 | {"FROG",8389383}, {"Finished",8552571}, {"FlushClass",8421522}, {"FlushObj",8487059}, {"From",8421492}, {"GLASS",8389379}, {"GLISSANT",8389419}, | | | | 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | {"FROG",8389383}, {"Finished",8552571}, {"FlushClass",8421522}, {"FlushObj",8487059}, {"From",8421492}, {"GLASS",8389379}, {"GLISSANT",8389419}, {"GetArray",8421569}, {"GetInventory",8421524}, {"HAWK",8389425}, {"HEARTBEAT",8389407}, {"HIT",8389134}, {"HITBY",8389135}, {"Hard",8618063}, {"Height",9142345}, {"HeightAt",8421525}, {"Help",8683649}, {"INIT",8389120}, {"IgnoreKey",8421526}, {"Image",8618046}, {"InPlace",8683647}, {"Inertia",9142335}, {"InitArray",8421570}, {"Input",8683645}, {"IntMove",10584215}, {"Invisible",8618086}, {"JAYAYAYNG",8389416}, {"JUMPED",8389128}, {"JumpTo",10584216}, {"KEWEL",8389422}, |
︙ | ︙ | |||
572 573 574 575 576 577 578 | {"SUBS",8683651}, {"SUNK",8389131}, {"SW",9437189}, {"Seek",8487086}, {"Self",8421490}, {"Send",10584239}, {"SendEx",10584240}, | | | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | {"SUBS",8683651}, {"SUNK",8389131}, {"SW",9437189}, {"Seek",8487086}, {"Self",8421490}, {"Send",10584239}, {"SendEx",10584240}, {"SetArray",8421571}, {"SetInventory",8421553}, {"Shape",8618042}, {"ShapeDir",8618065}, {"Sharp",8618064}, {"Shovable",8618066}, {"Sound",8421554}, {"Stealthy",8618091}, |
︙ | ︙ | |||
656 657 658 659 660 661 662 663 664 665 666 667 668 669 | {"c?",8421424}, {"chain",8421516}, {"cz?",8421425}, {"dup",8421377}, {"el",8683532}, {"else",8683530}, {"eq",8421416}, {"for",8683538}, {"ge",8486956}, {"gt",8486954}, {"if",8683529}, {"in",8421564}, {"is",8421422}, {"land",8421412}, | > | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | {"c?",8421424}, {"chain",8421516}, {"cz?",8421425}, {"dup",8421377}, {"el",8683532}, {"else",8683530}, {"eq",8421416}, {"flip",8421567}, {"for",8683538}, {"ge",8486956}, {"gt",8486954}, {"if",8683529}, {"in",8421564}, {"is",8421422}, {"land",8421412}, |
︙ | ︙ | |||
694 695 696 697 698 699 700 | {"swap",8421378}, {"then",8683531}, {"tmark",8421563}, {"tuck",8421380}, {"until",8683535}, {"while",8683536}, }; | | | 696 697 698 699 700 701 702 703 704 | {"swap",8421378}, {"then",8683531}, {"tmark",8421563}, {"tuck",8421380}, {"until",8683535}, {"while",8683536}, }; #define N_OP_NAMES 304 #endif |