Skip to content

Instantly share code, notes, and snippets.

@Alikberov
Last active June 7, 2023 18:18
Show Gist options
  • Save Alikberov/9b26f6e254c372b9b70b93e6e3221805 to your computer and use it in GitHub Desktop.
Save Alikberov/9b26f6e254c372b9b70b93e6e3221805 to your computer and use it in GitHub Desktop.
MMX-Instructions Simulator
<html>
<head>
<meta http-equiv=refresh content='3600'>
<title>It's Koyaanisqatsi, baby!</title>
<!-----------------------------------------------------------------------------
BigInt.prototype.PADD = function(n, mask) {
return (((this & mask) + (n & mask))) ^ ((this ^ n) & ~mask);
}
BigInt.prototype.PADD = function(n, mask) {
var m = BigInt(this);
'use asm';
m = m|0n;
n = n|0n;
mask = mask|0n;
return ((((m & mask) + (n & mask))) ^ ((m ^ n) & ~mask))|0n;
}
------------------------------------------------------------------------------>
<style>
/*<!---------------------------------------------------------------------------
--- User Interface Design Presets
---------------------------------------------------------------------------->*/
:root,
:root.Style0
{ /**********************************/
/*** "Chromed" Style ***/
/**********************************/
/* Caption */
--caption :repeating-linear-gradient(45deg, whitesmoke, grey 2px);/* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :black; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :repeating-linear-gradient(45deg,whitesmoke,silver 2px);/* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :silver; /* Menu Topic Edge Color */
--menu-open :whitesmoke; /* Menu Topic Openned Color */
--menu-open-claw:2px 2px 2px white; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:whitesmoke; /* Menu Topic Openned Edge Color */
--menu-open-text:black; /* Menu Topic Openned Text Color */
--menu-over :whitesmoke; /* Menu Topic Color On Mouse Over */
--menu-over-claw:2px 2px 2px white; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:whitesmoke; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:black; /* Menu Topic Text Color On Mouse Over */
--menu-push :whitesmoke; /* Menu Topic Pushed Color */
--menu-push-claw:2px 2px 2px white; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:silver; /* Menu Topic Pushed Edge Color */
--menu-push-text:black; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :repeating-linear-gradient(45deg, white, silver 1px); /* Menu Item Color */
--item-claw :2px 2px 2px grey; /* Menu Item Shadow Effect */
--item-edge :silver; /* Menu Item Edge Color */
--item-over :repeating-linear-gradient(45deg, white, silver 1px); /* Menu Item Color On Mouse Over */
--item-over-claw:1px 1px 1px grey; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:silver; /* Menu Item Edge Color On Mouse Over */
--item-over-text:black; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :repeating-linear-gradient(45deg, white,whitesmoke 8px);/* Floating Window Blank/BackGround Color */
--float-edge :silver; /* Floating Window Edge Color */
--float-text :black; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :silver; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :black; /* Listing TextArea Text Color */
--textrows :repeating-linear-gradient(45deg,whitesmoke,silver 2px);/* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :none; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :black; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :repeating-linear-gradient(45deg,whitesmoke,silver 2px);/* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :silver; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :repeating-linear-gradient(45deg,whitesmoke,silver 3px);/* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium whitesmoke; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'_'; /* Window Control Button "Collapse" Signature */
--maxi :repeating-linear-gradient(45deg,whitesmoke,silver 3px);/* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium whitesmoke; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25A1'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\29C9'; /* Window Control Button "Expanded/Restore" Signature */
--quit :repeating-linear-gradient(45deg,whitesmoke,silver 3px);/* Window Control Button "Exit" BackGround Color */
--quit-edge :medium whitesmoke; /* Window Control Button "Exit" Edge Style */
--quit-sign :'X'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style1
{ /**********************************/
/*** VisualBasic - Classic ***/
/**********************************/
/* Caption */
--caption :blue; /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :white; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :silver; /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :transparent; /* Menu Topic Edge Color */
--menu-open :black; /* Menu Topic Openned Color */
--menu-open-claw:none; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:transparent; /* Menu Topic Openned Edge Color */
--menu-open-text:white; /* Menu Topic Openned Text Color */
--menu-over :none; /* Menu Topic Color On Mouse Over */
--menu-over-claw:none; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:transparent; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:white; /* Menu Topic Text Color On Mouse Over */
--menu-push :blue; /* Menu Topic Pushed Color */
--menu-push-claw:none; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:transparent; /* Menu Topic Pushed Edge Color */
--menu-push-text:white; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :silver; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :transparent; /* Menu Item Edge Color */
--item-over :black; /* Menu Item Color On Mouse Over */
--item-over-claw:none; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:transparent; /* Menu Item Edge Color On Mouse Over */
--item-over-text:silver; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :silver; /* Floating Window Blank/BackGround Color */
--float-edge :transparent; /* Floating Window Edge Color */
--float-text :black; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :navy; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :white; /* Listing TextArea Text Color */
--textrows :darkcyan; /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :none; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :black; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :darkcyan; /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :transparent; /* Status Bar Edge Color */
--status-text :white; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :white; /* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium silver; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'\25BC'; /* Window Control Button "Collapse" Signature */
--maxi :white; /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium silver; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25B4'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\25C6'; /* Window Control Button "Expanded/Restore" Signature */
--quit :white; /* Window Control Button "Exit" BackGround Color */
--quit-edge :medium silver; /* Window Control Button "Exit" Edge Style */
--quit-sign :'\25AD'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style2
{ /**********************************/
/*** Macintosh Classic ***/
/**********************************/
/* Caption */
--caption :repeating-linear-gradient(0deg, silver, white 3px); /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :black; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :linear-gradient(0deg, grey, white); /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :silver; /* Menu Topic Edge Color */
--menu-open :linear-gradient(-90deg, white, grey); /* Menu Topic Openned Color */
--menu-open-claw:2px 2px 2px white; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:silver; /* Menu Topic Openned Edge Color */
--menu-open-text:black; /* Menu Topic Openned Text Color */
--menu-over :linear-gradient(90deg, white, grey); /* Menu Topic Color On Mouse Over */
--menu-over-claw:2px 2px 2px white; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:silver; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:black; /* Menu Topic Text Color On Mouse Over */
--menu-push :linear-gradient(-90deg, silver, black); /* Menu Topic Pushed Color */
--menu-push-claw:2px 2px 2px white; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:silver; /* Menu Topic Pushed Edge Color */
--menu-push-text:black; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :silver; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :silver; /* Menu Item Edge Color */
--item-over :linear-gradient(0deg, grey, white); /* Menu Item Color On Mouse Over */
--item-over-claw:2px 2px 2px white; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:silver; /* Menu Item Edge Color On Mouse Over */
--item-over-text:black; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :silver; /* Floating Window Blank/BackGround Color */
--float-edge :silver; /* Floating Window Edge Color */
--float-text :black; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :lightcyan; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :black; /* Listing TextArea Text Color */
--textrows :linear-gradient(90deg, cyan, lightcyan); /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :none; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :black; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :linear-gradient(0deg, grey, white); /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :silver; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :50%; /* Window Control Buttons Rounding Radius */
--mini :linear-gradient(135deg,lightgreen, green); /* Window Control Button "Collapse" BackGround Color */
--mini-edge :thin lightgreen; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'\00A0\00A0'; /* Window Control Button "Collapse" Signature */
--maxi :linear-gradient(135deg, yellow, orange); /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :thin orange; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\00A0\00A0'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\00A0\00A0'; /* Window Control Button "Expanded/Restore" Signature */
--quit :linear-gradient(135deg, orange, red); /* Window Control Button "Exit" BackGround Color */
--quit-edge :thin red; /* Window Control Button "Exit" Edge Style */
--quit-sign :'\00A0\00A0'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style3
{ /**********************************/
/*** Windows'3.1 - Classic ***/
/**********************************/
/* Caption */
--caption :darkblue; /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :white; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :silver; /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :silver; /* Menu Topic Edge Color */
--menu-open :blue; /* Menu Topic Openned Color */
--menu-open-claw:none; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:transparent; /* Menu Topic Openned Edge Color */
--menu-open-text:white; /* Menu Topic Openned Text Color */
--menu-over :none; /* Menu Topic Color On Mouse Over */
--menu-over-claw:none; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:transparent; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:black; /* Menu Topic Text Color On Mouse Over */
--menu-push :blue; /* Menu Topic Pushed Color */
--menu-push-claw:none; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:transparent; /* Menu Topic Pushed Edge Color */
--menu-push-text:white; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :silver; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :silver; /* Menu Item Edge Color */
--item-over :blue; /* Menu Item Color On Mouse Over */
--item-over-claw:none; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:silver; /* Menu Item Edge Color On Mouse Over */
--item-over-text:white; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :silver; /* Floating Window Blank/BackGround Color */
--float-edge :silver; /* Floating Window Edge Color */
--float-text :black; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :white; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :black; /* Listing TextArea Text Color */
--textrows :grey; /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :none; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :white; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :silver; /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :silver; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :white; /* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium silver; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'\25BC'; /* Window Control Button "Collapse" Signature */
--maxi :white; /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium silver; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25B4'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\25C6'; /* Window Control Button "Expanded/Restore" Signature */
--quit :white; /* Window Control Button "Exit" BackGround Color */
--quit-edge :medium silver; /* Window Control Button "Exit" Edge Style */
--quit-sign :'\25AD'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style4
{ /**********************************/
/*** Windows'3.1 - Dark ***/
/**********************************/
/* Caption */
--caption :darkblue; /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :white; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :grey; /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :silver; /* Menu Topic Edge Color */
--menu-open :blue; /* Menu Topic Openned Color */
--menu-open-claw:none; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:silver; /* Menu Topic Openned Edge Color */
--menu-open-text:white; /* Menu Topic Openned Text Color */
--menu-over :none; /* Menu Topic Color On Mouse Over */
--menu-over-claw:none; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:silver; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:black; /* Menu Topic Text Color On Mouse Over */
--menu-push :blue; /* Menu Topic Pushed Color */
--menu-push-claw:none; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:silver; /* Menu Topic Pushed Edge Color */
--menu-push-text:black; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :grey; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :silver; /* Menu Item Edge Color */
--item-over :blue; /* Menu Item Color On Mouse Over */
--item-over-claw:none; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:silver; /* Menu Item Edge Color On Mouse Over */
--item-over-text:white; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :black; /* Floating Window Blank/BackGround Color */
--float-edge :grey; /* Floating Window Edge Color */
--float-text :lightgreen; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :black; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :white; /* Listing TextArea Text Color */
--textrows :black; /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :none; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :grey; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :grey; /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :silver; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :grey; /* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium silver; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'\25BC'; /* Window Control Button "Collapse" Signature */
--maxi :grey; /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium silver; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25B4'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\25C6'; /* Window Control Button "Expanded/Restore" Signature */
--quit :grey; /* Window Control Button "Exit" BackGround Color */
--quit-edge :medium silver; /* Window Control Button "Exit" Edge Style */
--quit-sign :'\25AD'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style5
{ /**********************************/
/*** Windows'95 - Classic ***/
/**********************************/
/* Caption */
--caption :darkblue; /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :white; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :silver; /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :silver; /* Menu Topic Edge Color */
--menu-open :blue; /* Menu Topic Openned Color */
--menu-open-claw:none; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:silver; /* Menu Topic Openned Edge Color */
--menu-open-text:white; /* Menu Topic Openned Text Color */
--menu-over :none; /* Menu Topic Color On Mouse Over */
--menu-over-claw:none; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:silver; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:black; /* Menu Topic Text Color On Mouse Over */
--menu-push :blue; /* Menu Topic Pushed Color */
--menu-push-claw:none; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:silver; /* Menu Topic Pushed Edge Color */
--menu-push-text:white; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :silver; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :silver; /* Menu Item Edge Color */
--item-over :blue; /* Menu Item Color On Mouse Over */
--item-over-claw:none; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:silver; /* Menu Item Edge Color On Mouse Over */
--item-over-text:white; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :silver; /* Floating Window Blank/BackGround Color */
--float-edge :silver; /* Floating Window Edge Color */
--float-text :black; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :white; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :black; /* Listing TextArea Text Color */
--textrows :grey; /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :none; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :white; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :silver; /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :silver; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :white; /* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium silver; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'_'; /* Window Control Button "Collapse" Signature */
--maxi :white; /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium silver; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25A1'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\29C9'; /* Window Control Button "Expanded/Restore" Signature */
--quit :white; /* Window Control Button "Exit" BackGround Color */
--quit-edge :medium silver; /* Window Control Button "Exit" Edge Style */
--quit-sign :'X'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style6
{ /**********************************/
/*** Windows'95 - Dark ***/
/**********************************/
/* Caption */
--caption :darkblue; /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :white; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :grey; /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :transparent; /* Menu Topic Edge Color */
--menu-open :blue; /* Menu Topic Openned Color */
--menu-open-claw:none; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:transparent; /* Menu Topic Openned Edge Color */
--menu-open-text:white; /* Menu Topic Openned Text Color */
--menu-over :none; /* Menu Topic Color On Mouse Over */
--menu-over-claw:none; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:transparent; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:black; /* Menu Topic Text Color On Mouse Over */
--menu-push :blue; /* Menu Topic Pushed Color */
--menu-push-claw:none; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:transparent; /* Menu Topic Pushed Edge Color */
--menu-push-text:white; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :grey; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :silver; /* Menu Item Edge Color */
--item-over :blue; /* Menu Item Color On Mouse Over */
--item-over-claw:none; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:silver; /* Menu Item Edge Color On Mouse Over */
--item-over-text:white; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :black; /* Floating Window Blank/BackGround Color */
--float-edge :grey; /* Floating Window Edge Color */
--float-text :lightgreen; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :black; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :white; /* Listing TextArea Text Color */
--textrows :grey; /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :none; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :white; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :grey; /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :silver; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :silver; /* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium silver; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'_'; /* Window Control Button "Collapse" Signature */
--maxi :silver; /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium silver; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25A1'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\29C9'; /* Window Control Button "Expanded/Restore" Signature */
--quit :silver; /* Window Control Button "Exit" BackGround Color */
--quit-edge :medium silver; /* Window Control Button "Exit" Edge Style */
--quit-sign :'X'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style7
{ /**********************************/
/*** TurboPascal'7 - Classic ***/
/**********************************/
/* Caption */
--caption :blue; /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :white; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :darkcyan; /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :transparent; /* Menu Topic Edge Color */
--menu-open :black; /* Menu Topic Openned Color */
--menu-open-claw:none; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:transparent; /* Menu Topic Openned Edge Color */
--menu-open-text:white; /* Menu Topic Openned Text Color */
--menu-over :none; /* Menu Topic Color On Mouse Over */
--menu-over-claw:none; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:transparent; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:white; /* Menu Topic Text Color On Mouse Over */
--menu-push :blue; /* Menu Topic Pushed Color */
--menu-push-claw:none; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:transparent; /* Menu Topic Pushed Edge Color */
--menu-push-text:white; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :darkcyan; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :transparent; /* Menu Item Edge Color */
--item-over :black; /* Menu Item Color On Mouse Over */
--item-over-claw:none; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:transparent; /* Menu Item Edge Color On Mouse Over */
--item-over-text:white; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :teal; /* Floating Window Blank/BackGround Color */
--float-edge :transparent; /* Floating Window Edge Color */
--float-text :white; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :navy; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :white; /* Listing TextArea Text Color */
--textrows :blue; /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :none; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :white; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :darkcyan; /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :transparent; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :white; /* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium silver; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'\25BC'; /* Window Control Button "Collapse" Signature */
--maxi :white; /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium silver; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25B4'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\25C6'; /* Window Control Button "Expanded/Restore" Signature */
--quit :white; /* Window Control Button "Exit" BackGround Color */
--quit-edge :medium silver; /* Window Control Button "Exit" Edge Style */
--quit-sign :'\25AD'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style8
{ /**********************************/
/*** Windows'98 - Classic ***/
/**********************************/
/* Caption */
--caption :linear-gradient(45deg, blue, cyan); /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :white; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :silver; /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :transparent; /* Menu Topic Edge Color */
--menu-open :inherit; /* Menu Topic Openned Color */
--menu-open-claw:2px 2px 2px white; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:silver; /* Menu Topic Openned Edge Color */
--menu-open-text:black; /* Menu Topic Openned Text Color */
--menu-over :none; /* Menu Topic Color On Mouse Over */
--menu-over-claw:none; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:silver; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:black; /* Menu Topic Text Color On Mouse Over */
--menu-push :blue; /* Menu Topic Pushed Color */
--menu-push-claw:2px 2px 2px white; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:transparent; /* Menu Topic Pushed Edge Color */
--menu-push-text:white; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :silver; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :silver; /* Menu Item Edge Color */
--item-over :blue; /* Menu Item Color On Mouse Over */
--item-over-claw:none; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:silver; /* Menu Item Edge Color On Mouse Over */
--item-over-text:white; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :silver; /* Floating Window Blank/BackGround Color */
--float-edge :grey; /* Floating Window Edge Color */
--float-text :black; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :white; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :black; /* Listing TextArea Text Color */
--textrows :grey; /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :2px 2px 2px white; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :white; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :silver; /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :silver; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :silver; /* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium silver; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'_'; /* Window Control Button "Collapse" Signature */
--maxi :silver; /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium silver; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25A1'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\29C9'; /* Window Control Button "Expanded/Restore" Signature */
--quit :silver; /* Window Control Button "Exit" BackGround Color */
--quit-edge :medium silver; /* Window Control Button "Exit" Edge Style */
--quit-sign :'X'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
:root.Style9
{ /**********************************/
/*** Windows'98 - Dark ***/
/**********************************/
/* Caption */
--caption :linear-gradient(45deg, darkblue, blue); /* Caption BackGround Color */
--caption-claw :none; /* Caption/Title Shadow Effect */
--caption-text :white; /* Caption/Title Text Color */
/* Button */
--button :silver; /* Button Face 3D Color */
--button-edge :silver; /* Button Edge Color */
--button-text :black; /* Button Text Color */
/* Menu Topic */
--menu :grey; /* Menu Topic Color */
--menu-claw :none; /* Menu Topic Shadow Effect */
--menu-edge :transparent; /* Menu Topic Edge Color */
--menu-open :inherit; /* Menu Topic Openned Color */
--menu-open-claw:2px 2px 2px silver; /* Menu Topic Openned Shadow Effect */
--menu-open-edge:silver; /* Menu Topic Openned Edge Color */
--menu-open-text:white; /* Menu Topic Openned Text Color */
--menu-over :none; /* Menu Topic Color On Mouse Over */
--menu-over-claw:none; /* Menu Topic Shadow Effect On Mouse Over */
--menu-over-edge:silver; /* Menu Topic Edge Color On Mouse Over */
--menu-over-text:black; /* Menu Topic Text Color On Mouse Over */
--menu-push :blue; /* Menu Topic Pushed Color */
--menu-push-claw:2px 2px 2px white; /* Menu Topic Pushed Shadow Effect */
--menu-push-edge:transparent; /* Menu Topic Pushed Edge Color */
--menu-push-text:white; /* Menu Topic Pushed Text Color */
--menu-text :black; /* Menu Topic Text Color */
/* Menu Topic Item */
--item :grey; /* Menu Item Color */
--item-claw :none; /* Menu Item Shadow Effect */
--item-edge :silver; /* Menu Item Edge Color */
--item-over :blue; /* Menu Item Color On Mouse Over */
--item-over-claw:none; /* Menu Item Shadow Effect On Mouse Over */
--item-over-edge:silver; /* Menu Item Edge Color On Mouse Over */
--item-over-text:white; /* Menu Item Text Color On Mouse Over */
--item-text :black; /* Menu Item Text Color */
/* Floating Window */
--float :black; /* Floating Window Blank/BackGround Color */
--float-edge :grey; /* Floating Window Edge Color */
--float-text :lightgreen; /* Floating Window Text Color */
--float-opacity :90%; /* Floating Window Opacity */
/* Listing TextArea */
--textarea :black; /* Listing TextArea Blank/BackGround Color */
--textarea-claw :none; /* Listing TextArea Shadow Effect */
--textarea-text :white; /* Listing TextArea Text Color */
--textrows :grey; /* Listing TextArea-Rows Blank/BackGround Color */
--textrows-claw :2px 2px 2px white; /* Listing TextArea-Rows Shadow Effect */
--textrows-text :white; /* Listing TextArea-Rows Text Color */
/* Status Bar */
--status :grey; /* Status Bar Color */
--status-claw :none; /* Status Bar Shadow Effect */
--status-edge :silver; /* Status Bar Edge Color */
--status-text :black; /* Status Bar Text Color */
/* Main Window Control Buttons */
--radius :0%; /* Window Control Buttons Rounding Radius */
--mini :silver; /* Window Control Button "Collapse" BackGround Color */
--mini-edge :medium silver; /* Window Control Button "Collapse" Edge Style */
--mini-sign :'_'; /* Window Control Button "Collapse" Signature */
--maxi :silver; /* Window Control Button "Expanding" BackGround Color */
--maxi-edge :medium silver; /* Window Control Button "Expanding" Edge Style */
--maxi-sign :'\25A1'; /* Window Control Button "Expand" Signature */
--maximal-sign :'\29C9'; /* Window Control Button "Expanded/Restore" Signature */
--quit :silver; /* Window Control Button "Exit" BackGround Color */
--quit-edge :medium silver; /* Window Control Button "Exit" Edge Style */
--quit-sign :'X'; /* Window Control Button "Exit" Signature */
/* Graphical Canvas BackGround */
--display-bg :linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%)
,linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
}
</style>
<script type='text/plain' title="Bresenham's x86-line (Quick Interactive Canvas)">
::x86 ; revision 20230323
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Please, Move Your Mouse over Live
; Canvas and Mark Line by Clicking.
Line: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov rax,0xFFBBCC9900000000
mov eax,[Canvas.y1],[Canvas.x1] ; Canvas Line x1,y1
mov ecx,[Canvas.y2],[Canvas.x2] ; Canvas Line x2,y2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
add cx,ax
sub ecx,eax ; ecx{y2:x2} -= eax{y1:x1}
sbb ebx,ebx
sub cx,ax
sbb bx,bx
xor ecx,ebx
add cx,bx
sub ecx,ebx ; ecx{y2:x2} = abs(y2:x2)
or ebx,0x000010001 ; ebx{dy:dx} = sgn(dy:dx)
and ebx,0x07FFF7FFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov edx,ecx
ror edx,16 ; edx = abs(dx:dy)
mov edi,edx
add dx,cx
sub edx,ecx
sbb esi,esi
sub dx,cx
sbb si,si ; esi = abs(dx:dy) < abs(dy:dx)
movsx esi,si
and ecx,esi
not esi
and edi,esi
or ecx,edi ; ecx = {shorter:longer}
mov edx,ecx
shl ecx,16
mov cx,dx ; ecx = {counter:longer}
shr dx,1 ; edx = {delta_err:error}
not si
mov [length],cx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.canvas clear
.log clear
.log length
.log " ????????_YYYY_XXXX"
.repeat
.Step: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log RAX," YYYY_XXXX"
.canvas rax
shld edi,edx,16 ; di = HI(edx)
add dx,di
cmp cx,dx
sbb edi,edi
and di,cx
sub dx,di
sar edi,16
or edi,esi
and edi,ebx
add eax,edi
and eax,0x07FFF7FFF
sub ecx,0x000010000
.repeat length
.log "Coordinates logging..."
</script>
<script type='text/plain' title="Bresenham's x86-line (Interactive Canvas)">
::x86 ; revision 20230323
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Please, Move Your Mouse over Live
; Canvas and Mark Line by Clicking.
Line: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov rax,0xFFBBCC9900000000
mov eax,[Canvas.y1],[Canvas.x1] ; Canvas Line x1,y1
mov ecx,[Canvas.y2],[Canvas.x2] ; Canvas Line x2,y2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
add cx,ax
sub ecx,eax ; ecx{y2:x2} -= eax{y1:x1}
sbb ebx,ebx
sub cx,ax
sbb bx,bx
xor ecx,ebx
add cx,bx
sub ecx,ebx ; ecx{y2:x2} = abs(y2:x2)
or ebx,0x000010001 ; ebx{dy:dx} = sgn(dy:dx)
and ebx,0x07FFF7FFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov edx,ecx
ror edx,16 ; edx = abs(dx:dy)
mov edi,edx
add dx,cx
sub edx,ecx
sbb esi,esi
sub dx,cx
sbb si,si ; esi = abs(dx:dy) < abs(dy:dx)
movsx esi,si
and ecx,esi
not esi
and edi,esi
or ecx,edi ; ecx = {shorter:longer}
mov edx,ecx
shl ecx,16
mov cx,dx ; ecx = {counter:longer}
shr dx,1 ; edx = {delta_err:error}
not si
mov length,cx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.canvas clear
.log clear
.log length
.log " ????????_YYYY_XXXX"
.repeat
.Step: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log RAX," YYYY_XXXX"
.canvas rax
shld edi,edx,16 ; di = HI(edx)
add dx,di
cmp cx,dx
sbb edi,edi
and di,cx
sub dx,di
sar edi,16
or edi,esi
and edi,ebx
add eax,edi
and eax,0x07FFF7FFF
sub ecx,0x000010000
.repeat length
.log "Coordinates logging..."
</script>
<script type='text/plain' title="Bresenham's mmx-line (Interactive Canvas)">
::mmx ; revision 20230323
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Please, Move Your Mouse over Live
; Canvas and Mark Line by Clicking.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
col: .equ 0x_00000000_FFCCAA88 ; color
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line: ;movq mm2,[user_y2],[user_x2] ; Canvas Line x2,y2
;psubd mm2,[user_y1],[user_x1] ; Canvas Line x1,y1
movq mm2,[Canvas.y2],[Canvas.x2] ; Canvas Line x2,y2
psubd mm2,[Canvas.y1],[Canvas.x1] ; Canvas Line x1,y1
pxor mm0,mm0
pcmpgtd mm0,mm2 ; { y2:x2 < 0 }
pxor mm2,mm0
psubd mm2,mm0 ; { abs(y2:x2 - y1:x1) }
pcmpeqd mm1,mm1 ; { -1:-1 }
pslld mm0,1
psubd mm0,mm1 ; { sgn(y2:x2 - y1:x1) }
movq mm3,mm2
psrlq mm3,32
punpckldq mm3,mm2
movq mm4,mm2
pcmpgtd mm4,mm3 ; { master:slave mask }
movq mm1,mm4
pandn mm1,mm0 ; { slave:master directions }
pand mm0,mm4 ; { master:slave directions }
punpckldq mm4,mm4
pand mm2,mm4
pandn mm4,mm3
por mm2,mm4 ; { length_max:length_min }
movq length,mm2
movq mm5,mm2
psrlq mm5,32 ; { delta_err = max_length }
movq mm4,[Canvas.y1],[Canvas.x1] ; Load Canvas Start Coordinate
movq mm3,mm5
psrld mm3,1 ; { error = delta_err / 2 }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log clear
.log "Coordinates logging:"
.log " YYYYYYYY_XXXXXXXX"
.canvas clear
.repeat ; { prepare for iterations }
.Step: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log mm4
movq mm6,[col] ; { load pixel-color }
punpcklwd mm6,mm0 ; { prepare for mix with x,y-pos }
movq mm7,mm4 ; { load x,y-position }
packusdw mm7,mm6 ; { pack the color with position }
.canvas mm7 ; { set pixel to canvas }
paddd mm3,mm5 ; { error += delta_err }
movq mm6,mm3 ; { if error > length_min }
pcmpgtd mm6,mm2
movq mm7,mm2
pand mm7,mm6
psubd mm3,mm7 ; { then error -= length_min }
punpckldq mm6,mm6
pand mm6,mm1
paddd mm4,mm6 ; { then y:x += slave:master }
paddd mm4,mm0 ; { y:x += master:slave }
.repeat length ; { repeats few times }
.Ready: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log mm4 ; { y:x }
.log "Coordinates logging..."
</script>
<script type='text/plain' subtitle="Bresenham's line to [x,y]-array (mmx)">
::mmx ; revision 20230323
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
x1: .equ 0x_0000007E_00000040 ; y1 = 126, x1 = 64
x2: .equ 0x_00000064_0000005B ; y2 = 100, x2 = 86
col: .equ 0x_00000000_FFCCAA88 ; color
Addr: .equ 64000 ; Pixel pointer
width: .equ 1280 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line: movq mm1,[width]
punpckldq mm1,mm1
movq mm2,[x2] ; { mm2 = y2:x2 }
psubd mm2,[x1] ; { mm2 -= y1:x1 }
pxor mm0,mm0
pcmpgtd mm0,mm2 ; { y2:x2 < 0 }
pxor mm2,mm0
psubd mm2,mm0 ; { abs(y2:x2 - y1:x1) }
pcmpeqd mm7,mm7 ; { -1:-1 }
pxor mm1,mm0
psubd mm1,mm0
psrlq mm1,32
por mm1,mm0
pslld mm0,1
psubd mm0,mm7 ; { sgn(y2:x2 - y1:x1) }
punpckldq mm0,mm0
psrlq mm0,32 ; { mm0 = dx, mm5 = dy }
movq mm3,mm2
psrlq mm3,32
punpckldq mm3,mm2
movq mm5,mm2
movq mm4,mm5
punpckldq mm5,mm5
pand mm2,mm5
pandn mm5,mm3
por mm2,mm5 ; { length_max:length_min }
pcmpgtd mm4,mm3 ; { master:slave mask }
psrlq mm4,32
punpckldq mm4,mm4
movq mm7,mm4
movq mm6,mm4
movq mm5,mm4
pandn mm4,mm1 ; { slave:master directions }
pandn mm6,mm0
pand mm0,mm5 ; { master:slave directions }
por mm0,mm4
pand mm1,mm7
por mm1,mm6
movq length,mm2
movq mm5,mm2
psrlq mm5,32 ; { delta_err = max_length }
pcmpeqd mm7,mm7
psrlq mm7,32
pand mm0,mm7
pand mm1,mm7
movq mm4,[Addr]
movq mm3,mm5
psrld mm3,1 ; { error = delta_err / 2 }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log clear
.log "Coordinates logging:"
.log " YYYYYYYY_XXXXXXXX"
.log length
.canvas clear
.repeat ; { prepare for iterations }
.Step: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log mm4
movq mm6,[col] ; { load pixel-color }
punpcklwd mm6,mm0 ; { prepare for mix with x,y-pos }
movq mm7,mm4 ; { load x,y-position }
packusdw mm7,mm6 ; { pack the color with position }
.canvas mm7,width ; { set pixel to canvas }
paddd mm3,mm5 ; { error += delta_err }
movq mm6,mm3 ; { if error > length_min }
pcmpgtd mm6,mm2
movq mm7,mm2
pand mm7,mm6
psubd mm3,mm7 ; { then error -= length_min }
punpckldq mm6,mm6
pand mm6,mm1
paddd mm4,mm6 ; { then y:x += slave:master }
paddd mm4,mm0 ; { y:x += master:slave }
.repeat length ; { repeats few times }
.Ready: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log mm4 ; { y:x }
</script>
<script type='text/plain' subtitle="Bresenham's line to Pointer-array (mmx)">
::mmx ; revision 20230323
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
x1: .equ 0x_00000029_00000022 ; y1 = 126, x1 = 64
x2: .equ 0x_00000040_00000029 ; y2 = 100, x2 = 86
col: .equ 0x_00000000_FFCCAA88 ; color
Addr: .equ 57680 ; Pixel pointer
width: .equ 1280 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line: movq mm1,[width]
punpckldq mm1,mm1
movq mm2,[x2] ; { mm2 = y2:x2 }
psubd mm2,[x1] ; { mm2 -= y1:x1 }
pxor mm0,mm0
pcmpgtd mm0,mm2 ; { y2:x2 < 0 }
pxor mm2,mm0
psubd mm2,mm0 ; { abs(y2:x2 - y1:x1) }
pcmpeqd mm7,mm7 ; { -1:-1 }
pxor mm1,mm0
psubd mm1,mm0
psrlq mm1,32
pslld mm0,1
psubd mm0,mm7 ; { sgn(y2:x2 - y1:x1) }
; psrlq mm0,32 ; { mm0 = dx, mm5 = dy }
movq mm3,mm2
psrlq mm3,32
punpckldq mm3,mm2
movq mm5,mm2
pcmpgtd mm5,mm3 ; { master:slave mask }
punpckldq mm5,mm5
movq mm4,mm5
pand mm2,mm5
pandn mm5,mm3
por mm2,mm5 ; { length_max:length_min }
psrlq mm4,32
punpckldq mm4,mm4
movq mm7,mm4
movq mm6,mm4
movq mm5,mm4
pandn mm4,mm1 ; { slave:master directions }
pandn mm6,mm0
pand mm0,mm5 ; { master:slave directions }
por mm0,mm4
pand mm1,mm7
por mm1,mm6
movq length,mm2
movq mm5,mm2
psrlq mm5,32 ; { delta_err = max_length }
pcmpeqd mm7,mm7
psrlq mm7,32
pand mm0,mm7
pand mm1,mm7
movq mm4,[Addr]
movq mm3,mm5
psrld mm3,1 ; { error = delta_err / 2 }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log clear
.log "Coordinates logging:"
.log " YYYYYYYY_XXXXXXXX"
.log length
.canvas clear
.repeat ; { prepare for iterations }
.Step: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log mm4
movq mm6,[col] ; { load pixel-color }
punpckldq mm6,mm6 ; { prepare for mix with x,y-pos }
movq mm7,mm4 ; { load x,y-position }
punpckldq mm7,mm6 ; { pack the color with position }
.canvas mm7,width ; { set pixel to canvas }
paddd mm3,mm5 ; { error += delta_err }
movq mm6,mm3 ; { if error > length_min }
pcmpgtd mm6,mm2
movq mm7,mm2
pand mm7,mm6
psubd mm3,mm7 ; { then error -= length_min }
punpckldq mm6,mm6
pand mm6,mm1
paddd mm4,mm6 ; { then y:x += slave:master }
paddd mm4,mm0 ; { y:x += master:slave }
.repeat length ; { repeats few times }
.Ready: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log mm4 ; { y:x }
</script>
<script type='text/plain' subtitle="Bresenham's line to [x,y]-array (x86)">
::x86 ; revision 20230323
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov rax,0xFFBBCC9900000000
mov eax,0x0005F000E ; eax = {y1:y1}
mov ecx,0x000590018 ; ecx = {y2:x2}
mov eax,[user_y1],[user_x1]
mov ecx,[user_y2],[user_x2]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
add cx,ax
sub ecx,eax ; ecx{y2:x2} -= eax{y1:x1}
sbb ebx,ebx
sub cx,ax
sbb bx,bx
xor ecx,ebx
add cx,bx
sub ecx,ebx ; ecx{y2:x2} = abs(y2:x2)
or ebx,0x000010001 ; ebx{dy:dx} = sgn(dy:dx)
and ebx,0x07FFF7FFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov edx,ecx
ror edx,16 ; edx = abs(dx:dy)
mov edi,edx
add dx,cx
sub edx,ecx
sbb esi,esi
sub dx,cx
sbb si,si ; esi = abs(dx:dy) < abs(dy:dx)
movsx esi,si
and ecx,esi
not esi
and edi,esi
or ecx,edi ; ecx = {shorter:longer}
mov edx,ecx
shl ecx,16
mov cx,dx ; ecx = {counter:longer}
shr dx,1 ; edx = {delta_err:error}
not si
mov length,cx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.canvas clear
.log clear
.log length
.log " ????????_YYYY_XXXX"
.repeat
.Step: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.log RAX
.canvas rax
shld edi,edx,16
add dx,di
cmp cx,dx
sbb edi,edi
and di,cx
sub dx,di
sar edi,16
or edi,esi
and edi,ebx
add eax,edi
and eax,0x07FFF7FFF
sub ecx,0x000010000
.repeat length
.log "Coordinates logging..."
</script>
<script type='text/plain' title="i8080 24-bits Multiplication test">
::x86 ; revision 20230323
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.SHOW AUTO
LXI SP,075FFH
LXI H,0A009H
MVI A,014H ; AHL = 1351689
MVI E,0FFH
;;;;;;;;;;;;;;;;;;;;;;;
; HLDE = AHL * 10 + E
;;;;;;;;;;;;;;;;;;;;;;;
MUL10:
PUSH PSW ; 10
XRA A ; 4
MOV D,A ; 5
MOV B,H ; 5
MOV C,L ; 5
DAD H ; 11
ADC A ; 4 AHL x= 2
DAD H ; 11
ADC A ; 4 AHL x= 4
DAD B ; 11
ADC D ; 7 AHL x= 5
DAD H ; 11
ADC A ; 4 AHL *= 10
DAD D ; 11
ADC D ; 4 AHL += E
XCHG ; 4 ADE = HL * 10 + E
POP H ; 11
MOV L,H ; 5
MVI H,000H ; 7
MOV B,H ; 5
MOV C,L ; 5
DAD H ; 11
DAD H ; 11
DAD B ; 11
DAD H ; 11
MOV C,A ; 5
MVI B,000H ; 7
DAD B ; 11 = 208
; L = 0xCE, D = 0x41, E = 0x59
; LDE = 13517145
</script>
<script>
const pExamples = Object.fromEntries(Array.from(document.querySelectorAll("script[type='text/plain'][title]")).map(script => [script.title, script.textContent]));
</script>
<script title='gists'>
var linkTo
= {
gist :{
host :"https://gist.githubusercontent.com/Alikberov",
list :"/66bb9698f58765031522c600dda55260/raw/koy-mac-catalogue.txt"
}
};
</script>
<script title='Hexadecimaler'>
Number.prototype.toHex = function(n) {
return (n < 0 ? "0x" : "") + ("0000000" + this.toString(16)).substr(-Math.abs(n)).toUpperCase();
}
</script>
<script>
const hRefresh = setTimeout
(function() {
window.location = "";
}, 30000);
window.addEventListener("mouseover",
function() {
clearTimeout(hRefresh);
}
);
if(window.location.protocol != "file:")
clearTimeout(hRefresh);
</script>
<script title='Interface Elements Handles'>
var hCaption; // Main Caption Bar
var hCaptionMenu; // Menu under Caption Bar
var hCaptionTopics; //
var hStatus; // Main Status Bar
var hListingRows; // Main Listing Lines numbers
var hListing; // Main Listing TextArea
var hFilesGists; // Gists list
var hFilesExamples; // Examples list
var hDebugger;
var hDisplay;
var hDisplay_Status;
var hScreen;
var hClock;
var hGraphic;
var hUserPad;
var hEmuDump;
var hEmuDis;
var hRegs_X80;
var hRegs_X64;
var hRegs_X86;
var hRegs_MMX;
var hRegs_SSE;
var hPseudos;
var hEmuLog;
var hProgressBar;
var hFiles;
var hImageFiles;
var hIteration; // Logging Slider
var nIteration = 0;
var editStatus = 0;
var hRefreshAssm = 0;
var hSliders;
function init() {
hCaption = document.getElementById("Caption");
hCaptionMenu = document.getElementById("CaptionMenu");
hCaptionTopics = document.getElementsByName("CaptionTopic");
hFilesGists = document.getElementById("FilesGists");
hFilesExamples = document.getElementById("FilesExamples");
hStatus = document.getElementById("Status");
hListingRows = document.getElementById("ListingRows");
hListing = document.getElementById("Listing");
hFiles = document.getElementById("Files");
hDebugger = document.getElementById("Debugger");
hUserPad = document.getElementById("UserPad");
hSprites = document.getElementById("Sprites");
hDisplay_Status = document.getElementById("Display_Status");
hDisplay = document.getElementById("Display").getContext("2d");
hScreen = document.getElementById("Screen").getContext("2d");
hGraphic = hScreen.getImageData(0, 0, hScreen.canvas.width, hScreen.canvas.height);
hImageFiles = document.getElementById("ImageFiles");
hProgressBar = document.getElementById("ProgressBar");
hEmuDump = document.getElementById("EmuDump");
hEmuDis = document.getElementById("EmuDis");
hRegs_X80 = document.getElementById("Regs_X80");
hRegs_X64 = document.getElementById("Regs_X64");
hRegs_X86 = document.getElementById("Regs_X86");
hRegs_MMX = document.getElementById("Regs_MMX");
hRegs_SSE = document.getElementById("Regs_SSE");
hPseudos = document.getElementById("Pseudos");
hRegs_MMX.addEventListener("keydown", Ctx_KeyDown);
hRegs_MMX.addEventListener("keyup", Ctx_KeyUp);
hRegs_MMX.addEventListener("selectstart", Ctx_SelectStart);
hEmuLog = document.getElementById("EmuLog");
hIteration = document.getElementById("Iteration");
hEllipsys = document.getElementById("FilEllipsys");
hMainMenu = document.getElementById("MenuBar");
hStylers = document.getElementsByName("Styling");
hSliders = document.getElementsByName("Sliders");
for(var i = 0; i < hSliders.length; ++ i) {
if(("Slider" + i) in window.localStorage)
hSliders[i].value = Number(window.localStorage["Slider" + i]);
hSliders[i].dataset.index = i;
hSliders[i].addEventListener("input", (evt) => { window.localStorage["Slider" + evt.srcElement.dataset.index] = evt.srcElement.value; });
hSliders[i].addEventListener("change", (evt) => { window.localStorage["Slider" + evt.srcElement.dataset.index] = evt.srcElement.value; Execute_Program(); });
}
}
</script>
<script title='Draggable elements'>
function MakeDraggable(el, x, y) {
const position_suffix = "_Position";
const header_suffix = "_Header";
var last = {}, that = {};
tmp = el.id + position_suffix;
if(el && (tmp in window.localStorage)) {
tmp = window.localStorage[tmp].split(",");
x = Number(tmp[0]), y = Number(tmp[1]);
if(x < 0)
x = 0;
else
if(x > window.innerWidth - el.offsetWidth)
x = window.innerWidth - el.offsetWidth;
if(y < hCaption.offsetHeight)
y = hCaption.offsetHeight;
else
if(y > window.innerHeight - hStatus.offsetHeight - el.offsetHeight)
y = window.innerHeight - hStatus.offsetHeight - el.offsetHeight;
el.style.top = y + "px";
el.style.left = x + "px";
} else
el.style.top = y + "px",
el.style.left = x + "px";
if(tmp = el.getElementsByTagName("header"))
tmp[0].addEventListener("mousedown", StartDragging);
else
el.addEventListener("mousedown", StartDragging);
function StartDragging(e) {
e = e || window.event;
e.preventDefault();
// get the mouse cursor position at startup:;
last = {x: e.clientX, y: e.clientY};
if(e.srcElement.localName == "div") {
e.srcElement.parentElement.insertBefore(e.srcElement, e.srcElement.parentElement.children[e.srcElement.parentElement.children.length - 1].nextSibling);
} else {
e.srcElement.parentElement.parentElement.insertBefore(e.srcElement.parentElement, e.srcElement.parentElement.parentElement.children[e.srcElement.parentElement.parentElement.children.length - 1].nextSibling);
}
document.onmouseup = DragFinish;
// call a function whenever the cursor moves:
document.onmousemove = DragElement;
}
function DragElement(e) {
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
that = {x: last.x - e.clientX, y: last.y - e.clientY};
last = {x: e.clientX, y: e.clientY};
// set the element's new position:
x = el.offsetLeft - that.x;
y = el.offsetTop - that.y;
if(x < 0)
x = 0;
else
if(x > window.innerWidth - el.offsetWidth)
x = window.innerWidth - el.offsetWidth;
if(y < hCaption.offsetHeight)
y = hCaption.offsetHeight;
else
if(y > window.innerHeight - hStatus.offsetHeight - el.offsetHeight)
y = window.innerHeight - hStatus.offsetHeight - el.offsetHeight;
el.style.top = y + "px";
el.style.left = x + "px";
window.localStorage[el.id + position_suffix] = [x, y].join();
}
function DragFinish(e) {
e = e || window.event;
// stop moving when mouse button is released:
document.onmouseup = null;
document.onmousemove = null;
if(e.srcElement.localName == "div")
e.srcElement.style.zIndex = "";
else
if(e.srcElement.parentElement)
e.srcElement.parentElement.style.zIndex = "";
}
}
</script>
<script>
const Shell = {
CANVAS
:{
X1 :() => { return Number(hDisplay.canvas.dataset.x1); },
Y1 :() => { return Number(hDisplay.canvas.dataset.y1); },
X2 :() => { return Number(hDisplay.canvas.dataset.x2); },
Y2 :() => { return Number(hDisplay.canvas.dataset.y2); },
},
SLIDER1 :() => { return Number(document.getElementsByName("Sliders")[0].value); },
SLIDER2 :() => { return Number(document.getElementsByName("Sliders")[1].value); },
SLIDER3 :() => { return Number(document.getElementsByName("Sliders")[2].value); },
SLIDER4 :() => { return Number(document.getElementsByName("Sliders")[3].value); },
SLIDER5 :() => { return Number(document.getElementsByName("Sliders")[4].value); },
SLIDER6 :() => { return Number(document.getElementsByName("Sliders")[5].value); },
SLIDER7 :() => { return Number(document.getElementsByName("Sliders")[6].value); },
SLIDER8 :() => { return Number(document.getElementsByName("Sliders")[7].value); }
}
</script>
<script>
const getters32 = {
right :function() { return 0x0F & this; },
left :function() { return 0x0F & (this >> 4); },
low :function() { return 0xFF & this; },
high :function() { return 0xFF & (this >> 8); },
isNum :function() { return (this & 15) <= 9; },
isReg :function() { return (this & 15) >= 0xA && (this & 15) <= 0xD; },
isDec :function() { return (this & 15) <= 9 && ((this >> 4) & 15) <= 9 && this > 0; }
};
function get64_width(_) {
return this.WIDTH;
}
function get64_RAX(_) {
var n = BigInt(this[0]); n.WIDTH = 64; return n;
}
const getters64 = {
MASK_B :function() { return BigInt(0x7F7F7F7F7F7F7F7F); },
MASK_W :function() { return BigInt(0x7FFF7FFF7FFF7FFF); },
MASK_D :function() { return BigInt(0x7FFFFFFF7FFFFFFF); },
MASK_Q :function() { return BigInt(0x7FFFFFFFFFFFFFFF); },
width :get64_width//function() { return this.WIDTH; }
};
const X64_getters = {
RAX :get64_RAX,//function() { var n = this[0]; n.WIDTH = 64; return n; },
EAX :function() { return (this[0] & BigInt(0xFFFFFFFF)) | BigInt(this.SIGNED && (this[0] & BigInt(0x80000000)) ? 0xFFFFFFFF00000000n : 0); },
AX :function() { return (this[0] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[0] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
PSW :function() { return ((this[0] & BigInt(0xFF)) << BigInt(8)) | (this[16] & BigInt(0xFF)); },
AL :function() { return (this[0] & BigInt(0xFF)) | BigInt(this.SIGNED && (this[0] & BigInt(0x80)) ? 0xFFFFFFFFFFFFFF00n : 0); },
A :function() { return (this[0] & BigInt(0xFF)) | BigInt(this.SIGNED && (this[0] & BigInt(0x80)) ? 0xFFFFFFFFFFFFFF00n : 0); },
AH :function() { return ((this[0] >> BigInt(8)) & BigInt(0xFF)) | BigInt(this.SIGNED && (this[0] & BigInt(0x8000)) ? 0xFFFFFFFFFFFFFF00n : 0); },
RBX :function() { return this[3]; },
EBX :function() { return (this[3] & BigInt(0xFFFFFFFF)) | BigInt(this.SIGNED && (this[3] & BigInt(0x80000000)) ? 0xFFFFFFFF00000000n : 0); },
BX :function() { return (this[3] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[3] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
HL :function() { return (this[3] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[3] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
BL :function() { return (this[3] & BigInt(0xFF)) | BigInt(this.SIGNED && (this[3] & BigInt(0x80)) ? 0xFFFFFFFFFFFFFF00n : 0); },
L :function() { return (this[3] & BigInt(0xFF)) | BigInt(this.SIGNED && (this[3] & BigInt(0x80)) ? 0xFFFFFFFFFFFFFF00n : 0); },
BH :function() { return ((this[3] >> BigInt(8)) & BigInt(0xFF)) | BigInt(this.SIGNED && (this[3] & BigInt(0x8000)) ? 0xFFFFFFFFFFFFFF00n : 0); },
H :function() { return ((this[3] >> BigInt(8)) & BigInt(0xFF)) | BigInt(this.SIGNED && (this[3] & BigInt(0x8000)) ? 0xFFFFFFFFFFFFFF00n : 0); },
RCX :function() { return this[1]; },
ECX :function() { return (this[1] & BigInt(0xFFFFFFFF)) | BigInt(this.SIGNED && (this[1] & BigInt(0x80000000)) ? 0xFFFFFFFF00000000n : 0); },
CX :function() { return (this[1] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[1] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
BC :function() { return (this[1] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[1] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
CL :function() { return (this[1] & BigInt(0xFF)) | BigInt(this.SIGNED && (this[1] & BigInt(0x80)) ? 0xFFFFFFFFFFFFFF00n : 0); },
C :function() { return (this[1] & BigInt(0xFF)) | BigInt(this.SIGNED && (this[1] & BigInt(0x80)) ? 0xFFFFFFFFFFFFFF00n : 0); },
CH :function() { return ((this[1] >> BigInt(8)) & BigInt(0xFF)) | BigInt(this.SIGNED && (this[1] & BigInt(0x8000)) ? 0xFFFFFFFFFFFFFF00n : 0); },
B :function() { return ((this[1] >> BigInt(8)) & BigInt(0xFF)) | BigInt(this.SIGNED && (this[1] & BigInt(0x8000)) ? 0xFFFFFFFFFFFFFF00n : 0); },
RDX :function() { return this[2]; },
EDX :function() { return (this[2] & BigInt(0xFFFFFFFF)) | BigInt(this.SIGNED && (this[2] & BigInt(0x80000000)) ? 0xFFFFFFFF00000000n : 0); },
DX :function() { return (this[2] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[2] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
DE :function() { return (this[2] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[2] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
DL :function() { return (this[2] & BigInt(0xFF)) | BigInt(this.SIGNED && (this[2] & BigInt(0x80)) ? 0xFFFFFFFFFFFFFF00n : 0); },
E :function() { return (this[2] & BigInt(0xFF)) | BigInt(this.SIGNED && (this[2] & BigInt(0x80)) ? 0xFFFFFFFFFFFFFF00n : 0); },
DH :function() { return ((this[2] >> BigInt(8)) & BigInt(0xFF)) | BigInt(this.SIGNED && (this[2] & BigInt(0x8000)) ? 0xFFFFFFFFFFFFFF00n : 0); },
D :function() { return ((this[2] >> BigInt(8)) & BigInt(0xFF)) | BigInt(this.SIGNED && (this[2] & BigInt(0x8000)) ? 0xFFFFFFFFFFFFFF00n : 0); },
RSP :function() { return this[4]; },
ESP :function() { return (this[4] & BigInt(0xFFFFFFFF)) | BigInt(this.SIGNED && (this[4] & BigInt(0x80000000)) ? 0xFFFFFFFF00000000n : 0); },
SP :function() { return (this[4] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[4] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
RBP :function() { return this[5]; },
EBP :function() { return (this[5] & BigInt(0xFFFFFFFF)) | BigInt(this.SIGNED && (this[5] & BigInt(0x80000000)) ? 0xFFFFFFFF00000000n : 0); },
BP :function() { return (this[5] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[5] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
RSI :function() { return this[6]; },
ESI :function() { return (this[6] & BigInt(0xFFFFFFFF)) | BigInt(this.SIGNED && (this[6] & BigInt(0x80000000)) ? 0xFFFFFFFF00000000n : 0); },
SI :function() { return (this[6] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[6] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
RDI :function() { return this[7]; },
EDI :function() { return (this[7] & BigInt(0xFFFFFFFF)) | BigInt(this.SIGNED && (this[7] & BigInt(0x80000000)) ? 0xFFFFFFFF00000000n : 0); },
DI :function() { return (this[7] & BigInt(0xFFFF)) | BigInt(this.SIGNED && (this[7] & BigInt(0x8000)) ? 0xFFFFFFFFFFFF0000n : 0); },
R0 :function() { return this[0]; },
R1 :function() { return this[1]; },
R2 :function() { return this[2]; },
R3 :function() { return this[3]; },
R4 :function() { return this[4]; },
R5 :function() { return this[5]; },
R6 :function() { return this[6]; },
R7 :function() { return this[7]; },
R8 :function() { return this[8]; },
R9 :function() { return this[9]; },
R10 :function() { return this[10]; },
R11 :function() { return this[11]; },
R12 :function() { return this[12]; },
R13 :function() { return this[13]; },
R14 :function() { return this[14]; },
R15 :function() { return this[15]; },
RFX :function() { return this[16]; },
MM0 :function() { return this[20]; },
MM1 :function() { return this[21]; },
MM2 :function() { return this[22]; },
MM3 :function() { return this[23]; },
MM4 :function() { return this[24]; },
MM5 :function() { return this[25]; },
MM6 :function() { return this[26]; },
MM7 :function() { return this[27]; },
SIGNED :function() { this.SIGNED = true; return this; }
};
const X64_setters = {
RAX :function(x) { this[0] = BigInt(x); },
EAX :function(x) { this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); },
AX :function(x) { this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
PSW :function(x) { this[16] = (BigInt(this[16]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x));
this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFFFFFFFF00n)) | ((BigInt(0x0000FF00) & BigInt(x)) >> BigInt(8)); },
AL :function(x) { this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); },
A :function(x) { this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); },
AH :function(x) { this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); },
RBX :function(x) { this[3] = BigInt(x); },
EBX :function(x) { this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); },
BX :function(x) { this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
HL :function(x) { this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
BL :function(x) { this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); },
L :function(x) { this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); },
BH :function(x) { this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); },
H :function(x) { this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); },
RCX :function(x) { this[1] = BigInt(x); },
ECX :function(x) { this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); },
CX :function(x) { this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
BC :function(x) { this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
CL :function(x) { this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); },
C :function(x) { this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); },
CH :function(x) { this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); },
B :function(x) { this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); },
RDX :function(x) { this[2] = BigInt(x); },
EDX :function(x) { this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); },
DX :function(x) { this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
DE :function(x) { this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
DL :function(x) { this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); },
E :function(x) { this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); },
DH :function(x) { this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); },
D :function(x) { this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); },
RSP :function(x) { this[4] = BigInt(x); },
ESP :function(x) { this[4] = (BigInt(this[4]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); },
SP :function(x) { this[4] = (BigInt(this[4]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
RBP :function(x) { this[5] = BigInt(x); },
EBP :function(x) { this[5] = (BigInt(this[5]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); },
BP :function(x) { this[5] = (BigInt(this[5]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
RSI :function(x) { this[6] = BigInt(x); },
ESI :function(x) { this[6] = (BigInt(this[6]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); },
SI :function(x) { this[6] = (BigInt(this[6]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
RDI :function(x) { this[7] = BigInt(x); },
EDI :function(x) { this[7] = (BigInt(this[7]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); },
DI :function(x) { this[7] = (BigInt(this[7]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); },
R0 :function(x) { this[0] = BigInt(x); },
R1 :function(x) { this[1] = BigInt(x); },
R2 :function(x) { this[2] = BigInt(x); },
R3 :function(x) { this[3] = BigInt(x); },
R4 :function(x) { this[4] = BigInt(x); },
R5 :function(x) { this[5] = BigInt(x); },
R6 :function(x) { this[6] = BigInt(x); },
R7 :function(x) { this[7] = BigInt(x); },
R8 :function(x) { this[8] = BigInt(x); },
R9 :function(x) { this[9] = BigInt(x); },
R10 :function(x) { this[10] = BigInt(x); },
R11 :function(x) { this[11] = BigInt(x); },
R12 :function(x) { this[12] = BigInt(x); },
R13 :function(x) { this[13] = BigInt(x); },
R14 :function(x) { this[14] = BigInt(x); },
R15 :function(x) { this[15] = BigInt(x); },
RFX :function(x) { this[16] = BigInt(x); },
MM0 :function(x) { this[20] = BigInt(x); },
MM1 :function(x) { this[21] = BigInt(x); },
MM2 :function(x) { this[22] = BigInt(x); },
MM3 :function(x) { this[23] = BigInt(x); },
MM4 :function(x) { this[24] = BigInt(x); },
MM5 :function(x) { this[25] = BigInt(x); },
MM6 :function(x) { this[26] = BigInt(x); },
MM7 :function(x) { this[27] = BigInt(x); },
};
for(var fn in getters32)
Number.prototype.__defineGetter__(fn, getters32[fn]);
for(var fn in getters64)
BigInt.prototype.__defineGetter__(fn, getters64[fn]);
for(var fn in X64_getters)
BigUint64Array.prototype.__defineGetter__(fn, X64_getters[fn]);
for(var fn in X64_setters)
BigUint64Array.prototype.__defineSetter__(fn, X64_setters[fn]);
BigUint64Array.prototype.GET = function(id) {
switch(id.toUpperCase()) {
case "RAX" :return this[0];
case "EAX" :return this[0] & BigInt(0xFFFFFFFF);
case "AX" :return this[0] & BigInt(0xFFFF);
case "AL" :
case "A" :return this[0] & BigInt(0xFF);
case "AH" :return (this[0] >> BigInt(8)) & BigInt(0xFF);
case "RBX" :return this[3];
case "EBX" :return this[3] & BigInt(0xFFFFFFFF);
case "BX" :
case "HL" :return this[3] & BigInt(0xFFFF);
case "BL" :
case "L" :return this[3] & BigInt(0xFF);
case "BH" :
case "H" :return (this[3] >> BigInt(8)) & BigInt(0xFF);
case "RCX" :return this[1];
case "ECX" :return this[1] & BigInt(0xFFFFFFFF);
case "CX" :
case "BC" :return this[1] & BigInt(0xFFFF);
case "CL" :
case "C" :return this[1] & BigInt(0xFF);
case "CH" :
case "B" :return (this[1] >> BigInt(8)) & BigInt(0xFF);
case "RDX" :return this[2];
case "EDX" :return this[2] & BigInt(0xFFFFFFFF);
case "DX" :
case "DE" :return this[2] & BigInt(0xFFFF);
case "DL" :
case "E" :return this[2] & BigInt(0xFF);
case "DH" :
case "D" :return (this[2] >> BigInt(8)) & BigInt(0xFF);
case "RSP" :return this[4];
case "ESP" :return this[4] & BigInt(0xFFFFFFFF);
case "SP" :return this[4] & BigInt(0xFFFF);
case "RBP" :return this[5];
case "EBP" :return this[5] & BigInt(0xFFFFFFFF);
case "BP" :return this[5] & BigInt(0xFFFF);
case "RSI" :return this[6];
case "ESI" :return this[6] & BigInt(0xFFFFFFFF)
case "SI" :return this[6] & BigInt(0xFFFF);
case "RDI" :return this[7];
case "EDI" :return this[7] & BigInt(0xFFFFFFFF);
case "DI" :return this[7] & BigInt(0xFFFF);
}
};
BigUint64Array.prototype.SET = function(id, x) {
switch(id.toUpperCase()) {
case "RAX" :this[0] = BigInt(x); break;
case "EAX" :this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); break;
case "AX" :this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); break;
case "AL" :
case "A" :this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); break;
case "AH" :this[0] = (BigInt(this[0]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); break;
case "RBX" :this[3] = BigInt(x); break;
case "EBX" :this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); break;
case "BX" :
case "HL" :this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); break;
case "BL" :
case "L" :this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); break;
case "BH" :
case "H" :this[3] = (BigInt(this[3]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); break;
case "RCX" :this[1] = BigInt(x); break;
case "ECX" :this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); break;
case "CX" :
case "BC" :this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); break;
case "CL" :
case "C" :this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); break;
case "CH" :
case "B" :this[1] = (BigInt(this[1]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); break;
case "RDX" :this[2] = BigInt(x); break;
case "EDX" :this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); break;
case "DX" :
case "DE" :this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); break;
case "DL" :
case "E" :this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFFFF00n)) | (BigInt(0x000000FF) & BigInt(x)); break;
case "DH" :
case "D" :this[2] = (BigInt(this[2]) & BigInt(0xFFFFFFFFFFFF00FFn)) | ((BigInt(0x000000FF) & BigInt(x)) << BigInt(8)); break;
case "RSP" :this[4] = BigInt(x); break;
case "ESP" :this[4] = (BigInt(this[4]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); break;
case "SP" :this[4] = (BigInt(this[4]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); break;
case "RBP" :this[5] = BigInt(x); break;
case "EBP" :this[5] = (BigInt(this[5]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); break;
case "BP" :this[5] = (BigInt(this[5]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); break;
case "RSI" :this[6] = BigInt(x); break;
case "ESI" :this[6] = (BigInt(this[6]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); break;
case "SI" :this[6] = (BigInt(this[6]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); break;
case "RDI" :this[7] = BigInt(x); break;
case "EDI" :this[7] = (BigInt(this[7]) & BigInt(0xFFFFFFFF00000000n)) | (BigInt(0xFFFFFFFF) & BigInt(x)); break;
case "DI" :this[7] = (BigInt(this[7]) & BigInt(0xFFFFFFFFFFFF0000n)) | (BigInt(0x0000FFFF) & BigInt(x)); break;
}
};
BigUint64Array.prototype.DIGITS = function(id) {
if(id.match(/^(MM[0-7])$/i))
return 64;
else
if(id.match(/^(R([A-D]X|[SB]P|[SD]I|[89]|1[0-5]))$/i))
return 64;
else
if(id.match(/^(E([A-D]X|[SB]P|[SD]I))$/i))
return 32;
else
if(id.match(/^([A-D]X|[SB]P|[SD]I)$/i))
return 16;
else
if(id.match(/^([A-D][HL])$/i))
return 8;
else
return 0;
};
BigUint64Array.prototype.ADD = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x + BigInt(y));
r = this.GET(id);
this[16] = BigInt(r < x ? 1n : 0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.ADC = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x + BigInt(y) + (this[16] & BigInt(1n)));
r = this.GET(id);
this[16] = BigInt(r < x ? 1n : 0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.CMP = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x - BigInt(y));
r = this.GET(id);
this.SET(id, x);
this[16] = BigInt(r > x ? 1n : 0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.SUB = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x - BigInt(y));
r = this.GET(id);
this[16] = BigInt(r > x ? 1n : 0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.SBB = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x - BigInt(y) - (this[16] & BigInt(1n)));
r = this.GET(id);
this[16] = BigInt(r > x ? 1n : 0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.XOR = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x ^ BigInt(y));
r = this.GET(id);
this[16] = BigInt(0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.AND = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x & BigInt(y));
r = this.GET(id);
this[16] = BigInt(0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.OR = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x | BigInt(y));
r = this.GET(id);
this[16] = BigInt(0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.SAR = function(id, y) {
var r = this.GET(id);
var x = r;
this.SET(id, x >> BigInt(y));
r = this.GET(id);
this[16] = BigInt(0n);
if(r === BigInt(0n))
this[16] |= BigInt(64n);
switch(this.DIGITS(id)) {
case 64:
if(x & BigInt(0x8000000000000000n))
this.SET(id, r | (BigInt(0xFFFFFFFFFFFFFFFFn) << (BigInt(64n) - BigInt(y))));
if(r & BigInt(0x8000000000000000n))
this[16] |= BigInt(128n);
break;
case 32:
if(x & BigInt(0x80000000n))
this.SET(id, r | (BigInt(0xFFFFFFFFFFFFFFFFn) << (BigInt(32n) - BigInt(y))));
if(r & BigInt(0x80000000n))
this[16] |= BigInt(128n);
break;
case 16:
if(x & BigInt(0x8000n))
this.SET(id, r | (BigInt(0xFFFFFFFFFFFFFFFFn) << (BigInt(16n) - BigInt(y))));
if(r & BigInt(0x8000n))
this[16] |= BigInt(128n);
break;
case 8:
if(x & BigInt(0x80n))
this.SET(id, r | (BigInt(0xFFFFFFFFFFFFFFFFn) << (BigInt(8n) - BigInt(y))));
if(r & BigInt(0x80n))
this[16] |= BigInt(128n);
break;
}
};
BigUint64Array.prototype.MOVSX = function(idx, idy) {
var r = this.GET(idy);
this.SET(idx, r);
switch(this.DIGITS(idy)) {
case 32:
if((r & BigInt(0x80000000n)) > BigInt(0n))
this.SET(idx, r | BigInt(0xFFFFFFFF00000000n));
break;
case 16:
if((r & BigInt(0x8000n)) > BigInt(0n))
this.SET(idx, r | BigInt(0xFFFFFFFFFFFF0000n));
break;
case 8:
if((r & BigInt(0x80n)) > BigInt(0n))
this.SET(idx, r | BigInt(0xFFFFFFFFFFFFFF00n));
break;
}
};
BigUint64Array.prototype.PUSHW = function(y) {
var sp = this.SP;
this.SP = sp - 2;
};
/*Number.prototype.__defineGetter__("right",
function() {
return this & 15;
}
);
Number.prototype.__defineGetter__("left",
function() {
return (this >> 4) & 15;
}
);
Number.prototype.__defineGetter__("low",
function() {
return this & 255;
}
);
Number.prototype.__defineGetter__("high",
function() {
return (this >> 8) & 255;
}
);
Number.prototype.__defineGetter__("isNum",
function() {
return this <= 9;
}
);
Number.prototype.__defineGetter__('isReg",
function() {
return this >= 0xA && this <= 0xD;
}
);*/
</script>
<script>
var i;
var MMX_R = new BigUint64Array(67);
MMX_R[0] = 0x0000000000000000n;
MMX_R[1] = 0x0000000000000001n;
MMX_R[2] = 0x0000000000000002n;
MMX_R[3] = 0x0000000000000003n;
MMX_R[4] = 0x9ABCDE0F12345678n;
MMX_R[5] = 0x2D098CBE756431FAn;
MMX_R[6] = 0x0000000000000006n;
MMX_R[7] = 0x0000000000000007n;
MMX_R[8] = 0x7F7F7F7F7F7F7F7Fn;
MMX_R[9] = 0x8080808080808080n;
MMX_R[10] = 7n;
MMX_R[11] = 0xFFn;
MMX_R[16] = 0x7FFF7FFF7FFF7FFFn;
MMX_R[17] = 0x8000800080008000n;
MMX_R[18] = 15n;
MMX_R[19] = 0xFFFFn;
MMX_R[32] = 0x7FFFFFFF7FFFFFFFn;
MMX_R[33] = 0x8000000080000000n;
MMX_R[34] = 31n;
MMX_R[35] = 0xFFFFFFFFn;
MMX_R[64] = 0x7FFFFFFFFFFFFFFFn;
MMX_R[65] = 0x8000000000000000n;
MMX_R[66] = 63n;
MMX_R[67] = 0xFFFFFFFFFFFFFFFFn;
BigInt.prototype.__defineGetter__("U", function() { this.UNSIGNED = true; return this; } );
BigInt.prototype.__defineGetter__("S", function() { this.SATURATED = true; return this; } );
BigInt.prototype.__defineGetter__("L", function() { this.LOWER = true; return this; } );
BigInt.prototype.__defineGetter__("H", function() { this.HIGHER = true; return this; } );
BigInt.prototype.__defineGetter__("B", function() { this.BYTE = true; this.MASK = BigInt(0x7F7F7F7F7F7F7F7Fn); return this; } );
BigInt.prototype.__defineGetter__("W", function() { this.WORD = true; this.MASK = BigInt(0x7FFF7FFF7FFF7FFFn); return this; } );
BigInt.prototype.__defineGetter__("D", function() { this.DWORD = true; this.MASK = BigInt(0x7FFFFFFF7FFFFFFFn); return this; } );
BigInt.prototype.__defineGetter__("Q", function() { this.QWORD = true; this.MASK = BigInt(0x7FFFFFFFFFFFFFFFn); return this; } );
BigInt.prototype.__defineGetter__("PTEST", function() {
return (function(n) {
console.log(this.UNSIGNED ? "UNSIGNED" : "SIGNED");
console.log(this.SATURATED ? "SATURATED" : "LOOPED" );
console.log(this.LOWER ? "LOWER" : this.HIGHER ? "HIGHER" : "WHOLE");
console.log(this.BYTE ? "BYTE" : this.WORD ? "WORD" : this.DWORD ? "DWORD" : this.QWORD ? "QWORD" : "AUTO");
console.log(n);
return this;
}).bind(this);
});
BigInt.prototype.__defineGetter__
("Show", function(){
alert(this.TEST);
return this;
}
);
BigInt.prototype.toHex = function(n) {
return (n < 0 ? "0x" : "") + (
("0000000" + ((this >> BigInt(32n)) & BigInt(0xFFFFFFFFn)).toString(16)).substr(-8) +
("0000000" + (this & BigInt(0xFFFFFFFFn)).toString(16)).substr(-8)).substr(-Math.abs(n)).toUpperCase();
}
var test = BigInt(65000);
//console.log(test.B.W.MASK.toHex(16));
Number.prototype.__defineGetter__
("ME", function() {
this.PERSON = "Me";
return this;
});
Number.prototype.__defineGetter__
("HERE", function() {
this.PLACE = "Here";
return this;
});
var Man = new Number(1536);
var Logs = [];
try {
Logs.push(`Man: ${Man}`);
} catch(e) {}
try {
Logs.push(`Man.ME: ${Man.ME}`);
// Почему тут не число 1536, а [object.Window]?
} catch(e) {}
try {
Logs.push(`Man.HERE: ${Man.HERE}`);
// Почему тут не число 1536, а [object.Window]?
} catch(e) {}
try {
Logs.push(`Man.ME.HERE: ${Man.ME.HERE}`);
// Почему тут не число 1536, а [object.Window]?
} catch(e) {}
try {
Logs.push(`Man.HERE.ME: ${Man.HERE.ME}`);
// Почему тут не число 1536, а [object.Window]?
} catch(e) {}
try {
Logs.push(`Man.ME.PERSON: ${Man.ME.PERSON}`);
// Работает
} catch(e) {}
try {
Logs.push(`Man.HERE.PLACE: ${Man.HERE.PLACE}`);
// Работает
} catch(e) {}
try {
Logs.push(`Man.ME.HERE.PLACE: ${Man.ME.HERE.PLACE}`);
// Почему накопление свойств не работает?
} catch(e) {}
try {
Logs.push(`Man.HERE.ME.PLACE: ${Man.HERE.ME.PLACE}`);
// Почему накопление свойств не работает?
} catch(e) {}
try {
Logs.push(`Man.ME.HERE.PERSON: ${Man.ME.HERE.PERSON}`);
// Почему накопление свойств не работает?
} catch(e) {}
try {
Logs.push(`Man.HERE.ME.PERSON: ${Man.HERE.ME.PERSON}`);
// Почему накопление свойств не работает?
} catch(e) {}
//console.log(Logs.join("\n"));
//alert(Logs.join("\n"));
/*BigInt.prototype.PADD = function(n, mask) {
return (((this & mask) + (n & mask))) ^ ((this ^ n) & ~mask);
}*/
BigInt.prototype.PADD = function(n, mask) {
var _this = BigInt(this)|0n;
'use asm';
_this = _this|0n;
n = n|0n;
mask = mask|0n;
return ((((_this & mask) + (n & mask))) ^ ((_this ^ n) & ~mask))|0n;
}
//0x1234n.PADD(0xEF5Dn, 0x7777n)
/*BigInt.prototype.PSUB = function(n, mask) {
return (((this | ~mask) - (n & mask)) & mask) | ((this - n) & ~mask);
}*/
BigInt.prototype.PSUB = function(n, mask) {
var _this = BigInt(this);
'use asm';
_this = _this|0n;
n = n|0n;
mask = mask|0n;
return (((_this | ~mask) - (n & mask)) & mask) | ((_this - n) & ~mask)|0n;
}
BigInt.prototype.PCMPGT = function(n, digits) {
/*var x = 0x1234;
var y = 0x8623;
var m = MMX_R[digits];
var n = ~MMX_R[digits];*/
var lo = this & BigInt(0xFFFFFFFFn);
var hi = (this >> BigInt(32n)) & BigInt(0xFFFFFFFFn);
var nlo = n & BigInt(0xFFFFFFFFn);
var nhi = (n >> BigInt(32n)) & BigInt(0xFFFFFFFFn);
var zlo = ((lo | MMX_R[digits + 1]) - (nlo & MMX_R[digits])) & (MMX_R[digits] | MMX_R[digits + 1]);
var zhi = ((hi | MMX_R[digits + 1]) - (nhi & MMX_R[digits])) & (MMX_R[digits] | MMX_R[digits + 1]);
var zlo1 = (lo ^ nlo) & MMX_R[digits + 1];
var zhi1 = (hi ^ nhi) & MMX_R[digits + 1];
var zlo2 = (((zlo ^ zlo1) & MMX_R[digits + 1]) >> MMX_R[digits + 2]) * (MMX_R[digits + 3]);
var zhi2 = (((zhi ^ zhi1) & MMX_R[digits + 1]) >> MMX_R[digits + 2]) * (MMX_R[digits + 3]);
return BigInt(BigInt(zlo2) + (BigInt(zhi2) << BigInt(32)));
}
BigInt.prototype.PCMPEQB = function(n) {
var d1 = BigInt(0xFF) & this;
var d2 = BigInt(0xFF) & (this >> BigInt(8));
var d3 = BigInt(0xFF) & (this >> BigInt(16));
var d4 = BigInt(0xFF) & (this >> BigInt(24));
var d5 = BigInt(0xFF) & (this >> BigInt(32));
var d6 = BigInt(0xFF) & (this >> BigInt(40));
var d7 = BigInt(0xFF) & (this >> BigInt(48));
var d8 = BigInt(0xFF) & (this >> BigInt(56));
var n1 = BigInt(0xFF) & n;
var n2 = BigInt(0xFF) & (n >> BigInt(8));
var n3 = BigInt(0xFF) & (n >> BigInt(16));
var n4 = BigInt(0xFF) & (n >> BigInt(24));
var n5 = BigInt(0xFF) & (n >> BigInt(32));
var n6 = BigInt(0xFF) & (n >> BigInt(40));
var n7 = BigInt(0xFF) & (n >> BigInt(48));
var n8 = BigInt(0xFF) & (n >> BigInt(56));
var r1 = BigInt(d1 == n1 ? 0xFF : 0x00);
var r2 = BigInt(d2 == n2 ? 0xFF : 0x00) << BigInt(8);
var r3 = BigInt(d3 == n3 ? 0xFF : 0x00) << BigInt(16);
var r4 = BigInt(d4 == n4 ? 0xFF : 0x00) << BigInt(24);
var r5 = BigInt(d5 == n5 ? 0xFF : 0x00) << BigInt(32);
var r6 = BigInt(d6 == n6 ? 0xFF : 0x00) << BigInt(40);
var r7 = BigInt(d7 == n7 ? 0xFF : 0x00) << BigInt(48);
var r8 = BigInt(d8 == n8 ? 0xFF : 0x00) << BigInt(56);
return r8 | r7 | r6 | r5 | r4 | r3 | r2 | r1;
}
BigInt.prototype.PCMPEQW = function(n) {
var d1 = BigInt(0xFFFF) & this;
var d2 = BigInt(0xFFFF) & (this >> BigInt(16));
var d3 = BigInt(0xFFFF) & (this >> BigInt(32));
var d4 = BigInt(0xFFFF) & (this >> BigInt(48));
var n1 = BigInt(0xFFFF) & n;
var n2 = BigInt(0xFFFF) & (n >> BigInt(16));
var n3 = BigInt(0xFFFF) & (n >> BigInt(32));
var n4 = BigInt(0xFFFF) & (n >> BigInt(48));
var r1 = BigInt(d1 == n1 ? 0xFFFF : 0x0000);
var r2 = BigInt(d2 == n2 ? 0xFFFF : 0x0000) << BigInt(16);
var r3 = BigInt(d3 == n3 ? 0xFFFF : 0x0000) << BigInt(32);
var r4 = BigInt(d4 == n4 ? 0xFFFF : 0x0000) << BigInt(48);
return r4 | r3 | r2 | r1;
}
BigInt.prototype.PCMPEQD = function(n) {
var d1 = BigInt(0xFFFFFFFF) & this;
var d2 = BigInt(0xFFFFFFFF) & (this >> BigInt(32));
var n1 = BigInt(0xFFFFFFFF) & n;
var n2 = BigInt(0xFFFFFFFF) & (n >> BigInt(32));
var r1 = BigInt(d1 == n1 ? 0xFFFFFFFF : 0x00000000);
var r2 = BigInt(d2 == n2 ? 0xFFFFFFFF : 0x00000000) << BigInt(32);
return r2 | r1;
}
BigInt.prototype.PCMPGTB = function(n) {
var d1 = BigInt(0xFF) & this;
var d2 = BigInt(0xFF) & (this >> BigInt(8));
var d3 = BigInt(0xFF) & (this >> BigInt(16));
var d4 = BigInt(0xFF) & (this >> BigInt(24));
var d5 = BigInt(0xFF) & (this >> BigInt(32));
var d6 = BigInt(0xFF) & (this >> BigInt(40));
var d7 = BigInt(0xFF) & (this >> BigInt(48));
var d8 = BigInt(0xFF) & (this >> BigInt(56));
var n1 = BigInt(0xFF) & n;
var n2 = BigInt(0xFF) & (n >> BigInt(8));
var n3 = BigInt(0xFF) & (n >> BigInt(16));
var n4 = BigInt(0xFF) & (n >> BigInt(24));
var n5 = BigInt(0xFF) & (n >> BigInt(32));
var n6 = BigInt(0xFF) & (n >> BigInt(40));
var n7 = BigInt(0xFF) & (n >> BigInt(48));
var n8 = BigInt(0xFF) & (n >> BigInt(56));
var r1 = BigInt(BigInt(0x80n) ^ d1 > BigInt(0x80n) ^ n1 ? 0xFF : 0x00);
var r2 = BigInt(BigInt(0x80n) ^ d2 > BigInt(0x80n) ^ n2 ? 0xFF : 0x00) << BigInt(8);
var r3 = BigInt(BigInt(0x80n) ^ d3 > BigInt(0x80n) ^ n3 ? 0xFF : 0x00) << BigInt(16);
var r4 = BigInt(BigInt(0x80n) ^ d4 > BigInt(0x80n) ^ n4 ? 0xFF : 0x00) << BigInt(24);
var r5 = BigInt(BigInt(0x80n) ^ d5 > BigInt(0x80n) ^ n5 ? 0xFF : 0x00) << BigInt(32);
var r6 = BigInt(BigInt(0x80n) ^ d6 > BigInt(0x80n) ^ n6 ? 0xFF : 0x00) << BigInt(40);
var r7 = BigInt(BigInt(0x80n) ^ d7 > BigInt(0x80n) ^ n7 ? 0xFF : 0x00) << BigInt(48);
var r8 = BigInt(BigInt(0x80n) ^ d8 > BigInt(0x80n) ^ n8 ? 0xFF : 0x00) << BigInt(56);
return r8 | r7 | r6 | r5 | r4 | r3 | r2 | r1;
}
BigInt.prototype.PCMPGTW = function(n) {
var d1 = BigInt(0xFFFF) & this;
var d2 = BigInt(0xFFFF) & (this >> BigInt(16));
var d3 = BigInt(0xFFFF) & (this >> BigInt(32));
var d4 = BigInt(0xFFFF) & (this >> BigInt(48));
var n1 = BigInt(0xFFFF) & n;
var n2 = BigInt(0xFFFF) & (n >> BigInt(16));
var n3 = BigInt(0xFFFF) & (n >> BigInt(32));
var n4 = BigInt(0xFFFF) & (n >> BigInt(48));
var r1 = BigInt(BigInt(0x8000n) ^ d1 > BigInt(0x8000n) ^ n1 ? 0xFFFF : 0x0000);
var r2 = BigInt(BigInt(0x8000n) ^ d2 > BigInt(0x8000n) ^ n2 ? 0xFFFF : 0x0000) << BigInt(16);
var r3 = BigInt(BigInt(0x8000n) ^ d3 > BigInt(0x8000n) ^ n3 ? 0xFFFF : 0x0000) << BigInt(32);
var r4 = BigInt(BigInt(0x8000n) ^ d4 > BigInt(0x8000n) ^ n4 ? 0xFFFF : 0x0000) << BigInt(48);
return r4 | r3 | r2 | r1;
}
BigInt.prototype.PCMPGTD = function(n) {
var d1 = BigInt(0xFFFFFFFF) & BigInt(this);
var d2 = BigInt(0xFFFFFFFF) & BigInt(this >> BigInt(32));
var n1 = BigInt(0xFFFFFFFF) & BigInt(n);
var n2 = BigInt(0xFFFFFFFF) & (BigInt(n) >> BigInt(32));
var r1 = BigInt((BigInt(0x80000000n) ^ BigInt(d1)) > (BigInt(0x80000000n) ^ BigInt(n1)) ? 0xFFFFFFFF : 0x00000000);
var r2 = BigInt((BigInt(0x80000000n) ^ BigInt(d2)) > (BigInt(0x80000000n) ^ BigInt(n2)) ? 0xFFFFFFFF : 0x00000000) << BigInt(32);
return r2 | r1;
}
BigInt.prototype.PACKUSDW = function(n) {
var d1 = BigInt(0xFFFFFFFF) & BigInt(this);
var d2 = BigInt(0xFFFFFFFF) & BigInt(this >> BigInt(32));
var n1 = BigInt(0xFFFFFFFF) & BigInt(n);
var n2 = BigInt(0xFFFFFFFF) & (BigInt(n) >> BigInt(32));
var r1 = d1 > BigInt(65535) ? BigInt(65535) : d1;
var r2 = d2 > BigInt(65535) ? BigInt(65535) : d2;
var r3 = n1 > BigInt(65535) ? BigInt(65535) : n1;
var r4 = n2 > BigInt(65535) ? BigInt(65535) : n2;
// console.log(this.toHex(16), n.toHex(16), d1,d1,n1,n2,r1,r2,r3,r4);
return r1 | (r2 << BigInt(16)) | (r3 << BigInt(32)) | (r4 << BigInt(48));
}
/*
BigInt.prototype.PUNPCKLDQ = function(n) {
return (this & BigInt(0x00000000FFFFFFFFn)) | (n << BigInt(32n));
}*/
BigInt.prototype.PUNPCKLDQ = function(n) {
var _this = this;
'use asm';
_this = _this|0n;
n = n|0n;
return ((_this & 0x00000000FFFFFFFFn) | (n << 32n))|0n;
}
/*BigInt.prototype.PUNPCKLWD = function(n) {
var d1 = BigInt(0xFFFF) & BigInt(this);
var d2 = BigInt(0xFFFF) & BigInt(this >> BigInt(16));
var n1 = BigInt(0xFFFF) & BigInt(n);
var n2 = BigInt(0xFFFF) & BigInt(n >> BigInt(16));
return d1 | (n1 << BigInt(16n)) | (d2 << BigInt(32n)) | (n2 << BigInt(48n));
}*/
BigInt.prototype.PUNPCKLWD = function(n) {
var _this = this;
var d1, d2, n1, n2;
'use asm';
_this = _this|0n;
n = n|0n;
d1 = (0xFFFFn & _this)|0n;
d2 = (0xFFFFn & (_this >> 16n))|0n;
n1 = (0xFFFFn & n)|0n;
n2 = (0xFFFFn & (n >> 16n))|0n;
return (d1 | (n1 << 16n) | (d2 << 32n) | (n2 << 48n))|0n;
}
BigInt.prototype.PSLLD = function(n) {
var d1 = BigInt(this);
var n1 = parseInt(n);
var i;
for(i = 1; i <= n1; ++ i) {
d1 <<= BigInt(1);
d1 &= BigInt(0xFFFFFFFEFFFFFFFEn);
}
return d1;
}
BigInt.prototype.PSLLQ = function(n) {
var d1 = BigInt(this);
var n1 = parseInt(n);
var i;
for(i = 1; i <= n1; ++ i) {
d1 <<= BigInt(1);
d1 &= BigInt(0xFFFFFFFFFFFFFFFEn);
}
return d1;
}
BigInt.prototype.PSRLD = function(n) {
var d1 = BigInt(this);
var n1 = parseInt(n);
var i;
for(i = 1; i <= n1; ++ i) {
d1 >>= BigInt(1);
d1 &= BigInt(0x7FFFFFFF7FFFFFFFn);
}
return d1;
}
BigInt.prototype.PSRLQ = function(n) {
var d1 = BigInt(this);
var n1 = parseInt(n);
var i;
for(i = 1; i <= n1; ++ i) {
d1 >>= BigInt(1);
d1 &= BigInt(0x7FFFFFFFFFFFFFFFn);
}
return d1;
}
</script>
<script>
var KOY
= function() {
this.cps = 1; // Cycles Per Second
this.is_peek = false;
this.cycles = 0;
this.ticks = 0;
this.classic = false;
this.prefix = false;
this.prefixes = 0;
this.marginal = 0; // Vector's prefixes margins
this.address = 0; // Vector's indexing accumulator
this.offset = 0; // Vector's offset value
this.pairs = 0; // Vector's using pairs flags
this.id = 0;
this.dis_pointer = 0;
this.dis_address = 0x0000;
this.dis_lines = 16;
this.dis_line_letters = 24;
this.dis_line_bytes = 4;
this.dis_line_lettersingle = 30;
this.dis_line_bytesingle = 2;
this.dis_lines_points = [];
this.dis_points_lines = [];
this.dis_lines_tables = [];
this.snaps_offset = [];
this.images = [];
//////////////////////////////////////////////////////////////////////
this.program = [];
this.labels = [];
this.Views = "";
//////////////////////////////////////////////////////////////////////
this.MMX_R = new BigUint64Array(8);
this.MMX_R[0] = 0x416C696B6265726Fn;
this.MMX_R[1] = 0x53696D756C61746Fn;
this.MMX_R[2] = 0x56657273696F6E31n;
this.MMX_R[3] = 0x0000000000000003n;
this.MMX_R[4] = 0x9ABCDE0F12345678n;
this.MMX_R[5] = 0x2D098CBE756431FAn;
this.MMX_R[6] = 0x0000000000000006n;
this.MMX_R[7] = 0x0765676567656765n;
//////////////////////////////////////////////////////////////////////
this.SSE_R = new BigUint64Array(16);
this.SSE_R[0] = 0x0123456765432109n;
this.SSE_R[1] = 0x0000000000000001n;
this.SSE_R[2] = 0x0000000000000002n;
this.SSE_R[3] = 0x0000000000000003n;
this.SSE_R[4] = 0x9ABCDE0F12345678n;
this.SSE_R[5] = 0x2D098CBE756431FAn;
this.SSE_R[6] = 0x0000000000000006n;
this.SSE_R[7] = 0x0765676567656765n;
this.SSE_R[8] = 0x0123456765432109n;
this.SSE_R[9] = 0x0000000000000001n;
this.SSE_R[10] = 0x0000000000000002n;
this.SSE_R[11] = 0x0000000000000003n;
this.SSE_R[12] = 0x9ABCDE0F12345678n;
this.SSE_R[13] = 0x2D098CBE756431FAn;
this.SSE_R[14] = 0x0000000000000006n;
this.SSE_R[15] = 0x0765676567656765n;
//////////////////////////////////////////////////////////////////////
this.X64_R = new BigUint64Array(256);
this.X64_R[0] = 0x0123456765432109n;
this.X64_R[1] = 0x0000000000000001n;
this.X64_R[2] = 0x0000000000000002n;
this.X64_R[3] = 0x0000000000000003n;
this.X64_R[4] = 0x9ABCDE0F12345678n;
this.X64_R[5] = 0x2D098CBE756431FAn;
this.X64_R[6] = 0x0000000000000006n;
this.X64_R[7] = 0x0765676567656765n;
this.X64_R[8] = 0x0123456765432109n;
this.X64_R[9] = 0x0000000000000001n;
this.X64_R[10] = 0x0000000000000002n;
this.X64_R[11] = 0x0000000000000003n;
this.X64_R[12] = 0x9ABCDE0F12345678n;
this.X64_R[13] = 0x2D098CBE756431FAn;
this.X64_R[14] = 0x0000000000000006n;
this.X64_R[15] = 0x0765676567656765n;
this.X64_R[16] = 0x0765676567656765n;
//////////////////////////////////////////////////////////////////////
this.snaps = [];
this.logging = [];
this.limit = 1000;
this.format = "";
this.draft = null;
//////////////////////////////////////////////////////////////////////
this.devices
= {
i8255 :{
init :
function() {
this.state = [];
for(var i = 0; i < 256; ++ i)
this.state[i] = [0x00, 0x00, 0x00, 0x00];
}
,
clock :
function() {
}
,
read :
function(index, port) {
return this.state[index][port & 3];
}
,
write :
function(index, port, data) {
this.state[index][port & 3] = data & 0xFF;
}
},
i8279 :{
init :
function() {
this.state = [];
this.mode = [];
this.freq = [];
for(var i = 0; i < 256; ++ i) {
this.state[i] = 0;
this.mode[i] = 0;
this.freq[i] = 0;
}
}
,
clock :
function() {
}
,
read :
function(index, port) {
switch(port) {
case 0x00:
if(!this._this.is_peek) {
if(hUserPad.selectionEnd == hUserPad.selectionStart + 1) {
hUserPad.selectionStart ++;
hUserPad.selectionEnd ++;
if(hUserPad.selectionStart >= hUserPad.value.length) {
tmp = hUserPad.value.indexOf("$run ");
if(tmp >= 0) {
hUserPad.selectionStart = tmp + 5;
hUserPad.selectionEnd = hUserPad.selectionStart + 1;
}
}
}
}
return hUserPad.value.charCodeAt(hUserPad.selectionStart) & 0xFF;
}
return 0xFF;
}
,
write :
function(index, port, data) {
switch(port) {
case 0x01:
if((port & 0xE0) == 0x00)
// 0_0_0_D_D_K_K_K
// 0 0 -------> 8×8 character display - left entry
// 0 1 -------> 16×8 character display - left entry
// 1 0 -------> 8×8 character display - right entry
// 1 1 -------> 16×8 character display - right entry
// 0 0 0 -> Encoded Scan Keyboard - 2-Key Lock-out
// 0 0 1 -> Decoded Scan Keyboard - 2-Key Lock-out
// 0 1 0 -> Encoded Scan Keyboard - N-Key Roll-over
// 0 1 1 -> Decoded Scan Keyboard - N-Key Roll-over
// 1 0 0 -> Encoded Scan Sensor Matrix
// 1 0 1 -> Decoded Scan Sensor Matrix
// 1 1 0 -> Strobed Input. Encoded Display Scan
// 1 1 1 -> Strobed Input. Decoded Display Scan
this.mode[index] = data & 0x1F;
if((port & 0xE0) == 0x20)
this.freq[index] = data & 0x1F;
break;
}
}
},
i82C0 :{
init :
function() {
}
,
clock :
function() {
}
,
read :
function(index, port) {
return this.state[index][port & 3];
}
,
write :
function(index, port, data) {
if(data == 0x00)
hEmuLog.textContent = "";
else
hEmuLog.textContent += String.fromCharCode(data);
}
},
i82CB :{
init :
function() {
this.buffer = new Uint8Array(256 * 8);
}
,
clock :
function() {
}
,
read :
function(index, port) {
return 0;
}
,
write :
function(index, port, data) {
var addr = (index & 0xFF) << 3;
var x = (index & 0x0F) << 3;
var y = (index & 0xF0) >> 1;
var pixels;
var alfa = 0;
this.buffer[addr + (port & 7)] = data & 0xFF;
}
},
i82CD :{
init :
function() {
this.buffer = new Uint8Array(256 * 8);
}
,
clock :
function() {
}
,
read :
function(index, port) {
return 0;
}
,
write :
function(index, port, data) {
var addr = (index & 0xFF) << 3;
var x = (index & 0x0F) << 3;
var y = (index & 0xF0) >> 1;
var pixels;
var alfa = 0;
this.buffer[addr + (port & 7)] = data & 0xFF;
if((this.buffer[addr] | this.buffer[addr + 1]
| this.buffer[addr + 2] | this.buffer[addr + 3]
| this.buffer[addr + 4] | this.buffer[addr + 5]
| this.buffer[addr + 6] | this.buffer[addr + 7]) != 0)
alfa = 255;
for(var h = 0; h < 8; ++ h) {
pixels = hDisplay.getImageData(x + h, y, 1, 8);
data = this.buffer[addr + h];
for(var i = 0; i < 8; ++ i) {
pixels.data[i * 4 + 0] = data & 1 ? 0xFF : 0x00;
pixels.data[i * 4 + 1] = data & 1 ? 0xFF : 0x00;
pixels.data[i * 4 + 2] = data & 1 ? 0xFF : 0x00;
pixels.data[i * 4 + 3] = alfa;
data >>= 1;
}
hDisplay.putImageData(pixels, x + h, y);
}
}
}
};
//////////////////////////////////////////////////////////////////////
this.ram = new Uint8Array(65536);
//////////////////////////////////////////////////////////////////////
this.rams
= new Proxy
(new Array(65536),
{
get: function(target, name) {
if(0x00D0 <= name && name <= 0x00D9) {
if(name <= 0x00D7) {
if(("i82" + target[0x00D9].toHex(2)) in target.devices) {
return target.devices["i82" + target[0x00D9].toHex(2)].read(target[0x00D8], (+name & 0x7));
}
}
}
return target[name];
},
set: function(target, name, data) {
if(0x00D0 <= name && name <= 0x00D9) {
if(name <= 0x00D7) {
target[0xD000 + +target[0x00D9] * 16 + (+name & 0x000F)] = data;
if(("i82" + target[0x00D9].toHex(2)) in target.devices) {
target.devices["i82" + target[0x00D9].toHex(2)].write(target[0x00D8], (+name & 0x7), +data);
}
} else
if(name == 0x00D8)
target[0xD000 + +target[0x00D9] * 16 + (+name & 0x000F)] = data;
else {
if(data == 0xCB)
hScreen.canvas.style.zoom = 1;
target[0x00D9] = data;
}
/* switch(target[0x00D9]) {
case 0xC0:
switch(+name) {
case 0x00D0:
if(data == 0x00)
hEmuLog.textContent = "";
else
hEmuLog.textContent += String.fromCharCode(data);
}
break;
default:
}*/
}
if(name >= 0x7000 && 0x9FFF >= name) {
var addr = +name - 0x7000;
var x = addr % 120;
var y = (addr - x) / 120;
hGraphic.data[addr * 16 + 0] = +data;
hGraphic.data[addr * 16 + 1] = +data;
hGraphic.data[addr * 16 + 2] = +data;
hGraphic.data[addr * 16 + 3] = 0xFF;
hGraphic.data[addr * 16 + 4] = +data;
hGraphic.data[addr * 16 + 5] = +data;
hGraphic.data[addr * 16 + 6] = +data;
hGraphic.data[addr * 16 + 7] = 0xFF;
hGraphic.data[addr * 16 + 8] = +data;
hGraphic.data[addr * 16 + 9] = +data;
hGraphic.data[addr * 16 + 10] = +data;
hGraphic.data[addr * 16 + 11] = 0xFF;
hGraphic.data[addr * 16 + 12] = +data;
hGraphic.data[addr * 16 + 13] = +data;
hGraphic.data[addr * 16 + 14] = +data;
hGraphic.data[addr * 16 + 15] = 0xFF;
hScreen.putImageData(hGraphic, 0, 0);
//hScreen.fillStyle = "#" + (+data * 0x010101).HEX(6);
//hScreen.fillRect(x * 2, y * 2, 2, 2);
}
return target[name] = data;
}
}
);
//////////////////////////////////////////////////////////////////////
this.ram.base = 0x0000;
this.ctx = new Array(0xFFF + 1);
for(i = 0; i < this.ctx.length; ++ i)
this.ctx[i] = 0;
this.ctx.devices = this.devices;
for(i = 0; i < 8; ++ i) {
Object.defineProperty(this.ctx, 0xD0 + i,
{
set: (
function(data) {
var id = this._this.ctx[0xD9];
var name = `i82${id.toHex(2)}`;
if(name in this._this.devices)
this._this.devices[name].write(this._this.ctx[0xD8], this.index, data);
else
this._this.ctx[0xE0 + id] = data;
}
).bind(
{
_this :this,
index :i
}
),
get: (
function() {
var id = this._this.ctx[0xD9];
var name = `i82${id.toHex(2)}`;
if(name in this._this.devices)
return this._this.devices[name].read(this._this.ctx[0xD8], this.index);
return this._this.ctx[0xE0 + id];
}
).bind(
{
_this :this,
index :i
}
)
}
);
}
//////////////////////////////////////////////////////////////////////
this.ctx.receiver
= function(data) {
var vector = this[this[0x00AE] | 0x0F];
if(isFinite(data))
this[vector] = data.low;
else
if(typeof data == "string")
return vector.toHex(2).toLowerCase() + data;
return this[vector];
}
//////////////////////////////////////////////////////////////////////
this.ctx.translator
= function(data) {
var vector = this[(this[0x00AE].right << 4) | 0x000F];
if(isFinite(data))
this[vector] = data.low;
else
if(typeof data == "string")
return vector.toHex(2).toLowerCase() + data;
return this[vector];
}
//////////////////////////////////////////////////////////////////////
this.ctx.state
= function(data) {
if(isFinite(data))
this[0x00A0] = (data & 0xFF ? 0 : 1) | (data & 0x100 ? 2 : 0) | (data & 0x80 ? 8 : 0);
return this[0x00A0];
}
//////////////////////////////////////////////////////////////////////
this.ctx.pointer
= function(index, address) {
if(typeof address == "string")
return (0x0BC0 | index).toHex(3) + address;
else
if(isFinite(address)) {
this[this.base | index] = address.high;
this[(this.base | index) + 0x10] = address.low;
}
return (this[this.base | index] << 8) | this[(this.base | index) + 0x10];
}
//////////////////////////////////////////////////////////////////////
this.ram.toDump
= function(address, width) {
var i;
var n = address.low;
var row, data;
var dump = [];
address &= 0xFF00;
for(i = 0; i < 256; ++ i) {
if(i.right == 0)
row = [(address + i).toHex(4) + ":"];
data = this[address + i];
if(isFinite(data))
data = data.toHex(2);
else
data = "--";
row.push(
(i == n ? "<span class=ActiveByte>" + data + "</span>":
(i > n && i <= n + width - 1 ? "<span class=ActiveByte>" + data + "</span>" : data)
));
if(i.right == 15)
dump.push(row.join(" "));
}
return dump;
}
//////////////////////////////////////////////////////////////////////
this.ram.set
= function(data) {
var address;
var ram = this;
//
if("string" == typeof data) {
data
.split(/\r?\n/)
.forEach
(function(row) {
row
.split(/\s+|\t+/)
.forEach
(function(chars) {
data = chars.match(/[0-9A-F]{2,4}/);
if(data)
switch(data[0].length) {
case 4:
address = parseInt(data[0], 16);
break;
case 2:
ram[address ++] = parseInt(data[0], 16);
break;
}
else
if(chars.match(/'./))
ram[address ++] = chars.charCodeAt(1) & 0xFF;
});
});
} else
address = this.length;
while(address -- > 0)
this[address] = isFinite(data) ? data : 0;
return this;
}
//////////////////////////////////////////////////////////////////////
this.context
= function(snap) {
if(!snap)
return new BigUint64Array(this.X64_R);
var i;
var x80 = [];
var x64 = [];
var x86 = [];
var mmx = [];
var flags = this.ctx[0xA0];
var regs = "RAX RCX RDX RBX RSP RBP RSI RDI R8_ R9_ R10 R11 R12 R13 R14 R15 RFX".split(/\s+/);
/*text.push(`[${(" " + this.marginal.toString(10)).substr(-4)}#${this.id<160?"D"+(this.id>>4):" "}+${this.address.toHex(4)}+${this.offset.toHex(4)}]${this.prefixes}`);
text.push(`PC:${this.ctx.pointer(0x00BE).toHex(4)} TICKS:${this.ticks}`);
text.push(`AF:${flags & 0x08 ? "AF(Is Among)" : "NA(No Among)"}`);
text.push(`BF:${flags & 0x04 ? "BF(Is ???)" : "NB(No ???)"}`);
text.push(`CF:${flags & 0x02 ? "CF(Is Carry)" : "NC(No Carry)"}`);
text.push(`DF:${flags & 0x01 ? "DF(Is Duplex)" : "ND(No Duplex)"}`);*/
this.is_peek = true;
x80.push(`BC:${snap.BC.toHex(4)}`);
x80.push(`DE:${snap.DE.toHex(4)}`);
x80.push(`HL:${snap.HL.toHex(4)}`);
x80.push(`AF:${snap.PSW.toHex(4)}`);
x80.push(`SP:${snap.SP.toHex(4)}`);
x80.push(`+0:${(this.ram[snap.SP] + this.ram[snap.SP + 1n] * 256).toHex(4)}`);
x80.push(`+2:${(this.ram[snap.SP + 2n] + this.ram[snap.SP + 3n] * 256).toHex(4)}`);
x80.push(`+4:${(this.ram[snap.SP + 4n] + this.ram[snap.SP + 5n] * 256).toHex(4)}`);
x80.push(`+6:${(this.ram[snap.SP + 6n] + this.ram[snap.SP + 7n] * 256).toHex(4)}`);
x80.push(`+8:${(this.ram[snap.SP + 8n] + this.ram[snap.SP + 9n] * 256).toHex(4)}`);
for(i = 0; i <= 7; ++ i) {
x86.push(`${regs[i].replace("R", "E")}:${snap[i].toHex(8)}`);
mmx.push(`MM${i}:${snap["MM" + i].toHex(16)}`);
}
for(i = 0; i <= 16; ++ i) {
x64.push(`${regs[i]}:${snap[i].toHex(16)}`);
}
x86.push(`${regs[16].replace("R", "E")}:${snap[16].toHex(8)}`);
this.is_peek = false;
return {
mmx: mmx.join("\r\n"),
x80: x80.join("\r\n"),
x64: x64.join("\r\n"),
x86: x86.join("\r\n")
};
}
//////////////////////////////////////////////////////////////////////
this.prepareImage
= function(im) {
var pScr = [];
var hSrc = document.createElement("canvas").getContext("2d");
hSrc.canvas.width = im.width;
hSrc.canvas.height = im.height;
hSrc.canvas.setAttribute("crossOrigin", "");
hSrc.imageSmoothingEnabled = false;
hSrc.drawImage(im, 0, 0);
var imdt = hSrc.getImageData(0, 0, hSrc.canvas.width, hSrc.canvas.height);
var data = imdt.data;
var len = data.length;
var i, bytes, code = 0;
var bc, gc, rc;
var sprite = false;
var flag, index;
var paper, sprite, indexes, output;
var rrggbb;
//
for(i = 0; i < len; i += 4) {
paper = {
b: (data[i] & 0x30) << 2,
g: (data[i + 1] & 0x30) << 2,
r: (data[i + 2] & 0x30) << 2
};
sprite = {
b: (data[i] & 0xC0),
g: (data[i + 1] & 0xC0),
r: (data[i + 2] & 0xC0)
};
indexes = {
b: (data[i] & 0x0C) << 4,
g: (data[i + 1] & 0x0C) << 4,
r: (data[i + 2] & 0x0C) << 4
};
flag = paper.r == sprite.r && paper.g == sprite.g && paper.b == sprite.b;
if(flag) {
output = {
r: paper.r & 0xC0,
g: paper.g & 0xC0,
b: paper.b & 0xC0
};
} else {
output = {
r: sprite.r & 0xC0,
g: sprite.g & 0xC0,
b: sprite.b & 0xC0
};
}
data[i] = output.b;
data[i + 1] = output.g;
data[i + 2] = output.r;
code = ((indexes.r & 0xC0) >> 2) | ((indexes.g & 0xC0) >> 4) | ((indexes.b & 0xC0) >> 6);
output_rrggbb = (output.r >> 2) | (output.g >> 4) | (output.b >> 6);
paper_rrggbb = (paper.r >> 2) | (paper.g >> 4) | (paper.b >> 6);
sprite_rrggbb = (sprite.r >> 2) | (sprite.g >> 4) | (sprite.b >> 6);
if(index != code) {
index = code;
pScr.push(index);
pScr.push(128 + paper_rrggbb);
} else {
pScr.push(128 + 64 + sprite_rrggbb);
pScr.push(128 + 0 + paper_rrggbb);
}
}
//
pScr.width = hSrc.canvas.width;
pScr.height = hSrc.canvas.height;
return pScr;
}
//////////////////////////////////////////////////////////////////////
this.render
= function(hCnv, pScr) {
if(hCnv.canvas.width != pScr.width || hCnv.canvas.height != pScr.height) {
hCnv.canvas.width = pScr.width * 2;
hCnv.canvas.height = pScr.height * 2;
}
var imdt = hCnv.getImageData(0, 0, hCnv.canvas.width, hCnv.canvas.height);
var data = imdt.data;
var r = 0, g = 0, b = 0;
var len = data.length / 3;
var dup = hCnv.canvas.width * 4;
var i = 0, bytes, index = 0, shift = 0;
var d, x, y;
var s = 0;
var mask = this.devices.i82CB.buffer.slice(0x0, 0x08);
var rn, gn, bn, noisel = 0;
//
for(y = 0; y < hCnv.canvas.height; ++ y) {
for(x = 0; x < hCnv.canvas.width; ++ x) {
if(-- noisel < 0) {
noisel = Math.floor(Math.random() * 64 * this.render.noise / 100) + 8;
rn = Math.floor(Math.random() * 256 * this.render.noise / 100);
gn = Math.floor(Math.random() * 256 * this.render.noise / 100);
bn = Math.floor(Math.random() * 256 * this.render.noise / 100);
}
d = pScr[s ++];
if(d & 128) {
if(((d >> 6) & 1) == ((mask[index] >> shift) & 1)) {
b = ((d & 3) << 6) ^ bn;
g = ((d & 12) << 4) ^ gn;
r = ((d & 48) << 2) ^ rn;
}
} else {
index = (d >> 3) & 15;
shift = d & 7;
}
data[i] = b;
data[i + 1] = g;
data[i + 2] = r;
data[i + 3] = 255;
data[i + dup] = b;
data[i + dup + 1] = g;
data[i + dup + 2] = r;
data[i + dup + 3] = 255;
i += 4;
if(x == hCnv.canvas.width - 1)
i += dup;
}
}
hCnv.putImageData(imdt, 0, 0);
}
//////////////////////////////////////////////////////////////////////
function parse_vector(text) {
var j;
var base;
var product = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var offset = 0, sign = 1;
var scan = 0;
var immediate = text.match(/\$[-+]?/);
var mode = 0;
var parts;
var codes = [], code;
var uses, used;
var using, usings;
if(text.match(/\$\+D/i) || text.match(/\$\+\d/))
mode = 1,
parts = text.replace(/\$\+/, "").match(/(D\d)|(\+\d*D\d)|([-+]\d+)/gi);
else
if(text.match(/[1-9]+#/))
mode = Number(text.match(/(\d+)/)[1]),
parts = text.replace(/\d+#/, "").match(/(D\d)|(\+\d*D\d)|([-+]\d+)/gi);
else
parts = text.match(/(D\d)|(\+\d*\*?D\d)|([-+]?\d+)/gi);
if(parts) {
if(parts[0].match(/^D\d$/i))
base = Number(parts[0].substr(-1));
else
if(parts[0].match(/[-+]\d+/))
offset = Number(parts[0].substr(1)),
base = 9;
for(i = 1; i < parts.length; ++ i) {
if(parts[i].match(/\+\d*D\d/i)) {
product[Number(parts[i].substr(-1))] += isFinite(parseInt(parts[i].substr(1))) ? parseInt(parts[i].substr(1)) : 1;
} else
if(parts[i].match(/[-+]\d+/)) {
if(parts[i].match(/-\d+/))
sign = -1;
offset = Number(parts[i].substr(1));
}
}
for(i = 0; i <= 9; ++ i) {
j = -1;
while((product[i] >> (j + 1)) > 0)
++ j;
if(scan < j)
scan = j;
}
used = 0;
usings = [];
usings.push(base);
while(scan >= 0) {
uses = 0;
using = [];
i = usings.pop();
code = [];
if((product[i] >> scan) > 0) {
product[i] -= 1 << scan;
uses |= 1 << i;
code.push(i);
if(scan > 0 && ((product[i] >> (scan - 1)) & 1) > 0)
using.push(String(i));
}
for(i = 0; i <= 9; ++ i) {
if((product[i] >> scan) > 0) {
uses |= 1 << i;
code.push(String(i));
if(scan > 0 && ((product[i] >> (scan - 1)) & 1) > 0)
using.push(i);
}
}
if((used & uses) == 0)
codes.push(String(base));
codes = codes.concat(code);
for(i = 0; i <= 9; ++ i) {
if((product[i] >> scan) > 0)
product[i] -= 1 << scan;
}
-- scan;
used = uses;
usings = [base].concat(using);
}
}
i = codes.length;
while(-- i >= 0) {
codes[i] += String(offset % 10);
offset = Math.floor(offset / 10);
}
while(offset > 0) {
codes.unshift(String(base) + String(offset % 10));
offset = Math.floor(offset / 10);
}
if(immediate)
codes.unshift(String(base) + "0"),
codes.unshift(String(base) + "0");
if(sign < 0)
codes.unshift(String(base) + "0");
if(typeof mode != "number")
mode = mode ? Number(mode[1]) : 0;
while(mode > 0) {
codes.unshift(String(mode % 10) + "0");
codes.unshift(String(mode % 10) + "0");
mode = Math.floor(mode / 10);
}
return codes.join(" ");
}
//////////////////////////////////////////////////////////////////////
function show_vector(codes) {
var mul = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var sep = -1;
var offset = 0;
var hi, lo, i;
var exp = [""];
var last = -1;
var nulls = 0;
var mode = 0;
var key = 0;
var flag;
var sign = "+";
var pairs = 0;
var marginal = 0;
console.log(codes.join(" "));
codes
.forEach
/* this.offset += this.offset << 2;
this.offset <<= 1;
this.offset += ic.right;
if(this.offset == 0 && ic.left == this.id.left && this.pairs == (1 << this.id.left))
this.marginal = this.marginal * 10 + ic.left,
this.id = 160,
this.pairs = 0;
else
if(((this.pairs >> ic.left) & 1) > 0) {
this.address <<= 1,
this.pairs = (1 << ic.left);
if(this.id < 160)
this.pairs |= (1 << this.id.left);
if(ic.left != this.id.left && this.id < 160)
this.address += this.ctx.pointer(0x00B0 | ic.left);
} else