Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added opcode for NOP_x (0xc5) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
2acd1fa545035b015ba8f0099ccaca70 |
User & Date: | jos 2015-08-11 21:50:18.700 |
Context
2015-08-11
| ||
23:19 | Added logic to calculate the length of an instruction. check-in: 0791033629 user: jos tags: trunk | |
21:50 | Added opcode for NOP_x (0xc5) check-in: 2acd1fa545 user: jos tags: trunk | |
14:49 | This fixes the ST.B (sp,0xvv),Rx problem. The second field is captured as everything between balanced parenteses, (including a ','). check-in: b37e57a31d user: jos tags: trunk | |
Changes
Changes to opcodes.lua.
︙ | ︙ | |||
228 229 230 231 232 233 234 | return 0x84 + (ourNr + 2*(ourNr2-2)) ; end end end function do_LD_W(f1, f2, f3) | > > > > > > > > | > > > > > > > > > > > > > | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | return 0x84 + (ourNr + 2*(ourNr2-2)) ; end end end function do_LD_W(f1, f2, f3) local ind_dst = (f3:match('%b()')~=nil); local autoinc = (ind_dst and (f3:match('++')~=nil) ); local stack = f3:match("[sS][pP]"); local ourNr = isReg(f2); if( not ind_dst ) then if( f3:match('#') ) then return 0xd0 + ourNr, 0x00, 0x00; else return 0xb0 + ourNr, 0x00, 0x00; end; else if( stack ) then return 0xa0 + ourNr, 0x00; end; local ourNr2 = tonumber( f3:match("[23]") ); if( ourNr2 == nil ) then error("Line ".. string.format("%04d",LineNr) .. ": Operand must be R2 or R3", 0 ) end if( autoinc ) then return 0x90 + (ourNr + 2*(ourNr2-2)) ; else return 0x80 + (ourNr + 2*(ourNr2-2)) ; end end end function do_LSL(f1, f2, f3) return 0xff ; end function do_LSL_WT(f1, f2, f3) |
︙ | ︙ | |||
301 302 303 304 305 306 307 308 309 310 311 312 313 314 | end return 0xf5, 0x00 ; end function do_NOP(f1, f2, f3) return 0xff ; end function do_POP(f1, f2, f3) local b = f2:sub(-1); if( b == 'S' or b == 's' ) then return 0xc4 end -- for POP PS return( 0xc0 + tonumber(b) ); end | > > > > | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | end return 0xf5, 0x00 ; end function do_NOP(f1, f2, f3) return 0xff ; end function do_NOP_X(f1, f2, f3) return 0xc5 ; end function do_POP(f1, f2, f3) local b = f2:sub(-1); if( b == 'S' or b == 's' ) then return 0xc4 end -- for POP PS return( 0xc0 + tonumber(b) ); end |
︙ | ︙ | |||
385 386 387 388 389 390 391 | else return 0x8c + (ourNr + 2*(ourNr2-2)) ; -- ST.B (Rb),Rx end end end function do_ST_W(f1, f2, f3) | > > > | > > > > > > > > > > > > > > > > | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | else return 0x8c + (ourNr + 2*(ourNr2-2)) ; -- ST.B (Rb),Rx end end end function do_ST_W(f1, f2, f3) local ind_dst = (f2:match('%b()')~=nil); local autoinc = (ind_dst and (f2:match('++')~=nil) ); local stack = f2:match("[sS][pP]"); local ourNr = isReg(f3); if( not ind_dst ) then return 0xb8 + ourNr, 0x00, 0x00; -- ST.B 0xWWWW,Rx ; else if( stack ) then return 0xa8 + ourNr, 0x00; end; -- ST.B (SP,0xVV),Rx ; local ourNr2 = tonumber( f2:match("[23]") ); if( ourNr2 == nil ) then error("Line ".. string.format("%04d",LineNr) .. ": Operand must be R2 or R3", 0 ) end if( autoinc ) then return 0x98 + (ourNr + 2*(ourNr2-2)) ; -- ST.B (Rb++),Rx ; else return 0x88 + (ourNr + 2*(ourNr2-2)) ; -- ST.B (Rb),Rx end end end function do_SUB(f1, f2, f3) return( 0x60 + isReg2(f2,f3) ); end function do_SUBX(f1, f2, f3) |
︙ | ︙ | |||
476 477 478 479 480 481 482 483 484 485 486 487 488 489 | ['MULS'] = { 1, do_MULS }, ['MULU'] = { 1, do_MULU }, ['NEG'] = { 1, do_NEG }, ['NEGX'] = { 1, do_NEGX }, ['OR'] = { 0, do_OR }, -- 2 if op1 is PS, 1 otherwise. ['ORI'] = { 2, do_ORI }, -- alias for OR PS,#VV ; ['NOP'] = { 1, do_NOP }, ['POP'] = { 1, do_POP }, ['PUSH'] = { 1, do_PUSH }, ['RET'] = { 1, do_RET }, ['RETI'] = { 1, do_RETI }, ['ROL'] = { 2, do_ROL }, ['ROL.WT'] = { 2, do_ROL_WT }, ['ROR'] = { 2, do_ROR }, | > | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | ['MULS'] = { 1, do_MULS }, ['MULU'] = { 1, do_MULU }, ['NEG'] = { 1, do_NEG }, ['NEGX'] = { 1, do_NEGX }, ['OR'] = { 0, do_OR }, -- 2 if op1 is PS, 1 otherwise. ['ORI'] = { 2, do_ORI }, -- alias for OR PS,#VV ; ['NOP'] = { 1, do_NOP }, ['NOP_X'] = { 1, do_NOP_X }, -- Unused instruction. ['POP'] = { 1, do_POP }, ['PUSH'] = { 1, do_PUSH }, ['RET'] = { 1, do_RET }, ['RETI'] = { 1, do_RETI }, ['ROL'] = { 2, do_ROL }, ['ROL.WT'] = { 2, do_ROL_WT }, ['ROR'] = { 2, do_ROR }, |
︙ | ︙ |