Java YVM Example

Introduction

The java yvm example is extracted from the most popular open source projects, you can refer to the following example for usage.

Programming language: Java

Class/type: YVM

Example#1
File: YVMasm.javaProject: sawlyst/Compilo

 public void iffaux() {
   Ecriture.ecrireString(o, "; ");
   super.iffaux();
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "cmp ax,0");
   Ecriture.ecrireStringln(o, "je " + structureConditionnelleActuelle.getEtiquetteSuivante());
 }

Example#2
File: YVMasm.javaProject: sawlyst/Compilo

 public void ineg() {
   Ecriture.ecrireString(o, "; ");
   super.ineg();
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "neg ax");
   Ecriture.ecrireStringln(o, "push ax");
 }

Example#3
File: YVMasm.javaProject: sawlyst/Compilo

 public void queue() {
   Ecriture.ecrireString(o, "; ");
   super.queue();
   Ecriture.ecrireStringln(o, "nop");
   Ecriture.ecrireStringln(o, "EXITCODE");
   Ecriture.ecrireStringln(o, "end debut");
 }

Example#4
File: YVMasm.javaProject: sawlyst/Compilo

 public void ifeq(String etiquette) {
   Ecriture.ecrireString(o, "; ");
   super.ifeq(etiquette);
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "cmp ax,0");
   Ecriture.ecrireStringln(o, "je " + etiquette);
 }

Example#5
File: YVMasm.javaProject: sawlyst/Compilo

 public void iload(int offset) {
   Ecriture.ecrireString(o, "; ");
   super.iload(offset);
   String signe = "";
   if (offset >= 0) signe = "+";
   Ecriture.ecrireStringln(o, "push word ptr [bp" + signe + offset + "]");
 }

Example#6
File: YVMasm.javaProject: sawlyst/Compilo

 public void isub() {
   Ecriture.ecrireString(o, "; ");
   super.isub();
   Ecriture.ecrireStringln(o, "pop bx");
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "sub ax,bx");
   Ecriture.ecrireStringln(o, "push ax");
 }

Example#7
File: YVMasm.javaProject: sawlyst/Compilo

 public void ior() {
   Ecriture.ecrireString(o, "; ");
   super.ior();
   Ecriture.ecrireStringln(o, "pop bx");
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "or ax,bx");
   Ecriture.ecrireStringln(o, "push ax");
 }

Example#8
File: YVMasm.javaProject: sawlyst/Compilo

 public void imul() {
   Ecriture.ecrireString(o, "; ");
   super.imul();
   Ecriture.ecrireStringln(o, "pop bx");
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "imul bx");
   Ecriture.ecrireStringln(o, "push ax");
 }

Example#9
File: YVMasm.javaProject: sawlyst/Compilo

 public void ireturn(int offset) {
   Ecriture.ecrireString(o, "; ");
   super.ireturn(offset);
   Ecriture.ecrireStringln(o, "pop ax");
   String signe = "";
   if (offset >= 0) signe = "+";
   Ecriture.ecrireStringln(o, "mov [bp" + signe + offset + "],ax");
 }

Example#10
File: YVMasm.javaProject: sawlyst/Compilo

 public void iand() {
   Ecriture.ecrireString(o, "; ");
   super.iand();
   Ecriture.ecrireStringln(o, "pop bx");
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "and ax,bx");
   Ecriture.ecrireStringln(o, "push ax");
 }

Example#11
File: YVMasm.javaProject: sawlyst/Compilo

 public void idiv() {
   Ecriture.ecrireString(o, "; ");
   super.idiv();
   Ecriture.ecrireStringln(o, "pop bx");
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "cwd");
   Ecriture.ecrireStringln(o, "idiv bx");
   Ecriture.ecrireStringln(o, "push ax");
 }

Example#12
File: YVMasm.javaProject: sawlyst/Compilo

 public void lireEnt(int offset) {
   Ecriture.ecrireString(o, "; ");
   super.lireEnt(offset);
   String signe = "";
   if (offset >= 0) signe = "+";
   Ecriture.ecrireStringln(o, "lea dx,[bp" + signe + offset + "]");
   Ecriture.ecrireStringln(o, "push dx");
   Ecriture.ecrireStringln(o, "call lirent");
 }

Example#13
File: YVMasm.javaProject: sawlyst/Compilo

 public void entete() {
   Ecriture.ecrireString(o, "; ");
   super.entete();
   Ecriture.ecrireStringln(
       o, "extrn lirent:proc, ecrent:proc, ecrbool:proc, ecrch:proc, ligsuiv:proc");
   Ecriture.ecrireStringln(o, ".model SMALL");
   Ecriture.ecrireStringln(o, ".586");
   Ecriture.ecrireStringln(o, "");
   Ecriture.ecrireStringln(o, ".CODE");
 }

Example#14
File: YVMasm.javaProject: sawlyst/Compilo

 public void iinf() {
   Ecriture.ecrireString(o, "; ");
   super.iinf();
   Ecriture.ecrireStringln(o, "pop bx");
   Ecriture.ecrireStringln(o, "pop ax");
   Ecriture.ecrireStringln(o, "cmp ax,bx");
   Ecriture.ecrireStringln(o, "jge $+6");
   Ecriture.ecrireStringln(o, "push -1");
   Ecriture.ecrireStringln(o, "jmp $+4");
   Ecriture.ecrireStringln(o, "push 0");
 }

Example#15
File: YVMasm.javaProject: sawlyst/Compilo

 public void ecrireChaine(String s) {
   Ecriture.ecrireString(o, "; ");
   super.ecrireChaine(s);
   Ecriture.ecrireStringln(o, ".DATA");
   String tmp = s.substring(0, s.length() - 1);
   Ecriture.ecrireStringln(o, "mess" + cmptChaine + " DB " + tmp + "$\"");
   Ecriture.ecrireStringln(o, ".CODE");
   Ecriture.ecrireStringln(o, "lea dx,mess" + cmptChaine);
   Ecriture.ecrireStringln(o, "push dx");
   Ecriture.ecrireStringln(o, "call ecrch");
   cmptChaine++;
 }

Example#16
File: YVMasm.javaProject: sawlyst/Compilo

 public void call(String nom) {
   Ecriture.ecrireString(o, "; ");
   super.call(nom);
   Ecriture.ecrireStringln(o, "call " + nom);
 }

Example#17
File: YVMasm.javaProject: sawlyst/Compilo

 public void ecrireBool() {
   Ecriture.ecrireString(o, "; ");
   super.ecrireBool();
   Ecriture.ecrireStringln(o, "call ecrbool");
 }

Example#18
File: YVMasm.javaProject: sawlyst/Compilo

 public void aLaLigne() {
   Ecriture.ecrireString(o, "; ");
   super.aLaLigne();
   Ecriture.ecrireStringln(o, "call ligsuiv");
 }

Example#19
File: YVMasm.javaProject: sawlyst/Compilo

 public void ouvreBloc(int taille) {
   Ecriture.ecrireString(o, "; ");
   super.ouvreBloc(taille);
   Ecriture.ecrireStringln(o, "enter " + taille + ",0");
 }

Example#20
File: YVMasm.javaProject: sawlyst/Compilo

 public void fermeBloc(int taille) {
   Ecriture.ecrireString(o, "; ");
   super.fermeBloc(taille);
   Ecriture.ecrireStringln(o, "leave ");
   Ecriture.ecrireStringln(o, "ret " + taille);
 }

Example#21
File: YVMasm.javaProject: sawlyst/Compilo

 public void sinon() {
   Ecriture.ecrireString(o, "; ");
   super.sinon();
   Ecriture.ecrireStringln(o, "jmp " + conditions.getEtiquetteFin());
   Ecriture.ecrireStringln(o, conditions.getEtiquetteSinon() + ":");
 }

Example#22
File: YVMasm.javaProject: sawlyst/Compilo

 public void fait() {
   Ecriture.ecrireString(o, "; ");
   super.fait();
   Ecriture.ecrireStringln(o, "jmp " + iterations.getEtiquetteDebut() + "\n");
   Ecriture.ecrireStringln(o, iterations.getEtiquetteFinAndFinish() + ":");
 }

Example#23
File: YVMasm.javaProject: sawlyst/Compilo

 public void ouvrePrinc(int offset) {
   Ecriture.ecrireString(o, "; ");
   super.ouvrePrinc(offset);
   Ecriture.ecrireStringln(o, "mov bp,sp");
   Ecriture.ecrireStringln(o, "sub sp," + offset);
 }

Example#24
File: YVMasm.javaProject: sawlyst/Compilo

 public void igoto(int etiquette) {
   Ecriture.ecrireString(o, "; ");
   super.igoto(etiquette);
   Ecriture.ecrireStringln(o, "jmp " + etiquette);
 }

Example#25
File: YVMasm.javaProject: sawlyst/Compilo

 public void reserveRetour() {
   Ecriture.ecrireString(o, "; ");
   super.reserveRetour();
   Ecriture.ecrireStringln(o, "sub sp,2");
 }

Example#26
File: YVMasm.javaProject: sawlyst/Compilo

 public void iconst(int valeur) {
   Ecriture.ecrireString(o, "; ");
   super.iconst(valeur);
   Ecriture.ecrireStringln(o, "push word ptr " + valeur);
 }

Example#27
File: YVMasm.javaProject: sawlyst/Compilo

 public void nomFonc(String nom) {
   Ecriture.ecrireString(o, "; ");
   super.nomFonc(nom);
   Ecriture.ecrireStringln(o, nom + ":");
 }

Example#28
File: YVMasm.javaProject: sawlyst/Compilo

 public void ecrireEnt() {
   Ecriture.ecrireString(o, "; ");
   super.ecrireEnt();
   Ecriture.ecrireStringln(o, "call ecrent");
 }