OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [asmdata.cpp] - Diff between revs 46 and 60

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 46 Rev 60
Line 387... Line 387...
                                lln->addline(new ILINE(zp.op_not(m_opb)));
                                lln->addline(new ILINE(zp.op_not(m_opb)));
                                lln->addline(new ILINE(zp.op_add(1,m_opb)));
                                lln->addline(new ILINE(zp.op_add(1,m_opb)));
                                return lln;
                                return lln;
                        }break;
                        }break;
                case OP_JMP:
                case OP_JMP:
                        if (!fitsin(imm, 16))
                        if (m_opb == zp.ZIP_Rnone) {
                                yyerror("JMP: Immediate out of range");
 
                        else if (m_opb == zp.ZIP_Rnone) {
 
                                if (m_cond != zp.ZIPC_ALWAYS)
                                if (m_cond != zp.ZIPC_ALWAYS)
                                        yyerror("JMP: Conditions are not allowed for absolute jumps.");
                                        yyerror("JMP: Conditions are not allowed for absolute jumps.");
                                imm &= (1<<24)-1;
                                imm &= (1<<24)-1;
                                if (!fitsin(imm, 24))
                                if (!fitsin(imm, 24))
                                        yyerror("JMP: Absolute jump address out of range");
                                        yyerror("JMP: Absolute jump address out of range");
                                zp.op_ldi(imm, zp.ZIP_PC);
                                in = zp.op_ldi(imm, zp.ZIP_PC);
                        }
                        } else if (fitsin(imm,16)) {
                        in = zp.op_mov(m_cond, imm, m_opb, zp.ZIP_PC);
                        in = zp.op_mov(m_cond, imm, m_opb, zp.ZIP_PC);
 
                        } else if (fitsin(imm,20))
 
                                in = zp.op_add(m_cond, imm, m_opb, zp.ZIP_PC);
 
                        else
 
                                yyerror("JMP: Immediate out of range");
 
                        break;
                case OP_BRA:
                case OP_BRA:
                        BLD_BRANCH(op_bra,ZIPC_ALWAYS)
                        BLD_BRANCH(op_bra,ZIPC_ALWAYS)
                        break;
                        break;
                case OP_BZ:
                case OP_BZ:
                        BLD_BRANCH(op_brz,ZIPC_Z)
                        BLD_BRANCH(op_brz,ZIPC_Z)
Line 431... Line 434...
                                in = zp.op_clrf(m_cond, m_opb);
                                in = zp.op_clrf(m_cond, m_opb);
                        break;
                        break;
                case OP_TRAP:
                case OP_TRAP:
                        if((m_opb == zp.ZIP_Rnone)&&(m_cond == zp.ZIPC_ALWAYS))
                        if((m_opb == zp.ZIP_Rnone)&&(m_cond == zp.ZIPC_ALWAYS))
                                in = zp.op_ldi(imm, zp.ZIP_CC);
                                in = zp.op_ldi(imm, zp.ZIP_CC);
                        else if((m_opb == zp.ZIP_Rnone)&&((imm&0x0ffff)==imm))
                        else if((m_opb == zp.ZIP_Rnone)&&((imm&0x0ffdf)==imm))
                                in = zp.op_ldilo(imm, zp.ZIP_CC);
                                in = zp.op_ldilo(m_cond, imm & 0x0ffdf, zp.ZIP_CC);
                        else if((m_opb != zp.ZIP_Rnone)&&(fitsin(imm, 16)))
                        else if((m_opb != zp.ZIP_Rnone)&&(fitsin(imm, 16)))
                                in = zp.op_mov(m_cond, imm, m_opb, zp.ZIP_CC);
                                in = zp.op_mov(m_cond, imm, m_opb, zp.ZIP_CC);
                        else {
                        else {
                                yyerror("Illegal trap!");
                                yyerror("Illegal trap!");
                                in = zp.op_trap(m_cond, 0);
                                in = zp.op_trap(m_cond, 0);

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.