text
stringlengths
1
1.05M
; *********************************************************** ; * * ; * Copyright, (C) Honeywell Bull Inc., 1987 * ; * * ; * Copyright, (C) Honeywell Information Systems Inc., 1986 * ; * * ; *********************************************************** ; HISTORY COMMENTS: ; 1) change(86-08-14,Westcott), approve(87-07-13,MCR7580), ; audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072): ; Created. ; 2) change(86-09-11,Flegel), approve(87-07-13,MCR7580), ; audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072): ; Resetting the MCR to not drop DTR. ; 3) change(86-09-11,Flegel), approve(87-07-13,MCR7580), ; audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072): ; Resetting the MCR to not drop RTS as well. ; 4) change(87-04-08,Flegel), approve(87-07-13,MCR7580), ; audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072): ; Erase the entire data area (security measures). ; END HISTORY COMMENTS page 55,132 ;/* : PROCEDURE FUNCTION (terminate_mowse): ; ;Remove MOWSE from the PC. This involves: ; - disabling interrupts from rs232 hardware ; - restoring interrupt vectors to pre-mowse values ; - releasing memory used by mowse ;*/ include dos.mac ;Lattice include file include xoscall.mac ;Bios and Dos Call macros include mowsdefs.mac include ws.mac include ws_buf.mac env_addr equ 2Ch ; location of address of environment string on PSP page ;***************************************************************************** ; DATA ;***************************************************************************** dseg ;------- External Declarations ----------------------------------------------- extrn _PSP:word extrn MASK8259:byte extrn SOFTNO:word extrn COM_PORT:word extrn HARDINTRPT:word extrn _TOP:word extrn _STACK:word ;------- Public Declarations ------------------------------------------------- public terminate_mowse endds page ;***************************************************************************** ; Program mainline ;***************************************************************************** pseg extrn INTHARD:near extrn INTSOFT:near extrn INT13:near extrn INT1C:near extrn INT28:near extrn free_program:near terminate_mowse proc near push bp ;/* : disable hardware interrupt on 8259 interrupt controller */ cli in AL,IMR8259 ;Get current masks mov cl,MASK8259 not cl or al,cl ;Reset interrupt mask out IMR8259,AL ;And restore to Interrupt Mask ;Register ;/* : disable 8250 interrupts */ mov DX,LCR ;DX ==> LCR add DX,COM_PORT in AL,DX ;Reset DLAB for IER access and AL,MASKLCR out DX,AL mov DX,IER ;Address IER add DX,COM_PORT xor ax,ax out DX,AL ; disable all rs232 interrupts ;/* : disable DTR,RTS,OUT1,OUT2 on 8250 */ mov DX,MCR ;Address MCR add DX,COM_PORT mov al,MASKMCR ;Disable OUT2, Leave DTR, RTS active low out DX,AL sti ;/* : Restore interrupt vectors to pre-mowse values */ push ds mov ax,HARDINTRPT push cs ; Set up addressability into CS pop ds mov dx,word ptr INTHARD mov ds,word ptr INTHARD+2 mov ah,25h int 21h pop ds mov ax,SOFTNO push ds push cs ; Set up addressability into CS pop ds ;/* : restore sofware interrupt vector */ mov dx,word ptr INTSOFT mov ds,word ptr INTSOFT+2 mov ah,25h int 21h ;/* : restore int 13 vector */ mov dx,word ptr INT13 mov ds,word ptr INT13+2 mov al,13h mov ah,25h int 21h ;/* : restore int 1C vector */ mov dx,word ptr INT1C mov ds,word ptr INT1C+2 mov al,1Ch mov ah,25h int 21h ;/* : restore int 28 vector */ mov dx,word ptr INT28 mov ds,word ptr INT28+2 mov al,28h mov ah,25h int 21h pop ds ;/* : Erase all static data area */ xor al,al mov cx,_TOP sub cx,_STACK xor si,si push DS pop ES erase_data: mov ES:[si],al inc si loopne erase_data ;/* : Free memory occupied by environment block */ push ES push CS pop ES ; ES = CS of program to free call free_program ; free program pop ES pop bp ret terminate_mowse endp endps end
//Language: GNU C++ /* ID: roben_71 PROG: acrobat LANG: C++ */ #include <iostream> #include<stdio.h> #include<stdlib.h> #include <cmath> #include<set> #include<algorithm> #include<vector> #include<string> #include<string.h> #include<fstream> #include<queue> #include<deque> #include<stack> #define pb push_back //#define pop pop_back #define li 200009 #define e 10000 #define maxxx 100000000 #define mp make_pair #define ss second.second #define sf second.first #define fs first.second #define ff first.first #define st first #define nd second #define ll long long #define inf 2147483647 #define rep(i,r,n) for(int i=r;i<=n;i++) #define clr(x,i) memset(x,i,sizeof(x)) #define min(x,i) x<i?x:i #define max(x,i) x>i?x:i #define ro(x,i) x-i<0?i-x:x-i #define abs(x) x<0?-x:x #define read(x) scanf("%d",&x) #define getf scanf #define print(x) printf("%d ",x) //#define end printf("\n") using namespace std; //ifstream fin; //ofstream fout; FILE *outt,*inn; ifstream fin("1.txt"); const int N = 1e3+10; int n,m,ans[N][N],nxt[128],rank=0,vis[N][N]; char c[N][N]; bool mark[N][N]; int sol(int i,int j,int x,int y){ if(c[i][j]=='A'){ return (ans[x][y]+1); } else{ return ans[x][y]; } } void dfs(int i,int j){ mark[i][j]=1; vis[i][j]=rank; bool is=0;//,ok=0; if(c[i][j+1]==nxt[c[i][j]]){ is=1; if(vis[i][j+1]==rank){ // cout<<i<<" "<<j<<" "<<i<<" "<<j+1<<endl; // cout<<rank; puts("Poor Inna!"); exit(0); } if(!mark[i][j+1]){ // ok=1; dfs(i,j+1); } ans[i][j]=max(ans[i][j],sol(i,j,i,j+1)); } //2 if(c[i][j-1]==nxt[c[i][j]]){ is=1; if(vis[i][j-1]==rank){ // cout<<i<<" "<<j<<" "<<i<<" "<<j-1<<endl; // cout<<rank; puts("Poor Inna!"); exit(0); } if(!mark[i][j-1]){ // ok=1; dfs(i,j-1); } ans[i][j]=max(ans[i][j],sol(i,j,i,j-1)); } //3 if(c[i+1][j]==nxt[c[i][j]]){ is=1; if(vis[i+1][j]==rank){ // cout<<i<<" "<<j<<" "<<i+1<<" "<<j<<endl; // cout<<rank; puts("Poor Inna!"); exit(0); } if(!mark[i+1][j]){ // ok=1; dfs(i+1,j); } ans[i][j]=max(ans[i][j],sol(i,j,i+1,j)); } //4 if(c[i-1][j]==nxt[c[i][j]]){ is=1; if(vis[i-1][j]==rank){ // cout<<i<<" "<<j<<" "<<i-1<<" "<<j<<endl; // cout<<rank; puts("Poor Inna!"); exit(0); } if(!mark[i-1][j]){ // ok=1; dfs(i-1,j); } ans[i][j]=max(ans[i][j],sol(i,j,i-1,j)); } if(!is){ if(c[i][j]=='A'){ ans[i][j]=1; } } // if(!ok){ vis[i][j]=0; // } return; } int main(){ read(n),read(m); nxt['D']='I'; nxt['I']='M';nxt['M']='A';nxt['A']='D'; for(int i=1;i<=n;i++){ scanf("%s",c[i]+1); } clr(ans,0); clr(vis,0); clr(mark,0); rank=1; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(!mark[i][j] && c[i][j]=='D'){ dfs(i,j); } } } int res=0; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(c[i][j]=='D'){ res=max(res,ans[i][j]); } } } if(res==0){ puts("Poor Dima!"); return 0; } printf("%d",res); return 0; }
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.23506.0 TITLE D:\scottsdocs\sourcecode\OpenGLboxes\code\glfwwrapper.cpp .686P .XMM include listing.inc .model flat INCLUDELIB MSVCRTD INCLUDELIB OLDNAMES PUBLIC ?__empty_global_delete@@YAXPAX@Z ; __empty_global_delete PUBLIC ?__empty_global_delete@@YAXPAXI@Z ; __empty_global_delete PUBLIC ??2@YAPAXIPAX@Z ; operator new PUBLIC ?length@?$char_traits@D@std@@SAIPBD@Z ; std::char_traits<char>::length PUBLIC ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z ; std::char_traits<char>::copy PUBLIC ?move@?$char_traits@D@std@@SAPADPADPBDI@Z ; std::char_traits<char>::move PUBLIC ?assign@?$char_traits@D@std@@SAXAADABD@Z ; std::char_traits<char>::assign PUBLIC ??0_Container_proxy@std@@QAE@XZ ; std::_Container_proxy::_Container_proxy PUBLIC ??0_Container_base12@std@@QAE@XZ ; std::_Container_base12::_Container_base12 PUBLIC ??1_Container_base12@std@@QAE@XZ ; std::_Container_base12::~_Container_base12 PUBLIC ?_Orphan_all@_Container_base12@std@@QAEXXZ ; std::_Container_base12::_Orphan_all PUBLIC ?_Allocate@std@@YAPAXII_N@Z ; std::_Allocate PUBLIC ?_Deallocate@std@@YAXPAXII@Z ; std::_Deallocate PUBLIC ??0?$allocator@D@std@@QAE@XZ ; std::allocator<char>::allocator<char> PUBLIC ??0?$allocator@D@std@@QAE@ABV01@@Z ; std::allocator<char>::allocator<char> PUBLIC ?deallocate@?$allocator@D@std@@QAEXPADI@Z ; std::allocator<char>::deallocate PUBLIC ?allocate@?$allocator@D@std@@QAEPADI@Z ; std::allocator<char>::allocate PUBLIC ?max_size@?$allocator@D@std@@QBEIXZ ; std::allocator<char>::max_size PUBLIC ?max_size@?$allocator_traits@V?$allocator@D@std@@@std@@SAIABV?$allocator@D@2@@Z ; std::allocator_traits<std::allocator<char> >::max_size PUBLIC ??0?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAE@ABV?$allocator@D@1@@Z ; std::_Wrap_alloc<std::allocator<char> >::_Wrap_alloc<std::allocator<char> > PUBLIC ?allocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEPADI@Z ; std::_Wrap_alloc<std::allocator<char> >::allocate PUBLIC ?deallocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPADI@Z ; std::_Wrap_alloc<std::allocator<char> >::deallocate PUBLIC ?max_size@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QBEIU_Nil@2@@Z ; std::_Wrap_alloc<std::allocator<char> >::max_size PUBLIC ??0?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ ; std::_String_val<std::_Simple_types<char> >::_String_val<std::_Simple_types<char> > PUBLIC ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QAEPADXZ ; std::_String_val<std::_Simple_types<char> >::_Myptr PUBLIC ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QBEPBDXZ ; std::_String_val<std::_Simple_types<char> >::_Myptr PUBLIC ??1?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ ; std::_String_val<std::_Simple_types<char> >::~_String_val<std::_Simple_types<char> > PUBLIC ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr PUBLIC ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEPBDXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr PUBLIC ??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_String_alloc<std::_String_base_types<char,std::allocator<char> > > PUBLIC ??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<std::_String_base_types<char,std::allocator<char> > > PUBLIC ?_Alloc_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Alloc_proxy PUBLIC ?_Free_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Free_proxy PUBLIC ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy PUBLIC ?_Orphan_all@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Orphan_all PUBLIC ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal PUBLIC ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal PUBLIC ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data PUBLIC ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data PUBLIC ?_Bx@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAT_Bxty@?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Bx PUBLIC ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize PUBLIC ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize PUBLIC ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres PUBLIC ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_first PUBLIC ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_first PUBLIC ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_second PUBLIC ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_second PUBLIC ??1?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::~_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1> PUBLIC ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > PUBLIC ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign PUBLIC ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign PUBLIC ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign PUBLIC ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@I@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::erase PUBLIC ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::erase PUBLIC ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size PUBLIC ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::max_size PUBLIC ?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy PUBLIC ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos PUBLIC ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NI_N@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow PUBLIC ?_Inside@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NPBD@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Inside PUBLIC ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEX_NI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy PUBLIC ?_Xlen@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xlen PUBLIC ?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xran PUBLIC ??0GLFWwrapper@@QAE@XZ ; GLFWwrapper::GLFWwrapper PUBLIC ??0GLFWwrapper@@QAE@PAVEventListener@@HHPBD@Z ; GLFWwrapper::GLFWwrapper PUBLIC ??1GLFWwrapper@@QAE@XZ ; GLFWwrapper::~GLFWwrapper PUBLIC ?vSync@GLFWwrapper@@QAEXH@Z ; GLFWwrapper::vSync PUBLIC ?PollEvents@GLFWwrapper@@QAEXPAVEventListener@@@Z ; GLFWwrapper::PollEvents PUBLIC ?WrapSwapBuffers@GLFWwrapper@@QAEXXZ ; GLFWwrapper::WrapSwapBuffers PUBLIC ?KeyHandler@GLFWwrapper@@SAXPAUGLFWwindow@@HHHH@Z ; GLFWwrapper::KeyHandler PUBLIC ?ScrollHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z ; GLFWwrapper::ScrollHandler PUBLIC ?MouseHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z ; GLFWwrapper::MouseHandler PUBLIC ??$?0NN@?$tvec2@M$0A@@glm@@QAE@ABN0@Z ; glm::tvec2<float,0>::tvec2<float,0><double,double> PUBLIC ??$_Debug_pointer@$$CBD@std@@YAXPBDPB_WI@Z ; std::_Debug_pointer<char const > PUBLIC ??$?0ABV?$allocator@D@std@@$$V@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@U_One_then_variadic_args_t@1@ABV?$allocator@D@1@@Z ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1><std::allocator<char> const &> PUBLIC ??$destroy@PAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPAD@Z ; std::_Wrap_alloc<std::allocator<char> >::destroy<char *> PUBLIC ??$addressof@D@std@@YAPADAAD@Z ; std::addressof<char> PUBLIC ??$_Debug_pointer_if@$$CBD@std@@YAX_NPBDPB_WI@Z ; std::_Debug_pointer_if<char const > PUBLIC ??$construct@PADAAPAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPADAAPAD@Z ; std::_Wrap_alloc<std::allocator<char> >::construct<char *,char * &> PUBLIC ?deallocate@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@2@I@Z ; std::allocator<std::_Container_proxy>::deallocate PUBLIC ?allocate@?$allocator@U_Container_proxy@std@@@std@@QAEPAU_Container_proxy@2@I@Z ; std::allocator<std::_Container_proxy>::allocate PUBLIC ?allocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEPAU_Container_proxy@2@I@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::allocate PUBLIC ?deallocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@2@I@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::deallocate PUBLIC ??$destroy@U_Container_proxy@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::destroy<std::_Container_proxy> PUBLIC ??$construct@U_Container_proxy@std@@U12@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::construct<std::_Container_proxy,std::_Container_proxy> PUBLIC ??$?0U?$_Wrap_alloc@V?$allocator@D@std@@@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAE@AAU?$_Wrap_alloc@V?$allocator@D@std@@@1@@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::_Wrap_alloc<std::allocator<std::_Container_proxy> ><std::_Wrap_alloc<std::allocator<char> > > PUBLIC ??$?0D@?$allocator@U_Container_proxy@std@@@std@@QAE@ABV?$allocator@D@1@@Z ; std::allocator<std::_Container_proxy>::allocator<std::_Container_proxy><char> PUBLIC ??$forward@ABV?$allocator@D@std@@@std@@YAABV?$allocator@D@0@ABV10@@Z ; std::forward<std::allocator<char> const &> PUBLIC ??$destroy@PAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPAD@Z ; std::allocator_traits<std::allocator<char> >::destroy<char *> PUBLIC ??$_Addressof@D@std@@YAPADAADU?$integral_constant@_N$0A@@0@@Z ; std::_Addressof<char> PUBLIC ??$forward@AAPAD@std@@YAAAPADAAPAD@Z ; std::forward<char * &> PUBLIC ??$construct@PADAAPAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPADAAPAD@Z ; std::allocator_traits<std::allocator<char> >::construct<char *,char * &> PUBLIC ??$destroy@U_Container_proxy@std@@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@@Z ; std::allocator_traits<std::allocator<std::_Container_proxy> >::destroy<std::_Container_proxy> PUBLIC ??$forward@U_Container_proxy@std@@@std@@YA$$QAU_Container_proxy@0@AAU10@@Z ; std::forward<std::_Container_proxy> PUBLIC ??$construct@U_Container_proxy@std@@U12@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@$$QAU31@@Z ; std::allocator_traits<std::allocator<std::_Container_proxy> >::construct<std::_Container_proxy,std::_Container_proxy> PUBLIC ??$destroy@PAD@?$allocator@D@std@@QAEXPAPAD@Z ; std::allocator<char>::destroy<char *> PUBLIC ??$construct@PADAAPAD@?$allocator@D@std@@QAEXPAPADAAPAD@Z ; std::allocator<char>::construct<char *,char * &> PUBLIC ??$destroy@U_Container_proxy@std@@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@@Z ; std::allocator<std::_Container_proxy>::destroy<std::_Container_proxy> PUBLIC ??$construct@U_Container_proxy@std@@U12@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z ; std::allocator<std::_Container_proxy>::construct<std::_Container_proxy,std::_Container_proxy> PUBLIC ?__LINE__Var@?0??_Allocate@std@@YAPAXII_N@Z@4JA ; `std::_Allocate'::`1'::__LINE__Var PUBLIC ??_C@_0BE@LMNLACIC@_Ptr_container?5?$CB?$DN?50?$AA@ ; `string' PUBLIC ??_C@_1DG@HGDKEBPG@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$CB?$AA?$DN?$AA?5?$AA0?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5?$AA0?$AA?$AA@ ; `string' PUBLIC ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ ; `string' PUBLIC ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ ; `string' PUBLIC ??_C@_1BO@NKFMJPA@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAA?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ ; `string' PUBLIC ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ ; `string' PUBLIC ??_C@_09GLJCAGLP@_Ptr?5?$CB?$DN?50?$AA@ ; `string' PUBLIC ??_C@_1CC@GKJLLHIM@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA?5?$AA?$CB?$AA?$DN?$AA?5?$AA0?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5?$AA0?$AA?$AA@ ; `string' PUBLIC ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA ; `std::_Deallocate'::`1'::__LINE__Var PUBLIC ??_C@_0BN@HMCJOMKN@_Count?5?$DM?$DN?5?$CIsize_t?$CJ?$CI?91?$CJ?5?1?5_Sz?$AA@ ; `string' PUBLIC ??_C@_1EI@MLOBABC@?$AA?$CC?$AA_?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA?$CI?$AAs?$AAi?$AAz?$AAe?$AA_?$AAt?$AA?$CJ?$AA?$CI?$AA?9?$AA1?$AA?$CJ?$AA?5?$AA?1?$AA?5?$AA_?$AAS?$AAz?$AA?$CC?$AA?5?$AA?$CG@ ; `string' PUBLIC ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ ; `string' PUBLIC ??_C@_0DD@GBGGGKGG@?$CI_Ptr_user?5?$CG?5?$CI_BIG_ALLOCATION_AL@ ; `string' PUBLIC ??_C@_1HE@CDMBFOKC@?$AA?$CC?$AA?$CI?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?5?$AA?$CG?$AA?5?$AA?$CI?$AA_?$AAB?$AAI?$AAG?$AA_?$AAA?$AAL?$AAL?$AAO?$AAC?$AAA?$AAT?$AAI?$AAO?$AAN?$AA_?$AAA@ ; `string' PUBLIC ??_C@_0EI@NOJHEJCJ@reinterpret_cast?$DMuintptr_t?5?$CK?$DO?$CI_P@ ; `string' PUBLIC ??_C@_1JO@EKLKIEHP@?$AA?$CC?$AAr?$AAe?$AAi?$AAn?$AAt?$AAe?$AAr?$AAp?$AAr?$AAe?$AAt?$AA_?$AAc?$AAa?$AAs?$AAt?$AA?$DM?$AAu?$AAi?$AAn?$AAt?$AAp?$AAt?$AAr?$AA_?$AAt?$AA?5?$AA?$CK?$AA?$DO?$AA?$CI?$AA_@ ; `string' PUBLIC ??_C@_0BL@OCKMEJON@_Ptr_container?5?$DM?5_Ptr_user?$AA@ ; `string' PUBLIC ??_C@_1EE@PDHAHDDC@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$DM?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5@ ; `string' PUBLIC ??_C@_0DB@GLFJLNCE@2?5?$CK?5sizeof?$CIvoid?5?$CK?$CJ?5?$DM?$DN?5_Ptr_user?5@ ; `string' PUBLIC ??_C@_1HA@NAPGMHAO@?$AA?$CC?$AA2?$AA?5?$AA?$CK?$AA?5?$AAs?$AAi?$AAz?$AAe?$AAo?$AAf?$AA?$CI?$AAv?$AAo?$AAi?$AAd?$AA?5?$AA?$CK?$AA?$CJ?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr@ ; `string' PUBLIC ??_C@_0CN@BLHJCAL@_Ptr_user?5?9?5_Ptr_container?5?$DM?$DN?5_N@ ; `string' PUBLIC ??_C@_1GI@DHJGPFNI@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?5?$AA?9?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA_@ ; `string' PUBLIC ??_C@_0CJ@NALJHCFL@must?5pass?5in?5event?5struct?5to?5GLF@ ; `string' PUBLIC ??_C@_0BK@FDBIAIHI@failed?5to?5initialize?5glfw?$AA@ ; `string' PUBLIC ??_C@_0BI@EPCLPAIO@failed?5to?5create?5window?$AA@ ; `string' PUBLIC ??_C@_1EE@PIAPABGP@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAs?$AAt?$AAr?$AAi?$AAn@ ; `string' PUBLIC ??_C@_0BI@CFPLBAOH@invalid?5string?5position?$AA@ ; `string' PUBLIC ??_C@_0BA@JFNIOLAK@string?5too?5long?$AA@ ; `string' PUBLIC ??_C@_1CK@EOPGIILJ@?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAn?$AAu?$AAl?$AAl?$AA?5?$AAp?$AAo?$AAi?$AAn?$AAt?$AAe?$AAr?$AA?$AA@ ; `string' EXTRN ??2@YAPAXI@Z:PROC ; operator new EXTRN ??3@YAXPAX@Z:PROC ; operator delete EXTRN __imp___invalid_parameter:PROC EXTRN __imp_??0_Lockit@std@@QAE@H@Z:PROC EXTRN __imp_??1_Lockit@std@@QAE@XZ:PROC EXTRN _memcpy:PROC EXTRN __imp__memmove:PROC EXTRN _strlen:PROC EXTRN __imp___CrtDbgReportW:PROC EXTRN __imp_?_Debug_message@std@@YAXPB_W0I@Z:PROC EXTRN __imp_?_Xbad_alloc@std@@YAXXZ:PROC EXTRN __imp_?_Xlength_error@std@@YAXPBD@Z:PROC EXTRN __imp_?_Xout_of_range@std@@YAXPBD@Z:PROC EXTRN _glfwInit:PROC EXTRN _glfwTerminate:PROC EXTRN _glfwWindowHint:PROC EXTRN _glfwCreateWindow:PROC EXTRN _glfwSetWindowUserPointer:PROC EXTRN _glfwGetWindowUserPointer:PROC EXTRN _glfwPollEvents:PROC EXTRN _glfwSetKeyCallback:PROC EXTRN _glfwSetCursorPosCallback:PROC EXTRN _glfwSetScrollCallback:PROC EXTRN _glfwMakeContextCurrent:PROC EXTRN _glfwSwapBuffers:PROC EXTRN _glfwSwapInterval:PROC EXTRN ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z:PROC ; EventListener::SetKey EXTRN ?SetMousePos@EventListener@@QAEXU?$tvec2@M$0A@@glm@@@Z:PROC ; EventListener::SetMousePos EXTRN ?SetIsMouseInWindow@EventListener@@QAEX_N@Z:PROC ; EventListener::SetIsMouseInWindow EXTRN ?GetIsMouseInWindow@EventListener@@QAE_NXZ:PROC ; EventListener::GetIsMouseInWindow EXTRN ?SetCloseGame@EventListener@@QAEXXZ:PROC ; EventListener::SetCloseGame EXTRN ?Assert@Debug@@SAX_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z:PROC ; Debug::Assert EXTRN @_RTC_CheckStackVars@8:PROC EXTRN @__security_check_cookie@4:PROC EXTRN __CxxThrowException@8:PROC EXTRN __RTC_CheckEsp:PROC EXTRN __RTC_InitBase:PROC EXTRN __RTC_Shutdown:PROC EXTRN ___CxxFrameHandler3:PROC EXTRN ___security_cookie:DWORD EXTRN __fltused:DWORD ; COMDAT rtc$TMZ rtc$TMZ SEGMENT __RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown rtc$TMZ ENDS ; COMDAT rtc$IMZ rtc$IMZ SEGMENT __RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase rtc$IMZ ENDS ; COMDAT ??_C@_1CK@EOPGIILJ@?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAn?$AAu?$AAl?$AAl?$AA?5?$AAp?$AAo?$AAi?$AAn?$AAt?$AAe?$AAr?$AA?$AA@ CONST SEGMENT ??_C@_1CK@EOPGIILJ@?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAn?$AAu?$AAl?$AAl?$AA?5?$AAp?$AAo?$AAi?$AAn?$AAt?$AAe?$AAr?$AA?$AA@ DB 'i' DB 00H, 'n', 00H, 'v', 00H, 'a', 00H, 'l', 00H, 'i', 00H, 'd', 00H DB ' ', 00H, 'n', 00H, 'u', 00H, 'l', 00H, 'l', 00H, ' ', 00H, 'p' DB 00H, 'o', 00H, 'i', 00H, 'n', 00H, 't', 00H, 'e', 00H, 'r', 00H DB 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BA@JFNIOLAK@string?5too?5long?$AA@ CONST SEGMENT ??_C@_0BA@JFNIOLAK@string?5too?5long?$AA@ DB 'string too long', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BI@CFPLBAOH@invalid?5string?5position?$AA@ CONST SEGMENT ??_C@_0BI@CFPLBAOH@invalid?5string?5position?$AA@ DB 'invalid string posi' DB 'tion', 00H ; `string' CONST ENDS ; COMDAT ??_C@_1EE@PIAPABGP@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAs?$AAt?$AAr?$AAi?$AAn@ CONST SEGMENT ??_C@_1EE@PIAPABGP@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAs?$AAt?$AAr?$AAi?$AAn@ DB 'd' DB 00H, ':', 00H, '\', 00H, 'a', 00H, 'p', 00H, 'p', 00H, 'd', 00H DB 'a', 00H, 't', 00H, 'a', 00H, '\', 00H, 'v', 00H, 's', 00H, 'p' DB 00H, '\', 00H, 'v', 00H, 'c', 00H, '\', 00H, 'i', 00H, 'n', 00H DB 'c', 00H, 'l', 00H, 'u', 00H, 'd', 00H, 'e', 00H, '\', 00H, 'x' DB 00H, 's', 00H, 't', 00H, 'r', 00H, 'i', 00H, 'n', 00H, 'g', 00H DB 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BI@EPCLPAIO@failed?5to?5create?5window?$AA@ CONST SEGMENT ??_C@_0BI@EPCLPAIO@failed?5to?5create?5window?$AA@ DB 'failed to create w' DB 'indow', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BK@FDBIAIHI@failed?5to?5initialize?5glfw?$AA@ CONST SEGMENT ??_C@_0BK@FDBIAIHI@failed?5to?5initialize?5glfw?$AA@ DB 'failed to initia' DB 'lize glfw', 00H ; `string' CONST ENDS ; COMDAT ??_C@_0CJ@NALJHCFL@must?5pass?5in?5event?5struct?5to?5GLF@ CONST SEGMENT ??_C@_0CJ@NALJHCFL@must?5pass?5in?5event?5struct?5to?5GLF@ DB 'must pass ' DB 'in event struct to GLFWwrapper', 00H ; `string' CONST ENDS ; COMDAT ??_C@_1GI@DHJGPFNI@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?5?$AA?9?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA_@ CONST SEGMENT ??_C@_1GI@DHJGPFNI@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?5?$AA?9?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA_@ DB '"' DB 00H, '_', 00H, 'P', 00H, 't', 00H, 'r', 00H, '_', 00H, 'u', 00H DB 's', 00H, 'e', 00H, 'r', 00H, ' ', 00H, '-', 00H, ' ', 00H, '_' DB 00H, 'P', 00H, 't', 00H, 'r', 00H, '_', 00H, 'c', 00H, 'o', 00H DB 'n', 00H, 't', 00H, 'a', 00H, 'i', 00H, 'n', 00H, 'e', 00H, 'r' DB 00H, ' ', 00H, '<', 00H, '=', 00H, ' ', 00H, '_', 00H, 'N', 00H DB 'O', 00H, 'N', 00H, '_', 00H, 'U', 00H, 'S', 00H, 'E', 00H, 'R' DB 00H, '_', 00H, 'S', 00H, 'I', 00H, 'Z', 00H, 'E', 00H, '"', 00H DB ' ', 00H, '&', 00H, '&', 00H, ' ', 00H, '0', 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0CN@BLHJCAL@_Ptr_user?5?9?5_Ptr_container?5?$DM?$DN?5_N@ CONST SEGMENT ??_C@_0CN@BLHJCAL@_Ptr_user?5?9?5_Ptr_container?5?$DM?$DN?5_N@ DB '_Ptr_u' DB 'ser - _Ptr_container <= _NON_USER_SIZE', 00H ; `string' CONST ENDS ; COMDAT ??_C@_1HA@NAPGMHAO@?$AA?$CC?$AA2?$AA?5?$AA?$CK?$AA?5?$AAs?$AAi?$AAz?$AAe?$AAo?$AAf?$AA?$CI?$AAv?$AAo?$AAi?$AAd?$AA?5?$AA?$CK?$AA?$CJ?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr@ CONST SEGMENT ??_C@_1HA@NAPGMHAO@?$AA?$CC?$AA2?$AA?5?$AA?$CK?$AA?5?$AAs?$AAi?$AAz?$AAe?$AAo?$AAf?$AA?$CI?$AAv?$AAo?$AAi?$AAd?$AA?5?$AA?$CK?$AA?$CJ?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr@ DB '"' DB 00H, '2', 00H, ' ', 00H, '*', 00H, ' ', 00H, 's', 00H, 'i', 00H DB 'z', 00H, 'e', 00H, 'o', 00H, 'f', 00H, '(', 00H, 'v', 00H, 'o' DB 00H, 'i', 00H, 'd', 00H, ' ', 00H, '*', 00H, ')', 00H, ' ', 00H DB '<', 00H, '=', 00H, ' ', 00H, '_', 00H, 'P', 00H, 't', 00H, 'r' DB 00H, '_', 00H, 'u', 00H, 's', 00H, 'e', 00H, 'r', 00H, ' ', 00H DB '-', 00H, ' ', 00H, '_', 00H, 'P', 00H, 't', 00H, 'r', 00H, '_' DB 00H, 'c', 00H, 'o', 00H, 'n', 00H, 't', 00H, 'a', 00H, 'i', 00H DB 'n', 00H, 'e', 00H, 'r', 00H, '"', 00H, ' ', 00H, '&', 00H, '&' DB 00H, ' ', 00H, '0', 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0DB@GLFJLNCE@2?5?$CK?5sizeof?$CIvoid?5?$CK?$CJ?5?$DM?$DN?5_Ptr_user?5@ CONST SEGMENT ??_C@_0DB@GLFJLNCE@2?5?$CK?5sizeof?$CIvoid?5?$CK?$CJ?5?$DM?$DN?5_Ptr_user?5@ DB '2' DB ' * sizeof(void *) <= _Ptr_user - _Ptr_container', 00H ; `string' CONST ENDS ; COMDAT ??_C@_1EE@PDHAHDDC@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$DM?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5@ CONST SEGMENT ??_C@_1EE@PDHAHDDC@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$DM?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5@ DB '"' DB 00H, '_', 00H, 'P', 00H, 't', 00H, 'r', 00H, '_', 00H, 'c', 00H DB 'o', 00H, 'n', 00H, 't', 00H, 'a', 00H, 'i', 00H, 'n', 00H, 'e' DB 00H, 'r', 00H, ' ', 00H, '<', 00H, ' ', 00H, '_', 00H, 'P', 00H DB 't', 00H, 'r', 00H, '_', 00H, 'u', 00H, 's', 00H, 'e', 00H, 'r' DB 00H, '"', 00H, ' ', 00H, '&', 00H, '&', 00H, ' ', 00H, '0', 00H DB 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BL@OCKMEJON@_Ptr_container?5?$DM?5_Ptr_user?$AA@ CONST SEGMENT ??_C@_0BL@OCKMEJON@_Ptr_container?5?$DM?5_Ptr_user?$AA@ DB '_Ptr_containe' DB 'r < _Ptr_user', 00H ; `string' CONST ENDS ; COMDAT ??_C@_1JO@EKLKIEHP@?$AA?$CC?$AAr?$AAe?$AAi?$AAn?$AAt?$AAe?$AAr?$AAp?$AAr?$AAe?$AAt?$AA_?$AAc?$AAa?$AAs?$AAt?$AA?$DM?$AAu?$AAi?$AAn?$AAt?$AAp?$AAt?$AAr?$AA_?$AAt?$AA?5?$AA?$CK?$AA?$DO?$AA?$CI?$AA_@ CONST SEGMENT ??_C@_1JO@EKLKIEHP@?$AA?$CC?$AAr?$AAe?$AAi?$AAn?$AAt?$AAe?$AAr?$AAp?$AAr?$AAe?$AAt?$AA_?$AAc?$AAa?$AAs?$AAt?$AA?$DM?$AAu?$AAi?$AAn?$AAt?$AAp?$AAt?$AAr?$AA_?$AAt?$AA?5?$AA?$CK?$AA?$DO?$AA?$CI?$AA_@ DB '"' DB 00H, 'r', 00H, 'e', 00H, 'i', 00H, 'n', 00H, 't', 00H, 'e', 00H DB 'r', 00H, 'p', 00H, 'r', 00H, 'e', 00H, 't', 00H, '_', 00H, 'c' DB 00H, 'a', 00H, 's', 00H, 't', 00H, '<', 00H, 'u', 00H, 'i', 00H DB 'n', 00H, 't', 00H, 'p', 00H, 't', 00H, 'r', 00H, '_', 00H, 't' DB 00H, ' ', 00H, '*', 00H, '>', 00H, '(', 00H, '_', 00H, 'P', 00H DB 't', 00H, 'r', 00H, '_', 00H, 'p', 00H, 't', 00H, 'r', 00H, ')' DB 00H, '[', 00H, '-', 00H, '1', 00H, ']', 00H, ' ', 00H, '=', 00H DB '=', 00H, ' ', 00H, '_', 00H, 'B', 00H, 'I', 00H, 'G', 00H, '_' DB 00H, 'A', 00H, 'L', 00H, 'L', 00H, 'O', 00H, 'C', 00H, 'A', 00H DB 'T', 00H, 'I', 00H, 'O', 00H, 'N', 00H, '_', 00H, 'S', 00H, 'E' DB 00H, 'N', 00H, 'T', 00H, 'I', 00H, 'N', 00H, 'E', 00H, 'L', 00H DB '"', 00H, ' ', 00H, '&', 00H, '&', 00H, ' ', 00H, '0', 00H, 00H DB 00H ; `string' CONST ENDS ; COMDAT ??_C@_0EI@NOJHEJCJ@reinterpret_cast?$DMuintptr_t?5?$CK?$DO?$CI_P@ CONST SEGMENT ??_C@_0EI@NOJHEJCJ@reinterpret_cast?$DMuintptr_t?5?$CK?$DO?$CI_P@ DB 'rei' DB 'nterpret_cast<uintptr_t *>(_Ptr_ptr)[-1] == _BIG_ALLOCATION_S' DB 'ENTINEL', 00H ; `string' CONST ENDS ; COMDAT ??_C@_1HE@CDMBFOKC@?$AA?$CC?$AA?$CI?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?5?$AA?$CG?$AA?5?$AA?$CI?$AA_?$AAB?$AAI?$AAG?$AA_?$AAA?$AAL?$AAL?$AAO?$AAC?$AAA?$AAT?$AAI?$AAO?$AAN?$AA_?$AAA@ CONST SEGMENT ??_C@_1HE@CDMBFOKC@?$AA?$CC?$AA?$CI?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?5?$AA?$CG?$AA?5?$AA?$CI?$AA_?$AAB?$AAI?$AAG?$AA_?$AAA?$AAL?$AAL?$AAO?$AAC?$AAA?$AAT?$AAI?$AAO?$AAN?$AA_?$AAA@ DB '"' DB 00H, '(', 00H, '_', 00H, 'P', 00H, 't', 00H, 'r', 00H, '_', 00H DB 'u', 00H, 's', 00H, 'e', 00H, 'r', 00H, ' ', 00H, '&', 00H, ' ' DB 00H, '(', 00H, '_', 00H, 'B', 00H, 'I', 00H, 'G', 00H, '_', 00H DB 'A', 00H, 'L', 00H, 'L', 00H, 'O', 00H, 'C', 00H, 'A', 00H, 'T' DB 00H, 'I', 00H, 'O', 00H, 'N', 00H, '_', 00H, 'A', 00H, 'L', 00H DB 'I', 00H, 'G', 00H, 'N', 00H, 'M', 00H, 'E', 00H, 'N', 00H, 'T' DB 00H, ' ', 00H, '-', 00H, ' ', 00H, '1', 00H, ')', 00H, ')', 00H DB ' ', 00H, '=', 00H, '=', 00H, ' ', 00H, '0', 00H, '"', 00H, ' ' DB 00H, '&', 00H, '&', 00H, ' ', 00H, '0', 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0DD@GBGGGKGG@?$CI_Ptr_user?5?$CG?5?$CI_BIG_ALLOCATION_AL@ CONST SEGMENT ??_C@_0DD@GBGGGKGG@?$CI_Ptr_user?5?$CG?5?$CI_BIG_ALLOCATION_AL@ DB '(_Ptr' DB '_user & (_BIG_ALLOCATION_ALIGNMENT - 1)) == 0', 00H ; `string' CONST ENDS ; COMDAT ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ CONST SEGMENT ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ DB 's' DB 00H, 't', 00H, 'd', 00H, ':', 00H, ':', 00H, '_', 00H, 'D', 00H DB 'e', 00H, 'a', 00H, 'l', 00H, 'l', 00H, 'o', 00H, 'c', 00H, 'a' DB 00H, 't', 00H, 'e', 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_1EI@MLOBABC@?$AA?$CC?$AA_?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA?$CI?$AAs?$AAi?$AAz?$AAe?$AA_?$AAt?$AA?$CJ?$AA?$CI?$AA?9?$AA1?$AA?$CJ?$AA?5?$AA?1?$AA?5?$AA_?$AAS?$AAz?$AA?$CC?$AA?5?$AA?$CG@ CONST SEGMENT ??_C@_1EI@MLOBABC@?$AA?$CC?$AA_?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA?$CI?$AAs?$AAi?$AAz?$AAe?$AA_?$AAt?$AA?$CJ?$AA?$CI?$AA?9?$AA1?$AA?$CJ?$AA?5?$AA?1?$AA?5?$AA_?$AAS?$AAz?$AA?$CC?$AA?5?$AA?$CG@ DB '"' DB 00H, '_', 00H, 'C', 00H, 'o', 00H, 'u', 00H, 'n', 00H, 't', 00H DB ' ', 00H, '<', 00H, '=', 00H, ' ', 00H, '(', 00H, 's', 00H, 'i' DB 00H, 'z', 00H, 'e', 00H, '_', 00H, 't', 00H, ')', 00H, '(', 00H DB '-', 00H, '1', 00H, ')', 00H, ' ', 00H, '/', 00H, ' ', 00H, '_' DB 00H, 'S', 00H, 'z', 00H, '"', 00H, ' ', 00H, '&', 00H, '&', 00H DB ' ', 00H, '0', 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BN@HMCJOMKN@_Count?5?$DM?$DN?5?$CIsize_t?$CJ?$CI?91?$CJ?5?1?5_Sz?$AA@ CONST SEGMENT ??_C@_0BN@HMCJOMKN@_Count?5?$DM?$DN?5?$CIsize_t?$CJ?$CI?91?$CJ?5?1?5_Sz?$AA@ DB '_' DB 'Count <= (size_t)(-1) / _Sz', 00H ; `string' CONST ENDS ; COMDAT ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA _DATA SEGMENT ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA DD 062H ; `std::_Deallocate'::`1'::__LINE__Var _DATA ENDS ; COMDAT ??_C@_1CC@GKJLLHIM@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA?5?$AA?$CB?$AA?$DN?$AA?5?$AA0?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5?$AA0?$AA?$AA@ CONST SEGMENT ??_C@_1CC@GKJLLHIM@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA?5?$AA?$CB?$AA?$DN?$AA?5?$AA0?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5?$AA0?$AA?$AA@ DB '"' DB 00H, '_', 00H, 'P', 00H, 't', 00H, 'r', 00H, ' ', 00H, '!', 00H DB '=', 00H, ' ', 00H, '0', 00H, '"', 00H, ' ', 00H, '&', 00H, '&' DB 00H, ' ', 00H, '0', 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_09GLJCAGLP@_Ptr?5?$CB?$DN?50?$AA@ CONST SEGMENT ??_C@_09GLJCAGLP@_Ptr?5?$CB?$DN?50?$AA@ DB '_Ptr != 0', 00H ; `string' CONST ENDS ; COMDAT ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ CONST SEGMENT ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ DB '"' DB 00H, 'i', 00H, 'n', 00H, 'v', 00H, 'a', 00H, 'l', 00H, 'i', 00H DB 'd', 00H, ' ', 00H, 'a', 00H, 'r', 00H, 'g', 00H, 'u', 00H, 'm' DB 00H, 'e', 00H, 'n', 00H, 't', 00H, '"', 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_1BO@NKFMJPA@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAA?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ CONST SEGMENT ??_C@_1BO@NKFMJPA@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAA?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ DB 's' DB 00H, 't', 00H, 'd', 00H, ':', 00H, ':', 00H, '_', 00H, 'A', 00H DB 'l', 00H, 'l', 00H, 'o', 00H, 'c', 00H, 'a', 00H, 't', 00H, 'e' DB 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ CONST SEGMENT ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ DB 'd' DB 00H, ':', 00H, '\', 00H, 'a', 00H, 'p', 00H, 'p', 00H, 'd', 00H DB 'a', 00H, 't', 00H, 'a', 00H, '\', 00H, 'v', 00H, 's', 00H, 'p' DB 00H, '\', 00H, 'v', 00H, 'c', 00H, '\', 00H, 'i', 00H, 'n', 00H DB 'c', 00H, 'l', 00H, 'u', 00H, 'd', 00H, 'e', 00H, '\', 00H, 'x' DB 00H, 'm', 00H, 'e', 00H, 'm', 00H, 'o', 00H, 'r', 00H, 'y', 00H DB '0', 00H, 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ CONST SEGMENT ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ DB '%', 00H, 'l', 00H, 's', 00H DB 00H, 00H ; `string' CONST ENDS ; COMDAT ??_C@_1DG@HGDKEBPG@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$CB?$AA?$DN?$AA?5?$AA0?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5?$AA0?$AA?$AA@ CONST SEGMENT ??_C@_1DG@HGDKEBPG@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$CB?$AA?$DN?$AA?5?$AA0?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5?$AA0?$AA?$AA@ DB '"' DB 00H, '_', 00H, 'P', 00H, 't', 00H, 'r', 00H, '_', 00H, 'c', 00H DB 'o', 00H, 'n', 00H, 't', 00H, 'a', 00H, 'i', 00H, 'n', 00H, 'e' DB 00H, 'r', 00H, ' ', 00H, '!', 00H, '=', 00H, ' ', 00H, '0', 00H DB '"', 00H, ' ', 00H, '&', 00H, '&', 00H, ' ', 00H, '0', 00H, 00H DB 00H ; `string' CONST ENDS ; COMDAT ??_C@_0BE@LMNLACIC@_Ptr_container?5?$CB?$DN?50?$AA@ CONST SEGMENT ??_C@_0BE@LMNLACIC@_Ptr_container?5?$CB?$DN?50?$AA@ DB '_Ptr_container !=' DB ' 0', 00H ; `string' CONST ENDS ; COMDAT ?__LINE__Var@?0??_Allocate@std@@YAPAXII_N@Z@4JA _DATA SEGMENT ?__LINE__Var@?0??_Allocate@std@@YAPAXII_N@Z@4JA DD 036H ; `std::_Allocate'::`1'::__LINE__Var _DATA ENDS ; COMDAT xdata$x xdata$x SEGMENT __catchsym$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$5 DD 040H DD 00H DD 00H DD FLAT:__catch$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$0 __catchsym$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$4 DD 040H DD 00H DD 00H DD FLAT:__catch$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$1 __unwindtable$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z DD 0ffffffffH DD 00H DD 0ffffffffH DD 00H DD 01H DD 00H DD 01H DD 00H __ehfuncinfo$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z DD 019930522H DD 04H DD FLAT:__unwindtable$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z DD 02H DD FLAT:__tryblocktable$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z DD 2 DUP(00H) DD 00H DD 01H __tryblocktable$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z DD 02H DD 02H DD 03H DD 01H DD FLAT:__catchsym$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$4 DD 00H DD 00H DD 03H DD 01H DD FLAT:__catchsym$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$5 xdata$x ENDS ; COMDAT xdata$x xdata$x SEGMENT __unwindtable$??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z DD 0ffffffffH DD FLAT:__unwindfunclet$??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z$0 __ehfuncinfo$??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z DD 019930522H DD 01H DD FLAT:__unwindtable$??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z DD 2 DUP(00H) DD 2 DUP(00H) DD 00H DD 01H xdata$x ENDS ; COMDAT xdata$x xdata$x SEGMENT __ehfuncinfo$??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ DD 019930522H DD 00H DD 00H DD 2 DUP(00H) DD 2 DUP(00H) DD 00H DD 05H xdata$x ENDS ; COMDAT xdata$x xdata$x SEGMENT __unwindtable$??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z DD 0ffffffffH DD FLAT:__unwindfunclet$??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z$0 __ehfuncinfo$??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z DD 019930522H DD 01H DD FLAT:__unwindtable$??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z DD 2 DUP(00H) DD 2 DUP(00H) DD 00H DD 01H xdata$x ENDS ; COMDAT xdata$x xdata$x SEGMENT __ehfuncinfo$??1_Container_base12@std@@QAE@XZ DD 019930522H DD 00H DD 00H DD 2 DUP(00H) DD 2 DUP(00H) DD 00H DD 05H xdata$x ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$construct@U_Container_proxy@std@@U12@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z _TEXT SEGMENT tv74 = -220 ; size = 4 $T1 = -212 ; size = 4 _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 _<_Args_0>$ = 12 ; size = 4 ??$construct@U_Container_proxy@std@@U12@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z PROC ; std::allocator<std::_Container_proxy>::construct<std::_Container_proxy,std::_Container_proxy>, COMDAT ; _this$ = ecx ; 654 : { // construct _Objty(_Types...) at _Ptr push ebp mov ebp, esp sub esp, 220 ; 000000dcH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-220] mov ecx, 55 ; 00000037H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 655 : ::new ((void *)_Ptr) _Objty(_STD forward<_Types>(_Args)...); mov eax, DWORD PTR __Ptr$[ebp] push eax push 8 call ??2@YAPAXIPAX@Z ; operator new add esp, 8 mov DWORD PTR $T1[ebp], eax cmp DWORD PTR $T1[ebp], 0 je SHORT $LN3@construct mov ecx, DWORD PTR _<_Args_0>$[ebp] push ecx call ??$forward@U_Container_proxy@std@@@std@@YA$$QAU_Container_proxy@0@AAU10@@Z ; std::forward<std::_Container_proxy> add esp, 4 mov edx, DWORD PTR [eax] mov eax, DWORD PTR [eax+4] mov ecx, DWORD PTR $T1[ebp] mov DWORD PTR [ecx], edx mov DWORD PTR [ecx+4], eax mov edx, DWORD PTR $T1[ebp] mov DWORD PTR tv74[ebp], edx jmp SHORT $LN1@construct $LN3@construct: mov DWORD PTR tv74[ebp], 0 $LN1@construct: ; 656 : } pop edi pop esi pop ebx add esp, 220 ; 000000dcH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ??$construct@U_Container_proxy@std@@U12@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z ENDP ; std::allocator<std::_Container_proxy>::construct<std::_Container_proxy,std::_Container_proxy> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$destroy@U_Container_proxy@std@@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 ??$destroy@U_Container_proxy@std@@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@@Z PROC ; std::allocator<std::_Container_proxy>::destroy<std::_Container_proxy>, COMDAT ; _this$ = ecx ; 661 : { // destroy object at _Ptr push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 662 : _Ptr->~_Uty(); ; 663 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 4 ??$destroy@U_Container_proxy@std@@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@@Z ENDP ; std::allocator<std::_Container_proxy>::destroy<std::_Container_proxy> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$construct@PADAAPAD@?$allocator@D@std@@QAEXPAPADAAPAD@Z _TEXT SEGMENT tv73 = -220 ; size = 4 $T1 = -212 ; size = 4 _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 _<_Args_0>$ = 12 ; size = 4 ??$construct@PADAAPAD@?$allocator@D@std@@QAEXPAPADAAPAD@Z PROC ; std::allocator<char>::construct<char *,char * &>, COMDAT ; _this$ = ecx ; 654 : { // construct _Objty(_Types...) at _Ptr push ebp mov ebp, esp sub esp, 220 ; 000000dcH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-220] mov ecx, 55 ; 00000037H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 655 : ::new ((void *)_Ptr) _Objty(_STD forward<_Types>(_Args)...); mov eax, DWORD PTR __Ptr$[ebp] push eax push 4 call ??2@YAPAXIPAX@Z ; operator new add esp, 8 mov DWORD PTR $T1[ebp], eax cmp DWORD PTR $T1[ebp], 0 je SHORT $LN3@construct mov ecx, DWORD PTR _<_Args_0>$[ebp] push ecx call ??$forward@AAPAD@std@@YAAAPADAAPAD@Z ; std::forward<char * &> add esp, 4 mov edx, DWORD PTR $T1[ebp] mov eax, DWORD PTR [eax] mov DWORD PTR [edx], eax mov ecx, DWORD PTR $T1[ebp] mov DWORD PTR tv73[ebp], ecx jmp SHORT $LN1@construct $LN3@construct: mov DWORD PTR tv73[ebp], 0 $LN1@construct: ; 656 : } pop edi pop esi pop ebx add esp, 220 ; 000000dcH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ??$construct@PADAAPAD@?$allocator@D@std@@QAEXPAPADAAPAD@Z ENDP ; std::allocator<char>::construct<char *,char * &> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$destroy@PAD@?$allocator@D@std@@QAEXPAPAD@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 ??$destroy@PAD@?$allocator@D@std@@QAEXPAPAD@Z PROC ; std::allocator<char>::destroy<char *>, COMDAT ; _this$ = ecx ; 661 : { // destroy object at _Ptr push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 662 : _Ptr->~_Uty(); ; 663 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 4 ??$destroy@PAD@?$allocator@D@std@@QAEXPAPAD@Z ENDP ; std::allocator<char>::destroy<char *> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$construct@U_Container_proxy@std@@U12@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@$$QAU31@@Z _TEXT SEGMENT __Al$ = 8 ; size = 4 __Ptr$ = 12 ; size = 4 _<_Args_0>$ = 16 ; size = 4 ??$construct@U_Container_proxy@std@@U12@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@$$QAU31@@Z PROC ; std::allocator_traits<std::allocator<std::_Container_proxy> >::construct<std::_Container_proxy,std::_Container_proxy>, COMDAT ; 772 : { // construct _Objty(_Types...) at _Ptr push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 773 : _Al.construct(_Ptr, _STD forward<_Types>(_Args)...); mov eax, DWORD PTR _<_Args_0>$[ebp] push eax call ??$forward@U_Container_proxy@std@@@std@@YA$$QAU_Container_proxy@0@AAU10@@Z ; std::forward<std::_Container_proxy> add esp, 4 push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx mov ecx, DWORD PTR __Al$[ebp] call ??$construct@U_Container_proxy@std@@U12@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z ; std::allocator<std::_Container_proxy>::construct<std::_Container_proxy,std::_Container_proxy> ; 774 : } pop edi pop esi pop ebx add esp, 192 ; 000000c0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??$construct@U_Container_proxy@std@@U12@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@$$QAU31@@Z ENDP ; std::allocator_traits<std::allocator<std::_Container_proxy> >::construct<std::_Container_proxy,std::_Container_proxy> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\type_traits ; COMDAT ??$forward@U_Container_proxy@std@@@std@@YA$$QAU_Container_proxy@0@AAU10@@Z _TEXT SEGMENT __Arg$ = 8 ; size = 4 ??$forward@U_Container_proxy@std@@@std@@YA$$QAU_Container_proxy@0@AAU10@@Z PROC ; std::forward<std::_Container_proxy>, COMDAT ; 1233 : { // forward an lvalue as either an lvalue or an rvalue push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 1234 : return (static_cast<_Ty&&>(_Arg)); mov eax, DWORD PTR __Arg$[ebp] ; 1235 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ??$forward@U_Container_proxy@std@@@std@@YA$$QAU_Container_proxy@0@AAU10@@Z ENDP ; std::forward<std::_Container_proxy> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$destroy@U_Container_proxy@std@@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@@Z _TEXT SEGMENT __Al$ = 8 ; size = 4 __Ptr$ = 12 ; size = 4 ??$destroy@U_Container_proxy@std@@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@@Z PROC ; std::allocator_traits<std::allocator<std::_Container_proxy> >::destroy<std::_Container_proxy>, COMDAT ; 779 : { // destroy object at _Ptr push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 780 : _Al.destroy(_Ptr); mov eax, DWORD PTR __Ptr$[ebp] push eax mov ecx, DWORD PTR __Al$[ebp] call ??$destroy@U_Container_proxy@std@@@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@1@@Z ; std::allocator<std::_Container_proxy>::destroy<std::_Container_proxy> ; 781 : } pop edi pop esi pop ebx add esp, 192 ; 000000c0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??$destroy@U_Container_proxy@std@@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@@Z ENDP ; std::allocator_traits<std::allocator<std::_Container_proxy> >::destroy<std::_Container_proxy> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$construct@PADAAPAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPADAAPAD@Z _TEXT SEGMENT __Al$ = 8 ; size = 4 __Ptr$ = 12 ; size = 4 _<_Args_0>$ = 16 ; size = 4 ??$construct@PADAAPAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPADAAPAD@Z PROC ; std::allocator_traits<std::allocator<char> >::construct<char *,char * &>, COMDAT ; 772 : { // construct _Objty(_Types...) at _Ptr push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 773 : _Al.construct(_Ptr, _STD forward<_Types>(_Args)...); mov eax, DWORD PTR _<_Args_0>$[ebp] push eax call ??$forward@AAPAD@std@@YAAAPADAAPAD@Z ; std::forward<char * &> add esp, 4 push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx mov ecx, DWORD PTR __Al$[ebp] call ??$construct@PADAAPAD@?$allocator@D@std@@QAEXPAPADAAPAD@Z ; std::allocator<char>::construct<char *,char * &> ; 774 : } pop edi pop esi pop ebx add esp, 192 ; 000000c0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??$construct@PADAAPAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPADAAPAD@Z ENDP ; std::allocator_traits<std::allocator<char> >::construct<char *,char * &> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\type_traits ; COMDAT ??$forward@AAPAD@std@@YAAAPADAAPAD@Z _TEXT SEGMENT __Arg$ = 8 ; size = 4 ??$forward@AAPAD@std@@YAAAPADAAPAD@Z PROC ; std::forward<char * &>, COMDAT ; 1233 : { // forward an lvalue as either an lvalue or an rvalue push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 1234 : return (static_cast<_Ty&&>(_Arg)); mov eax, DWORD PTR __Arg$[ebp] ; 1235 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ??$forward@AAPAD@std@@YAAAPADAAPAD@Z ENDP ; std::forward<char * &> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstddef ; COMDAT ??$_Addressof@D@std@@YAPADAADU?$integral_constant@_N$0A@@0@@Z _TEXT SEGMENT __Val$ = 8 ; size = 4 ___formal$ = 12 ; size = 1 ??$_Addressof@D@std@@YAPADAADU?$integral_constant@_N$0A@@0@@Z PROC ; std::_Addressof<char>, COMDAT ; 688 : { // return address of object _Val push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 689 : return (reinterpret_cast<_Ty *>( mov eax, DWORD PTR __Val$[ebp] ; 690 : &const_cast<char&>( ; 691 : reinterpret_cast<const volatile char&>(_Val)))); ; 692 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ??$_Addressof@D@std@@YAPADAADU?$integral_constant@_N$0A@@0@@Z ENDP ; std::_Addressof<char> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$destroy@PAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPAD@Z _TEXT SEGMENT __Al$ = 8 ; size = 4 __Ptr$ = 12 ; size = 4 ??$destroy@PAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPAD@Z PROC ; std::allocator_traits<std::allocator<char> >::destroy<char *>, COMDAT ; 779 : { // destroy object at _Ptr push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 780 : _Al.destroy(_Ptr); mov eax, DWORD PTR __Ptr$[ebp] push eax mov ecx, DWORD PTR __Al$[ebp] call ??$destroy@PAD@?$allocator@D@std@@QAEXPAPAD@Z ; std::allocator<char>::destroy<char *> ; 781 : } pop edi pop esi pop ebx add esp, 192 ; 000000c0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??$destroy@PAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPAD@Z ENDP ; std::allocator_traits<std::allocator<char> >::destroy<char *> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\type_traits ; COMDAT ??$forward@ABV?$allocator@D@std@@@std@@YAABV?$allocator@D@0@ABV10@@Z _TEXT SEGMENT __Arg$ = 8 ; size = 4 ??$forward@ABV?$allocator@D@std@@@std@@YAABV?$allocator@D@0@ABV10@@Z PROC ; std::forward<std::allocator<char> const &>, COMDAT ; 1233 : { // forward an lvalue as either an lvalue or an rvalue push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 1234 : return (static_cast<_Ty&&>(_Arg)); mov eax, DWORD PTR __Arg$[ebp] ; 1235 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ??$forward@ABV?$allocator@D@std@@@std@@YAABV?$allocator@D@0@ABV10@@Z ENDP ; std::forward<std::allocator<char> const &> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$?0D@?$allocator@U_Container_proxy@std@@@std@@QAE@ABV?$allocator@D@1@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 ___formal$ = 8 ; size = 4 ??$?0D@?$allocator@U_Container_proxy@std@@@std@@QAE@ABV?$allocator@D@1@@Z PROC ; std::allocator<std::_Container_proxy>::allocator<std::_Container_proxy><char>, COMDAT ; _this$ = ecx ; 627 : { // construct from a related allocator (do nothing) push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 628 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx mov esp, ebp pop ebp ret 4 ??$?0D@?$allocator@U_Container_proxy@std@@@std@@QAE@ABV?$allocator@D@1@@Z ENDP ; std::allocator<std::_Container_proxy>::allocator<std::_Container_proxy><char> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$?0U?$_Wrap_alloc@V?$allocator@D@std@@@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAE@AAU?$_Wrap_alloc@V?$allocator@D@std@@@1@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Right$ = 8 ; size = 4 ??$?0U?$_Wrap_alloc@V?$allocator@D@std@@@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAE@AAU?$_Wrap_alloc@V?$allocator@D@std@@@1@@Z PROC ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::_Wrap_alloc<std::allocator<std::_Container_proxy> ><std::_Wrap_alloc<std::allocator<char> > >, COMDAT ; _this$ = ecx ; 874 : { // construct from a related allocator push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 873 : : _Mybase(_Right) mov eax, DWORD PTR __Right$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ??$?0D@?$allocator@U_Container_proxy@std@@@std@@QAE@ABV?$allocator@D@1@@Z ; std::allocator<std::_Container_proxy>::allocator<std::_Container_proxy><char> ; 875 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ??$?0U?$_Wrap_alloc@V?$allocator@D@std@@@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAE@AAU?$_Wrap_alloc@V?$allocator@D@std@@@1@@Z ENDP ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::_Wrap_alloc<std::allocator<std::_Container_proxy> ><std::_Wrap_alloc<std::allocator<char> > > _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$construct@U_Container_proxy@std@@U12@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 _<_Args_0>$ = 12 ; size = 4 ??$construct@U_Container_proxy@std@@U12@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z PROC ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::construct<std::_Container_proxy,std::_Container_proxy>, COMDAT ; _this$ = ecx ; 916 : { // construct _Ty(_Types...) at _Ptr push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 917 : _Mytraits::construct(*this, _Ptr, mov eax, DWORD PTR _<_Args_0>$[ebp] push eax call ??$forward@U_Container_proxy@std@@@std@@YA$$QAU_Container_proxy@0@AAU10@@Z ; std::forward<std::_Container_proxy> add esp, 4 push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx mov edx, DWORD PTR _this$[ebp] push edx call ??$construct@U_Container_proxy@std@@U12@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@$$QAU31@@Z ; std::allocator_traits<std::allocator<std::_Container_proxy> >::construct<std::_Container_proxy,std::_Container_proxy> add esp, 12 ; 0000000cH ; 918 : _STD forward<_Types>(_Args)...); ; 919 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ??$construct@U_Container_proxy@std@@U12@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z ENDP ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::construct<std::_Container_proxy,std::_Container_proxy> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$destroy@U_Container_proxy@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 ??$destroy@U_Container_proxy@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@@Z PROC ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::destroy<std::_Container_proxy>, COMDAT ; _this$ = ecx ; 924 : { // destroy object at _Ptr push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 925 : _Mytraits::destroy(*this, _Ptr); mov eax, DWORD PTR __Ptr$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] push ecx call ??$destroy@U_Container_proxy@std@@@?$allocator_traits@V?$allocator@U_Container_proxy@std@@@std@@@std@@SAXAAV?$allocator@U_Container_proxy@std@@@1@PAU_Container_proxy@1@@Z ; std::allocator_traits<std::allocator<std::_Container_proxy> >::destroy<std::_Container_proxy> add esp, 8 ; 926 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ??$destroy@U_Container_proxy@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@@Z ENDP ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::destroy<std::_Container_proxy> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?deallocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@2@I@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 __Count$ = 12 ; size = 4 ?deallocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@2@I@Z PROC ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::deallocate, COMDAT ; _this$ = ecx ; 908 : { // deallocate object at _Ptr, ignore size push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 909 : _Mybase::deallocate(_Ptr, _Count); mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx mov ecx, DWORD PTR _this$[ebp] call ?deallocate@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@2@I@Z ; std::allocator<std::_Container_proxy>::deallocate ; 910 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ?deallocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@2@I@Z ENDP ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::deallocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?allocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEPAU_Container_proxy@2@I@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Count$ = 8 ; size = 4 ?allocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEPAU_Container_proxy@2@I@Z PROC ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::allocate, COMDAT ; _this$ = ecx ; 897 : { // allocate array of _Count elements push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 898 : return (_Mybase::allocate(_Count)); mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?allocate@?$allocator@U_Container_proxy@std@@@std@@QAEPAU_Container_proxy@2@I@Z ; std::allocator<std::_Container_proxy>::allocate ; 899 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?allocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEPAU_Container_proxy@2@I@Z ENDP ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::allocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?allocate@?$allocator@U_Container_proxy@std@@@std@@QAEPAU_Container_proxy@2@I@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Count$ = 8 ; size = 4 ?allocate@?$allocator@U_Container_proxy@std@@@std@@QAEPAU_Container_proxy@2@I@Z PROC ; std::allocator<std::_Container_proxy>::allocate, COMDAT ; _this$ = ecx ; 642 : { // allocate array of _Count elements push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 643 : return (static_cast<pointer>(_Allocate(_Count, sizeof (_Ty)))); push 1 push 8 mov eax, DWORD PTR __Count$[ebp] push eax call ?_Allocate@std@@YAPAXII_N@Z ; std::_Allocate add esp, 12 ; 0000000cH ; 644 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?allocate@?$allocator@U_Container_proxy@std@@@std@@QAEPAU_Container_proxy@2@I@Z ENDP ; std::allocator<std::_Container_proxy>::allocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?deallocate@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@2@I@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 __Count$ = 12 ; size = 4 ?deallocate@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@2@I@Z PROC ; std::allocator<std::_Container_proxy>::deallocate, COMDAT ; _this$ = ecx ; 637 : { // deallocate object at _Ptr push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 638 : _Deallocate(_Ptr, _Count, sizeof (_Ty)); push 8 mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx call ?_Deallocate@std@@YAXPAXII@Z ; std::_Deallocate add esp, 12 ; 0000000cH ; 639 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ?deallocate@?$allocator@U_Container_proxy@std@@@std@@QAEXPAU_Container_proxy@2@I@Z ENDP ; std::allocator<std::_Container_proxy>::deallocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$construct@PADAAPAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPADAAPAD@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 _<_Args_0>$ = 12 ; size = 4 ??$construct@PADAAPAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPADAAPAD@Z PROC ; std::_Wrap_alloc<std::allocator<char> >::construct<char *,char * &>, COMDAT ; _this$ = ecx ; 916 : { // construct _Ty(_Types...) at _Ptr push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 917 : _Mytraits::construct(*this, _Ptr, mov eax, DWORD PTR _<_Args_0>$[ebp] push eax call ??$forward@AAPAD@std@@YAAAPADAAPAD@Z ; std::forward<char * &> add esp, 4 push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx mov edx, DWORD PTR _this$[ebp] push edx call ??$construct@PADAAPAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPADAAPAD@Z ; std::allocator_traits<std::allocator<char> >::construct<char *,char * &> add esp, 12 ; 0000000cH ; 918 : _STD forward<_Types>(_Args)...); ; 919 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ??$construct@PADAAPAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPADAAPAD@Z ENDP ; std::_Wrap_alloc<std::allocator<char> >::construct<char *,char * &> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ??$_Debug_pointer_if@$$CBD@std@@YAX_NPBDPB_WI@Z _TEXT SEGMENT __Test$ = 8 ; size = 1 __Ptr$ = 12 ; size = 4 __File$ = 16 ; size = 4 __Line$ = 20 ; size = 4 ??$_Debug_pointer_if@$$CBD@std@@YAX_NPBDPB_WI@Z PROC ; std::_Debug_pointer_if<char const >, COMDAT ; 774 : { // conditionally test pointer for non-singularity, pointers push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 775 : if (_Test && _Ptr == 0) movzx eax, BYTE PTR __Test$[ebp] test eax, eax je SHORT $LN1@Debug_poin cmp DWORD PTR __Ptr$[ebp], 0 jne SHORT $LN1@Debug_poin ; 776 : _DEBUG_ERROR2("invalid null pointer", _File, _Line); mov esi, esp mov eax, DWORD PTR __Line$[ebp] push eax mov ecx, DWORD PTR __File$[ebp] push ecx push OFFSET ??_C@_1CK@EOPGIILJ@?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAn?$AAu?$AAl?$AAl?$AA?5?$AAp?$AAo?$AAi?$AAn?$AAt?$AAe?$AAr?$AA?$AA@ call DWORD PTR __imp_?_Debug_message@std@@YAXPB_W0I@Z add esp, 12 ; 0000000cH cmp esi, esp call __RTC_CheckEsp $LN1@Debug_poin: ; 777 : } pop edi pop esi pop ebx add esp, 192 ; 000000c0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??$_Debug_pointer_if@$$CBD@std@@YAX_NPBDPB_WI@Z ENDP ; std::_Debug_pointer_if<char const > _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstddef ; COMDAT ??$addressof@D@std@@YAPADAAD@Z _TEXT SEGMENT $T1 = -209 ; size = 1 __Val$ = 8 ; size = 4 ??$addressof@D@std@@YAPADAAD@Z PROC ; std::addressof<char>, COMDAT ; 696 : { // return address of _Val push ebp mov ebp, esp sub esp, 216 ; 000000d8H push ebx push esi push edi lea edi, DWORD PTR [ebp-216] mov ecx, 54 ; 00000036H mov eax, -858993460 ; ccccccccH rep stosd ; 697 : return (_Addressof(_Val, is_function<_Ty>())); movzx eax, BYTE PTR $T1[ebp] push eax mov ecx, DWORD PTR __Val$[ebp] push ecx call ??$_Addressof@D@std@@YAPADAADU?$integral_constant@_N$0A@@0@@Z ; std::_Addressof<char> add esp, 8 ; 698 : } pop edi pop esi pop ebx add esp, 216 ; 000000d8H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??$addressof@D@std@@YAPADAAD@Z ENDP ; std::addressof<char> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??$destroy@PAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPAD@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 ??$destroy@PAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPAD@Z PROC ; std::_Wrap_alloc<std::allocator<char> >::destroy<char *>, COMDAT ; _this$ = ecx ; 924 : { // destroy object at _Ptr push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 925 : _Mytraits::destroy(*this, _Ptr); mov eax, DWORD PTR __Ptr$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] push ecx call ??$destroy@PAD@?$allocator_traits@V?$allocator@D@std@@@std@@SAXAAV?$allocator@D@1@PAPAD@Z ; std::allocator_traits<std::allocator<char> >::destroy<char *> add esp, 8 ; 926 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ??$destroy@PAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPAD@Z ENDP ; std::_Wrap_alloc<std::allocator<char> >::destroy<char *> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ??$?0ABV?$allocator@D@std@@$$V@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@U_One_then_variadic_args_t@1@ABV?$allocator@D@1@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 ___formal$ = 8 ; size = 1 __Val1$ = 12 ; size = 4 ??$?0ABV?$allocator@D@std@@$$V@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@U_One_then_variadic_args_t@1@ABV?$allocator@D@1@@Z PROC ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1><std::allocator<char> const &>, COMDAT ; _this$ = ecx ; 288 : { // construct from forwarded values push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 286 : : _Ty1(_STD forward<_Other1>(_Val1)), mov eax, DWORD PTR __Val1$[ebp] push eax call ??$forward@ABV?$allocator@D@std@@@std@@YAABV?$allocator@D@0@ABV10@@Z ; std::forward<std::allocator<char> const &> add esp, 4 push eax mov ecx, DWORD PTR _this$[ebp] call ??0?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAE@ABV?$allocator@D@1@@Z ; std::_Wrap_alloc<std::allocator<char> >::_Wrap_alloc<std::allocator<char> > ; 287 : _Myval2(_STD forward<_Other2>(_Val2)...) mov ecx, DWORD PTR _this$[ebp] call ??0?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ ; std::_String_val<std::_Simple_types<char> >::_String_val<std::_Simple_types<char> > ; 289 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ??$?0ABV?$allocator@D@std@@$$V@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@U_One_then_variadic_args_t@1@ABV?$allocator@D@1@@Z ENDP ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1><std::allocator<char> const &> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ??$_Debug_pointer@$$CBD@std@@YAXPBDPB_WI@Z _TEXT SEGMENT __Ptr$ = 8 ; size = 4 __File$ = 12 ; size = 4 __Line$ = 16 ; size = 4 ??$_Debug_pointer@$$CBD@std@@YAXPBDPB_WI@Z PROC ; std::_Debug_pointer<char const >, COMDAT ; 760 : { // test pointer for non-singularity, pointers push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 761 : if (_Ptr == 0) cmp DWORD PTR __Ptr$[ebp], 0 jne SHORT $LN1@Debug_poin ; 762 : _DEBUG_ERROR2("invalid null pointer", _File, _Line); mov esi, esp mov eax, DWORD PTR __Line$[ebp] push eax mov ecx, DWORD PTR __File$[ebp] push ecx push OFFSET ??_C@_1CK@EOPGIILJ@?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAn?$AAu?$AAl?$AAl?$AA?5?$AAp?$AAo?$AAi?$AAn?$AAt?$AAe?$AAr?$AA?$AA@ call DWORD PTR __imp_?_Debug_message@std@@YAXPB_W0I@Z add esp, 12 ; 0000000cH cmp esi, esp call __RTC_CheckEsp $LN1@Debug_poin: ; 763 : } pop edi pop esi pop ebx add esp, 192 ; 000000c0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??$_Debug_pointer@$$CBD@std@@YAXPBDPB_WI@Z ENDP ; std::_Debug_pointer<char const > _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\deps\include\glm\detail\type_vec2.inl ; COMDAT ??$?0NN@?$tvec2@M$0A@@glm@@QAE@ABN0@Z _TEXT SEGMENT _this$ = -8 ; size = 4 _a$ = 8 ; size = 4 _b$ = 12 ; size = 4 ??$?0NN@?$tvec2@M$0A@@glm@@QAE@ABN0@Z PROC ; glm::tvec2<float,0>::tvec2<float,0><double,double>, COMDAT ; _this$ = ecx ; 78 : {} push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 76 : : x(static_cast<T>(a)) mov eax, DWORD PTR _a$[ebp] cvtsd2ss xmm0, QWORD PTR [eax] mov ecx, DWORD PTR _this$[ebp] movss DWORD PTR [ecx], xmm0 ; 77 : , y(static_cast<T>(b)) mov eax, DWORD PTR _b$[ebp] cvtsd2ss xmm0, QWORD PTR [eax] mov ecx, DWORD PTR _this$[ebp] movss DWORD PTR [ecx+4], xmm0 ; 78 : {} mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx mov esp, ebp pop ebp ret 8 ??$?0NN@?$tvec2@M$0A@@glm@@QAE@ABN0@Z ENDP ; glm::tvec2<float,0>::tvec2<float,0><double,double> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ?MouseHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z _TEXT SEGMENT _pos$1 = -28 ; size = 8 _events$ = -12 ; size = 4 __$ArrayPad$ = -4 ; size = 4 _platform$ = 8 ; size = 4 _xPos$ = 12 ; size = 8 _yPos$ = 20 ; size = 8 ?MouseHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z PROC ; GLFWwrapper::MouseHandler, COMDAT ; 137 : { push ebp mov ebp, esp sub esp, 224 ; 000000e0H push ebx push esi push edi lea edi, DWORD PTR [ebp-224] mov ecx, 56 ; 00000038H mov eax, -858993460 ; ccccccccH rep stosd mov eax, DWORD PTR ___security_cookie xor eax, ebp mov DWORD PTR __$ArrayPad$[ebp], eax ; 138 : EventListener* events = (EventListener*)glfwGetWindowUserPointer(platform); mov eax, DWORD PTR _platform$[ebp] push eax call _glfwGetWindowUserPointer add esp, 4 mov DWORD PTR _events$[ebp], eax ; 139 : ; 140 : if (!events->GetIsMouseInWindow()) mov ecx, DWORD PTR _events$[ebp] call ?GetIsMouseInWindow@EventListener@@QAE_NXZ ; EventListener::GetIsMouseInWindow movzx eax, al test eax, eax jne SHORT $LN1@MouseHandl ; 141 : { ; 142 : glm::vec2 pos = glm::vec2(xPos, yPos); lea eax, DWORD PTR _yPos$[ebp] push eax lea ecx, DWORD PTR _xPos$[ebp] push ecx lea ecx, DWORD PTR _pos$1[ebp] call ??$?0NN@?$tvec2@M$0A@@glm@@QAE@ABN0@Z ; glm::tvec2<float,0>::tvec2<float,0><double,double> ; 143 : events->SetMousePos(pos); mov eax, DWORD PTR _pos$1[ebp+4] push eax mov ecx, DWORD PTR _pos$1[ebp] push ecx mov ecx, DWORD PTR _events$[ebp] call ?SetMousePos@EventListener@@QAEXU?$tvec2@M$0A@@glm@@@Z ; EventListener::SetMousePos ; 144 : events->SetIsMouseInWindow(true); push 1 mov ecx, DWORD PTR _events$[ebp] call ?SetIsMouseInWindow@EventListener@@QAEX_N@Z ; EventListener::SetIsMouseInWindow $LN1@MouseHandl: ; 145 : } ; 146 : ; 147 : ; 148 : //double xOffset = xPos - wrapper->mouse.lastX; ; 149 : //double yOffset = wrapper->mouse.lastY - yPos; //reversed because y coords go from bot to top ; 150 : ; 151 : ; 152 : ; 153 : //wrapper->cameraPtr->ChangeViewAngle(xOffset, yOffset); ; 154 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN6@MouseHandl call @_RTC_CheckStackVars@8 pop eax pop edx pop edi pop esi pop ebx mov ecx, DWORD PTR __$ArrayPad$[ebp] xor ecx, ebp call @__security_check_cookie@4 add esp, 224 ; 000000e0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 npad 1 $LN6@MouseHandl: DD 1 DD $LN5@MouseHandl $LN5@MouseHandl: DD -28 ; ffffffe4H DD 8 DD $LN4@MouseHandl $LN4@MouseHandl: DB 112 ; 00000070H DB 111 ; 0000006fH DB 115 ; 00000073H DB 0 ?MouseHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z ENDP ; GLFWwrapper::MouseHandler _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ?ScrollHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z _TEXT SEGMENT _events$ = -8 ; size = 4 _platform$ = 8 ; size = 4 _xOffset$ = 12 ; size = 8 _yOffset$ = 20 ; size = 8 ?ScrollHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z PROC ; GLFWwrapper::ScrollHandler, COMDAT ; 130 : { push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd ; 131 : EventListener* events = (EventListener*)glfwGetWindowUserPointer(platform); mov eax, DWORD PTR _platform$[ebp] push eax call _glfwGetWindowUserPointer add esp, 4 mov DWORD PTR _events$[ebp], eax ; 132 : ; 133 : //windowPtr->cameraPtr->ChangeZoom((GLfloat)yOffset); ; 134 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?ScrollHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z ENDP ; GLFWwrapper::ScrollHandler _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ?KeyHandler@GLFWwrapper@@SAXPAUGLFWwindow@@HHHH@Z _TEXT SEGMENT tv66 = -208 ; size = 4 _events$ = -8 ; size = 4 _platform$ = 8 ; size = 4 _key$ = 12 ; size = 4 _scancode$ = 16 ; size = 4 _action$ = 20 ; size = 4 _mode$ = 24 ; size = 4 ?KeyHandler@GLFWwrapper@@SAXPAUGLFWwindow@@HHHH@Z PROC ; GLFWwrapper::KeyHandler, COMDAT ; 69 : { push ebp mov ebp, esp sub esp, 208 ; 000000d0H push ebx push esi push edi lea edi, DWORD PTR [ebp-208] mov ecx, 52 ; 00000034H mov eax, -858993460 ; ccccccccH rep stosd ; 70 : EventListener* events = (EventListener*) glfwGetWindowUserPointer(platform); mov eax, DWORD PTR _platform$[ebp] push eax call _glfwGetWindowUserPointer add esp, 4 mov DWORD PTR _events$[ebp], eax ; 71 : ; 72 : ; 73 : switch (action) mov eax, DWORD PTR _action$[ebp] mov DWORD PTR tv66[ebp], eax cmp DWORD PTR tv66[ebp], 0 je SHORT $LN10@KeyHandler cmp DWORD PTR tv66[ebp], 1 je SHORT $LN4@KeyHandler jmp $LN1@KeyHandler $LN4@KeyHandler: ; 74 : { ; 75 : case GLFW_PRESS: ; 76 : { ; 77 : if (key == GLFW_KEY_W) cmp DWORD PTR _key$[ebp], 87 ; 00000057H jne SHORT $LN5@KeyHandler ; 78 : { ; 79 : events->SetKey(KEY_W, true); push 1 push 1 mov ecx, DWORD PTR _events$[ebp] call ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z ; EventListener::SetKey $LN5@KeyHandler: ; 80 : } ; 81 : if (key == GLFW_KEY_A) cmp DWORD PTR _key$[ebp], 65 ; 00000041H jne SHORT $LN6@KeyHandler ; 82 : { ; 83 : events->SetKey(KEY_A, true); push 1 push 2 mov ecx, DWORD PTR _events$[ebp] call ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z ; EventListener::SetKey $LN6@KeyHandler: ; 84 : } ; 85 : if (key == GLFW_KEY_S) cmp DWORD PTR _key$[ebp], 83 ; 00000053H jne SHORT $LN7@KeyHandler ; 86 : { ; 87 : events->SetKey(KEY_S, true); push 1 push 3 mov ecx, DWORD PTR _events$[ebp] call ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z ; EventListener::SetKey $LN7@KeyHandler: ; 88 : } ; 89 : if (key == GLFW_KEY_D) cmp DWORD PTR _key$[ebp], 68 ; 00000044H jne SHORT $LN8@KeyHandler ; 90 : { ; 91 : events->SetKey(KEY_D, true); push 1 push 4 mov ecx, DWORD PTR _events$[ebp] call ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z ; EventListener::SetKey $LN8@KeyHandler: ; 92 : } ; 93 : ; 94 : if (key == GLFW_KEY_ESCAPE) cmp DWORD PTR _key$[ebp], 256 ; 00000100H jne SHORT $LN9@KeyHandler ; 95 : { ; 96 : events->SetCloseGame(); mov ecx, DWORD PTR _events$[ebp] call ?SetCloseGame@EventListener@@QAEXXZ ; EventListener::SetCloseGame $LN9@KeyHandler: ; 97 : } ; 98 : } ; 99 : break; jmp SHORT $LN1@KeyHandler $LN10@KeyHandler: ; 100 : case GLFW_RELEASE: ; 101 : { ; 102 : if (key == GLFW_KEY_W) cmp DWORD PTR _key$[ebp], 87 ; 00000057H jne SHORT $LN11@KeyHandler ; 103 : { ; 104 : events->SetKey(KEY_W, false); push 0 push 1 mov ecx, DWORD PTR _events$[ebp] call ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z ; EventListener::SetKey $LN11@KeyHandler: ; 105 : } ; 106 : if (key == GLFW_KEY_A) cmp DWORD PTR _key$[ebp], 65 ; 00000041H jne SHORT $LN12@KeyHandler ; 107 : { ; 108 : events->SetKey(KEY_A, false); push 0 push 2 mov ecx, DWORD PTR _events$[ebp] call ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z ; EventListener::SetKey $LN12@KeyHandler: ; 109 : } ; 110 : if (key == GLFW_KEY_S) cmp DWORD PTR _key$[ebp], 83 ; 00000053H jne SHORT $LN13@KeyHandler ; 111 : { ; 112 : events->SetKey(KEY_S, false); push 0 push 3 mov ecx, DWORD PTR _events$[ebp] call ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z ; EventListener::SetKey $LN13@KeyHandler: ; 113 : } ; 114 : if (key == GLFW_KEY_D) cmp DWORD PTR _key$[ebp], 68 ; 00000044H jne SHORT $LN14@KeyHandler ; 115 : { ; 116 : events->SetKey(KEY_D, false); push 0 push 4 mov ecx, DWORD PTR _events$[ebp] call ?SetKey@EventListener@@QAEXW4KeyCode@@_N@Z ; EventListener::SetKey $LN14@KeyHandler: ; 117 : } ; 118 : ; 119 : if (key == GLFW_KEY_ESCAPE) cmp DWORD PTR _key$[ebp], 256 ; 00000100H jne SHORT $LN1@KeyHandler ; 120 : { ; 121 : events->SetCloseGame(); mov ecx, DWORD PTR _events$[ebp] call ?SetCloseGame@EventListener@@QAEXXZ ; EventListener::SetCloseGame $LN1@KeyHandler: ; 122 : } ; 123 : } ; 124 : break; ; 125 : ; 126 : } ; 127 : } pop edi pop esi pop ebx add esp, 208 ; 000000d0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?KeyHandler@GLFWwrapper@@SAXPAUGLFWwindow@@HHHH@Z ENDP ; GLFWwrapper::KeyHandler _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ?WrapSwapBuffers@GLFWwrapper@@QAEXXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?WrapSwapBuffers@GLFWwrapper@@QAEXXZ PROC ; GLFWwrapper::WrapSwapBuffers, COMDAT ; _this$ = ecx ; 63 : { push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 64 : glfwSwapBuffers(GLFWhandle); mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR [eax+4] push ecx call _glfwSwapBuffers add esp, 4 ; 65 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?WrapSwapBuffers@GLFWwrapper@@QAEXXZ ENDP ; GLFWwrapper::WrapSwapBuffers _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ?PollEvents@GLFWwrapper@@QAEXPAVEventListener@@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 _events$ = 8 ; size = 4 ?PollEvents@GLFWwrapper@@QAEXPAVEventListener@@@Z PROC ; GLFWwrapper::PollEvents, COMDAT ; _this$ = ecx ; 56 : { push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 57 : this->events = events; mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR _events$[ebp] mov DWORD PTR [eax], ecx ; 58 : glfwPollEvents(); call _glfwPollEvents ; 59 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?PollEvents@GLFWwrapper@@QAEXPAVEventListener@@@Z ENDP ; GLFWwrapper::PollEvents _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ?vSync@GLFWwrapper@@QAEXH@Z _TEXT SEGMENT _this$ = -8 ; size = 4 _frameRate$ = 8 ; size = 4 ?vSync@GLFWwrapper@@QAEXH@Z PROC ; GLFWwrapper::vSync, COMDAT ; _this$ = ecx ; 50 : { push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 51 : glfwSwapInterval(frameRate); mov eax, DWORD PTR _frameRate$[ebp] push eax call _glfwSwapInterval add esp, 4 ; 52 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?vSync@GLFWwrapper@@QAEXH@Z ENDP ; GLFWwrapper::vSync _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ??1GLFWwrapper@@QAE@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ??1GLFWwrapper@@QAE@XZ PROC ; GLFWwrapper::~GLFWwrapper, COMDAT ; _this$ = ecx ; 18 : { push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 19 : glfwTerminate(); call _glfwTerminate ; 20 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??1GLFWwrapper@@QAE@XZ ENDP ; GLFWwrapper::~GLFWwrapper _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ??0GLFWwrapper@@QAE@PAVEventListener@@HHPBD@Z _TEXT SEGMENT tv163 = -236 ; size = 4 tv161 = -232 ; size = 4 tv143 = -229 ; size = 1 $T1 = -224 ; size = 4 $T2 = -212 ; size = 4 _this$ = -8 ; size = 4 _events$ = 8 ; size = 4 _width$ = 12 ; size = 4 _height$ = 16 ; size = 4 _name$ = 20 ; size = 4 ??0GLFWwrapper@@QAE@PAVEventListener@@HHPBD@Z PROC ; GLFWwrapper::GLFWwrapper, COMDAT ; _this$ = ecx ; 23 : { push ebp mov ebp, esp sub esp, 236 ; 000000ecH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-236] mov ecx, 59 ; 0000003bH mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 24 : if (!glfwInit()) call _glfwInit test eax, eax jne SHORT $LN2@GLFWwrappe ; 25 : { ; 26 : Debug::Assert(0, "failed to initialize glfw"); sub esp, 28 ; 0000001cH mov ecx, esp mov DWORD PTR $T2[ebp], esp push OFFSET ??_C@_0BK@FDBIAIHI@failed?5to?5initialize?5glfw?$AA@ call ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > mov DWORD PTR tv161[ebp], eax push 0 call ?Assert@Debug@@SAX_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z ; Debug::Assert add esp, 32 ; 00000020H $LN2@GLFWwrappe: ; 27 : } ; 28 : glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); push 3 push 139266 ; 00022002H call _glfwWindowHint add esp, 8 ; 29 : glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); push 3 push 139267 ; 00022003H call _glfwWindowHint add esp, 8 ; 30 : glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); push 204801 ; 00032001H push 139272 ; 00022008H call _glfwWindowHint add esp, 8 ; 31 : glfwWindowHint(GLFW_RESIZABLE, GL_TRUE); push 1 push 131075 ; 00020003H call _glfwWindowHint add esp, 8 ; 32 : ; 33 : //all game "windows" will be within the main window ; 34 : this->GLFWhandle = glfwCreateWindow(width, height, name, nullptr, nullptr); push 0 push 0 mov eax, DWORD PTR _name$[ebp] push eax mov ecx, DWORD PTR _height$[ebp] push ecx mov edx, DWORD PTR _width$[ebp] push edx call _glfwCreateWindow add esp, 20 ; 00000014H mov ecx, DWORD PTR _this$[ebp] mov DWORD PTR [ecx+4], eax ; 35 : ; 36 : //check if window was made ; 37 : Debug::Assert(GLFWhandle != nullptr, "failed to create window"); mov eax, DWORD PTR _this$[ebp] cmp DWORD PTR [eax+4], 0 je SHORT $LN4@GLFWwrappe mov BYTE PTR tv143[ebp], 1 jmp SHORT $LN5@GLFWwrappe $LN4@GLFWwrappe: mov BYTE PTR tv143[ebp], 0 $LN5@GLFWwrappe: sub esp, 28 ; 0000001cH mov ecx, esp mov DWORD PTR $T1[ebp], esp push OFFSET ??_C@_0BI@EPCLPAIO@failed?5to?5create?5window?$AA@ call ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > mov DWORD PTR tv163[ebp], eax movzx ecx, BYTE PTR tv143[ebp] push ecx call ?Assert@Debug@@SAX_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z ; Debug::Assert add esp, 32 ; 00000020H ; 38 : ; 39 : glfwSetWindowUserPointer(GLFWhandle, events); mov eax, DWORD PTR _events$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] mov edx, DWORD PTR [ecx+4] push edx call _glfwSetWindowUserPointer add esp, 8 ; 40 : ; 41 : glfwSetKeyCallback(GLFWhandle, KeyHandler); push OFFSET ?KeyHandler@GLFWwrapper@@SAXPAUGLFWwindow@@HHHH@Z ; GLFWwrapper::KeyHandler mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR [eax+4] push ecx call _glfwSetKeyCallback add esp, 8 ; 42 : glfwSetCursorPosCallback(GLFWhandle, MouseHandler); push OFFSET ?MouseHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z ; GLFWwrapper::MouseHandler mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR [eax+4] push ecx call _glfwSetCursorPosCallback add esp, 8 ; 43 : glfwSetScrollCallback(GLFWhandle, ScrollHandler); push OFFSET ?ScrollHandler@GLFWwrapper@@SAXPAUGLFWwindow@@NN@Z ; GLFWwrapper::ScrollHandler mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR [eax+4] push ecx call _glfwSetScrollCallback add esp, 8 ; 44 : ; 45 : glfwMakeContextCurrent(GLFWhandle); mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR [eax+4] push ecx call _glfwMakeContextCurrent add esp, 4 ; 46 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx add esp, 236 ; 000000ecH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 16 ; 00000010H ??0GLFWwrapper@@QAE@PAVEventListener@@HHPBD@Z ENDP ; GLFWwrapper::GLFWwrapper _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ??0GLFWwrapper@@QAE@XZ _TEXT SEGMENT tv80 = -220 ; size = 4 $T1 = -212 ; size = 4 _this$ = -8 ; size = 4 ??0GLFWwrapper@@QAE@XZ PROC ; GLFWwrapper::GLFWwrapper, COMDAT ; _this$ = ecx ; 13 : { push ebp mov ebp, esp sub esp, 220 ; 000000dcH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-220] mov ecx, 55 ; 00000037H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 14 : Debug::Assert(0, "must pass in event struct to GLFWwrapper"); sub esp, 28 ; 0000001cH mov ecx, esp mov DWORD PTR $T1[ebp], esp push OFFSET ??_C@_0CJ@NALJHCFL@must?5pass?5in?5event?5struct?5to?5GLF@ call ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > mov DWORD PTR tv80[ebp], eax push 0 call ?Assert@Debug@@SAX_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z ; Debug::Assert add esp, 32 ; 00000020H ; 15 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx add esp, 220 ; 000000dcH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??0GLFWwrapper@@QAE@XZ ENDP ; GLFWwrapper::GLFWwrapper _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xran, COMDAT ; _this$ = ecx ; 2251 : { // report an out_of_range error push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 2252 : _Xout_of_range("invalid string position"); mov esi, esp push OFFSET ??_C@_0BI@CFPLBAOH@invalid?5string?5position?$AA@ call DWORD PTR __imp_?_Xout_of_range@std@@YAXPBD@Z cmp esi, esp call __RTC_CheckEsp $LN2@Xran: ; 2253 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xran _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Xlen@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Xlen@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xlen, COMDAT ; _this$ = ecx ; 2246 : { // report a length_error push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 2247 : _Xlength_error("string too long"); mov esi, esp push OFFSET ??_C@_0BA@JFNIOLAK@string?5too?5long?$AA@ call DWORD PTR __imp_?_Xlength_error@std@@YAXPBD@Z cmp esi, esp call __RTC_CheckEsp $LN2@Xlen: ; 2248 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Xlen@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xlen _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEX_NI@Z _TEXT SEGMENT __Ptr$1 = -20 ; size = 4 _this$ = -8 ; size = 4 __Built$ = 8 ; size = 1 __Newsize$ = 12 ; size = 4 ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEX_NI@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy, COMDAT ; _this$ = ecx ; 2229 : { // initialize buffer, deallocating any storage push ebp mov ebp, esp sub esp, 216 ; 000000d8H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-216] mov ecx, 54 ; 00000036H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 2230 : if (!_Built) movzx eax, BYTE PTR __Built$[ebp] test eax, eax jne SHORT $LN2@Tidy jmp SHORT $LN3@Tidy $LN2@Tidy: ; 2231 : ; ; 2232 : else if (this->_BUF_SIZE <= this->_Myres()) mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres cmp DWORD PTR [eax], 16 ; 00000010H jb SHORT $LN3@Tidy ; 2233 : { // copy any leftovers to small buffer and deallocate ; 2234 : pointer _Ptr = this->_Bx()._Ptr; mov ecx, DWORD PTR _this$[ebp] call ?_Bx@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAT_Bxty@?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Bx mov eax, DWORD PTR [eax] mov DWORD PTR __Ptr$1[ebp], eax ; 2235 : this->_Getal().destroy(&this->_Bx()._Ptr); mov ecx, DWORD PTR _this$[ebp] call ?_Bx@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAT_Bxty@?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Bx push eax mov ecx, DWORD PTR _this$[ebp] call ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal mov ecx, eax call ??$destroy@PAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPAD@Z ; std::_Wrap_alloc<std::allocator<char> >::destroy<char *> ; 2236 : if (0 < _Newsize) cmp DWORD PTR __Newsize$[ebp], 0 jbe SHORT $LN5@Tidy ; 2237 : _Traits::copy(this->_Bx()._Buf, mov eax, DWORD PTR __Newsize$[ebp] push eax mov ecx, DWORD PTR __Ptr$1[ebp] push ecx call ??$addressof@D@std@@YAPADAAD@Z ; std::addressof<char> add esp, 4 push eax mov ecx, DWORD PTR _this$[ebp] call ?_Bx@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAT_Bxty@?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Bx push eax call ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z ; std::char_traits<char>::copy add esp, 12 ; 0000000cH $LN5@Tidy: ; 2238 : _STD addressof(*_Ptr), _Newsize); ; 2239 : this->_Getal().deallocate(_Ptr, this->_Myres() + 1); mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres mov eax, DWORD PTR [eax] add eax, 1 push eax mov ecx, DWORD PTR __Ptr$1[ebp] push ecx mov ecx, DWORD PTR _this$[ebp] call ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal mov ecx, eax call ?deallocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPADI@Z ; std::_Wrap_alloc<std::allocator<char> >::deallocate $LN3@Tidy: ; 2240 : } ; 2241 : this->_Myres() = this->_BUF_SIZE - 1; mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres mov DWORD PTR [eax], 15 ; 0000000fH ; 2242 : _Eos(_Newsize); mov eax, DWORD PTR __Newsize$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos ; 2243 : } pop edi pop esi pop ebx add esp, 216 ; 000000d8H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEX_NI@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Inside@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NPBD@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 ?_Inside@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NPBD@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Inside, COMDAT ; _this$ = ecx ; 2219 : { // test if _Ptr points inside string push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 2220 : if (_Ptr == 0 || _Ptr < this->_Myptr() ; 2221 : || this->_Myptr() + this->_Mysize() <= _Ptr) cmp DWORD PTR __Ptr$[ebp], 0 je SHORT $LN4@Inside mov ecx, DWORD PTR _this$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr cmp DWORD PTR __Ptr$[ebp], eax jb SHORT $LN4@Inside mov ecx, DWORD PTR _this$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr mov esi, eax mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize add esi, DWORD PTR [eax] cmp esi, DWORD PTR __Ptr$[ebp] ja SHORT $LN2@Inside $LN4@Inside: ; 2222 : return (false); // don't ask xor al, al jmp SHORT $LN1@Inside ; 2223 : else jmp SHORT $LN1@Inside $LN2@Inside: ; 2224 : return (true); mov al, 1 $LN1@Inside: ; 2225 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?_Inside@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NPBD@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Inside _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NI_N@Z _TEXT SEGMENT tv140 = -208 ; size = 4 tv133 = -208 ; size = 4 _this$ = -8 ; size = 4 __Newsize$ = 8 ; size = 4 __Trim$ = 12 ; size = 1 ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NI_N@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow, COMDAT ; _this$ = ecx ; 2205 : { // ensure buffer is big enough, trim to size if _Trim is true push ebp mov ebp, esp sub esp, 208 ; 000000d0H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-208] mov ecx, 52 ; 00000034H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 2206 : if (max_size() < _Newsize) mov ecx, DWORD PTR _this$[ebp] call ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::max_size cmp eax, DWORD PTR __Newsize$[ebp] jae SHORT $LN2@Grow ; 2207 : _Xlen(); // result too long mov ecx, DWORD PTR _this$[ebp] call ?_Xlen@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xlen $LN2@Grow: ; 2208 : if (this->_Myres() < _Newsize) mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres mov eax, DWORD PTR [eax] cmp eax, DWORD PTR __Newsize$[ebp] jae SHORT $LN3@Grow ; 2209 : _Copy(_Newsize, this->_Mysize()); // reallocate to grow mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov eax, DWORD PTR [eax] push eax mov ecx, DWORD PTR __Newsize$[ebp] push ecx mov ecx, DWORD PTR _this$[ebp] call ?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy jmp SHORT $LN4@Grow $LN3@Grow: ; 2210 : else if (_Trim && _Newsize < this->_BUF_SIZE) movzx eax, BYTE PTR __Trim$[ebp] test eax, eax je SHORT $LN5@Grow cmp DWORD PTR __Newsize$[ebp], 16 ; 00000010H jae SHORT $LN5@Grow ; 2211 : _Tidy(true, // copy and deallocate if trimming to small string mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov ecx, DWORD PTR __Newsize$[ebp] cmp ecx, DWORD PTR [eax] jae SHORT $LN9@Grow mov edx, DWORD PTR __Newsize$[ebp] mov DWORD PTR tv133[ebp], edx jmp SHORT $LN10@Grow $LN9@Grow: mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov eax, DWORD PTR [eax] mov DWORD PTR tv133[ebp], eax $LN10@Grow: mov ecx, DWORD PTR tv133[ebp] push ecx push 1 mov ecx, DWORD PTR _this$[ebp] call ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEX_NI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy jmp SHORT $LN4@Grow $LN5@Grow: ; 2212 : _Newsize < this->_Mysize() ? _Newsize : this->_Mysize()); ; 2213 : else if (_Newsize == 0) cmp DWORD PTR __Newsize$[ebp], 0 jne SHORT $LN4@Grow ; 2214 : _Eos(0); // new size is zero, just null terminate push 0 mov ecx, DWORD PTR _this$[ebp] call ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos $LN4@Grow: ; 2215 : return (0 < _Newsize); // return true only if more work to do cmp DWORD PTR __Newsize$[ebp], 0 jbe SHORT $LN11@Grow mov DWORD PTR tv140[ebp], 1 jmp SHORT $LN12@Grow $LN11@Grow: mov DWORD PTR tv140[ebp], 0 $LN12@Grow: mov al, BYTE PTR tv140[ebp] $LN8@Grow: ; 2216 : } pop edi pop esi pop ebx add esp, 208 ; 000000d0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NI_N@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z _TEXT SEGMENT $T1 = -209 ; size = 1 _this$ = -8 ; size = 4 __Newsize$ = 8 ; size = 4 ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos, COMDAT ; _this$ = ecx ; 2199 : { // set new length and null terminator push ebp mov ebp, esp sub esp, 216 ; 000000d8H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-216] mov ecx, 54 ; 00000036H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 2200 : _Traits::assign(this->_Myptr()[this->_Mysize() = _Newsize], _Elem()); mov BYTE PTR $T1[ebp], 0 mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov ecx, DWORD PTR __Newsize$[ebp] mov DWORD PTR [eax], ecx lea edx, DWORD PTR $T1[ebp] push edx mov ecx, DWORD PTR _this$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr add eax, DWORD PTR __Newsize$[ebp] push eax call ?assign@?$char_traits@D@std@@SAXAADABD@Z ; std::char_traits<char>::assign add esp, 8 ; 2201 : } pop edi pop esi pop ebx add esp, 216 ; 000000d8H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z _TEXT SEGMENT tv213 = -252 ; size = 4 tv212 = -252 ; size = 4 __Ptr$ = -52 ; size = 4 __Newres$ = -40 ; size = 4 _this$ = -28 ; size = 4 __$ArrayPad$ = -20 ; size = 4 __$EHRec$ = -16 ; size = 16 __Newsize$ = 8 ; size = 4 __Oldlen$ = 12 ; size = 4 ?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy, COMDAT ; _this$ = ecx ; 2164 : { // copy _Oldlen elements to newly allocated buffer push ebp mov ebp, esp push -1 push __ehhandler$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z mov eax, DWORD PTR fs:0 push eax push ecx sub esp, 236 ; 000000ecH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-252] mov ecx, 59 ; 0000003bH mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov eax, DWORD PTR ___security_cookie xor eax, ebp mov DWORD PTR __$ArrayPad$[ebp], eax push eax lea eax, DWORD PTR __$EHRec$[ebp+4] mov DWORD PTR fs:0, eax mov DWORD PTR __$EHRec$[ebp], esp mov DWORD PTR _this$[ebp], ecx ; 2165 : size_type _Newres = _Newsize | this->_ALLOC_MASK; mov eax, DWORD PTR __Newsize$[ebp] or eax, 15 ; 0000000fH mov DWORD PTR __Newres$[ebp], eax ; 2166 : if (max_size() < _Newres) mov ecx, DWORD PTR _this$[ebp] call ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::max_size cmp eax, DWORD PTR __Newres$[ebp] jae SHORT $LN2@Copy ; 2167 : _Newres = _Newsize; // undo roundup if too big mov eax, DWORD PTR __Newsize$[ebp] mov DWORD PTR __Newres$[ebp], eax jmp SHORT $LN3@Copy $LN2@Copy: ; 2168 : else if (this->_Myres() / 2 <= _Newres / 3) mov eax, DWORD PTR __Newres$[ebp] xor edx, edx mov ecx, 3 div ecx mov esi, eax mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres mov edx, DWORD PTR [eax] shr edx, 1 cmp edx, esi ja SHORT $LN4@Copy jmp SHORT $LN3@Copy $LN4@Copy: ; 2169 : ; ; 2170 : else if (this->_Myres() <= max_size() - this->_Myres() / 2) mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres mov esi, DWORD PTR [eax] shr esi, 1 mov ecx, DWORD PTR _this$[ebp] call ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::max_size mov edi, eax sub edi, esi mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres cmp DWORD PTR [eax], edi ja SHORT $LN6@Copy ; 2171 : _Newres = this->_Myres() mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres mov esi, DWORD PTR [eax] shr esi, 1 mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres add esi, DWORD PTR [eax] mov DWORD PTR __Newres$[ebp], esi ; 2172 : + this->_Myres() / 2; // grow exponentially if possible ; 2173 : else jmp SHORT $LN3@Copy $LN6@Copy: ; 2174 : _Newres = max_size(); // settle for max_size() mov ecx, DWORD PTR _this$[ebp] call ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::max_size mov DWORD PTR __Newres$[ebp], eax $LN3@Copy: ; 2175 : ; 2176 : _Elem *_Ptr; ; 2177 : _TRY_BEGIN mov DWORD PTR __$EHRec$[ebp+12], 0 ; 2178 : _Ptr = this->_Getal().allocate(_Newres + 1); mov eax, DWORD PTR __Newres$[ebp] add eax, 1 push eax mov ecx, DWORD PTR _this$[ebp] call ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal mov ecx, eax call ?allocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEPADI@Z ; std::_Wrap_alloc<std::allocator<char> >::allocate mov DWORD PTR tv212[ebp], eax mov ecx, DWORD PTR tv212[ebp] mov DWORD PTR __Ptr$[ebp], ecx jmp SHORT $LN12@Copy __catch$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$0: ; 2179 : _CATCH_ALL mov DWORD PTR __$EHRec$[ebp], esp ; 2180 : _Newres = _Newsize; // allocation failed, undo roundup and retry mov eax, DWORD PTR __Newsize$[ebp] mov DWORD PTR __Newres$[ebp], eax ; 2181 : _TRY_BEGIN mov BYTE PTR __$EHRec$[ebp+12], 2 ; 2182 : _Ptr = this->_Getal().allocate(_Newres + 1); mov eax, DWORD PTR __Newres$[ebp] add eax, 1 push eax mov ecx, DWORD PTR _this$[ebp] call ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal mov ecx, eax call ?allocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEPADI@Z ; std::_Wrap_alloc<std::allocator<char> >::allocate mov DWORD PTR tv213[ebp], eax mov ecx, DWORD PTR tv213[ebp] mov DWORD PTR __Ptr$[ebp], ecx jmp SHORT $LN14@Copy __catch$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$1: ; 2183 : _CATCH_ALL ; 2184 : _Tidy(true); // failed again, discard storage and reraise push 0 push 1 mov ecx, DWORD PTR _this$[ebp] call ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEX_NI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy ; 2185 : _RERAISE; push 0 push 0 call __CxxThrowException@8 ; 2186 : _CATCH_END mov eax, $LN17@Copy ret 0 $LN14@Copy: mov DWORD PTR __$EHRec$[ebp+12], 1 jmp SHORT __tryend$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$2 $LN17@Copy: mov DWORD PTR __$EHRec$[ebp+12], 1 __tryend$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$2: ; 2187 : _CATCH_END mov eax, $LN19@Copy ret 0 $LN12@Copy: mov DWORD PTR __$EHRec$[ebp+12], -1 jmp SHORT __tryend$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$3 $LN19@Copy: mov DWORD PTR __$EHRec$[ebp+12], -1 __tryend$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$3: ; 2188 : ; 2189 : if (0 < _Oldlen) cmp DWORD PTR __Oldlen$[ebp], 0 jbe SHORT $LN10@Copy ; 2190 : _Traits::copy(_Ptr, this->_Myptr(), mov eax, DWORD PTR __Oldlen$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx call ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z ; std::char_traits<char>::copy add esp, 12 ; 0000000cH $LN10@Copy: ; 2191 : _Oldlen); // copy existing elements ; 2192 : _Tidy(true); push 0 push 1 mov ecx, DWORD PTR _this$[ebp] call ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEX_NI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy ; 2193 : this->_Getal().construct(&this->_Bx()._Ptr, _Ptr); lea eax, DWORD PTR __Ptr$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Bx@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAT_Bxty@?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Bx push eax mov ecx, DWORD PTR _this$[ebp] call ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal mov ecx, eax call ??$construct@PADAAPAD@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPAPADAAPAD@Z ; std::_Wrap_alloc<std::allocator<char> >::construct<char *,char * &> ; 2194 : this->_Myres() = _Newres; mov ecx, DWORD PTR _this$[ebp] call ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres mov ecx, DWORD PTR __Newres$[ebp] mov DWORD PTR [eax], ecx ; 2195 : _Eos(_Oldlen); mov eax, DWORD PTR __Oldlen$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos $LN11@Copy: ; 2196 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN23@Copy call @_RTC_CheckStackVars@8 pop eax pop edx mov ecx, DWORD PTR __$EHRec$[ebp+4] mov DWORD PTR fs:0, ecx pop ecx pop edi pop esi pop ebx mov ecx, DWORD PTR __$ArrayPad$[ebp] xor ecx, ebp call @__security_check_cookie@4 add esp, 252 ; 000000fcH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 $LN23@Copy: DD 1 DD $LN22@Copy $LN22@Copy: DD -52 ; ffffffccH DD 4 DD $LN20@Copy $LN20@Copy: DB 95 ; 0000005fH DB 80 ; 00000050H DB 116 ; 00000074H DB 114 ; 00000072H DB 0 _TEXT ENDS ; COMDAT text$x text$x SEGMENT __ehhandler$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z: mov edx, DWORD PTR [esp+8] lea eax, DWORD PTR [edx+12] mov ecx, DWORD PTR [edx-256] xor ecx, eax call @__security_check_cookie@4 mov ecx, DWORD PTR [edx-8] xor ecx, eax call @__security_check_cookie@4 mov eax, OFFSET __ehfuncinfo$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z jmp ___CxxFrameHandler3 text$x ENDS ?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ _TEXT SEGMENT tv75 = -232 ; size = 4 $T1 = -221 ; size = 1 __Num$ = -20 ; size = 4 _this$ = -8 ; size = 4 ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::max_size, COMDAT ; _this$ = ecx ; 1754 : { // return maximum possible length of sequence push ebp mov ebp, esp sub esp, 232 ; 000000e8H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-232] mov ecx, 58 ; 0000003aH mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 1755 : size_type _Num = this->_Getal().max_size(); movzx eax, BYTE PTR $T1[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal mov ecx, eax call ?max_size@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QBEIU_Nil@2@@Z ; std::_Wrap_alloc<std::allocator<char> >::max_size mov DWORD PTR __Num$[ebp], eax ; 1756 : return (_Num <= 1 ? 1 : _Num - 1); cmp DWORD PTR __Num$[ebp], 1 ja SHORT $LN3@max_size mov DWORD PTR tv75[ebp], 1 jmp SHORT $LN4@max_size $LN3@max_size: mov eax, DWORD PTR __Num$[ebp] sub eax, 1 mov DWORD PTR tv75[ebp], eax $LN4@max_size: mov eax, DWORD PTR tv75[ebp] ; 1757 : } pop edi pop esi pop ebx add esp, 232 ; 000000e8H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::max_size _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size, COMDAT ; _this$ = ecx ; 1749 : { // return length of sequence push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 1750 : return (this->_Mysize()); mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov eax, DWORD PTR [eax] ; 1751 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z _TEXT SEGMENT __Newsize$1 = -32 ; size = 4 __Ptr$2 = -20 ; size = 4 _this$ = -8 ; size = 4 __Off$ = 8 ; size = 4 __Count$ = 12 ; size = 4 ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::erase, COMDAT ; _this$ = ecx ; 1345 : { // erase elements [_Off, _Off + _Count) push ebp mov ebp, esp sub esp, 228 ; 000000e4H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-228] mov ecx, 57 ; 00000039H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 1346 : if (this->_Mysize() < _Off) mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov eax, DWORD PTR [eax] cmp eax, DWORD PTR __Off$[ebp] jae SHORT $LN2@erase ; 1347 : _Xran(); // _Off off end mov ecx, DWORD PTR _this$[ebp] call ?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xran $LN2@erase: ; 1348 : if (this->_Mysize() - _Off <= _Count) mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov eax, DWORD PTR [eax] sub eax, DWORD PTR __Off$[ebp] cmp eax, DWORD PTR __Count$[ebp] ja SHORT $LN3@erase ; 1349 : _Eos(_Off); // erase elements [_Off, ...) mov eax, DWORD PTR __Off$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos jmp SHORT $LN4@erase $LN3@erase: ; 1350 : else if (0 < _Count) cmp DWORD PTR __Count$[ebp], 0 jbe SHORT $LN4@erase ; 1351 : { // move elements down ; 1352 : value_type *_Ptr = this->_Myptr() + _Off; mov ecx, DWORD PTR _this$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr add eax, DWORD PTR __Off$[ebp] mov DWORD PTR __Ptr$2[ebp], eax ; 1353 : size_type _Newsize = this->_Mysize() - _Count; mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov eax, DWORD PTR [eax] sub eax, DWORD PTR __Count$[ebp] mov DWORD PTR __Newsize$1[ebp], eax ; 1354 : _Traits::move(_Ptr, _Ptr + _Count, _Newsize - _Off); mov eax, DWORD PTR __Newsize$1[ebp] sub eax, DWORD PTR __Off$[ebp] push eax mov ecx, DWORD PTR __Ptr$2[ebp] add ecx, DWORD PTR __Count$[ebp] push ecx mov edx, DWORD PTR __Ptr$2[ebp] push edx call ?move@?$char_traits@D@std@@SAPADPADPBDI@Z ; std::char_traits<char>::move add esp, 12 ; 0000000cH ; 1355 : _Eos(_Newsize); mov eax, DWORD PTR __Newsize$1[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos $LN4@erase: ; 1356 : } ; 1357 : return (*this); mov eax, DWORD PTR _this$[ebp] $LN6@erase: ; 1358 : } pop edi pop esi pop ebx add esp, 228 ; 000000e4H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::erase _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@I@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Off$ = 8 ; size = 4 ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@I@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::erase, COMDAT ; _this$ = ecx ; 1337 : { // erase elements [_Off, ...) push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 1338 : if (this->_Mysize() < _Off) mov ecx, DWORD PTR _this$[ebp] call ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize mov eax, DWORD PTR [eax] cmp eax, DWORD PTR __Off$[ebp] jae SHORT $LN2@erase ; 1339 : _Xran(); // _Off off end mov ecx, DWORD PTR _this$[ebp] call ?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xran $LN2@erase: ; 1340 : _Eos(_Off); mov eax, DWORD PTR __Off$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos ; 1341 : return (*this); mov eax, DWORD PTR _this$[ebp] $LN3@erase: ; 1342 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@I@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::erase _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign, COMDAT ; _this$ = ecx ; 1174 : { // assign [_Ptr, <null>) push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 1175 : _DEBUG_POINTER(_Ptr); push 1175 ; 00000497H push OFFSET ??_C@_1EE@PIAPABGP@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAs?$AAt?$AAr?$AAi?$AAn@ mov eax, DWORD PTR __Ptr$[ebp] push eax call ??$_Debug_pointer@$$CBD@std@@YAXPBDPB_WI@Z ; std::_Debug_pointer<char const > add esp, 12 ; 0000000cH ; 1176 : return (assign(_Ptr, _Traits::length(_Ptr))); mov eax, DWORD PTR __Ptr$[ebp] push eax call ?length@?$char_traits@D@std@@SAIPBD@Z ; std::char_traits<char>::length add esp, 4 push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx mov ecx, DWORD PTR _this$[ebp] call ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign ; 1177 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z _TEXT SEGMENT tv68 = -205 ; size = 1 _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 __Count$ = 12 ; size = 4 ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign, COMDAT ; _this$ = ecx ; 1159 : { // assign [_Ptr, _Ptr + _Count) push ebp mov ebp, esp sub esp, 208 ; 000000d0H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-208] mov ecx, 52 ; 00000034H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 1160 : _DEBUG_POINTER_IF(_Count != 0, _Ptr); cmp DWORD PTR __Count$[ebp], 0 je SHORT $LN5@assign mov BYTE PTR tv68[ebp], 1 jmp SHORT $LN6@assign $LN5@assign: mov BYTE PTR tv68[ebp], 0 $LN6@assign: push 1160 ; 00000488H push OFFSET ??_C@_1EE@PIAPABGP@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAs?$AAt?$AAr?$AAi?$AAn@ mov eax, DWORD PTR __Ptr$[ebp] push eax movzx ecx, BYTE PTR tv68[ebp] push ecx call ??$_Debug_pointer_if@$$CBD@std@@YAX_NPBDPB_WI@Z ; std::_Debug_pointer_if<char const > add esp, 16 ; 00000010H ; 1161 : if (_Inside(_Ptr)) mov eax, DWORD PTR __Ptr$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Inside@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NPBD@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Inside movzx ecx, al test ecx, ecx je SHORT $LN2@assign ; 1162 : return (assign(*this, mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr mov ecx, DWORD PTR __Ptr$[ebp] sub ecx, eax push ecx mov edx, DWORD PTR _this$[ebp] push edx mov ecx, DWORD PTR _this$[ebp] call ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign jmp SHORT $LN1@assign $LN2@assign: ; 1163 : _Ptr - this->_Myptr(), _Count)); // substring ; 1164 : ; 1165 : if (_Grow(_Count)) push 0 mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NI_N@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow movzx ecx, al test ecx, ecx je SHORT $LN3@assign ; 1166 : { // make room and assign new stuff ; 1167 : _Traits::copy(this->_Myptr(), _Ptr, _Count); mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx mov ecx, DWORD PTR _this$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr push eax call ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z ; std::char_traits<char>::copy add esp, 12 ; 0000000cH ; 1168 : _Eos(_Count); mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos $LN3@assign: ; 1169 : } ; 1170 : return (*this); mov eax, DWORD PTR _this$[ebp] $LN1@assign: ; 1171 : } pop edi pop esi pop ebx add esp, 208 ; 000000d0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z _TEXT SEGMENT __Num$ = -20 ; size = 4 _this$ = -8 ; size = 4 __Right$ = 8 ; size = 4 __Roff$ = 12 ; size = 4 __Count$ = 16 ; size = 4 ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign, COMDAT ; _this$ = ecx ; 1140 : { // assign _Right [_Roff, _Roff + _Count) push ebp mov ebp, esp sub esp, 216 ; 000000d8H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-216] mov ecx, 54 ; 00000036H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 1141 : if (_Right.size() < _Roff) mov ecx, DWORD PTR __Right$[ebp] call ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size cmp eax, DWORD PTR __Roff$[ebp] jae SHORT $LN2@assign ; 1142 : _Xran(); // _Roff off end mov ecx, DWORD PTR _this$[ebp] call ?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Xran $LN2@assign: ; 1143 : size_type _Num = _Right.size() - _Roff; mov ecx, DWORD PTR __Right$[ebp] call ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size sub eax, DWORD PTR __Roff$[ebp] mov DWORD PTR __Num$[ebp], eax ; 1144 : if (_Count < _Num) mov eax, DWORD PTR __Count$[ebp] cmp eax, DWORD PTR __Num$[ebp] jae SHORT $LN3@assign ; 1145 : _Num = _Count; // trim _Num to size mov eax, DWORD PTR __Count$[ebp] mov DWORD PTR __Num$[ebp], eax $LN3@assign: ; 1146 : ; 1147 : if (this == &_Right) mov eax, DWORD PTR _this$[ebp] cmp eax, DWORD PTR __Right$[ebp] jne SHORT $LN4@assign ; 1148 : erase((size_type)(_Roff + _Num)), erase(0, _Roff); // substring mov eax, DWORD PTR __Roff$[ebp] add eax, DWORD PTR __Num$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@I@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::erase mov ecx, DWORD PTR __Roff$[ebp] push ecx push 0 mov ecx, DWORD PTR _this$[ebp] call ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::erase jmp SHORT $LN5@assign $LN4@assign: ; 1149 : else if (_Grow(_Num)) push 0 mov eax, DWORD PTR __Num$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NI_N@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow movzx ecx, al test ecx, ecx je SHORT $LN5@assign ; 1150 : { // make room and assign new stuff ; 1151 : _Traits::copy(this->_Myptr(), mov eax, DWORD PTR __Num$[ebp] push eax mov ecx, DWORD PTR __Right$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEPBDXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr add eax, DWORD PTR __Roff$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr push eax call ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z ; std::char_traits<char>::copy add esp, 12 ; 0000000cH ; 1152 : _Right._Myptr() + _Roff, _Num); ; 1153 : _Eos(_Num); mov eax, DWORD PTR __Num$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos $LN5@assign: ; 1154 : } ; 1155 : return (*this); mov eax, DWORD PTR _this$[ebp] $LN7@assign: ; 1156 : } pop edi pop esi pop ebx add esp, 216 ; 000000d8H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 12 ; 0000000cH ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z _TEXT SEGMENT $T2 = -221 ; size = 1 _this$ = -20 ; size = 4 __$EHRec$ = -12 ; size = 12 __Ptr$ = 8 ; size = 4 ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z PROC ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >, COMDAT ; _this$ = ecx ; 824 : { // construct from [_Ptr, <null>) push ebp mov ebp, esp push -1 push __ehhandler$??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z mov eax, DWORD PTR fs:0 push eax sub esp, 216 ; 000000d8H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-228] mov ecx, 54 ; 00000036H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov eax, DWORD PTR ___security_cookie xor eax, ebp push eax lea eax, DWORD PTR __$EHRec$[ebp] mov DWORD PTR fs:0, eax mov DWORD PTR _this$[ebp], ecx ; 823 : : _Mybase() lea ecx, DWORD PTR $T2[ebp] call ??0?$allocator@D@std@@QAE@XZ ; std::allocator<char>::allocator<char> push eax mov ecx, DWORD PTR _this$[ebp] call ??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_String_alloc<std::_String_base_types<char,std::allocator<char> > > mov DWORD PTR __$EHRec$[ebp+8], 0 ; 825 : _Tidy(); push 0 push 0 mov ecx, DWORD PTR _this$[ebp] call ?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEX_NI@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy ; 826 : assign(_Ptr); mov eax, DWORD PTR __Ptr$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign ; 827 : } mov DWORD PTR __$EHRec$[ebp+8], -1 mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR __$EHRec$[ebp] mov DWORD PTR fs:0, ecx pop ecx pop edi pop esi pop ebx add esp, 228 ; 000000e4H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 _TEXT ENDS ; COMDAT text$x text$x SEGMENT __unwindfunclet$??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z$0: mov ecx, DWORD PTR _this$[ebp] jmp ??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<std::_String_base_types<char,std::allocator<char> > > __ehhandler$??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z: mov edx, DWORD PTR [esp+8] lea eax, DWORD PTR [edx+12] mov ecx, DWORD PTR [edx-232] xor ecx, eax call @__security_check_cookie@4 mov eax, OFFSET __ehfuncinfo$??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z jmp ___CxxFrameHandler3 text$x ENDS ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z ENDP ; std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> > ; Function compile flags: /Odtp /RTCsu /ZI ; COMDAT ??1?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ??1?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@XZ PROC ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::~_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>, COMDAT ; _this$ = ecx push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx mov ecx, DWORD PTR _this$[ebp] call ??1?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??1?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@XZ ENDP ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::~_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ PROC ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_second, COMDAT ; _this$ = ecx ; 318 : { // return const reference to second push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 319 : return (_Myval2); mov eax, DWORD PTR _this$[ebp] ; 320 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ENDP ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_second _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ PROC ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_second, COMDAT ; _this$ = ecx ; 313 : { // return reference to second push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 314 : return (_Myval2); mov eax, DWORD PTR _this$[ebp] ; 315 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ENDP ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_second _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ PROC ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_first, COMDAT ; _this$ = ecx ; 298 : { // return const reference to first push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 299 : return (*this); mov eax, DWORD PTR _this$[ebp] ; 300 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ENDP ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_first _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ PROC ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_first, COMDAT ; _this$ = ecx ; 293 : { // return reference to first push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 294 : return (*this); mov eax, DWORD PTR _this$[ebp] ; 295 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ENDP ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_first _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres, COMDAT ; _this$ = ecx ; 721 : { // return reference to _Myres push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 722 : return (_Get_data()._Myres); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data add eax, 24 ; 00000018H ; 723 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Myres@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myres _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABIXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABIXZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize, COMDAT ; _this$ = ecx ; 716 : { // return const reference to _Mysize push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 717 : return (_Get_data()._Mysize); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data add eax, 20 ; 00000014H ; 718 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABIXZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize, COMDAT ; _this$ = ecx ; 711 : { // return reference to _Mysize push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 712 : return (_Get_data()._Mysize); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data add eax, 20 ; 00000014H ; 713 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Mysize@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAIXZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Mysize _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Bx@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAT_Bxty@?$_String_val@U?$_Simple_types@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Bx@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAT_Bxty@?$_String_val@U?$_Simple_types@D@std@@@2@XZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Bx, COMDAT ; _this$ = ecx ; 701 : { // return reference to _Bx push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 702 : return (_Get_data()._Bx); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data add eax, 4 ; 703 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Bx@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAT_Bxty@?$_String_val@U?$_Simple_types@D@std@@@2@XZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Bx _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data, COMDAT ; _this$ = ecx ; 694 : { // return const reference to _String_val push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 695 : return (_Mypair._Get_second()); mov ecx, DWORD PTR _this$[ebp] call ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_second ; 696 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data, COMDAT ; _this$ = ecx ; 689 : { // return reference to _String_val push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 690 : return (_Mypair._Get_second()); mov ecx, DWORD PTR _this$[ebp] call ?_Get_second@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_second ; 691 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal, COMDAT ; _this$ = ecx ; 684 : { // return const reference to allocator push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 685 : return (_Mypair._Get_first()); mov ecx, DWORD PTR _this$[ebp] call ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_first ; 686 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal, COMDAT ; _this$ = ecx ; 679 : { // return reference to allocator push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 680 : return (_Mypair._Get_first()); mov ecx, DWORD PTR _this$[ebp] call ?_Get_first@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Get_first ; 681 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Orphan_all@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Orphan_all@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Orphan_all, COMDAT ; _this$ = ecx ; 669 : { // orphan all iterators push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 670 : _Get_data()._Orphan_all(); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data mov ecx, eax call ?_Orphan_all@_Container_base12@std@@QAEXXZ ; std::_Container_base12::_Orphan_all ; 671 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Orphan_all@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Orphan_all _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy, COMDAT ; _this$ = ecx ; 658 : { // return reference to _Myproxy push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 659 : return (_Get_data()._Myproxy); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data ; 660 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Free_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ _TEXT SEGMENT __Alproxy$ = -21 ; size = 1 _this$ = -12 ; size = 4 __$ArrayPad$ = -4 ; size = 4 ?_Free_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Free_proxy, COMDAT ; _this$ = ecx ; 643 : { // destroy proxy push ebp mov ebp, esp sub esp, 220 ; 000000dcH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-220] mov ecx, 55 ; 00000037H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov eax, DWORD PTR ___security_cookie xor eax, ebp mov DWORD PTR __$ArrayPad$[ebp], eax mov DWORD PTR _this$[ebp], ecx ; 644 : typename _Alty::template rebind<_Container_proxy>::other ; 645 : _Alproxy(_Getal()); mov ecx, DWORD PTR _this$[ebp] call ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal push eax lea ecx, DWORD PTR __Alproxy$[ebp] call ??$?0U?$_Wrap_alloc@V?$allocator@D@std@@@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAE@AAU?$_Wrap_alloc@V?$allocator@D@std@@@1@@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::_Wrap_alloc<std::allocator<std::_Container_proxy> ><std::_Wrap_alloc<std::allocator<char> > > ; 646 : _Orphan_all(); mov ecx, DWORD PTR _this$[ebp] call ?_Orphan_all@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Orphan_all ; 647 : _Alproxy.destroy(_Myproxy()); mov ecx, DWORD PTR _this$[ebp] call ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy mov eax, DWORD PTR [eax] push eax lea ecx, DWORD PTR __Alproxy$[ebp] call ??$destroy@U_Container_proxy@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::destroy<std::_Container_proxy> ; 648 : _Alproxy.deallocate(_Myproxy(), 1); push 1 mov ecx, DWORD PTR _this$[ebp] call ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy mov eax, DWORD PTR [eax] push eax lea ecx, DWORD PTR __Alproxy$[ebp] call ?deallocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@2@I@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::deallocate ; 649 : _Myproxy() = 0; mov ecx, DWORD PTR _this$[ebp] call ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy mov DWORD PTR [eax], 0 ; 650 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN5@Free_proxy call @_RTC_CheckStackVars@8 pop eax pop edx pop edi pop esi pop ebx mov ecx, DWORD PTR __$ArrayPad$[ebp] xor ecx, ebp call @__security_check_cookie@4 add esp, 220 ; 000000dcH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 npad 1 $LN5@Free_proxy: DD 1 DD $LN4@Free_proxy $LN4@Free_proxy: DD -21 ; ffffffebH DD 1 DD $LN3@Free_proxy $LN3@Free_proxy: DB 95 ; 0000005fH DB 65 ; 00000041H DB 108 ; 0000006cH DB 112 ; 00000070H DB 114 ; 00000072H DB 111 ; 0000006fH DB 120 ; 00000078H DB 121 ; 00000079H DB 0 ?_Free_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Free_proxy _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Alloc_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ _TEXT SEGMENT $T1 = -232 ; size = 8 __Alproxy$ = -21 ; size = 1 _this$ = -12 ; size = 4 __$ArrayPad$ = -4 ; size = 4 ?_Alloc_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Alloc_proxy, COMDAT ; _this$ = ecx ; 634 : { // construct proxy push ebp mov ebp, esp sub esp, 236 ; 000000ecH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-236] mov ecx, 59 ; 0000003bH mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov eax, DWORD PTR ___security_cookie xor eax, ebp mov DWORD PTR __$ArrayPad$[ebp], eax mov DWORD PTR _this$[ebp], ecx ; 635 : typename _Alty::template rebind<_Container_proxy>::other ; 636 : _Alproxy(_Getal()); mov ecx, DWORD PTR _this$[ebp] call ?_Getal@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAU?$_Wrap_alloc@V?$allocator@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal push eax lea ecx, DWORD PTR __Alproxy$[ebp] call ??$?0U?$_Wrap_alloc@V?$allocator@D@std@@@std@@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAE@AAU?$_Wrap_alloc@V?$allocator@D@std@@@1@@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::_Wrap_alloc<std::allocator<std::_Container_proxy> ><std::_Wrap_alloc<std::allocator<char> > > ; 637 : _Myproxy() = _Alproxy.allocate(1); push 1 lea ecx, DWORD PTR __Alproxy$[ebp] call ?allocate@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEPAU_Container_proxy@2@I@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::allocate mov esi, eax mov ecx, DWORD PTR _this$[ebp] call ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy mov DWORD PTR [eax], esi ; 638 : _Alproxy.construct(_Myproxy(), _Container_proxy()); lea ecx, DWORD PTR $T1[ebp] call ??0_Container_proxy@std@@QAE@XZ ; std::_Container_proxy::_Container_proxy push eax mov ecx, DWORD PTR _this$[ebp] call ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy mov eax, DWORD PTR [eax] push eax lea ecx, DWORD PTR __Alproxy$[ebp] call ??$construct@U_Container_proxy@std@@U12@@?$_Wrap_alloc@V?$allocator@U_Container_proxy@std@@@std@@@std@@QAEXPAU_Container_proxy@1@$$QAU21@@Z ; std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::construct<std::_Container_proxy,std::_Container_proxy> ; 639 : _Myproxy()->_Mycont = &_Get_data(); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data mov esi, eax mov ecx, DWORD PTR _this$[ebp] call ?_Myproxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAPAU_Container_proxy@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myproxy mov eax, DWORD PTR [eax] mov DWORD PTR [eax], esi ; 640 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN5@Alloc_prox call @_RTC_CheckStackVars@8 pop eax pop edx pop edi pop esi pop ebx mov ecx, DWORD PTR __$ArrayPad$[ebp] xor ecx, ebp call @__security_check_cookie@4 add esp, 236 ; 000000ecH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 $LN5@Alloc_prox: DD 1 DD $LN4@Alloc_prox $LN4@Alloc_prox: DD -21 ; ffffffebH DD 1 DD $LN3@Alloc_prox $LN3@Alloc_prox: DB 95 ; 0000005fH DB 65 ; 00000041H DB 108 ; 0000006cH DB 112 ; 00000070H DB 114 ; 00000072H DB 111 ; 0000006fH DB 120 ; 00000078H DB 121 ; 00000079H DB 0 ?_Alloc_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Alloc_proxy _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ _TEXT SEGMENT _this$ = -20 ; size = 4 __$EHRec$ = -12 ; size = 12 ??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<std::_String_base_types<char,std::allocator<char> > >, COMDAT ; _this$ = ecx ; 609 : { // destroy the object push ebp mov ebp, esp push -1 push __ehhandler$??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ mov eax, DWORD PTR fs:0 push eax sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-216] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov eax, DWORD PTR ___security_cookie xor eax, ebp push eax lea eax, DWORD PTR __$EHRec$[ebp] mov DWORD PTR fs:0, eax mov DWORD PTR _this$[ebp], ecx ; 610 : _Free_proxy(); mov ecx, DWORD PTR _this$[ebp] call ?_Free_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Free_proxy ; 611 : } mov ecx, DWORD PTR _this$[ebp] call ??1?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@XZ mov ecx, DWORD PTR __$EHRec$[ebp] mov DWORD PTR fs:0, ecx pop ecx pop edi pop esi pop ebx add esp, 216 ; 000000d8H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 _TEXT ENDS ; COMDAT text$x text$x SEGMENT __ehhandler$??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ: mov edx, DWORD PTR [esp+8] lea eax, DWORD PTR [edx+12] mov ecx, DWORD PTR [edx-220] xor ecx, eax call @__security_check_cookie@4 mov eax, OFFSET __ehfuncinfo$??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ jmp ___CxxFrameHandler3 text$x ENDS ??1?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@XZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<std::_String_base_types<char,std::allocator<char> > > ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z _TEXT SEGMENT $T2 = -221 ; size = 1 _this$ = -20 ; size = 4 __$EHRec$ = -12 ; size = 12 __Al$ = 8 ; size = 4 ??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_String_alloc<std::_String_base_types<char,std::allocator<char> > >, COMDAT ; _this$ = ecx ; 598 : { // construct allocator from _Al push ebp mov ebp, esp push -1 push __ehhandler$??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z mov eax, DWORD PTR fs:0 push eax sub esp, 216 ; 000000d8H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-228] mov ecx, 54 ; 00000036H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov eax, DWORD PTR ___security_cookie xor eax, ebp push eax lea eax, DWORD PTR __$EHRec$[ebp] mov DWORD PTR fs:0, eax mov DWORD PTR _this$[ebp], ecx ; 597 : : _Mypair(_One_then_variadic_args_t(), _Al) mov eax, DWORD PTR __Al$[ebp] push eax movzx ecx, BYTE PTR $T2[ebp] push ecx mov ecx, DWORD PTR _this$[ebp] call ??$?0ABV?$allocator@D@std@@$$V@?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@U_One_then_variadic_args_t@1@ABV?$allocator@D@1@@Z ; std::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1>::_Compressed_pair<std::_Wrap_alloc<std::allocator<char> >,std::_String_val<std::_Simple_types<char> >,1><std::allocator<char> const &> mov DWORD PTR __$EHRec$[ebp+8], 0 ; 599 : _Alloc_proxy(); mov ecx, DWORD PTR _this$[ebp] call ?_Alloc_proxy@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Alloc_proxy ; 600 : } mov DWORD PTR __$EHRec$[ebp+8], -1 mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR __$EHRec$[ebp] mov DWORD PTR fs:0, ecx pop ecx pop edi pop esi pop ebx add esp, 228 ; 000000e4H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 _TEXT ENDS ; COMDAT text$x text$x SEGMENT __unwindfunclet$??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z$0: mov ecx, DWORD PTR _this$[ebp] jmp ??1?$_Compressed_pair@U?$_Wrap_alloc@V?$allocator@D@std@@@std@@V?$_String_val@U?$_Simple_types@D@std@@@2@$00@std@@QAE@XZ __ehhandler$??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z: mov edx, DWORD PTR [esp+8] lea eax, DWORD PTR [edx+12] mov ecx, DWORD PTR [edx-232] xor ecx, eax call @__security_check_cookie@4 mov eax, OFFSET __ehfuncinfo$??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z jmp ___CxxFrameHandler3 text$x ENDS ??0?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAE@ABV?$allocator@D@1@@Z ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_String_alloc<std::_String_base_types<char,std::allocator<char> > > ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEPBDXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEPBDXZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr, COMDAT ; _this$ = ecx ; 565 : { // determine current pointer to buffer for nonmutable string push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 566 : return (_Get_data()._Myptr()); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEABV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data mov ecx, eax call ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QBEPBDXZ ; std::_String_val<std::_Simple_types<char> >::_Myptr ; 567 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QBEPBDXZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ PROC ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr, COMDAT ; _this$ = ecx ; 560 : { // determine current pointer to buffer for mutable string push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 561 : return (_Get_data()._Myptr()); mov ecx, DWORD PTR _this$[ebp] call ?_Get_data@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEAAV?$_String_val@U?$_Simple_types@D@std@@@2@XZ ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Get_data mov ecx, eax call ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QAEPADXZ ; std::_String_val<std::_Simple_types<char> >::_Myptr ; 562 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Myptr@?$_String_alloc@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEPADXZ ENDP ; std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Myptr _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; COMDAT ??1?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ??1?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ PROC ; std::_String_val<std::_Simple_types<char> >::~_String_val<std::_Simple_types<char> >, COMDAT ; _this$ = ecx push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx mov ecx, DWORD PTR _this$[ebp] call ??1_Container_base12@std@@QAE@XZ ; std::_Container_base12::~_Container_base12 pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??1?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ ENDP ; std::_String_val<std::_Simple_types<char> >::~_String_val<std::_Simple_types<char> > _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QBEPBDXZ _TEXT SEGMENT tv72 = -208 ; size = 4 _this$ = -8 ; size = 4 ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QBEPBDXZ PROC ; std::_String_val<std::_Simple_types<char> >::_Myptr, COMDAT ; _this$ = ecx ; 511 : { // determine current pointer to buffer for nonmutable string push ebp mov ebp, esp sub esp, 208 ; 000000d0H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-208] mov ecx, 52 ; 00000034H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 512 : return (this->_BUF_SIZE <= this->_Myres mov eax, DWORD PTR _this$[ebp] cmp DWORD PTR [eax+24], 16 ; 00000010H jb SHORT $LN3@Myptr mov ecx, DWORD PTR _this$[ebp] mov edx, DWORD PTR [ecx+4] push edx call ??$addressof@D@std@@YAPADAAD@Z ; std::addressof<char> add esp, 4 mov DWORD PTR tv72[ebp], eax jmp SHORT $LN4@Myptr $LN3@Myptr: mov eax, DWORD PTR _this$[ebp] add eax, 4 mov DWORD PTR tv72[ebp], eax $LN4@Myptr: mov eax, DWORD PTR tv72[ebp] ; 513 : ? _STD addressof(*this->_Bx._Ptr) ; 514 : : this->_Bx._Buf); ; 515 : } pop edi pop esi pop ebx add esp, 208 ; 000000d0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QBEPBDXZ ENDP ; std::_String_val<std::_Simple_types<char> >::_Myptr _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QAEPADXZ _TEXT SEGMENT tv72 = -208 ; size = 4 _this$ = -8 ; size = 4 ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QAEPADXZ PROC ; std::_String_val<std::_Simple_types<char> >::_Myptr, COMDAT ; _this$ = ecx ; 504 : { // determine current pointer to buffer for mutable string push ebp mov ebp, esp sub esp, 208 ; 000000d0H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-208] mov ecx, 52 ; 00000034H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 505 : return (this->_BUF_SIZE <= this->_Myres mov eax, DWORD PTR _this$[ebp] cmp DWORD PTR [eax+24], 16 ; 00000010H jb SHORT $LN3@Myptr mov ecx, DWORD PTR _this$[ebp] mov edx, DWORD PTR [ecx+4] push edx call ??$addressof@D@std@@YAPADAAD@Z ; std::addressof<char> add esp, 4 mov DWORD PTR tv72[ebp], eax jmp SHORT $LN4@Myptr $LN3@Myptr: mov eax, DWORD PTR _this$[ebp] add eax, 4 mov DWORD PTR tv72[ebp], eax $LN4@Myptr: mov eax, DWORD PTR tv72[ebp] ; 506 : ? _STD addressof(*this->_Bx._Ptr) ; 507 : : this->_Bx._Buf); ; 508 : } pop edi pop esi pop ebx add esp, 208 ; 000000d0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Myptr@?$_String_val@U?$_Simple_types@D@std@@@std@@QAEPADXZ ENDP ; std::_String_val<std::_Simple_types<char> >::_Myptr _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xstring ; COMDAT ??0?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ??0?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ PROC ; std::_String_val<std::_Simple_types<char> >::_String_val<std::_Simple_types<char> >, COMDAT ; _this$ = ecx ; 486 : _String_val() push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 487 : { // initialize values mov ecx, DWORD PTR _this$[ebp] call ??0_Container_base12@std@@QAE@XZ ; std::_Container_base12::_Container_base12 ; 488 : _Mysize = 0; mov eax, DWORD PTR _this$[ebp] mov DWORD PTR [eax+20], 0 ; 489 : _Myres = 0; mov eax, DWORD PTR _this$[ebp] mov DWORD PTR [eax+24], 0 ; 490 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ??0?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ ENDP ; std::_String_val<std::_Simple_types<char> >::_String_val<std::_Simple_types<char> > _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?max_size@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QBEIU_Nil@2@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 ___formal$ = 8 ; size = 1 ?max_size@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QBEIU_Nil@2@@Z PROC ; std::_Wrap_alloc<std::allocator<char> >::max_size, COMDAT ; _this$ = ecx ; 929 : { // get maximum size push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 930 : return (_Mytraits::max_size(*this)); mov eax, DWORD PTR _this$[ebp] push eax call ?max_size@?$allocator_traits@V?$allocator@D@std@@@std@@SAIABV?$allocator@D@2@@Z ; std::allocator_traits<std::allocator<char> >::max_size add esp, 4 ; 931 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?max_size@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QBEIU_Nil@2@@Z ENDP ; std::_Wrap_alloc<std::allocator<char> >::max_size _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?deallocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPADI@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 __Count$ = 12 ; size = 4 ?deallocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPADI@Z PROC ; std::_Wrap_alloc<std::allocator<char> >::deallocate, COMDAT ; _this$ = ecx ; 908 : { // deallocate object at _Ptr, ignore size push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 909 : _Mybase::deallocate(_Ptr, _Count); mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx mov ecx, DWORD PTR _this$[ebp] call ?deallocate@?$allocator@D@std@@QAEXPADI@Z ; std::allocator<char>::deallocate ; 910 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ?deallocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEXPADI@Z ENDP ; std::_Wrap_alloc<std::allocator<char> >::deallocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?allocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEPADI@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Count$ = 8 ; size = 4 ?allocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEPADI@Z PROC ; std::_Wrap_alloc<std::allocator<char> >::allocate, COMDAT ; _this$ = ecx ; 897 : { // allocate array of _Count elements push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 898 : return (_Mybase::allocate(_Count)); mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ?allocate@?$allocator@D@std@@QAEPADI@Z ; std::allocator<char>::allocate ; 899 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?allocate@?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAEPADI@Z ENDP ; std::_Wrap_alloc<std::allocator<char> >::allocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??0?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAE@ABV?$allocator@D@1@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Right$ = 8 ; size = 4 ??0?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAE@ABV?$allocator@D@1@@Z PROC ; std::_Wrap_alloc<std::allocator<char> >::_Wrap_alloc<std::allocator<char> >, COMDAT ; _this$ = ecx ; 857 : { // construct by copying base push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 856 : : _Mybase(_Right) mov eax, DWORD PTR __Right$[ebp] push eax mov ecx, DWORD PTR _this$[ebp] call ??0?$allocator@D@std@@QAE@ABV01@@Z ; std::allocator<char>::allocator<char> ; 858 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ??0?$_Wrap_alloc@V?$allocator@D@std@@@std@@QAE@ABV?$allocator@D@1@@Z ENDP ; std::_Wrap_alloc<std::allocator<char> >::_Wrap_alloc<std::allocator<char> > _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?max_size@?$allocator_traits@V?$allocator@D@std@@@std@@SAIABV?$allocator@D@2@@Z _TEXT SEGMENT __Al$ = 8 ; size = 4 ?max_size@?$allocator_traits@V?$allocator@D@std@@@std@@SAIABV?$allocator@D@2@@Z PROC ; std::allocator_traits<std::allocator<char> >::max_size, COMDAT ; 784 : { // get maximum size push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 785 : return (_Al.max_size()); mov ecx, DWORD PTR __Al$[ebp] call ?max_size@?$allocator@D@std@@QBEIXZ ; std::allocator<char>::max_size ; 786 : } pop edi pop esi pop ebx add esp, 192 ; 000000c0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?max_size@?$allocator_traits@V?$allocator@D@std@@@std@@SAIABV?$allocator@D@2@@Z ENDP ; std::allocator_traits<std::allocator<char> >::max_size _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?max_size@?$allocator@D@std@@QBEIXZ _TEXT SEGMENT _this$ = -8 ; size = 4 ?max_size@?$allocator@D@std@@QBEIXZ PROC ; std::allocator<char>::max_size, COMDAT ; _this$ = ecx ; 666 : { // estimate maximum array size push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 667 : return ((size_t)(-1) / sizeof (_Ty)); or eax, -1 ; 668 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?max_size@?$allocator@D@std@@QBEIXZ ENDP ; std::allocator<char>::max_size _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?allocate@?$allocator@D@std@@QAEPADI@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Count$ = 8 ; size = 4 ?allocate@?$allocator@D@std@@QAEPADI@Z PROC ; std::allocator<char>::allocate, COMDAT ; _this$ = ecx ; 642 : { // allocate array of _Count elements push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 643 : return (static_cast<pointer>(_Allocate(_Count, sizeof (_Ty)))); push 1 push 1 mov eax, DWORD PTR __Count$[ebp] push eax call ?_Allocate@std@@YAPAXII_N@Z ; std::_Allocate add esp, 12 ; 0000000cH ; 644 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 4 ?allocate@?$allocator@D@std@@QAEPADI@Z ENDP ; std::allocator<char>::allocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?deallocate@?$allocator@D@std@@QAEXPADI@Z _TEXT SEGMENT _this$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 __Count$ = 12 ; size = 4 ?deallocate@?$allocator@D@std@@QAEXPADI@Z PROC ; std::allocator<char>::deallocate, COMDAT ; _this$ = ecx ; 637 : { // deallocate object at _Ptr push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 638 : _Deallocate(_Ptr, _Count, sizeof (_Ty)); push 1 mov eax, DWORD PTR __Count$[ebp] push eax mov ecx, DWORD PTR __Ptr$[ebp] push ecx call ?_Deallocate@std@@YAXPAXII@Z ; std::_Deallocate add esp, 12 ; 0000000cH ; 639 : } pop edi pop esi pop ebx add esp, 204 ; 000000ccH cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 8 ?deallocate@?$allocator@D@std@@QAEXPADI@Z ENDP ; std::allocator<char>::deallocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??0?$allocator@D@std@@QAE@ABV01@@Z _TEXT SEGMENT _this$ = -8 ; size = 4 ___formal$ = 8 ; size = 4 ??0?$allocator@D@std@@QAE@ABV01@@Z PROC ; std::allocator<char>::allocator<char>, COMDAT ; _this$ = ecx ; 621 : allocator(const allocator<_Ty>&) _THROW0() push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 622 : { // construct by copying (do nothing) ; 623 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx mov esp, ebp pop ebp ret 4 ??0?$allocator@D@std@@QAE@ABV01@@Z ENDP ; std::allocator<char>::allocator<char> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ??0?$allocator@D@std@@QAE@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ??0?$allocator@D@std@@QAE@XZ PROC ; std::allocator<char>::allocator<char>, COMDAT ; _this$ = ecx ; 617 : allocator() _THROW0() push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 618 : { // construct default allocator (do nothing) ; 619 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ??0?$allocator@D@std@@QAE@XZ ENDP ; std::allocator<char>::allocator<char> _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?_Deallocate@std@@YAXPAXII@Z _TEXT SEGMENT __Ptr_container$1 = -44 ; size = 4 __Ptr_ptr$2 = -32 ; size = 4 __Ptr_user$3 = -20 ; size = 4 __User_size$ = -8 ; size = 4 __Ptr$ = 8 ; size = 4 __Count$ = 12 ; size = 4 __Sz$ = 16 ; size = 4 ?_Deallocate@std@@YAXPAXII@Z PROC ; std::_Deallocate, COMDAT ; 98 : { // deallocate storage for _Count elements of size _Sz push ebp mov ebp, esp sub esp, 240 ; 000000f0H push ebx push esi push edi lea edi, DWORD PTR [ebp-240] mov ecx, 60 ; 0000003cH mov eax, -858993460 ; ccccccccH rep stosd ; 99 : #if defined(_M_IX86) || defined(_M_X64) ; 100 : _SCL_SECURE_ALWAYS_VALIDATE(_Count <= (size_t)(-1) / _Sz); or eax, -1 xor edx, edx div DWORD PTR __Sz$[ebp] cmp DWORD PTR __Count$[ebp], eax jbe SHORT $LN2@Deallocate mov eax, OFFSET ??_C@_0BN@HMCJOMKN@_Count?5?$DM?$DN?5?$CIsize_t?$CJ?$CI?91?$CJ?5?1?5_Sz?$AA@ test eax, eax je SHORT $LN10@Deallocate xor ecx, ecx jne SHORT $LN11@Deallocate $LN10@Deallocate: mov esi, esp push OFFSET ??_C@_1EI@MLOBABC@?$AA?$CC?$AA_?$AAC?$AAo?$AAu?$AAn?$AAt?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA?$CI?$AAs?$AAi?$AAz?$AAe?$AA_?$AAt?$AA?$CJ?$AA?$CI?$AA?9?$AA1?$AA?$CJ?$AA?5?$AA?1?$AA?5?$AA_?$AAS?$AAz?$AA?$CC?$AA?5?$AA?$CG@ push OFFSET ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ push 0 mov edx, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add edx, 2 push edx push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push 2 call DWORD PTR __imp___CrtDbgReportW add esp, 24 ; 00000018H cmp esi, esp call __RTC_CheckEsp cmp eax, 1 jne SHORT $LN11@Deallocate int 3 $LN11@Deallocate: mov esi, esp push 0 mov eax, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add eax, 2 push eax push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push OFFSET ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ push OFFSET ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ call DWORD PTR __imp___invalid_parameter add esp, 20 ; 00000014H cmp esi, esp call __RTC_CheckEsp $LN2@Deallocate: ; 101 : const size_t _User_size = _Count * _Sz; mov eax, DWORD PTR __Count$[ebp] imul eax, DWORD PTR __Sz$[ebp] mov DWORD PTR __User_size$[ebp], eax ; 102 : if (_BIG_ALLOCATION_THRESHOLD <= _User_size) cmp DWORD PTR __User_size$[ebp], 4096 ; 00001000H jb $LN3@Deallocate ; 103 : { // deallocate large block ; 104 : const uintptr_t _Ptr_user = reinterpret_cast<uintptr_t>(_Ptr); mov eax, DWORD PTR __Ptr$[ebp] mov DWORD PTR __Ptr_user$3[ebp], eax ; 105 : _SCL_SECURE_ALWAYS_VALIDATE( mov eax, DWORD PTR __Ptr_user$3[ebp] and eax, 31 ; 0000001fH je SHORT $LN4@Deallocate mov eax, OFFSET ??_C@_0DD@GBGGGKGG@?$CI_Ptr_user?5?$CG?5?$CI_BIG_ALLOCATION_AL@ test eax, eax je SHORT $LN12@Deallocate xor ecx, ecx jne SHORT $LN13@Deallocate $LN12@Deallocate: mov esi, esp push OFFSET ??_C@_1HE@CDMBFOKC@?$AA?$CC?$AA?$CI?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?5?$AA?$CG?$AA?5?$AA?$CI?$AA_?$AAB?$AAI?$AAG?$AA_?$AAA?$AAL?$AAL?$AAO?$AAC?$AAA?$AAT?$AAI?$AAO?$AAN?$AA_?$AAA@ push OFFSET ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ push 0 mov edx, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add edx, 8 push edx push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push 2 call DWORD PTR __imp___CrtDbgReportW add esp, 24 ; 00000018H cmp esi, esp call __RTC_CheckEsp cmp eax, 1 jne SHORT $LN13@Deallocate int 3 $LN13@Deallocate: mov esi, esp push 0 mov eax, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add eax, 8 push eax push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push OFFSET ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ push OFFSET ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ call DWORD PTR __imp___invalid_parameter add esp, 20 ; 00000014H cmp esi, esp call __RTC_CheckEsp $LN4@Deallocate: ; 106 : (_Ptr_user & (_BIG_ALLOCATION_ALIGNMENT - 1)) == 0); ; 107 : const uintptr_t _Ptr_ptr = _Ptr_user - sizeof(void *); mov eax, DWORD PTR __Ptr_user$3[ebp] sub eax, 4 mov DWORD PTR __Ptr_ptr$2[ebp], eax ; 108 : const uintptr_t _Ptr_container = ; 109 : *reinterpret_cast<uintptr_t *>(_Ptr_ptr); mov eax, DWORD PTR __Ptr_ptr$2[ebp] mov ecx, DWORD PTR [eax] mov DWORD PTR __Ptr_container$1[ebp], ecx ; 110 : ; 111 : #ifdef _DEBUG ; 112 : // If the following asserts, it likely means that we are performing ; 113 : // an aligned delete on memory coming from an unaligned allocation. ; 114 : _SCL_SECURE_ALWAYS_VALIDATE( mov eax, 4 imul ecx, eax, -1 mov edx, DWORD PTR __Ptr_ptr$2[ebp] cmp DWORD PTR [edx+ecx], -84215046 ; fafafafaH je SHORT $LN5@Deallocate mov eax, OFFSET ??_C@_0EI@NOJHEJCJ@reinterpret_cast?$DMuintptr_t?5?$CK?$DO?$CI_P@ test eax, eax je SHORT $LN14@Deallocate xor ecx, ecx jne SHORT $LN15@Deallocate $LN14@Deallocate: mov esi, esp push OFFSET ??_C@_1JO@EKLKIEHP@?$AA?$CC?$AAr?$AAe?$AAi?$AAn?$AAt?$AAe?$AAr?$AAp?$AAr?$AAe?$AAt?$AA_?$AAc?$AAa?$AAs?$AAt?$AA?$DM?$AAu?$AAi?$AAn?$AAt?$AAp?$AAt?$AAr?$AA_?$AAt?$AA?5?$AA?$CK?$AA?$DO?$AA?$CI?$AA_@ push OFFSET ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ push 0 mov edx, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add edx, 18 ; 00000012H push edx push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push 2 call DWORD PTR __imp___CrtDbgReportW add esp, 24 ; 00000018H cmp esi, esp call __RTC_CheckEsp cmp eax, 1 jne SHORT $LN15@Deallocate int 3 $LN15@Deallocate: mov esi, esp push 0 mov eax, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add eax, 18 ; 00000012H push eax push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push OFFSET ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ push OFFSET ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ call DWORD PTR __imp___invalid_parameter add esp, 20 ; 00000014H cmp esi, esp call __RTC_CheckEsp $LN5@Deallocate: ; 115 : reinterpret_cast<uintptr_t *>(_Ptr_ptr)[-1] == ; 116 : _BIG_ALLOCATION_SENTINEL); ; 117 : #endif /* _DEBUG */ ; 118 : ; 119 : // Extra paranoia on aligned allocation/deallocation ; 120 : _SCL_SECURE_ALWAYS_VALIDATE(_Ptr_container < _Ptr_user); mov eax, DWORD PTR __Ptr_container$1[ebp] cmp eax, DWORD PTR __Ptr_user$3[ebp] jb SHORT $LN6@Deallocate mov eax, OFFSET ??_C@_0BL@OCKMEJON@_Ptr_container?5?$DM?5_Ptr_user?$AA@ test eax, eax je SHORT $LN16@Deallocate xor ecx, ecx jne SHORT $LN17@Deallocate $LN16@Deallocate: mov esi, esp push OFFSET ??_C@_1EE@PDHAHDDC@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$DM?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5@ push OFFSET ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ push 0 mov edx, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add edx, 22 ; 00000016H push edx push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push 2 call DWORD PTR __imp___CrtDbgReportW add esp, 24 ; 00000018H cmp esi, esp call __RTC_CheckEsp cmp eax, 1 jne SHORT $LN17@Deallocate int 3 $LN17@Deallocate: mov esi, esp push 0 mov eax, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add eax, 22 ; 00000016H push eax push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push OFFSET ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ push OFFSET ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ call DWORD PTR __imp___invalid_parameter add esp, 20 ; 00000014H cmp esi, esp call __RTC_CheckEsp $LN6@Deallocate: ; 121 : ; 122 : #ifdef _DEBUG ; 123 : _SCL_SECURE_ALWAYS_VALIDATE(2 * sizeof(void *) mov eax, DWORD PTR __Ptr_user$3[ebp] sub eax, DWORD PTR __Ptr_container$1[ebp] cmp eax, 8 jae SHORT $LN7@Deallocate mov eax, OFFSET ??_C@_0DB@GLFJLNCE@2?5?$CK?5sizeof?$CIvoid?5?$CK?$CJ?5?$DM?$DN?5_Ptr_user?5@ test eax, eax je SHORT $LN18@Deallocate xor ecx, ecx jne SHORT $LN19@Deallocate $LN18@Deallocate: mov esi, esp push OFFSET ??_C@_1HA@NAPGMHAO@?$AA?$CC?$AA2?$AA?5?$AA?$CK?$AA?5?$AAs?$AAi?$AAz?$AAe?$AAo?$AAf?$AA?$CI?$AAv?$AAo?$AAi?$AAd?$AA?5?$AA?$CK?$AA?$CJ?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr@ push OFFSET ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ push 0 mov edx, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add edx, 26 ; 0000001aH push edx push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push 2 call DWORD PTR __imp___CrtDbgReportW add esp, 24 ; 00000018H cmp esi, esp call __RTC_CheckEsp cmp eax, 1 jne SHORT $LN19@Deallocate int 3 $LN19@Deallocate: mov esi, esp push 0 mov eax, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add eax, 26 ; 0000001aH push eax push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push OFFSET ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ push OFFSET ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ call DWORD PTR __imp___invalid_parameter add esp, 20 ; 00000014H cmp esi, esp call __RTC_CheckEsp $LN7@Deallocate: ; 124 : <= _Ptr_user - _Ptr_container); ; 125 : ; 126 : #else /* _DEBUG */ ; 127 : _SCL_SECURE_ALWAYS_VALIDATE(sizeof(void *) ; 128 : <= _Ptr_user - _Ptr_container); ; 129 : #endif /* _DEBUG */ ; 130 : ; 131 : _SCL_SECURE_ALWAYS_VALIDATE(_Ptr_user - _Ptr_container mov eax, DWORD PTR __Ptr_user$3[ebp] sub eax, DWORD PTR __Ptr_container$1[ebp] cmp eax, 39 ; 00000027H jbe SHORT $LN8@Deallocate mov eax, OFFSET ??_C@_0CN@BLHJCAL@_Ptr_user?5?9?5_Ptr_container?5?$DM?$DN?5_N@ test eax, eax je SHORT $LN20@Deallocate xor ecx, ecx jne SHORT $LN21@Deallocate $LN20@Deallocate: mov esi, esp push OFFSET ??_C@_1GI@DHJGPFNI@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAu?$AAs?$AAe?$AAr?$AA?5?$AA?9?$AA?5?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$DM?$AA?$DN?$AA?5?$AA_@ push OFFSET ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ push 0 mov edx, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add edx, 34 ; 00000022H push edx push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push 2 call DWORD PTR __imp___CrtDbgReportW add esp, 24 ; 00000018H cmp esi, esp call __RTC_CheckEsp cmp eax, 1 jne SHORT $LN21@Deallocate int 3 $LN21@Deallocate: mov esi, esp push 0 mov eax, DWORD PTR ?__LINE__Var@?0??_Deallocate@std@@YAXPAXII@Z@4JA add eax, 34 ; 00000022H push eax push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push OFFSET ??_C@_1CC@LOFJFFDB@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAD?$AAe?$AAa?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ push OFFSET ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ call DWORD PTR __imp___invalid_parameter add esp, 20 ; 00000014H cmp esi, esp call __RTC_CheckEsp $LN8@Deallocate: ; 132 : <= _NON_USER_SIZE); ; 133 : ; 134 : _Ptr = reinterpret_cast<void *>(_Ptr_container); mov eax, DWORD PTR __Ptr_container$1[ebp] mov DWORD PTR __Ptr$[ebp], eax $LN3@Deallocate: ; 135 : } ; 136 : #endif /* defined(_M_IX86) || defined(_M_X64) */ ; 137 : ; 138 : ::operator delete(_Ptr); mov eax, DWORD PTR __Ptr$[ebp] push eax call ??3@YAXPAX@Z ; operator delete add esp, 4 ; 139 : } pop edi pop esi pop ebx add esp, 240 ; 000000f0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Deallocate@std@@YAXPAXII@Z ENDP ; std::_Deallocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xmemory0 ; COMDAT ?_Allocate@std@@YAPAXII_N@Z _TEXT SEGMENT __Ptr_container$1 = -44 ; size = 4 __Block_size$2 = -32 ; size = 4 __User_size$ = -20 ; size = 4 __Ptr$ = -8 ; size = 4 __Count$ = 8 ; size = 4 __Sz$ = 12 ; size = 4 __Try_aligned_allocation$ = 16 ; size = 1 ?_Allocate@std@@YAPAXII_N@Z PROC ; std::_Allocate, COMDAT ; 54 : { // allocate storage for _Count elements of size _Sz push ebp mov ebp, esp sub esp, 240 ; 000000f0H push ebx push esi push edi lea edi, DWORD PTR [ebp-240] mov ecx, 60 ; 0000003cH mov eax, -858993460 ; ccccccccH rep stosd ; 55 : void *_Ptr = 0; mov DWORD PTR __Ptr$[ebp], 0 ; 56 : ; 57 : if (_Count == 0) cmp DWORD PTR __Count$[ebp], 0 jne SHORT $LN2@Allocate ; 58 : return (_Ptr); mov eax, DWORD PTR __Ptr$[ebp] jmp $LN9@Allocate $LN2@Allocate: ; 59 : ; 60 : // check overflow of multiply ; 61 : if ((size_t)(-1) / _Sz < _Count) or eax, -1 xor edx, edx div DWORD PTR __Sz$[ebp] cmp eax, DWORD PTR __Count$[ebp] jae SHORT $LN3@Allocate ; 62 : _Xbad_alloc(); // report no memory mov esi, esp call DWORD PTR __imp_?_Xbad_alloc@std@@YAXXZ cmp esi, esp call __RTC_CheckEsp $LN3@Allocate: ; 63 : const size_t _User_size = _Count * _Sz; mov eax, DWORD PTR __Count$[ebp] imul eax, DWORD PTR __Sz$[ebp] mov DWORD PTR __User_size$[ebp], eax ; 64 : ; 65 : #if defined(_M_IX86) || defined(_M_X64) ; 66 : if (_Try_aligned_allocation ; 67 : && _BIG_ALLOCATION_THRESHOLD <= _User_size) movzx eax, BYTE PTR __Try_aligned_allocation$[ebp] test eax, eax je $LN4@Allocate cmp DWORD PTR __User_size$[ebp], 4096 ; 00001000H jb $LN4@Allocate ; 68 : { // allocate large block ; 69 : static_assert(sizeof (void *) < _BIG_ALLOCATION_ALIGNMENT, ; 70 : "Big allocations should at least match vector register size"); ; 71 : const size_t _Block_size = _NON_USER_SIZE + _User_size; mov eax, DWORD PTR __User_size$[ebp] add eax, 39 ; 00000027H mov DWORD PTR __Block_size$2[ebp], eax ; 72 : if (_Block_size <= _User_size) mov eax, DWORD PTR __Block_size$2[ebp] cmp eax, DWORD PTR __User_size$[ebp] ja SHORT $LN6@Allocate ; 73 : _Xbad_alloc(); // report no memory mov esi, esp call DWORD PTR __imp_?_Xbad_alloc@std@@YAXXZ cmp esi, esp call __RTC_CheckEsp $LN6@Allocate: ; 74 : const uintptr_t _Ptr_container = ; 75 : reinterpret_cast<uintptr_t>(::operator new(_Block_size)); mov eax, DWORD PTR __Block_size$2[ebp] push eax call ??2@YAPAXI@Z ; operator new add esp, 4 mov DWORD PTR __Ptr_container$1[ebp], eax ; 76 : _SCL_SECURE_ALWAYS_VALIDATE(_Ptr_container != 0); cmp DWORD PTR __Ptr_container$1[ebp], 0 jne SHORT $LN7@Allocate mov eax, OFFSET ??_C@_0BE@LMNLACIC@_Ptr_container?5?$CB?$DN?50?$AA@ test eax, eax je SHORT $LN10@Allocate xor ecx, ecx jne SHORT $LN11@Allocate $LN10@Allocate: mov esi, esp push OFFSET ??_C@_1DG@HGDKEBPG@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA_?$AAc?$AAo?$AAn?$AAt?$AAa?$AAi?$AAn?$AAe?$AAr?$AA?5?$AA?$CB?$AA?$DN?$AA?5?$AA0?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5?$AA0?$AA?$AA@ push OFFSET ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ push 0 mov edx, DWORD PTR ?__LINE__Var@?0??_Allocate@std@@YAPAXII_N@Z@4JA add edx, 22 ; 00000016H push edx push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push 2 call DWORD PTR __imp___CrtDbgReportW add esp, 24 ; 00000018H cmp esi, esp call __RTC_CheckEsp cmp eax, 1 jne SHORT $LN11@Allocate int 3 $LN11@Allocate: mov esi, esp push 0 mov eax, DWORD PTR ?__LINE__Var@?0??_Allocate@std@@YAPAXII_N@Z@4JA add eax, 22 ; 00000016H push eax push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push OFFSET ??_C@_1BO@NKFMJPA@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAA?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ push OFFSET ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ call DWORD PTR __imp___invalid_parameter add esp, 20 ; 00000014H cmp esi, esp call __RTC_CheckEsp $LN7@Allocate: ; 77 : _Ptr = reinterpret_cast<void *>((_Ptr_container + _NON_USER_SIZE) mov eax, DWORD PTR __Ptr_container$1[ebp] add eax, 39 ; 00000027H and eax, -32 ; ffffffe0H mov DWORD PTR __Ptr$[ebp], eax ; 78 : & ~(_BIG_ALLOCATION_ALIGNMENT - 1)); ; 79 : static_cast<uintptr_t *>(_Ptr)[-1] = _Ptr_container; mov eax, 4 imul ecx, eax, -1 mov edx, DWORD PTR __Ptr$[ebp] mov eax, DWORD PTR __Ptr_container$1[ebp] mov DWORD PTR [edx+ecx], eax ; 80 : ; 81 : #ifdef _DEBUG ; 82 : static_cast<uintptr_t *>(_Ptr)[-2] = _BIG_ALLOCATION_SENTINEL; mov eax, 4 imul ecx, eax, -2 mov edx, DWORD PTR __Ptr$[ebp] mov DWORD PTR [edx+ecx], -84215046 ; fafafafaH ; 83 : #endif /* _DEBUG */ ; 84 : } ; 85 : else jmp $LN5@Allocate $LN4@Allocate: ; 86 : #endif /* defined(_M_IX86) || defined(_M_X64) */ ; 87 : ; 88 : { // allocate normal block ; 89 : _Ptr = ::operator new(_User_size); mov eax, DWORD PTR __User_size$[ebp] push eax call ??2@YAPAXI@Z ; operator new add esp, 4 mov DWORD PTR __Ptr$[ebp], eax ; 90 : _SCL_SECURE_ALWAYS_VALIDATE(_Ptr != 0); cmp DWORD PTR __Ptr$[ebp], 0 jne SHORT $LN5@Allocate mov eax, OFFSET ??_C@_09GLJCAGLP@_Ptr?5?$CB?$DN?50?$AA@ test eax, eax je SHORT $LN12@Allocate xor ecx, ecx jne SHORT $LN13@Allocate $LN12@Allocate: mov esi, esp push OFFSET ??_C@_1CC@GKJLLHIM@?$AA?$CC?$AA_?$AAP?$AAt?$AAr?$AA?5?$AA?$CB?$AA?$DN?$AA?5?$AA0?$AA?$CC?$AA?5?$AA?$CG?$AA?$CG?$AA?5?$AA0?$AA?$AA@ push OFFSET ??_C@_17CNPHIMPH@?$AA?$CF?$AAl?$AAs?$AA?$AA@ push 0 mov edx, DWORD PTR ?__LINE__Var@?0??_Allocate@std@@YAPAXII_N@Z@4JA add edx, 36 ; 00000024H push edx push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push 2 call DWORD PTR __imp___CrtDbgReportW add esp, 24 ; 00000018H cmp esi, esp call __RTC_CheckEsp cmp eax, 1 jne SHORT $LN13@Allocate int 3 $LN13@Allocate: mov esi, esp push 0 mov eax, DWORD PTR ?__LINE__Var@?0??_Allocate@std@@YAPAXII_N@Z@4JA add eax, 36 ; 00000024H push eax push OFFSET ??_C@_1EG@DJALBHDK@?$AAd?$AA?3?$AA?2?$AAa?$AAp?$AAp?$AAd?$AAa?$AAt?$AAa?$AA?2?$AAv?$AAs?$AAp?$AA?2?$AAv?$AAc?$AA?2?$AAi?$AAn?$AAc?$AAl?$AAu?$AAd?$AAe?$AA?2?$AAx?$AAm?$AAe?$AAm?$AAo?$AAr@ push OFFSET ??_C@_1BO@NKFMJPA@?$AAs?$AAt?$AAd?$AA?3?$AA?3?$AA_?$AAA?$AAl?$AAl?$AAo?$AAc?$AAa?$AAt?$AAe?$AA?$AA@ push OFFSET ??_C@_1CG@JNLFBNGN@?$AA?$CC?$AAi?$AAn?$AAv?$AAa?$AAl?$AAi?$AAd?$AA?5?$AAa?$AAr?$AAg?$AAu?$AAm?$AAe?$AAn?$AAt?$AA?$CC?$AA?$AA@ call DWORD PTR __imp___invalid_parameter add esp, 20 ; 00000014H cmp esi, esp call __RTC_CheckEsp $LN5@Allocate: ; 91 : } ; 92 : return (_Ptr); mov eax, DWORD PTR __Ptr$[ebp] $LN9@Allocate: ; 93 : } pop edi pop esi pop ebx add esp, 240 ; 000000f0H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?_Allocate@std@@YAPAXII_N@Z ENDP ; std::_Allocate _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ?_Orphan_all@_Container_base12@std@@QAEXXZ _TEXT SEGMENT __Pnext$1 = -36 ; size = 4 __Lock$2 = -24 ; size = 4 _this$ = -12 ; size = 4 __$ArrayPad$ = -4 ; size = 4 ?_Orphan_all@_Container_base12@std@@QAEXXZ PROC ; std::_Container_base12::_Orphan_all, COMDAT ; _this$ = ecx ; 214 : { // orphan all iterators push ebp mov ebp, esp sub esp, 232 ; 000000e8H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-232] mov ecx, 58 ; 0000003aH mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov eax, DWORD PTR ___security_cookie xor eax, ebp mov DWORD PTR __$ArrayPad$[ebp], eax mov DWORD PTR _this$[ebp], ecx ; 215 : #if _ITERATOR_DEBUG_LEVEL == 2 ; 216 : if (_Myproxy != 0) mov eax, DWORD PTR _this$[ebp] cmp DWORD PTR [eax], 0 je SHORT $LN1@Orphan_all ; 217 : { // proxy allocated, drain it ; 218 : _Lockit _Lock(_LOCK_DEBUG); mov esi, esp push 3 lea ecx, DWORD PTR __Lock$2[ebp] call DWORD PTR __imp_??0_Lockit@std@@QAE@H@Z cmp esi, esp call __RTC_CheckEsp ; 219 : ; 220 : for (_Iterator_base12 **_Pnext = &_Myproxy->_Myfirstiter; mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR [eax] add ecx, 4 mov DWORD PTR __Pnext$1[ebp], ecx jmp SHORT $LN4@Orphan_all $LN2@Orphan_all: ; 221 : *_Pnext != 0; *_Pnext = (*_Pnext)->_Mynextiter) mov eax, DWORD PTR __Pnext$1[ebp] mov ecx, DWORD PTR [eax] mov edx, DWORD PTR __Pnext$1[ebp] mov eax, DWORD PTR [ecx+4] mov DWORD PTR [edx], eax $LN4@Orphan_all: mov eax, DWORD PTR __Pnext$1[ebp] cmp DWORD PTR [eax], 0 je SHORT $LN3@Orphan_all ; 222 : (*_Pnext)->_Myproxy = 0; mov eax, DWORD PTR __Pnext$1[ebp] mov ecx, DWORD PTR [eax] mov DWORD PTR [ecx], 0 jmp SHORT $LN2@Orphan_all $LN3@Orphan_all: ; 223 : _Myproxy->_Myfirstiter = 0; mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR [eax] mov DWORD PTR [ecx+4], 0 ; 224 : } mov esi, esp lea ecx, DWORD PTR __Lock$2[ebp] call DWORD PTR __imp_??1_Lockit@std@@QAE@XZ cmp esi, esp call __RTC_CheckEsp $LN1@Orphan_all: ; 225 : #endif /* _ITERATOR_DEBUG_LEVEL == 2 */ ; 226 : } push edx mov ecx, ebp push eax lea edx, DWORD PTR $LN10@Orphan_all call @_RTC_CheckStackVars@8 pop eax pop edx pop edi pop esi pop ebx mov ecx, DWORD PTR __$ArrayPad$[ebp] xor ecx, ebp call @__security_check_cookie@4 add esp, 232 ; 000000e8H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 npad 3 $LN10@Orphan_all: DD 1 DD $LN9@Orphan_all $LN9@Orphan_all: DD -24 ; ffffffe8H DD 4 DD $LN8@Orphan_all $LN8@Orphan_all: DB 95 ; 0000005fH DB 76 ; 0000004cH DB 111 ; 0000006fH DB 99 ; 00000063H DB 107 ; 0000006bH DB 0 ?_Orphan_all@_Container_base12@std@@QAEXXZ ENDP ; std::_Container_base12::_Orphan_all _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ??1_Container_base12@std@@QAE@XZ _TEXT SEGMENT _this$ = -20 ; size = 4 __$EHRec$ = -12 ; size = 12 ??1_Container_base12@std@@QAE@XZ PROC ; std::_Container_base12::~_Container_base12, COMDAT ; _this$ = ecx ; 94 : { // destroy the container push ebp mov ebp, esp push -1 push __ehhandler$??1_Container_base12@std@@QAE@XZ mov eax, DWORD PTR fs:0 push eax sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-216] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov eax, DWORD PTR ___security_cookie xor eax, ebp push eax lea eax, DWORD PTR __$EHRec$[ebp] mov DWORD PTR fs:0, eax mov DWORD PTR _this$[ebp], ecx ; 95 : _Orphan_all(); mov ecx, DWORD PTR _this$[ebp] call ?_Orphan_all@_Container_base12@std@@QAEXXZ ; std::_Container_base12::_Orphan_all ; 96 : } mov ecx, DWORD PTR __$EHRec$[ebp] mov DWORD PTR fs:0, ecx pop ecx pop edi pop esi pop ebx add esp, 216 ; 000000d8H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 _TEXT ENDS ; COMDAT text$x text$x SEGMENT __ehhandler$??1_Container_base12@std@@QAE@XZ: mov edx, DWORD PTR [esp+8] lea eax, DWORD PTR [edx+12] mov ecx, DWORD PTR [edx-220] xor ecx, eax call @__security_check_cookie@4 mov eax, OFFSET __ehfuncinfo$??1_Container_base12@std@@QAE@XZ jmp ___CxxFrameHandler3 text$x ENDS ??1_Container_base12@std@@QAE@XZ ENDP ; std::_Container_base12::~_Container_base12 ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ??0_Container_base12@std@@QAE@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ??0_Container_base12@std@@QAE@XZ PROC ; std::_Container_base12::_Container_base12, COMDAT ; _this$ = ecx ; 80 : { // construct childless container push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 79 : : _Myproxy(0) mov eax, DWORD PTR _this$[ebp] mov DWORD PTR [eax], 0 ; 81 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ??0_Container_base12@std@@QAE@XZ ENDP ; std::_Container_base12::_Container_base12 _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\xutility ; COMDAT ??0_Container_proxy@std@@QAE@XZ _TEXT SEGMENT _this$ = -8 ; size = 4 ??0_Container_proxy@std@@QAE@XZ PROC ; std::_Container_proxy::_Container_proxy, COMDAT ; _this$ = ecx ; 68 : { // construct from pointers push ebp mov ebp, esp sub esp, 204 ; 000000ccH push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-204] mov ecx, 51 ; 00000033H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 67 : : _Mycont(0), _Myfirstiter(0) mov eax, DWORD PTR _this$[ebp] mov DWORD PTR [eax], 0 mov eax, DWORD PTR _this$[ebp] mov DWORD PTR [eax+4], 0 ; 69 : } mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ??0_Container_proxy@std@@QAE@XZ ENDP ; std::_Container_proxy::_Container_proxy _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\iosfwd ; COMDAT ?assign@?$char_traits@D@std@@SAXAADABD@Z _TEXT SEGMENT __Left$ = 8 ; size = 4 __Right$ = 12 ; size = 4 ?assign@?$char_traits@D@std@@SAXAADABD@Z PROC ; std::char_traits<char>::assign, COMDAT ; 564 : { // assign an element push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 565 : _Left = _Right; mov eax, DWORD PTR __Left$[ebp] mov ecx, DWORD PTR __Right$[ebp] mov dl, BYTE PTR [ecx] mov BYTE PTR [eax], dl ; 566 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?assign@?$char_traits@D@std@@SAXAADABD@Z ENDP ; std::char_traits<char>::assign _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\iosfwd ; COMDAT ?move@?$char_traits@D@std@@SAPADPADPBDI@Z _TEXT SEGMENT tv69 = -196 ; size = 4 __First1$ = 8 ; size = 4 __First2$ = 12 ; size = 4 __Count$ = 16 ; size = 4 ?move@?$char_traits@D@std@@SAPADPADPBDI@Z PROC ; std::char_traits<char>::move, COMDAT ; 552 : { // copy [_First2, _First2 + _Count) to [_First1, ...) push ebp mov ebp, esp sub esp, 196 ; 000000c4H push ebx push esi push edi lea edi, DWORD PTR [ebp-196] mov ecx, 49 ; 00000031H mov eax, -858993460 ; ccccccccH rep stosd ; 553 : return (_Count == 0 ? _First1 cmp DWORD PTR __Count$[ebp], 0 jne SHORT $LN3@move mov eax, DWORD PTR __First1$[ebp] mov DWORD PTR tv69[ebp], eax jmp SHORT $LN4@move $LN3@move: mov esi, esp mov ecx, DWORD PTR __Count$[ebp] push ecx mov edx, DWORD PTR __First2$[ebp] push edx mov eax, DWORD PTR __First1$[ebp] push eax call DWORD PTR __imp__memmove add esp, 12 ; 0000000cH cmp esi, esp call __RTC_CheckEsp mov DWORD PTR tv69[ebp], eax $LN4@move: mov eax, DWORD PTR tv69[ebp] ; 554 : : (_Elem *)_CSTD memmove(_First1, _First2, _Count)); ; 555 : } pop edi pop esi pop ebx add esp, 196 ; 000000c4H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?move@?$char_traits@D@std@@SAPADPADPBDI@Z ENDP ; std::char_traits<char>::move _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\iosfwd ; COMDAT ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z _TEXT SEGMENT tv69 = -196 ; size = 4 __First1$ = 8 ; size = 4 __First2$ = 12 ; size = 4 __Count$ = 16 ; size = 4 ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z PROC ; std::char_traits<char>::copy, COMDAT ; 529 : { // copy [_First2, _First2 + _Count) to [_First1, ...) push ebp mov ebp, esp sub esp, 196 ; 000000c4H push ebx push esi push edi lea edi, DWORD PTR [ebp-196] mov ecx, 49 ; 00000031H mov eax, -858993460 ; ccccccccH rep stosd ; 530 : return (_Count == 0 ? _First1 cmp DWORD PTR __Count$[ebp], 0 jne SHORT $LN3@copy mov eax, DWORD PTR __First1$[ebp] mov DWORD PTR tv69[ebp], eax jmp SHORT $LN4@copy $LN3@copy: mov ecx, DWORD PTR __Count$[ebp] push ecx mov edx, DWORD PTR __First2$[ebp] push edx mov eax, DWORD PTR __First1$[ebp] push eax call _memcpy add esp, 12 ; 0000000cH mov DWORD PTR tv69[ebp], eax $LN4@copy: mov eax, DWORD PTR tv69[ebp] ; 531 : : (_Elem *)_CSTD memcpy(_First1, _First2, _Count)); ; 532 : } pop edi pop esi pop ebx add esp, 196 ; 000000c4H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?copy@?$char_traits@D@std@@SAPADPADPBDI@Z ENDP ; std::char_traits<char>::copy _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\iosfwd ; COMDAT ?length@?$char_traits@D@std@@SAIPBD@Z _TEXT SEGMENT tv68 = -196 ; size = 4 __First$ = 8 ; size = 4 ?length@?$char_traits@D@std@@SAIPBD@Z PROC ; std::char_traits<char>::length, COMDAT ; 522 : { // find length of null-terminated string push ebp mov ebp, esp sub esp, 196 ; 000000c4H push ebx push esi push edi lea edi, DWORD PTR [ebp-196] mov ecx, 49 ; 00000031H mov eax, -858993460 ; ccccccccH rep stosd ; 523 : return (*_First == 0 ? 0 mov eax, DWORD PTR __First$[ebp] movsx ecx, BYTE PTR [eax] test ecx, ecx jne SHORT $LN3@length mov DWORD PTR tv68[ebp], 0 jmp SHORT $LN4@length $LN3@length: mov edx, DWORD PTR __First$[ebp] push edx call _strlen add esp, 4 mov DWORD PTR tv68[ebp], eax $LN4@length: mov eax, DWORD PTR tv68[ebp] ; 524 : : _CSTD strlen(_First)); ; 525 : } pop edi pop esi pop ebx add esp, 196 ; 000000c4H cmp ebp, esp call __RTC_CheckEsp mov esp, ebp pop ebp ret 0 ?length@?$char_traits@D@std@@SAIPBD@Z ENDP ; std::char_traits<char>::length _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\appdata\vsp\vc\include\vcruntime_new.h ; COMDAT ??2@YAPAXIPAX@Z _TEXT SEGMENT __Size$ = 8 ; size = 4 __Where$ = 12 ; size = 4 ??2@YAPAXIPAX@Z PROC ; operator new, COMDAT ; 87 : { push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd ; 88 : (void)_Size; ; 89 : return _Where; mov eax, DWORD PTR __Where$[ebp] ; 90 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ??2@YAPAXIPAX@Z ENDP ; operator new _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ?__empty_global_delete@@YAXPAXI@Z _TEXT SEGMENT ___formal$ = 8 ; size = 4 ___formal$ = 12 ; size = 4 ?__empty_global_delete@@YAXPAXI@Z PROC ; __empty_global_delete, COMDAT push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?__empty_global_delete@@YAXPAXI@Z ENDP ; __empty_global_delete _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File d:\scottsdocs\sourcecode\openglboxes\code\glfwwrapper.cpp ; COMDAT ?__empty_global_delete@@YAXPAX@Z _TEXT SEGMENT ___formal$ = 8 ; size = 4 ?__empty_global_delete@@YAXPAX@Z PROC ; __empty_global_delete, COMDAT push ebp mov ebp, esp sub esp, 192 ; 000000c0H push ebx push esi push edi lea edi, DWORD PTR [ebp-192] mov ecx, 48 ; 00000030H mov eax, -858993460 ; ccccccccH rep stosd pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?__empty_global_delete@@YAXPAX@Z ENDP ; __empty_global_delete _TEXT ENDS END
_ProcEhPrepare: sub rsp, 0x1f8 vmovdqa [rsp+0x180], xmm6 vmovdqa [rsp+0x190], xmm7 vmovdqa [rsp+0x1a0], xmm8 vmovdqa [rsp+0x1b0], xmm9 vmovdqa [rsp+0x1c0], xmm10 vmovdqa [rsp+0x1d0], xmm11 vmovdqa xmm10, xword [xshufb_ror24] vmovdqa xmm11, xword [xshufb_ror16] vmovdqa xmm0, xword [s0] vmovdqa xmm1, xword [s2] vmovdqa xmm2, xword [s4] vmovdqa xmm3, xword [s6] vmovdqa xmm4, xword [iv] vmovdqa xmm5, xword [iv+0x10] vmovdqa xmm6, xword [iv4xor128] vmovdqa xmm7, xword [iv4xor128+0x10] mov r8, rsp mov r9d, blake2sigma call _ProcBlakeMsgSched call _ProcBlakeRound add r8, 0x80 add r9, 16 call _ProcBlakeMsgSched call _ProcBlakeRound add r8, 0x80 add r9, 16 _LoopEhPrepare1: call _ProcBlakeMsgSched call _ProcBlakeRound add r9, 16 cmp r9, blake2sigma+160 jb _LoopEhPrepare1 mov r8, rsp call _ProcBlakeRound add r8, 0x80 call _ProcBlakeRound vpxor xmm0, xmm0, xmm4 vpxor xmm1, xmm1, xmm5 vpxor xmm2, xmm2, xmm6 vpxor xmm3, xmm3, xmm7 vpxor xmm0, xmm0, xword [s0] vpxor xmm1, xmm1, xword [s2] vpxor xmm2, xmm2, xword [s4] vpxor xmm3, xmm3, xword [s6] vmovdqa xword [rcx+EH.mids+0x80], xmm0 vmovdqa xword [rcx+EH.mids+0x90], xmm1 vmovdqa xword [rcx+EH.mids+0xa0], xmm2 vmovdqa xword [rcx+EH.mids+0xb0], xmm3 vmovq xmm8, [rdx+0x80] vpshufd xmm4, xmm8, 0x44 vmovdqa xword [rcx+EH.mids+0xc0], xmm4 ;Begin second message block vmovdqa xmm4, xword [iv] vmovdqa xmm5, xword [iv+0x10] vmovdqa xmm6, xword [iv4xor144] vmovdqa xmm7, xword [iv6inverted] vpaddq xmm0, xmm0, xmm2 vpaddq xmm1, xmm1, xmm3 vpaddq xmm0, xmm0, xmm8 ;xmm8[63:0]=message vpxor xmm6, xmm6, xmm0 vpxor xmm7, xmm7, xmm1 vpshufd xmm6, xmm6, 0xb1 vmovq [rcx+EH.mids+0x08], xmm6 ;v12 vpshufd xmm7, xmm7, 0xb1 vpaddq xmm4, xmm4, xmm6 vmovq [rcx+EH.mids+0x10], xmm4 ;v8 vpaddq xmm5, xmm5, xmm7 vpxor xmm2, xmm2, xmm4 vpxor xmm3, xmm3, xmm5 vpshufb xmm2, xmm2, xmm10 vmovq [rcx+EH.mids+0x18], xmm2 ;v4 vpshufb xmm3, xmm3, xmm10 vpaddq xmm0, xmm0, xmm2 vmovq [rcx+EH.mids], xmm0 ;v0 vpaddq xmm1, xmm1, xmm3 vpextrq [rcx+EH.mids+0x60], xmm1, 1 ;v3 ;add message (nonce, index) to xmm0 here, but we don't have vpxor xmm6, xmm6, xmm0 vpxor xmm7, xmm7, xmm1 vpshufb xmm6, xmm6, xmm11 vpshufb xmm7, xmm7, xmm11 vmovdqa xword [rcx+EH.mids+0x40], xmm7 ;v14,15 vpaddq xmm4, xmm4, xmm6 vpextrq [rcx+EH.mids+0x70], xmm4, 1 ;v9 vpaddq xmm5, xmm5, xmm7 vmovdqa xword [rcx+EH.mids+0x50], xmm5 ;v10,11 vpxor xmm2, xmm2, xmm4 vpxor xmm3, xmm3, xmm5 vpaddq xmm8, xmm2, xmm2 vpsrlq xmm2, xmm2, 63 vpor xmm8, xmm2, xmm8 ;xmm8 takes xmm2 vpaddq xmm2, xmm3, xmm3 ;xmm2 is temp vpsrlq xmm3, xmm3, 63 vpor xmm3, xmm3, xmm2 vpalignr xmm2, xmm3, xmm8, 8 ;xmm2 resume vmovdqa xword [rcx+EH.mids+0x20], xmm2 ;v5,6 vpsrldq xmm3, xmm3, 8 vmovq [rcx+EH.mids+0x68], xmm3 ;v7 vpsrldq xmm7, xmm6, 8 vpaddq xmm0, xmm0, xmm2 vpextrq [rcx+EH.mids+0x30], xmm0, 1 ;v1 vpaddq xmm1, xmm1, xmm3 vmovq [rcx+EH.mids+0x78], xmm1 ;v2 vpxor xmm7, xmm7, xmm1 vpshufd xmm7, xmm7, 0xb1 vmovq [rcx+EH.mids+0x38], xmm7 ;v13 vmovdqa xmm6, [rsp+0x180] vmovdqa xmm7, [rsp+0x190] vmovdqa xmm8, [rsp+0x1a0] vmovdqa xmm9, [rsp+0x1b0] vmovdqa xmm10, [rsp+0x1c0] vmovdqa xmm11, [rsp+0x1d0] add rsp, 0x1f8 ret align 16 _ProcBlakeMsgSched: ;rdx=src ;r8=dst ;r9=sigma table xor r10d, r10d _LoopBlakeMsgSched: movzx eax, byte [r9+r10] mov rax, [rdx+rax*8] mov [r8+r10*8], rax add r10d, 1 cmp r10d, 16 jb _LoopBlakeMsgSched ret align 16 _ProcBlakeRound: vpaddq xmm0, xmm0, xmm2 vpaddq xmm1, xmm1, xmm3 vpaddq xmm0, xmm0, [r8] vpaddq xmm1, xmm1, [r8+0x10] vpxor xmm6, xmm6, xmm0 vpxor xmm7, xmm7, xmm1 vpshufd xmm6, xmm6, 0xb1 vpshufd xmm7, xmm7, 0xb1 vpaddq xmm4, xmm4, xmm6 vpaddq xmm5, xmm5, xmm7 vpxor xmm2, xmm2, xmm4 vpxor xmm3, xmm3, xmm5 vpshufb xmm2, xmm2, xmm10 vpshufb xmm3, xmm3, xmm10 vpaddq xmm0, xmm0, xmm2 vpaddq xmm1, xmm1, xmm3 vpaddq xmm0, xmm0, [r8+0x20] vpaddq xmm1, xmm1, [r8+0x30] vpxor xmm6, xmm6, xmm0 vpxor xmm7, xmm7, xmm1 vpshufb xmm9, xmm6, xmm11 ;xmm9 takes xmm6 vpshufb xmm7, xmm7, xmm11 vpaddq xmm4, xmm4, xmm9 vpaddq xmm5, xmm5, xmm7 vpxor xmm2, xmm2, xmm4 vpxor xmm3, xmm3, xmm5 vpaddq xmm8, xmm2, xmm2 vpsrlq xmm2, xmm2, 63 vpor xmm8, xmm2, xmm8 ;xmm8 takes xmm2 vpaddq xmm2, xmm3, xmm3 ;xmm2 is temp vpsrlq xmm3, xmm3, 63 vpor xmm3, xmm3, xmm2 vpalignr xmm2, xmm3, xmm8, 8 ;xmm2 resume vpalignr xmm3, xmm8, xmm3, 8 vpalignr xmm6, xmm9, xmm7, 8 ;xmm6 resume vpalignr xmm7, xmm7, xmm9, 8 vpaddq xmm0, xmm0, xmm2 vpaddq xmm1, xmm1, xmm3 vpaddq xmm0, xmm0, [r8+0x40] vpaddq xmm1, xmm1, [r8+0x50] vpxor xmm6, xmm6, xmm0 vpxor xmm7, xmm7, xmm1 vpshufd xmm6, xmm6, 0xb1 vpshufd xmm7, xmm7, 0xb1 vpaddq xmm5, xmm5, xmm6 vpaddq xmm4, xmm4, xmm7 vpxor xmm2, xmm2, xmm5 vpxor xmm3, xmm3, xmm4 vpshufb xmm2, xmm2, xmm10 vpshufb xmm3, xmm3, xmm10 vpaddq xmm0, xmm0, xmm2 vpaddq xmm1, xmm1, xmm3 vpaddq xmm0, xmm0, [r8+0x60] vpaddq xmm1, xmm1, [r8+0x70] vpxor xmm6, xmm6, xmm0 vpxor xmm7, xmm7, xmm1 vpshufb xmm9, xmm6, xmm11 ;xmm9 takes xmm6 vpshufb xmm7, xmm7, xmm11 vpaddq xmm5, xmm5, xmm9 vpaddq xmm4, xmm4, xmm7 vpxor xmm2, xmm2, xmm5 vpxor xmm3, xmm3, xmm4 vpaddq xmm8, xmm2, xmm2 vpsrlq xmm2, xmm2, 63 vpor xmm8, xmm2, xmm8 ;xmm8 takes xmm2 vpaddq xmm2, xmm3, xmm3 ;xmm2 is temp vpsrlq xmm3, xmm3, 63 vpor xmm3, xmm3, xmm2 vpalignr xmm2, xmm8, xmm3, 8 ;xmm2 resume vpalignr xmm3, xmm3, xmm8, 8 vpalignr xmm6, xmm7, xmm9, 8 ;xmm6 resume vpalignr xmm7, xmm9, xmm7, 8 ret
_ls: file format elf32-i386 Disassembly of section .text: 00000000 <main>: close(fd); } int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 56 push %esi e: 53 push %ebx f: 51 push %ecx 10: 83 ec 0c sub $0xc,%esp 13: 8b 01 mov (%ecx),%eax 15: 8b 51 04 mov 0x4(%ecx),%edx int i; if(argc < 2){ 18: 83 f8 01 cmp $0x1,%eax 1b: 7e 24 jle 41 <main+0x41> 1d: 8d 5a 04 lea 0x4(%edx),%ebx 20: 8d 34 82 lea (%edx,%eax,4),%esi 23: 90 nop 24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ls("."); exit(); } for(i=1; i<argc; i++) ls(argv[i]); 28: 83 ec 0c sub $0xc,%esp 2b: ff 33 pushl (%ebx) 2d: 83 c3 04 add $0x4,%ebx 30: e8 cb 00 00 00 call 100 <ls> for(i=1; i<argc; i++) 35: 83 c4 10 add $0x10,%esp 38: 39 f3 cmp %esi,%ebx 3a: 75 ec jne 28 <main+0x28> exit(); 3c: e8 41 05 00 00 call 582 <exit> ls("."); 41: 83 ec 0c sub $0xc,%esp 44: 68 80 0a 00 00 push $0xa80 49: e8 b2 00 00 00 call 100 <ls> exit(); 4e: e8 2f 05 00 00 call 582 <exit> 53: 66 90 xchg %ax,%ax 55: 66 90 xchg %ax,%ax 57: 66 90 xchg %ax,%ax 59: 66 90 xchg %ax,%ax 5b: 66 90 xchg %ax,%ax 5d: 66 90 xchg %ax,%ax 5f: 90 nop 00000060 <fmtname>: { 60: 55 push %ebp 61: 89 e5 mov %esp,%ebp 63: 56 push %esi 64: 53 push %ebx 65: 8b 5d 08 mov 0x8(%ebp),%ebx for(p=path+strlen(path); p >= path && *p != '/'; p--) 68: 83 ec 0c sub $0xc,%esp 6b: 53 push %ebx 6c: e8 3f 03 00 00 call 3b0 <strlen> 71: 83 c4 10 add $0x10,%esp 74: 01 d8 add %ebx,%eax 76: 73 0f jae 87 <fmtname+0x27> 78: eb 12 jmp 8c <fmtname+0x2c> 7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80: 83 e8 01 sub $0x1,%eax 83: 39 c3 cmp %eax,%ebx 85: 77 05 ja 8c <fmtname+0x2c> 87: 80 38 2f cmpb $0x2f,(%eax) 8a: 75 f4 jne 80 <fmtname+0x20> p++; 8c: 8d 58 01 lea 0x1(%eax),%ebx if(strlen(p) >= DIRSIZ) 8f: 83 ec 0c sub $0xc,%esp 92: 53 push %ebx 93: e8 18 03 00 00 call 3b0 <strlen> 98: 83 c4 10 add $0x10,%esp 9b: 83 f8 0d cmp $0xd,%eax 9e: 77 4a ja ea <fmtname+0x8a> memmove(buf, p, strlen(p)); a0: 83 ec 0c sub $0xc,%esp a3: 53 push %ebx a4: e8 07 03 00 00 call 3b0 <strlen> a9: 83 c4 0c add $0xc,%esp ac: 50 push %eax ad: 53 push %ebx ae: 68 ac 0d 00 00 push $0xdac b3: e8 98 04 00 00 call 550 <memmove> memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); b8: 89 1c 24 mov %ebx,(%esp) bb: e8 f0 02 00 00 call 3b0 <strlen> c0: 89 1c 24 mov %ebx,(%esp) c3: 89 c6 mov %eax,%esi return buf; c5: bb ac 0d 00 00 mov $0xdac,%ebx memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); ca: e8 e1 02 00 00 call 3b0 <strlen> cf: ba 0e 00 00 00 mov $0xe,%edx d4: 83 c4 0c add $0xc,%esp d7: 05 ac 0d 00 00 add $0xdac,%eax dc: 29 f2 sub %esi,%edx de: 52 push %edx df: 6a 20 push $0x20 e1: 50 push %eax e2: e8 f9 02 00 00 call 3e0 <memset> return buf; e7: 83 c4 10 add $0x10,%esp } ea: 8d 65 f8 lea -0x8(%ebp),%esp ed: 89 d8 mov %ebx,%eax ef: 5b pop %ebx f0: 5e pop %esi f1: 5d pop %ebp f2: c3 ret f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000100 <ls>: { 100: 55 push %ebp 101: 89 e5 mov %esp,%ebp 103: 57 push %edi 104: 56 push %esi 105: 53 push %ebx 106: 81 ec 64 02 00 00 sub $0x264,%esp 10c: 8b 7d 08 mov 0x8(%ebp),%edi if((fd = open(path, 0)) < 0){ 10f: 6a 00 push $0x0 111: 57 push %edi 112: e8 ab 04 00 00 call 5c2 <open> 117: 83 c4 10 add $0x10,%esp 11a: 85 c0 test %eax,%eax 11c: 78 52 js 170 <ls+0x70> if(fstat(fd, &st) < 0){ 11e: 8d b5 d4 fd ff ff lea -0x22c(%ebp),%esi 124: 83 ec 08 sub $0x8,%esp 127: 89 c3 mov %eax,%ebx 129: 56 push %esi 12a: 50 push %eax 12b: e8 aa 04 00 00 call 5da <fstat> 130: 83 c4 10 add $0x10,%esp 133: 85 c0 test %eax,%eax 135: 0f 88 c5 00 00 00 js 200 <ls+0x100> switch(st.type){ 13b: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax 142: 66 83 f8 01 cmp $0x1,%ax 146: 0f 84 84 00 00 00 je 1d0 <ls+0xd0> 14c: 66 83 f8 02 cmp $0x2,%ax 150: 74 3e je 190 <ls+0x90> close(fd); 152: 83 ec 0c sub $0xc,%esp 155: 53 push %ebx 156: e8 4f 04 00 00 call 5aa <close> 15b: 83 c4 10 add $0x10,%esp } 15e: 8d 65 f4 lea -0xc(%ebp),%esp 161: 5b pop %ebx 162: 5e pop %esi 163: 5f pop %edi 164: 5d pop %ebp 165: c3 ret 166: 8d 76 00 lea 0x0(%esi),%esi 169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi printf(2, "ls: cannot open %s\n", path); 170: 83 ec 04 sub $0x4,%esp 173: 57 push %edi 174: 68 38 0a 00 00 push $0xa38 179: 6a 02 push $0x2 17b: e8 60 05 00 00 call 6e0 <printf> return; 180: 83 c4 10 add $0x10,%esp } 183: 8d 65 f4 lea -0xc(%ebp),%esp 186: 5b pop %ebx 187: 5e pop %esi 188: 5f pop %edi 189: 5d pop %ebp 18a: c3 ret 18b: 90 nop 18c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size); 190: 83 ec 0c sub $0xc,%esp 193: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx 199: 8b b5 dc fd ff ff mov -0x224(%ebp),%esi 19f: 57 push %edi 1a0: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp) 1a6: e8 b5 fe ff ff call 60 <fmtname> 1ab: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx 1b1: 59 pop %ecx 1b2: 5f pop %edi 1b3: 52 push %edx 1b4: 56 push %esi 1b5: 6a 02 push $0x2 1b7: 50 push %eax 1b8: 68 60 0a 00 00 push $0xa60 1bd: 6a 01 push $0x1 1bf: e8 1c 05 00 00 call 6e0 <printf> break; 1c4: 83 c4 20 add $0x20,%esp 1c7: eb 89 jmp 152 <ls+0x52> 1c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ 1d0: 83 ec 0c sub $0xc,%esp 1d3: 57 push %edi 1d4: e8 d7 01 00 00 call 3b0 <strlen> 1d9: 83 c0 10 add $0x10,%eax 1dc: 83 c4 10 add $0x10,%esp 1df: 3d 00 02 00 00 cmp $0x200,%eax 1e4: 76 42 jbe 228 <ls+0x128> printf(1, "ls: path too long\n"); 1e6: 83 ec 08 sub $0x8,%esp 1e9: 68 6d 0a 00 00 push $0xa6d 1ee: 6a 01 push $0x1 1f0: e8 eb 04 00 00 call 6e0 <printf> break; 1f5: 83 c4 10 add $0x10,%esp 1f8: e9 55 ff ff ff jmp 152 <ls+0x52> 1fd: 8d 76 00 lea 0x0(%esi),%esi printf(2, "ls: cannot stat %s\n", path); 200: 83 ec 04 sub $0x4,%esp 203: 57 push %edi 204: 68 4c 0a 00 00 push $0xa4c 209: 6a 02 push $0x2 20b: e8 d0 04 00 00 call 6e0 <printf> close(fd); 210: 89 1c 24 mov %ebx,(%esp) 213: e8 92 03 00 00 call 5aa <close> return; 218: 83 c4 10 add $0x10,%esp } 21b: 8d 65 f4 lea -0xc(%ebp),%esp 21e: 5b pop %ebx 21f: 5e pop %esi 220: 5f pop %edi 221: 5d pop %ebp 222: c3 ret 223: 90 nop 224: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi strcpy(buf, path); 228: 83 ec 08 sub $0x8,%esp 22b: 57 push %edi 22c: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi 232: 57 push %edi 233: e8 f8 00 00 00 call 330 <strcpy> p = buf+strlen(buf); 238: 89 3c 24 mov %edi,(%esp) 23b: e8 70 01 00 00 call 3b0 <strlen> 240: 01 f8 add %edi,%eax while(read(fd, &de, sizeof(de)) == sizeof(de)){ 242: 83 c4 10 add $0x10,%esp *p++ = '/'; 245: 8d 48 01 lea 0x1(%eax),%ecx p = buf+strlen(buf); 248: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp) *p++ = '/'; 24e: c6 00 2f movb $0x2f,(%eax) 251: 89 8d a4 fd ff ff mov %ecx,-0x25c(%ebp) 257: 89 f6 mov %esi,%esi 259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi while(read(fd, &de, sizeof(de)) == sizeof(de)){ 260: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax 266: 83 ec 04 sub $0x4,%esp 269: 6a 10 push $0x10 26b: 50 push %eax 26c: 53 push %ebx 26d: e8 28 03 00 00 call 59a <read> 272: 83 c4 10 add $0x10,%esp 275: 83 f8 10 cmp $0x10,%eax 278: 0f 85 d4 fe ff ff jne 152 <ls+0x52> if(de.inum == 0) 27e: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp) 285: 00 286: 74 d8 je 260 <ls+0x160> memmove(p, de.name, DIRSIZ); 288: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax 28e: 83 ec 04 sub $0x4,%esp 291: 6a 0e push $0xe 293: 50 push %eax 294: ff b5 a4 fd ff ff pushl -0x25c(%ebp) 29a: e8 b1 02 00 00 call 550 <memmove> p[DIRSIZ] = 0; 29f: 8b 85 a8 fd ff ff mov -0x258(%ebp),%eax 2a5: c6 40 0f 00 movb $0x0,0xf(%eax) if(stat(buf, &st) < 0){ 2a9: 58 pop %eax 2aa: 5a pop %edx 2ab: 56 push %esi 2ac: 57 push %edi 2ad: e8 0e 02 00 00 call 4c0 <stat> 2b2: 83 c4 10 add $0x10,%esp 2b5: 85 c0 test %eax,%eax 2b7: 78 5f js 318 <ls+0x218> printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size); 2b9: 0f bf 85 d4 fd ff ff movswl -0x22c(%ebp),%eax 2c0: 83 ec 0c sub $0xc,%esp 2c3: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx 2c9: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx 2cf: 57 push %edi 2d0: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp) 2d6: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp) 2dc: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) 2e2: e8 79 fd ff ff call 60 <fmtname> 2e7: 5a pop %edx 2e8: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx 2ee: 59 pop %ecx 2ef: 8b 8d ac fd ff ff mov -0x254(%ebp),%ecx 2f5: 51 push %ecx 2f6: 52 push %edx 2f7: ff b5 b4 fd ff ff pushl -0x24c(%ebp) 2fd: 50 push %eax 2fe: 68 60 0a 00 00 push $0xa60 303: 6a 01 push $0x1 305: e8 d6 03 00 00 call 6e0 <printf> 30a: 83 c4 20 add $0x20,%esp 30d: e9 4e ff ff ff jmp 260 <ls+0x160> 312: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printf(1, "ls: cannot stat %s\n", buf); 318: 83 ec 04 sub $0x4,%esp 31b: 57 push %edi 31c: 68 4c 0a 00 00 push $0xa4c 321: 6a 01 push $0x1 323: e8 b8 03 00 00 call 6e0 <printf> continue; 328: 83 c4 10 add $0x10,%esp 32b: e9 30 ff ff ff jmp 260 <ls+0x160> 00000330 <strcpy>: 330: 55 push %ebp 331: 89 e5 mov %esp,%ebp 333: 53 push %ebx 334: 8b 45 08 mov 0x8(%ebp),%eax 337: 8b 4d 0c mov 0xc(%ebp),%ecx 33a: 89 c2 mov %eax,%edx 33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 340: 83 c1 01 add $0x1,%ecx 343: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 347: 83 c2 01 add $0x1,%edx 34a: 84 db test %bl,%bl 34c: 88 5a ff mov %bl,-0x1(%edx) 34f: 75 ef jne 340 <strcpy+0x10> 351: 5b pop %ebx 352: 5d pop %ebp 353: c3 ret 354: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 35a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000360 <strcmp>: 360: 55 push %ebp 361: 89 e5 mov %esp,%ebp 363: 53 push %ebx 364: 8b 55 08 mov 0x8(%ebp),%edx 367: 8b 4d 0c mov 0xc(%ebp),%ecx 36a: 0f b6 02 movzbl (%edx),%eax 36d: 0f b6 19 movzbl (%ecx),%ebx 370: 84 c0 test %al,%al 372: 75 1c jne 390 <strcmp+0x30> 374: eb 2a jmp 3a0 <strcmp+0x40> 376: 8d 76 00 lea 0x0(%esi),%esi 379: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 380: 83 c2 01 add $0x1,%edx 383: 0f b6 02 movzbl (%edx),%eax 386: 83 c1 01 add $0x1,%ecx 389: 0f b6 19 movzbl (%ecx),%ebx 38c: 84 c0 test %al,%al 38e: 74 10 je 3a0 <strcmp+0x40> 390: 38 d8 cmp %bl,%al 392: 74 ec je 380 <strcmp+0x20> 394: 29 d8 sub %ebx,%eax 396: 5b pop %ebx 397: 5d pop %ebp 398: c3 ret 399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 3a0: 31 c0 xor %eax,%eax 3a2: 29 d8 sub %ebx,%eax 3a4: 5b pop %ebx 3a5: 5d pop %ebp 3a6: c3 ret 3a7: 89 f6 mov %esi,%esi 3a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000003b0 <strlen>: 3b0: 55 push %ebp 3b1: 89 e5 mov %esp,%ebp 3b3: 8b 4d 08 mov 0x8(%ebp),%ecx 3b6: 80 39 00 cmpb $0x0,(%ecx) 3b9: 74 15 je 3d0 <strlen+0x20> 3bb: 31 d2 xor %edx,%edx 3bd: 8d 76 00 lea 0x0(%esi),%esi 3c0: 83 c2 01 add $0x1,%edx 3c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 3c7: 89 d0 mov %edx,%eax 3c9: 75 f5 jne 3c0 <strlen+0x10> 3cb: 5d pop %ebp 3cc: c3 ret 3cd: 8d 76 00 lea 0x0(%esi),%esi 3d0: 31 c0 xor %eax,%eax 3d2: 5d pop %ebp 3d3: c3 ret 3d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 3da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000003e0 <memset>: 3e0: 55 push %ebp 3e1: 89 e5 mov %esp,%ebp 3e3: 57 push %edi 3e4: 8b 55 08 mov 0x8(%ebp),%edx 3e7: 8b 4d 10 mov 0x10(%ebp),%ecx 3ea: 8b 45 0c mov 0xc(%ebp),%eax 3ed: 89 d7 mov %edx,%edi 3ef: fc cld 3f0: f3 aa rep stos %al,%es:(%edi) 3f2: 89 d0 mov %edx,%eax 3f4: 5f pop %edi 3f5: 5d pop %ebp 3f6: c3 ret 3f7: 89 f6 mov %esi,%esi 3f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000400 <strchr>: 400: 55 push %ebp 401: 89 e5 mov %esp,%ebp 403: 53 push %ebx 404: 8b 45 08 mov 0x8(%ebp),%eax 407: 8b 5d 0c mov 0xc(%ebp),%ebx 40a: 0f b6 10 movzbl (%eax),%edx 40d: 84 d2 test %dl,%dl 40f: 74 1d je 42e <strchr+0x2e> 411: 38 d3 cmp %dl,%bl 413: 89 d9 mov %ebx,%ecx 415: 75 0d jne 424 <strchr+0x24> 417: eb 17 jmp 430 <strchr+0x30> 419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 420: 38 ca cmp %cl,%dl 422: 74 0c je 430 <strchr+0x30> 424: 83 c0 01 add $0x1,%eax 427: 0f b6 10 movzbl (%eax),%edx 42a: 84 d2 test %dl,%dl 42c: 75 f2 jne 420 <strchr+0x20> 42e: 31 c0 xor %eax,%eax 430: 5b pop %ebx 431: 5d pop %ebp 432: c3 ret 433: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000440 <gets>: 440: 55 push %ebp 441: 89 e5 mov %esp,%ebp 443: 57 push %edi 444: 56 push %esi 445: 53 push %ebx 446: 31 f6 xor %esi,%esi 448: 89 f3 mov %esi,%ebx 44a: 83 ec 1c sub $0x1c,%esp 44d: 8b 7d 08 mov 0x8(%ebp),%edi 450: eb 2f jmp 481 <gets+0x41> 452: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 458: 8d 45 e7 lea -0x19(%ebp),%eax 45b: 83 ec 04 sub $0x4,%esp 45e: 6a 01 push $0x1 460: 50 push %eax 461: 6a 00 push $0x0 463: e8 32 01 00 00 call 59a <read> 468: 83 c4 10 add $0x10,%esp 46b: 85 c0 test %eax,%eax 46d: 7e 1c jle 48b <gets+0x4b> 46f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 473: 83 c7 01 add $0x1,%edi 476: 88 47 ff mov %al,-0x1(%edi) 479: 3c 0a cmp $0xa,%al 47b: 74 23 je 4a0 <gets+0x60> 47d: 3c 0d cmp $0xd,%al 47f: 74 1f je 4a0 <gets+0x60> 481: 83 c3 01 add $0x1,%ebx 484: 3b 5d 0c cmp 0xc(%ebp),%ebx 487: 89 fe mov %edi,%esi 489: 7c cd jl 458 <gets+0x18> 48b: 89 f3 mov %esi,%ebx 48d: 8b 45 08 mov 0x8(%ebp),%eax 490: c6 03 00 movb $0x0,(%ebx) 493: 8d 65 f4 lea -0xc(%ebp),%esp 496: 5b pop %ebx 497: 5e pop %esi 498: 5f pop %edi 499: 5d pop %ebp 49a: c3 ret 49b: 90 nop 49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 4a0: 8b 75 08 mov 0x8(%ebp),%esi 4a3: 8b 45 08 mov 0x8(%ebp),%eax 4a6: 01 de add %ebx,%esi 4a8: 89 f3 mov %esi,%ebx 4aa: c6 03 00 movb $0x0,(%ebx) 4ad: 8d 65 f4 lea -0xc(%ebp),%esp 4b0: 5b pop %ebx 4b1: 5e pop %esi 4b2: 5f pop %edi 4b3: 5d pop %ebp 4b4: c3 ret 4b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 4b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000004c0 <stat>: 4c0: 55 push %ebp 4c1: 89 e5 mov %esp,%ebp 4c3: 56 push %esi 4c4: 53 push %ebx 4c5: 83 ec 08 sub $0x8,%esp 4c8: 6a 00 push $0x0 4ca: ff 75 08 pushl 0x8(%ebp) 4cd: e8 f0 00 00 00 call 5c2 <open> 4d2: 83 c4 10 add $0x10,%esp 4d5: 85 c0 test %eax,%eax 4d7: 78 27 js 500 <stat+0x40> 4d9: 83 ec 08 sub $0x8,%esp 4dc: ff 75 0c pushl 0xc(%ebp) 4df: 89 c3 mov %eax,%ebx 4e1: 50 push %eax 4e2: e8 f3 00 00 00 call 5da <fstat> 4e7: 89 1c 24 mov %ebx,(%esp) 4ea: 89 c6 mov %eax,%esi 4ec: e8 b9 00 00 00 call 5aa <close> 4f1: 83 c4 10 add $0x10,%esp 4f4: 8d 65 f8 lea -0x8(%ebp),%esp 4f7: 89 f0 mov %esi,%eax 4f9: 5b pop %ebx 4fa: 5e pop %esi 4fb: 5d pop %ebp 4fc: c3 ret 4fd: 8d 76 00 lea 0x0(%esi),%esi 500: be ff ff ff ff mov $0xffffffff,%esi 505: eb ed jmp 4f4 <stat+0x34> 507: 89 f6 mov %esi,%esi 509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000510 <atoi>: 510: 55 push %ebp 511: 89 e5 mov %esp,%ebp 513: 53 push %ebx 514: 8b 4d 08 mov 0x8(%ebp),%ecx 517: 0f be 11 movsbl (%ecx),%edx 51a: 8d 42 d0 lea -0x30(%edx),%eax 51d: 3c 09 cmp $0x9,%al 51f: b8 00 00 00 00 mov $0x0,%eax 524: 77 1f ja 545 <atoi+0x35> 526: 8d 76 00 lea 0x0(%esi),%esi 529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 530: 8d 04 80 lea (%eax,%eax,4),%eax 533: 83 c1 01 add $0x1,%ecx 536: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax 53a: 0f be 11 movsbl (%ecx),%edx 53d: 8d 5a d0 lea -0x30(%edx),%ebx 540: 80 fb 09 cmp $0x9,%bl 543: 76 eb jbe 530 <atoi+0x20> 545: 5b pop %ebx 546: 5d pop %ebp 547: c3 ret 548: 90 nop 549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000550 <memmove>: 550: 55 push %ebp 551: 89 e5 mov %esp,%ebp 553: 56 push %esi 554: 53 push %ebx 555: 8b 5d 10 mov 0x10(%ebp),%ebx 558: 8b 45 08 mov 0x8(%ebp),%eax 55b: 8b 75 0c mov 0xc(%ebp),%esi 55e: 85 db test %ebx,%ebx 560: 7e 14 jle 576 <memmove+0x26> 562: 31 d2 xor %edx,%edx 564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 568: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 56c: 88 0c 10 mov %cl,(%eax,%edx,1) 56f: 83 c2 01 add $0x1,%edx 572: 39 d3 cmp %edx,%ebx 574: 75 f2 jne 568 <memmove+0x18> 576: 5b pop %ebx 577: 5e pop %esi 578: 5d pop %ebp 579: c3 ret 0000057a <fork>: 57a: b8 01 00 00 00 mov $0x1,%eax 57f: cd 40 int $0x40 581: c3 ret 00000582 <exit>: 582: b8 02 00 00 00 mov $0x2,%eax 587: cd 40 int $0x40 589: c3 ret 0000058a <wait>: 58a: b8 03 00 00 00 mov $0x3,%eax 58f: cd 40 int $0x40 591: c3 ret 00000592 <pipe>: 592: b8 04 00 00 00 mov $0x4,%eax 597: cd 40 int $0x40 599: c3 ret 0000059a <read>: 59a: b8 05 00 00 00 mov $0x5,%eax 59f: cd 40 int $0x40 5a1: c3 ret 000005a2 <write>: 5a2: b8 10 00 00 00 mov $0x10,%eax 5a7: cd 40 int $0x40 5a9: c3 ret 000005aa <close>: 5aa: b8 15 00 00 00 mov $0x15,%eax 5af: cd 40 int $0x40 5b1: c3 ret 000005b2 <kill>: 5b2: b8 06 00 00 00 mov $0x6,%eax 5b7: cd 40 int $0x40 5b9: c3 ret 000005ba <exec>: 5ba: b8 07 00 00 00 mov $0x7,%eax 5bf: cd 40 int $0x40 5c1: c3 ret 000005c2 <open>: 5c2: b8 0f 00 00 00 mov $0xf,%eax 5c7: cd 40 int $0x40 5c9: c3 ret 000005ca <mknod>: 5ca: b8 11 00 00 00 mov $0x11,%eax 5cf: cd 40 int $0x40 5d1: c3 ret 000005d2 <unlink>: 5d2: b8 12 00 00 00 mov $0x12,%eax 5d7: cd 40 int $0x40 5d9: c3 ret 000005da <fstat>: 5da: b8 08 00 00 00 mov $0x8,%eax 5df: cd 40 int $0x40 5e1: c3 ret 000005e2 <link>: 5e2: b8 13 00 00 00 mov $0x13,%eax 5e7: cd 40 int $0x40 5e9: c3 ret 000005ea <mkdir>: 5ea: b8 14 00 00 00 mov $0x14,%eax 5ef: cd 40 int $0x40 5f1: c3 ret 000005f2 <chdir>: 5f2: b8 09 00 00 00 mov $0x9,%eax 5f7: cd 40 int $0x40 5f9: c3 ret 000005fa <dup>: 5fa: b8 0a 00 00 00 mov $0xa,%eax 5ff: cd 40 int $0x40 601: c3 ret 00000602 <getpid>: 602: b8 0b 00 00 00 mov $0xb,%eax 607: cd 40 int $0x40 609: c3 ret 0000060a <sbrk>: 60a: b8 0c 00 00 00 mov $0xc,%eax 60f: cd 40 int $0x40 611: c3 ret 00000612 <sleep>: 612: b8 0d 00 00 00 mov $0xd,%eax 617: cd 40 int $0x40 619: c3 ret 0000061a <uptime>: 61a: b8 0e 00 00 00 mov $0xe,%eax 61f: cd 40 int $0x40 621: c3 ret 00000622 <getNumProc>: 622: b8 16 00 00 00 mov $0x16,%eax 627: cd 40 int $0x40 629: c3 ret 0000062a <chpr>: 62a: b8 17 00 00 00 mov $0x17,%eax 62f: cd 40 int $0x40 631: c3 ret 632: 66 90 xchg %ax,%ax 634: 66 90 xchg %ax,%ax 636: 66 90 xchg %ax,%ax 638: 66 90 xchg %ax,%ax 63a: 66 90 xchg %ax,%ax 63c: 66 90 xchg %ax,%ax 63e: 66 90 xchg %ax,%ax 00000640 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 640: 55 push %ebp 641: 89 e5 mov %esp,%ebp 643: 57 push %edi 644: 56 push %esi 645: 53 push %ebx 646: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 649: 85 d2 test %edx,%edx { 64b: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 64e: 89 d0 mov %edx,%eax if(sgn && xx < 0){ 650: 79 76 jns 6c8 <printint+0x88> 652: f6 45 08 01 testb $0x1,0x8(%ebp) 656: 74 70 je 6c8 <printint+0x88> x = -xx; 658: f7 d8 neg %eax neg = 1; 65a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 661: 31 f6 xor %esi,%esi 663: 8d 5d d7 lea -0x29(%ebp),%ebx 666: eb 0a jmp 672 <printint+0x32> 668: 90 nop 669: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do{ buf[i++] = digits[x % base]; 670: 89 fe mov %edi,%esi 672: 31 d2 xor %edx,%edx 674: 8d 7e 01 lea 0x1(%esi),%edi 677: f7 f1 div %ecx 679: 0f b6 92 8c 0a 00 00 movzbl 0xa8c(%edx),%edx }while((x /= base) != 0); 680: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 682: 88 14 3b mov %dl,(%ebx,%edi,1) }while((x /= base) != 0); 685: 75 e9 jne 670 <printint+0x30> if(neg) 687: 8b 45 c4 mov -0x3c(%ebp),%eax 68a: 85 c0 test %eax,%eax 68c: 74 08 je 696 <printint+0x56> buf[i++] = '-'; 68e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 693: 8d 7e 02 lea 0x2(%esi),%edi 696: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 69a: 8b 7d c0 mov -0x40(%ebp),%edi 69d: 8d 76 00 lea 0x0(%esi),%esi 6a0: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 6a3: 83 ec 04 sub $0x4,%esp 6a6: 83 ee 01 sub $0x1,%esi 6a9: 6a 01 push $0x1 6ab: 53 push %ebx 6ac: 57 push %edi 6ad: 88 45 d7 mov %al,-0x29(%ebp) 6b0: e8 ed fe ff ff call 5a2 <write> while(--i >= 0) 6b5: 83 c4 10 add $0x10,%esp 6b8: 39 de cmp %ebx,%esi 6ba: 75 e4 jne 6a0 <printint+0x60> putc(fd, buf[i]); } 6bc: 8d 65 f4 lea -0xc(%ebp),%esp 6bf: 5b pop %ebx 6c0: 5e pop %esi 6c1: 5f pop %edi 6c2: 5d pop %ebp 6c3: c3 ret 6c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 6c8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 6cf: eb 90 jmp 661 <printint+0x21> 6d1: eb 0d jmp 6e0 <printf> 6d3: 90 nop 6d4: 90 nop 6d5: 90 nop 6d6: 90 nop 6d7: 90 nop 6d8: 90 nop 6d9: 90 nop 6da: 90 nop 6db: 90 nop 6dc: 90 nop 6dd: 90 nop 6de: 90 nop 6df: 90 nop 000006e0 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 6e0: 55 push %ebp 6e1: 89 e5 mov %esp,%ebp 6e3: 57 push %edi 6e4: 56 push %esi 6e5: 53 push %ebx 6e6: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 6e9: 8b 75 0c mov 0xc(%ebp),%esi 6ec: 0f b6 1e movzbl (%esi),%ebx 6ef: 84 db test %bl,%bl 6f1: 0f 84 b3 00 00 00 je 7aa <printf+0xca> ap = (uint*)(void*)&fmt + 1; 6f7: 8d 45 10 lea 0x10(%ebp),%eax 6fa: 83 c6 01 add $0x1,%esi state = 0; 6fd: 31 ff xor %edi,%edi ap = (uint*)(void*)&fmt + 1; 6ff: 89 45 d4 mov %eax,-0x2c(%ebp) 702: eb 2f jmp 733 <printf+0x53> 704: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 708: 83 f8 25 cmp $0x25,%eax 70b: 0f 84 a7 00 00 00 je 7b8 <printf+0xd8> write(fd, &c, 1); 711: 8d 45 e2 lea -0x1e(%ebp),%eax 714: 83 ec 04 sub $0x4,%esp 717: 88 5d e2 mov %bl,-0x1e(%ebp) 71a: 6a 01 push $0x1 71c: 50 push %eax 71d: ff 75 08 pushl 0x8(%ebp) 720: e8 7d fe ff ff call 5a2 <write> 725: 83 c4 10 add $0x10,%esp 728: 83 c6 01 add $0x1,%esi for(i = 0; fmt[i]; i++){ 72b: 0f b6 5e ff movzbl -0x1(%esi),%ebx 72f: 84 db test %bl,%bl 731: 74 77 je 7aa <printf+0xca> if(state == 0){ 733: 85 ff test %edi,%edi c = fmt[i] & 0xff; 735: 0f be cb movsbl %bl,%ecx 738: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 73b: 74 cb je 708 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 73d: 83 ff 25 cmp $0x25,%edi 740: 75 e6 jne 728 <printf+0x48> if(c == 'd'){ 742: 83 f8 64 cmp $0x64,%eax 745: 0f 84 05 01 00 00 je 850 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 74b: 81 e1 f7 00 00 00 and $0xf7,%ecx 751: 83 f9 70 cmp $0x70,%ecx 754: 74 72 je 7c8 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 756: 83 f8 73 cmp $0x73,%eax 759: 0f 84 99 00 00 00 je 7f8 <printf+0x118> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 75f: 83 f8 63 cmp $0x63,%eax 762: 0f 84 08 01 00 00 je 870 <printf+0x190> putc(fd, *ap); ap++; } else if(c == '%'){ 768: 83 f8 25 cmp $0x25,%eax 76b: 0f 84 ef 00 00 00 je 860 <printf+0x180> write(fd, &c, 1); 771: 8d 45 e7 lea -0x19(%ebp),%eax 774: 83 ec 04 sub $0x4,%esp 777: c6 45 e7 25 movb $0x25,-0x19(%ebp) 77b: 6a 01 push $0x1 77d: 50 push %eax 77e: ff 75 08 pushl 0x8(%ebp) 781: e8 1c fe ff ff call 5a2 <write> 786: 83 c4 0c add $0xc,%esp 789: 8d 45 e6 lea -0x1a(%ebp),%eax 78c: 88 5d e6 mov %bl,-0x1a(%ebp) 78f: 6a 01 push $0x1 791: 50 push %eax 792: ff 75 08 pushl 0x8(%ebp) 795: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 798: 31 ff xor %edi,%edi write(fd, &c, 1); 79a: e8 03 fe ff ff call 5a2 <write> for(i = 0; fmt[i]; i++){ 79f: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 7a3: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 7a6: 84 db test %bl,%bl 7a8: 75 89 jne 733 <printf+0x53> } } } 7aa: 8d 65 f4 lea -0xc(%ebp),%esp 7ad: 5b pop %ebx 7ae: 5e pop %esi 7af: 5f pop %edi 7b0: 5d pop %ebp 7b1: c3 ret 7b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 7b8: bf 25 00 00 00 mov $0x25,%edi 7bd: e9 66 ff ff ff jmp 728 <printf+0x48> 7c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 7c8: 83 ec 0c sub $0xc,%esp 7cb: b9 10 00 00 00 mov $0x10,%ecx 7d0: 6a 00 push $0x0 7d2: 8b 7d d4 mov -0x2c(%ebp),%edi 7d5: 8b 45 08 mov 0x8(%ebp),%eax 7d8: 8b 17 mov (%edi),%edx 7da: e8 61 fe ff ff call 640 <printint> ap++; 7df: 89 f8 mov %edi,%eax 7e1: 83 c4 10 add $0x10,%esp state = 0; 7e4: 31 ff xor %edi,%edi ap++; 7e6: 83 c0 04 add $0x4,%eax 7e9: 89 45 d4 mov %eax,-0x2c(%ebp) 7ec: e9 37 ff ff ff jmp 728 <printf+0x48> 7f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 7f8: 8b 45 d4 mov -0x2c(%ebp),%eax 7fb: 8b 08 mov (%eax),%ecx ap++; 7fd: 83 c0 04 add $0x4,%eax 800: 89 45 d4 mov %eax,-0x2c(%ebp) if(s == 0) 803: 85 c9 test %ecx,%ecx 805: 0f 84 8e 00 00 00 je 899 <printf+0x1b9> while(*s != 0){ 80b: 0f b6 01 movzbl (%ecx),%eax state = 0; 80e: 31 ff xor %edi,%edi s = (char*)*ap; 810: 89 cb mov %ecx,%ebx while(*s != 0){ 812: 84 c0 test %al,%al 814: 0f 84 0e ff ff ff je 728 <printf+0x48> 81a: 89 75 d0 mov %esi,-0x30(%ebp) 81d: 89 de mov %ebx,%esi 81f: 8b 5d 08 mov 0x8(%ebp),%ebx 822: 8d 7d e3 lea -0x1d(%ebp),%edi 825: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 828: 83 ec 04 sub $0x4,%esp s++; 82b: 83 c6 01 add $0x1,%esi 82e: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 831: 6a 01 push $0x1 833: 57 push %edi 834: 53 push %ebx 835: e8 68 fd ff ff call 5a2 <write> while(*s != 0){ 83a: 0f b6 06 movzbl (%esi),%eax 83d: 83 c4 10 add $0x10,%esp 840: 84 c0 test %al,%al 842: 75 e4 jne 828 <printf+0x148> 844: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; 847: 31 ff xor %edi,%edi 849: e9 da fe ff ff jmp 728 <printf+0x48> 84e: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); 850: 83 ec 0c sub $0xc,%esp 853: b9 0a 00 00 00 mov $0xa,%ecx 858: 6a 01 push $0x1 85a: e9 73 ff ff ff jmp 7d2 <printf+0xf2> 85f: 90 nop write(fd, &c, 1); 860: 83 ec 04 sub $0x4,%esp 863: 88 5d e5 mov %bl,-0x1b(%ebp) 866: 8d 45 e5 lea -0x1b(%ebp),%eax 869: 6a 01 push $0x1 86b: e9 21 ff ff ff jmp 791 <printf+0xb1> putc(fd, *ap); 870: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); 873: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 876: 8b 07 mov (%edi),%eax write(fd, &c, 1); 878: 6a 01 push $0x1 ap++; 87a: 83 c7 04 add $0x4,%edi putc(fd, *ap); 87d: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 880: 8d 45 e4 lea -0x1c(%ebp),%eax 883: 50 push %eax 884: ff 75 08 pushl 0x8(%ebp) 887: e8 16 fd ff ff call 5a2 <write> ap++; 88c: 89 7d d4 mov %edi,-0x2c(%ebp) 88f: 83 c4 10 add $0x10,%esp state = 0; 892: 31 ff xor %edi,%edi 894: e9 8f fe ff ff jmp 728 <printf+0x48> s = "(null)"; 899: bb 82 0a 00 00 mov $0xa82,%ebx while(*s != 0){ 89e: b8 28 00 00 00 mov $0x28,%eax 8a3: e9 72 ff ff ff jmp 81a <printf+0x13a> 8a8: 66 90 xchg %ax,%ax 8aa: 66 90 xchg %ax,%ax 8ac: 66 90 xchg %ax,%ax 8ae: 66 90 xchg %ax,%ax 000008b0 <free>: static Header base; static Header *freep; void free(void *ap) { 8b0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8b1: a1 bc 0d 00 00 mov 0xdbc,%eax { 8b6: 89 e5 mov %esp,%ebp 8b8: 57 push %edi 8b9: 56 push %esi 8ba: 53 push %ebx 8bb: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 8be: 8d 4b f8 lea -0x8(%ebx),%ecx 8c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8c8: 39 c8 cmp %ecx,%eax 8ca: 8b 10 mov (%eax),%edx 8cc: 73 32 jae 900 <free+0x50> 8ce: 39 d1 cmp %edx,%ecx 8d0: 72 04 jb 8d6 <free+0x26> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 8d2: 39 d0 cmp %edx,%eax 8d4: 72 32 jb 908 <free+0x58> break; if(bp + bp->s.size == p->s.ptr){ 8d6: 8b 73 fc mov -0x4(%ebx),%esi 8d9: 8d 3c f1 lea (%ecx,%esi,8),%edi 8dc: 39 fa cmp %edi,%edx 8de: 74 30 je 910 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 8e0: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 8e3: 8b 50 04 mov 0x4(%eax),%edx 8e6: 8d 34 d0 lea (%eax,%edx,8),%esi 8e9: 39 f1 cmp %esi,%ecx 8eb: 74 3a je 927 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 8ed: 89 08 mov %ecx,(%eax) freep = p; 8ef: a3 bc 0d 00 00 mov %eax,0xdbc } 8f4: 5b pop %ebx 8f5: 5e pop %esi 8f6: 5f pop %edi 8f7: 5d pop %ebp 8f8: c3 ret 8f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 900: 39 d0 cmp %edx,%eax 902: 72 04 jb 908 <free+0x58> 904: 39 d1 cmp %edx,%ecx 906: 72 ce jb 8d6 <free+0x26> { 908: 89 d0 mov %edx,%eax 90a: eb bc jmp 8c8 <free+0x18> 90c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 910: 03 72 04 add 0x4(%edx),%esi 913: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 916: 8b 10 mov (%eax),%edx 918: 8b 12 mov (%edx),%edx 91a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 91d: 8b 50 04 mov 0x4(%eax),%edx 920: 8d 34 d0 lea (%eax,%edx,8),%esi 923: 39 f1 cmp %esi,%ecx 925: 75 c6 jne 8ed <free+0x3d> p->s.size += bp->s.size; 927: 03 53 fc add -0x4(%ebx),%edx freep = p; 92a: a3 bc 0d 00 00 mov %eax,0xdbc p->s.size += bp->s.size; 92f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 932: 8b 53 f8 mov -0x8(%ebx),%edx 935: 89 10 mov %edx,(%eax) } 937: 5b pop %ebx 938: 5e pop %esi 939: 5f pop %edi 93a: 5d pop %ebp 93b: c3 ret 93c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000940 <malloc>: return freep; } void* malloc(uint nbytes) { 940: 55 push %ebp 941: 89 e5 mov %esp,%ebp 943: 57 push %edi 944: 56 push %esi 945: 53 push %ebx 946: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 949: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 94c: 8b 15 bc 0d 00 00 mov 0xdbc,%edx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 952: 8d 78 07 lea 0x7(%eax),%edi 955: c1 ef 03 shr $0x3,%edi 958: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 95b: 85 d2 test %edx,%edx 95d: 0f 84 9d 00 00 00 je a00 <malloc+0xc0> 963: 8b 02 mov (%edx),%eax 965: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 968: 39 cf cmp %ecx,%edi 96a: 76 6c jbe 9d8 <malloc+0x98> 96c: 81 ff 00 10 00 00 cmp $0x1000,%edi 972: bb 00 10 00 00 mov $0x1000,%ebx 977: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); 97a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi 981: eb 0e jmp 991 <malloc+0x51> 983: 90 nop 984: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 988: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 98a: 8b 48 04 mov 0x4(%eax),%ecx 98d: 39 f9 cmp %edi,%ecx 98f: 73 47 jae 9d8 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 991: 39 05 bc 0d 00 00 cmp %eax,0xdbc 997: 89 c2 mov %eax,%edx 999: 75 ed jne 988 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 99b: 83 ec 0c sub $0xc,%esp 99e: 56 push %esi 99f: e8 66 fc ff ff call 60a <sbrk> if(p == (char*)-1) 9a4: 83 c4 10 add $0x10,%esp 9a7: 83 f8 ff cmp $0xffffffff,%eax 9aa: 74 1c je 9c8 <malloc+0x88> hp->s.size = nu; 9ac: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 9af: 83 ec 0c sub $0xc,%esp 9b2: 83 c0 08 add $0x8,%eax 9b5: 50 push %eax 9b6: e8 f5 fe ff ff call 8b0 <free> return freep; 9bb: 8b 15 bc 0d 00 00 mov 0xdbc,%edx if((p = morecore(nunits)) == 0) 9c1: 83 c4 10 add $0x10,%esp 9c4: 85 d2 test %edx,%edx 9c6: 75 c0 jne 988 <malloc+0x48> return 0; } } 9c8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 9cb: 31 c0 xor %eax,%eax } 9cd: 5b pop %ebx 9ce: 5e pop %esi 9cf: 5f pop %edi 9d0: 5d pop %ebp 9d1: c3 ret 9d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 9d8: 39 cf cmp %ecx,%edi 9da: 74 54 je a30 <malloc+0xf0> p->s.size -= nunits; 9dc: 29 f9 sub %edi,%ecx 9de: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 9e1: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 9e4: 89 78 04 mov %edi,0x4(%eax) freep = prevp; 9e7: 89 15 bc 0d 00 00 mov %edx,0xdbc } 9ed: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); 9f0: 83 c0 08 add $0x8,%eax } 9f3: 5b pop %ebx 9f4: 5e pop %esi 9f5: 5f pop %edi 9f6: 5d pop %ebp 9f7: c3 ret 9f8: 90 nop 9f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; a00: c7 05 bc 0d 00 00 c0 movl $0xdc0,0xdbc a07: 0d 00 00 a0a: c7 05 c0 0d 00 00 c0 movl $0xdc0,0xdc0 a11: 0d 00 00 base.s.size = 0; a14: b8 c0 0d 00 00 mov $0xdc0,%eax a19: c7 05 c4 0d 00 00 00 movl $0x0,0xdc4 a20: 00 00 00 a23: e9 44 ff ff ff jmp 96c <malloc+0x2c> a28: 90 nop a29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; a30: 8b 08 mov (%eax),%ecx a32: 89 0a mov %ecx,(%edx) a34: eb b1 jmp 9e7 <malloc+0xa7>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) Microsoft Corporation. All rights reserved. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include "spot_hardware_onewire_native.h" #include "spot_hardware_onewire_native_Microsoft_SPOT_Hardware_OneWire.h" using namespace Pulsecor::SPOT; HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::TouchReset___I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::TouchBit___I4__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::TouchByte___I4__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::WriteByte___I4__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::ReadByte___I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::AcquireEx___I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::Release___I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::FindFirstDevice___I4__BOOLEAN__BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::FindNextDevice___I4__BOOLEAN__BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_Pulsecor_Native_OneWire_Pulsecor_SPOT_OneWire::SerialNum___I4__SZARRAY_U1__BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); }
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %rax lea addresses_A_ht+0x19ee, %r10 nop nop and %r8, %r8 mov (%r10), %rax nop nop nop nop nop mfence pop %rax pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %rax push %rbx push %rsi // Store lea addresses_WC+0x17166, %r12 inc %r10 movw $0x5152, (%r12) sub $29975, %rax // Load lea addresses_US+0x1a966, %r10 nop nop nop nop nop cmp %rax, %rax mov (%r10), %r13 nop and %rax, %rax // Store mov $0xe06, %r12 nop nop nop nop nop add %r11, %r11 mov $0x5152535455565758, %r13 movq %r13, %xmm1 vmovups %ymm1, (%r12) nop nop nop nop sub %r11, %r11 // Store lea addresses_D+0xb0e6, %rsi cmp %r10, %r10 movw $0x5152, (%rsi) nop nop nop sub $55699, %rsi // Load lea addresses_US+0x1679f, %r11 nop dec %rax vmovups (%r11), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $1, %xmm3, %rbx xor $63327, %r12 // Store lea addresses_WC+0x17366, %r13 nop nop nop nop nop and %r12, %r12 movw $0x5152, (%r13) nop nop sub %r11, %r11 // Faulty Load lea addresses_US+0x12b66, %r10 nop nop nop nop nop xor $31401, %rsi movb (%r10), %r12b lea oracles, %rbx and $0xff, %r12 shlq $12, %r12 mov (%rbx,%r12,1), %r12 pop %rsi pop %rbx pop %rax pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 2, 'AVXalign': True, 'NT': True, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}} {'00': 17659} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
#include <list> #include "CostHeuristic.h" bool CostHeuristic::calculateGreedy1Solution(AdjacencyListGraph<Stop, Link>* ptn, LinePool* linePool){ /** * Sort lines due to greedy objective function */ struct LineSorter{ inline bool operator() (Line line1, Line line2){ return ((line1.getCost()/line1.getLength()) < (line2.getCost()/line2.getLength())); } }; //Track, if the user was already warned, that a violation of the upper freq bounds occurs bool hasBeenWarned = false; auto ptnEdges = ptn->getEdges(); std::list<Link> edges(ptnEdges.begin(), ptnEdges.end()); auto lines = linePool->getLines(); std::sort(lines.begin(), lines.end(), LineSorter()); //std::set<Line, LineSorter> orderedLines(lines.begin(), lines.end()); edges.erase(std::remove_if(edges.begin(), edges.end(), [](Link & link) { return link.getLowerFrequencyBound() == 0;}), edges.end()); // We will track the upper frequency bounds as well, to give a warning if one is violated // Note, that we only track it heuristically due to performance reasons. Therefore, we will not // always give a warning if the generated line concept is infeasible, but every time we give a warning, it will be! for(auto it = lines.begin(); it != lines.end() && edges.size() > 0; it++){ Line nextLine = *it; bool wouldBeInfeasible = false; int maximalMinimalFrequency = 0; for(Link& link : nextLine.getLinePath().getEdges()){ Link* ptnLink = ptn->getEdge(link.getId()); if(ptnLink->getUpperFrequencyBound() < maximalMinimalFrequency){ wouldBeInfeasible = true; } maximalMinimalFrequency = std::max(maximalMinimalFrequency, ptnLink->getLowerFrequencyBound()); ptnLink->setLowerFrequencyBound(0); ptnLink->setUpperFrequencyBound(ptnLink->getUpperFrequencyBound() - maximalMinimalFrequency); } if(wouldBeInfeasible && !hasBeenWarned){ std::cout << "WARNING: The calculated line concept will be infeasible due to upper frequency bounds" << std::endl; hasBeenWarned = true; } linePool->getLine(nextLine.getId())->setFrequency(maximalMinimalFrequency); edges.erase(std::remove_if(edges.begin(), edges.end(), [ptn](Link & link) { return ptn->getEdge(link.getId())->getLowerFrequencyBound() == 0;}), edges.end()); } if(edges.size() > 0){ std::cout << "ERROR: Could not compute a feasible line concept due to lower frequency bounds" << std::endl; return false; } return true; } bool CostHeuristic::calculateGreedy2Solution(AdjacencyListGraph<Stop, Link>* ptn, LinePool* linePool){ /** * Sort links based on their lower frequency bound */ struct LinkSorter{ inline bool operator() (Link* link1, Link* link2){ return link1->getLowerFrequencyBound() < link2->getLowerFrequencyBound(); } }; /** * Sort lines due to the greed objective function */ struct LineSorter{ inline bool operator() (Line line1, Line line2){ //Count elements with positive minimal frequency in line1 and line2 int sizeLine1 = 0; for(Link link : line1.getLinePath().getEdges()){ if(link.getLowerFrequencyBound() > 0){ sizeLine1++; } } int sizeLine2 = 0; for(Link link : line2.getLinePath().getEdges()){ if(link.getLowerFrequencyBound() > 0){ sizeLine2++; } } return ((line1.getCost()/sizeLine1) < (line2.getCost()/sizeLine2)); } }; //Track, if the user was already warned, that a violation of the upper freq bounds occurs bool hasBeenWarned = false; auto edgeCopies = ptn->getEdges(); std::vector<Link*> edges; for(Link link : edgeCopies){ edges.insert(edges.begin(), ptn->getEdge(link.getId())); } //We use a heap to sort the edges, the max element will be at the beginning std::make_heap(edges.begin(), edges.end(), LinkSorter()); while(true){ Link* maxLink = edges.front(); if(maxLink->getLowerFrequencyBound() == 0){ //If this is the case, there is no edge with minimal frequency left, we are done return true; } //Build the lines std::set<Line, LineSorter> lines; for(Line line : linePool->getLines()){ for(Link link : line.getLinePath().getEdges()){ if(link.getId() == maxLink->getId()){ updateFrequencyLowerBoundsInLine(ptn, &line); lines.insert(line); break; } } } if(lines.empty()){ //There is no line for our element. Therefore we cannot build a feasible line concept! std::cout << "WARNING: Could not compute a feasible line concept due to lower frequency bounds" << std::endl; return false; } Line nextLineCopy = *lines.begin(); auto nextLine = linePool->getLine(nextLineCopy.getId()); //Calculate the new frequency int fMin = maxLink->getLowerFrequencyBound(); for(Link link : nextLine->getLinePath().getEdges()){ auto ptnLink = ptn->getEdge(link.getId()); if(ptnLink->getLowerFrequencyBound() > 0){ fMin = std::min(fMin, ptnLink->getLowerFrequencyBound()); } } nextLine->setFrequency(nextLine->getFrequency() + fMin); for(Link linkCopy : nextLine->getLinePath().getEdges()){ auto link = ptn->getEdge(linkCopy.getId()); if(link->getUpperFrequencyBound() < fMin && !hasBeenWarned){ std::cout << "WARNING: The calculated line concept will be infeasible due to upper frequency bounds" << std::endl; hasBeenWarned = true; } link->setUpperFrequencyBound(link->getUpperFrequencyBound() - fMin); link->setLowerFrequencyBound(std::max(0, link->getLowerFrequencyBound() - fMin)); } std::make_heap(edges.begin(), edges.end(), LinkSorter()); } } void CostHeuristic::updateFrequencyLowerBoundsInLine(AdjacencyListGraph<Stop, Link>* ptn, Line* line){ for(Link link : line->getLinePath().getEdges()){ link.setLowerFrequencyBound(ptn->getEdge(link.getId())->getLowerFrequencyBound()); } }
INCLUDE "config_private.inc" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF __CLIB_OPT_ERROR ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; verbose mode SECTION code_clib SECTION code_error PUBLIC error_enomem_mc EXTERN __ENOMEM, errno_mc pop hl error_enomem_mc: ; set hl = -1 ; set carry flag ; set errno = ENOMEM ld l,__ENOMEM jp errno_mc SECTION rodata_clib SECTION rodata_error_strings IF __CLIB_OPT_ERROR & $02 defb __ENOMEM defm "ENOMEM - Insufficient memory" defb 0 ELSE defb __ENOMEM defm "ENOMEM" defb 0 ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELSE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SECTION code_clib SECTION code_error PUBLIC error_enomem_mc EXTERN errno_mc defc error_enomem_mc = errno_mc - 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#include "aquatroll.h" #include "utils.h" #include "rtc.h" #include "log.h" #include "sdi12_sensor.h" #include "common.h" namespace Aquatroll { /****************************************************************************** * Initialization ******************************************************************************/ RetResult init() { return RET_OK; } /****************************************************************************** * Measure correct Aquatroll model depending on config ******************************************************************************/ RetResult measure(WaterSensorData::Entry *data) { switch (AQUATROLL_MODEL) { case AQUATROLL_MODEL_400: return measure_aquatroll400(data); break; case AQUATROLL_MODEL_500: return measure_aquatroll500(data); break; case AQUATROLL_MODEL_600: return measure_aquatroll600(data); break; default: debug_println_e(F("Invalid Aquatroll model")); break; } return RET_ERROR; } /****************************************************************************** * Send measure command to the sensor and fill data structure * Aquatroll is configured to return the following measurements (in this order): * RDO - Dissolved oxygen (concentration) - mg/L * RDO - Dissolved oxygen (%saturation) - %Sat * RDO - Temperature - C * Cond - Specific Conductivity - uS/cm * pH/ORP - pH * pH/ORP - Oxidation Reduction Potential (ORP) - mV * Pres(A) 250ft - Pressure mBar * Pres(A) 250ft - Depth - cm * @param data Output structure ******************************************************************************/ RetResult measure_aquatroll400(WaterSensorData::Entry *data) { debug_println("Measuring water quality."); // Return dummy values switch if(FLAGS.MEASURE_DUMMY_WATER_QUALITY) { return measure_dummy(data); } // Zero structure memset(data, 0, sizeof(WaterSensorData::Entry)); // I2C slave SDI12 adapter Sdi12Sensor sensor(PIN_SDI12_DATA); // Output variables // Seconds to wait uint16_t secs_to_wait = 0; // Vals to be measured uint8_t measured_values = 0; if(sensor.measure(&secs_to_wait, &measured_values) != RET_OK) { Sdi12Sensor::ErrorCode error = sensor.get_last_error(); if(error == Sdi12Sensor::ERROR_INVALID_RESPONSE) { debug_println(F("Invalid response returned.")); Log::log(Log::WATER_QUALITY_INVALID_RESPONSE); return RET_ERROR; } return RET_ERROR; } // Check if seconds within range. Range values are chosen empirically. // If values not within range, something is wrong with the response or with the // configuration of Aquatroll if(secs_to_wait > AQUATROLL_MEASURE_WAIT_SEC_MAX) { debug_println(F("Invalid number of seconds to wait for measurements.")); Serial.print(F("Seconds to wait: ")); Serial.println(secs_to_wait, DEC); return RET_ERROR; } // The exact number of measured values is known and configured into Aquatroll if(measured_values != AQUATROLL400_NUMBER_OF_MEASUREMENTS) { debug_print(F("Invalid number of measured values. Expected: ")); debug_println(AQUATROLL400_NUMBER_OF_MEASUREMENTS, DEC); Serial.print(F("Returned: ")); Serial.println(measured_values, DEC); return RET_ERROR; } // TODO: // When sleeping, pins go low and sensor is disabled. // Use RTC GPIO so power pin can stay high and ESP32 can sleep instead of waiting debug_print(F("Waiting (sec): ")); debug_println(secs_to_wait + SDI12_MEASURE_EXTRA_WAIT_SECS); delay((secs_to_wait + SDI12_MEASURE_EXTRA_WAIT_SECS) * 1000); // // Request measurement data // WaterSensorData::Entry sensor_data = {0}; // Vars to receive all the measurement data // Data will be copied to output structure only after successfull measurement float d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0, d8 = 0; // // Batch 0 // int tries = 3; RetResult ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(0, &d1, &d2, &d3) != RET_OK) { debug_println(F("Could not get measurement results for batch 0.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 0); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // Batch 1 // tries = 3; ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(1, &d4, &d5, &d6) != RET_OK) { debug_println(F("Could not get measurement results for batch 1.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 1); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // Batch 2 // tries = 3; ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(2, &d7, &d8, nullptr) != RET_OK) { debug_println(F("Could not get measurement results for batch 2.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 2); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // All data received successfully, fill strcture // data->dissolved_oxygen = d1; data->temperature = d3; data->conductivity = d4; data->ph = d5; data->orp = d6; data->pressure = d7; data->depth_cm = d8; data->depth_ft = data->depth_cm * 0.032808399; // If all fields 0 return error even if CRC is OK if(data->dissolved_oxygen == 0 && data->temperature == 0 && data->conductivity == 0 && data->ph == 0 && data->orp == 0 && data->pressure == 0 && data->depth_cm == 0 && data->depth_ft == 0) { debug_println(F("All measured vals are 0, aborting.")); Log::log(Log::WATER_QUALITY_ZERO_VALS); return RET_ERROR; } Utils::serial_style(STYLE_GREEN); debug_println(F("All water quality data is received successfully.")); Utils::serial_style(STYLE_RESET); return RET_OK; } /****************************************************************************** * Send measure command to the sensor and fill data structure * Aquatroll is configured to return the following measurements (in this order): * RDO - Dissolved Oxygen (concentration) - mg/L * RDO - Dissolved Oxygen (%saturation) - %Sat * Cond - Temperature - C * Cond - Specific Conductivity - uS/cm * pH/ORP - ph -pH * pH/ORP - Oxidation Reductino Potential (ORP) - mV * Pres 30ft - Pressure - PSI * Pres 30ft - Depth - ft * @param data Output structure ******************************************************************************/ RetResult measure_aquatroll500(WaterSensorData::Entry *data) { debug_println("Measuring water quality."); // Return dummy values switch if(FLAGS.MEASURE_DUMMY_WATER_QUALITY) { return measure_dummy(data); } // Zero structure memset(data, 0, sizeof(WaterSensorData::Entry)); // I2C slave SDI12 adapter Sdi12Sensor sensor(PIN_SDI12_DATA); // Output variables // Seconds to wait uint16_t secs_to_wait = 0; // Vals to be measured uint8_t measured_values = 0; if(sensor.measure(&secs_to_wait, &measured_values) != RET_OK) { Sdi12Sensor::ErrorCode error = sensor.get_last_error(); if(error == Sdi12Sensor::ERROR_INVALID_RESPONSE) { debug_println(F("Invalid response returned.")); Log::log(Log::WATER_QUALITY_INVALID_RESPONSE); return RET_ERROR; } return RET_ERROR; } // Check if seconds within range. Range values are chosen empirically. // If values not within range, something is wrong with the response or with the // configuration of Aquatroll if(secs_to_wait > AQUATROLL_MEASURE_WAIT_SEC_MAX) { debug_println(F("Invalid number of seconds to wait for measurements.")); Serial.print(F("Seconds to wait: ")); Serial.println(secs_to_wait, DEC); return RET_ERROR; } // The exact number of measured values is known and configured into Aquatroll if(measured_values != AQUATROLL500_NUMBER_OF_MEASUREMENTS) { debug_print(F("Invalid number of measured values. Expected: ")); debug_println(AQUATROLL500_NUMBER_OF_MEASUREMENTS, DEC); Serial.print(F("Returned: ")); Serial.println(measured_values, DEC); return RET_ERROR; } // TODO: // When sleeping, pins go low and sensor is disabled. // Use RTC GPIO so power pin can stay high and ESP32 can sleep instead of waiting debug_print(F("Waiting (sec): ")); debug_println(secs_to_wait + SDI12_MEASURE_EXTRA_WAIT_SECS); delay((secs_to_wait + SDI12_MEASURE_EXTRA_WAIT_SECS) * 1000); // // Request measurement data // WaterSensorData::Entry sensor_data = {0}; // Vars to receive all the measurement data // Data will be copied to output structure only after successfull measurement float d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0, d8 = 0; // // Batch 0 // int tries = 3; RetResult ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(0, &d1, &d2, &d3) != RET_OK) { debug_println(F("Could not get measurement results for batch 0.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 0); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // Batch 1 // tries = 3; ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(1, &d4, &d5, &d6) != RET_OK) { debug_println(F("Could not get measurement results for batch 1.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 1); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // Batch 2 // tries = 3; ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(2, &d7, &d8, nullptr) != RET_OK) { debug_println(F("Could not get measurement results for batch 2.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 2); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // All data received successfully, fill strcture // data->dissolved_oxygen = d1; data->temperature = d3; data->conductivity = d4; data->ph = d5; data->orp = d6; data->pressure = d7; data->depth_ft = d8; data->depth_cm = data->depth_ft * 30.48f; // If all fields 0 return error even if CRC is OK if(data->dissolved_oxygen == 0 && data->temperature == 0 && data->conductivity == 0 && data->ph == 0 && data->orp == 0 && data->pressure == 0 && data->depth_cm == 0 && data->depth_ft == 0) { debug_println(F("All measured vals are 0, aborting.")); Log::log(Log::WATER_QUALITY_ZERO_VALS); return RET_ERROR; } Utils::serial_style(STYLE_GREEN); debug_println(F("All water quality data is received successfully.")); Utils::serial_style(STYLE_RESET); return RET_OK; } /****************************************************************************** * Send measure command to the sensor and fill data structure * Aquatroll is configured to return the following measurements (in this order): * RDO - Dissolved Oxygen (concentration) - mg/L * RDO - Dissolved Oxygen (%saturation) - %Sat * Cond - Temperature - C * Cond - Specific Conductivity - uS/cm * Pres 30ft - Pressure - PSI * Pres 30ft - Depth - ft * Turb - Total suspended solids * @param data Output structure ******************************************************************************/ RetResult measure_aquatroll600(WaterSensorData::Entry *data) { debug_println("Measuring water quality."); // Return dummy values switch if(FLAGS.MEASURE_DUMMY_WATER_QUALITY) { return measure_dummy(data); } // Zero structure memset(data, 0, sizeof(WaterSensorData::Entry)); // I2C slave SDI12 adapter Sdi12Sensor sensor(PIN_SDI12_DATA); // Output variables // Seconds to wait uint16_t secs_to_wait = 0; // Vals to be measured uint8_t measured_values = 0; if(sensor.measure(&secs_to_wait, &measured_values) != RET_OK) { Sdi12Sensor::ErrorCode error = sensor.get_last_error(); if(error == Sdi12Sensor::ERROR_INVALID_RESPONSE) { debug_println(F("Invalid response returned.")); Log::log(Log::WATER_QUALITY_INVALID_RESPONSE); return RET_ERROR; } return RET_ERROR; } // Check if seconds within range. Range values are chosen empirically. // If values not within range, something is wrong with the response or with the // configuration of Aquatroll if(secs_to_wait > AQUATROLL_MEASURE_WAIT_SEC_MAX) { debug_println(F("Invalid number of seconds to wait for measurements.")); Serial.print(F("Seconds to wait: ")); Serial.println(secs_to_wait, DEC); return RET_ERROR; } // The exact number of measured values is known and configured into Aquatroll if(measured_values != AQUATROLL600_NUMBER_OF_MEASUREMENTS) { debug_print(F("Invalid number of measured values. Expected: ")); debug_println(AQUATROLL600_NUMBER_OF_MEASUREMENTS, DEC); Serial.print(F("Returned: ")); Serial.println(measured_values, DEC); return RET_ERROR; } // TODO: // When sleeping, pins go low and sensor is disabled. // Use RTC GPIO so power pin can stay high and ESP32 can sleep instead of waiting debug_print(F("Waiting (sec): ")); debug_println(secs_to_wait + SDI12_MEASURE_EXTRA_WAIT_SECS); delay((secs_to_wait + SDI12_MEASURE_EXTRA_WAIT_SECS) * 1000); // // Request measurement data // WaterSensorData::Entry sensor_data = {0}; // Vars to receive all the measurement data // Data will be copied to output structure only after successfull measurement float d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0; // // Batch 0 // int tries = 3; RetResult ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(0, &d1, &d2, &d3) != RET_OK) { debug_println(F("Could not get measurement results for batch 0.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 0); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // Batch 1 // tries = 3; ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(1, &d4, &d5, &d6) != RET_OK) { debug_println(F("Could not get measurement results for batch 1.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 1); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // Batch 2 // tries = 3; ret = RET_ERROR; while(tries--) { if(sensor.read_measurement_data(2, &d7, nullptr, nullptr) != RET_OK) { debug_println(F("Could not get measurement results for batch 2.")); Log::log(Log::WATER_QUALITY_MEASUREMENT_DATA_REQ_FAILED, 2); if(tries > 0) { debug_println(F("Retrying")); } else { ret = RET_ERROR; } } else { ret = RET_OK; break; } } if(ret != RET_OK) { debug_println(F("Aborting")); return RET_ERROR; } // // All data received successfully, fill strcture // data->dissolved_oxygen = d1; data->temperature = d3; data->conductivity = d4; data->pressure = d5; data->depth_ft = d6; data->tss = d7; data->depth_cm = data->depth_ft * 30.48f; // If all fields 0 return error even if CRC is OK if(data->dissolved_oxygen == 0 && data->temperature == 0 && data->conductivity == 0 && data->pressure == 0 && data->pressure == 0 && data->depth_cm == 0 && data->depth_ft == 0 && data->tss == 0) { debug_println(F("All measured vals are 0, aborting.")); Log::log(Log::WATER_QUALITY_ZERO_VALS); return RET_ERROR; } Utils::serial_style(STYLE_GREEN); debug_println(F("All water quality data is received successfully.")); Utils::serial_style(STYLE_RESET); return RET_OK; } /****************************************************************************** * Fill water quality struct with dummy data * Used for debugging only * @param data Output structure *****************************************************************************/ RetResult measure_dummy(WaterSensorData::Entry *data) { debug_println(F("Returning dummy values")); static WaterSensorData::Entry dummy = { 24, 20, 50, 7, 200, 64 }; // Add/subtract random offset dummy.conductivity += (float)random(-400, 400) / 100; dummy.dissolved_oxygen += (float)random(-400, 400) / 100; dummy.ph += (float)random(-200, 200) / 100; dummy.temperature += (float)random(-400, 400) / 100; memcpy(data, &dummy, sizeof(dummy)); // Emulate waiting time delay(1000); return RET_OK; } }
#include <catch/catch.hpp> #include <world/core.h> using namespace world; TEST_CASE("WorldFile", "[serialize]") { WorldFile wf; wf.addString("1", "1s"); wf.addInt("2", 1); wf.addDouble("3", 3.2); wf.addBool("4", true); WorldFile a1, a2, a3, a4; a1.addString("0", "0s"); a2.addString("0", "1s"); wf.addArray("6"); wf.addToArray("6", std::move(a1)); wf.addToArray("6", std::move(a2)); WorldFile c1; c1.addString("0", "s"); wf.addChild("c1", std::move(c1)); SECTION("Test read") { CHECK(wf.readString("1") == "1s"); CHECK(wf.readInt("2") == 1); CHECK(wf.readFloat("3") == Approx(3.2)); CHECK(wf.readDouble("3") == Approx(3.2)); CHECK(wf.readBool("4")); CHECK_THROWS(wf.readString("2")); CHECK_THROWS(wf.readFloat("2")); CHECK_THROWS(wf.readInt("3")); CHECK_THROWS(wf.readString("100")); } SECTION("Test read objects") { auto &rc1 = wf.readChild("c1"); CHECK(rc1.readString("0") == "s"); SECTION("Try to reread objects") { auto &rc1bis = wf.readChild("c1"); CHECK(rc1bis.readString("0") == "s"); } } SECTION("Test read array") { std::vector<std::string> results; for (auto it = wf.readArray("6"); !it.end(); ++it) { results.push_back(it->readString("0")); } CHECK(results == std::vector<std::string>{"0s", "1s"}); } SECTION("Test jsonify") { WorldFile wf2; wf2.fromJson(wf.toJson()); CHECK(wf2.readString("1") == "1s"); CHECK(wf2.readInt("2") == 1); CHECK(wf2.readFloat("3") == Approx(3.2)); CHECK(wf2.readBool("4")); } SECTION("Test read and save") { world::createDirectories("unittests"); std::string filename("unittests/wf_test.json"); wf.save(filename); WorldFile wf2; wf2.load(filename); CHECK(wf2.readString("1") == "1s"); CHECK(wf2.readInt("2") == 1); CHECK(wf2.readFloat("3") == Approx(3.2)); CHECK(wf2.readBool("4")); } SECTION("Move ctor") { WorldFile wfc(std::move(wf)); CHECK(wfc.readBool("4")); } SECTION("Complex json") { WorldFile wcin; wcin.addStruct("position", vec3d{5}); INFO(wcin.toJson()); WorldFile wcout; wcout.addArray("nodes"); wcout.addToArray("nodes", std::move(wcin)); CHECK(wcout.toJson() == "{\"nodes\":[{\"position\":{\"x\":5.0,\"y\":5.0,\"z\":5.0}}]}"); } } class BaseClass1 : public ISerializable {}; class ChildClass1 : public BaseClass1 { WORLD_WRITE_SUBCLASS_METHOD }; class ChildClass2 : public BaseClass1 { WORLD_WRITE_SUBCLASS_METHOD }; template <typename T> class ChildClassTemplate : public BaseClass1 { public: WORLD_WRITE_SUBCLASS_METHOD }; // The current implementation of WORLD_REGISTER_BASE_CLASS // does not compile out of the world namespace. namespace world { // On Windows the symbol should not be exported // TODO Add a WORLDAPI_ONLY_EXPORT macro to avoid __dllimport() the specialized // templates And fix this issue #define WORLDAPI_EXPORT WORLD_REGISTER_BASE_CLASS(BaseClass1) } // namespace world WORLD_REGISTER_CHILD_CLASS(BaseClass1, ChildClass1, "1") WORLD_REGISTER_CHILD_CLASS(BaseClass1, ChildClass2, "2") WORLD_REGISTER_TEMPLATE_CHILD_CLASS(BaseClass1, ChildClassTemplate, int, "int") WORLD_REGISTER_TEMPLATE_CHILD_CLASS(BaseClass1, ChildClassTemplate, double, "double") TEST_CASE("ISerializable", "[serialize]") { SECTION("Polymorphism") { WorldFile wf; ChildClass1 c1; c1.writeSubclass(wf); BaseClass1 *r = readSubclass<BaseClass1>(wf); CHECK(dynamic_cast<ChildClass1 *>(r) != nullptr); CHECK(dynamic_cast<ChildClass2 *>(r) == nullptr); } SECTION("Template polymorphism") { WorldFile wf; ChildClassTemplate<double> ct; ct.writeSubclass(wf); BaseClass1 *r = readSubclass<BaseClass1>(wf); CHECK(dynamic_cast<ChildClass1 *>(r) == nullptr); CHECK(dynamic_cast<ChildClassTemplate<int> *>(r) == nullptr); CHECK(dynamic_cast<ChildClassTemplate<double> *>(r) != nullptr); } }
; A009945: Coordination sequence for NiAs(2), As position. ; 1,6,18,42,74,114,162,222,290,366,450,546,650,762,882,1014,1154,1302,1458,1626,1802,1986,2178,2382,2594,2814,3042,3282,3530,3786,4050,4326,4610,4902,5202,5514,5834,6162,6498,6846,7202,7566,7938,8322,8714,9114,9522,9942,10370,10806,11250,11706,12170,12642,13122,13614,14114,14622,15138,15666,16202,16746,17298,17862,18434,19014,19602,20202,20810,21426,22050,22686,23330,23982,24642,25314,25994,26682,27378,28086,28802,29526,30258,31002,31754,32514,33282,34062,34850,35646,36450,37266,38090,38922,39762 mov $5,$0 pow $0,2 mov $7,1 lpb $0 add $0,$7 div $0,8 mul $0,4 add $4,1 add $3,$4 add $0,$3 mul $7,$0 lpe add $0,1 mov $2,$5 mul $2,$5 mov $6,$2 mul $6,4 add $0,$6
/* * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "arm_compute/graph.h" #include "support/ToolchainSupport.h" #include "utils/CommonGraphOptions.h" #include "utils/GraphUtils.h" #include "utils/Utils.h" using namespace arm_compute::utils; using namespace arm_compute::graph::frontend; using namespace arm_compute::graph_utils; /** Example demonstrating how to implement ResNetV1_50 network using the Compute Library's graph API */ class GraphResNetV1_50Example : public Example { public: GraphResNetV1_50Example() : cmd_parser(), common_opts(cmd_parser), common_params(), graph(0, "ResNetV1_50") { } bool do_setup(int argc, char **argv) override { // Parse arguments cmd_parser.parse(argc, argv); // Consume common parameters common_params = consume_common_graph_parameters(common_opts); // Return when help menu is requested if(common_params.help) { cmd_parser.print_help(argv[0]); return false; } // Checks ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "QASYMM8 not supported for this graph"); ARM_COMPUTE_EXIT_ON_MSG(common_params.data_type == DataType::F16 && common_params.target == Target::NEON, "F16 NEON not supported for this graph"); // Print parameter values std::cout << common_params << std::endl; // Get trainable parameters data path std::string data_path = common_params.data_path; // Create a preprocessor object const std::array<float, 3> mean_rgb{ { 122.68f, 116.67f, 104.01f } }; std::unique_ptr<IPreprocessor> preprocessor = arm_compute::support::cpp14::make_unique<CaffePreproccessor>(mean_rgb, false /* Do not convert to BGR */); // Create input descriptor const TensorShape tensor_shape = permute_shape(TensorShape(224U, 224U, 3U, 1U), DataLayout::NCHW, common_params.data_layout); TensorDescriptor input_descriptor = TensorDescriptor(tensor_shape, common_params.data_type).set_layout(common_params.data_layout); // Set weights trained layout const DataLayout weights_layout = DataLayout::NCHW; graph << common_params.target << common_params.fast_math_hint << InputLayer(input_descriptor, get_input_accessor(common_params, std::move(preprocessor), false /* Do not convert to BGR */)) << ConvolutionLayer( 7U, 7U, 64U, get_weights_accessor(data_path, "/cnn_data/resnet50_model/conv1_weights.npy", weights_layout), std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(2, 2, 3, 3)) .set_name("conv1/convolution") << BatchNormalizationLayer( get_weights_accessor(data_path, "/cnn_data/resnet50_model/conv1_BatchNorm_moving_mean.npy"), get_weights_accessor(data_path, "/cnn_data/resnet50_model/conv1_BatchNorm_moving_variance.npy"), get_weights_accessor(data_path, "/cnn_data/resnet50_model/conv1_BatchNorm_gamma.npy"), get_weights_accessor(data_path, "/cnn_data/resnet50_model/conv1_BatchNorm_beta.npy"), 0.0000100099996416f) .set_name("conv1/BatchNorm") << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name("conv1/Relu") << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR))).set_name("pool1/MaxPool"); add_residual_block(data_path, "block1", weights_layout, 64, 3, 2); add_residual_block(data_path, "block2", weights_layout, 128, 4, 2); add_residual_block(data_path, "block3", weights_layout, 256, 6, 2); add_residual_block(data_path, "block4", weights_layout, 512, 3, 1); graph << PoolingLayer(PoolingLayerInfo(PoolingType::AVG)).set_name("pool5") << ConvolutionLayer( 1U, 1U, 1000U, get_weights_accessor(data_path, "/cnn_data/resnet50_model/logits_weights.npy", weights_layout), get_weights_accessor(data_path, "/cnn_data/resnet50_model/logits_biases.npy"), PadStrideInfo(1, 1, 0, 0)) .set_name("logits/convolution") << FlattenLayer().set_name("predictions/Reshape") << SoftmaxLayer().set_name("predictions/Softmax") << OutputLayer(get_output_accessor(common_params, 5)); // Finalize graph GraphConfig config; config.num_threads = common_params.threads; config.use_tuner = common_params.enable_tuner; graph.finalize(common_params.target, config); return true; } void do_run() override { // Run graph graph.run(); } private: CommandLineParser cmd_parser; CommonGraphOptions common_opts; CommonGraphParams common_params; Stream graph; void add_residual_block(const std::string &data_path, const std::string &name, DataLayout weights_layout, unsigned int base_depth, unsigned int num_units, unsigned int stride) { for(unsigned int i = 0; i < num_units; ++i) { std::stringstream unit_path_ss; unit_path_ss << "/cnn_data/resnet50_model/" << name << "_unit_" << (i + 1) << "_bottleneck_v1_"; std::stringstream unit_name_ss; unit_name_ss << name << "/unit" << (i + 1) << "/bottleneck_v1/"; std::string unit_path = unit_path_ss.str(); std::string unit_name = unit_name_ss.str(); unsigned int middle_stride = 1; if(i == (num_units - 1)) { middle_stride = stride; } SubStream right(graph); right << ConvolutionLayer( 1U, 1U, base_depth, get_weights_accessor(data_path, unit_path + "conv1_weights.npy", weights_layout), std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 0, 0)) .set_name(unit_name + "conv1/convolution") << BatchNormalizationLayer( get_weights_accessor(data_path, unit_path + "conv1_BatchNorm_moving_mean.npy"), get_weights_accessor(data_path, unit_path + "conv1_BatchNorm_moving_variance.npy"), get_weights_accessor(data_path, unit_path + "conv1_BatchNorm_gamma.npy"), get_weights_accessor(data_path, unit_path + "conv1_BatchNorm_beta.npy"), 0.0000100099996416f) .set_name(unit_name + "conv1/BatchNorm") << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(unit_name + "conv1/Relu") << ConvolutionLayer( 3U, 3U, base_depth, get_weights_accessor(data_path, unit_path + "conv2_weights.npy", weights_layout), std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(middle_stride, middle_stride, 1, 1)) .set_name(unit_name + "conv2/convolution") << BatchNormalizationLayer( get_weights_accessor(data_path, unit_path + "conv2_BatchNorm_moving_mean.npy"), get_weights_accessor(data_path, unit_path + "conv2_BatchNorm_moving_variance.npy"), get_weights_accessor(data_path, unit_path + "conv2_BatchNorm_gamma.npy"), get_weights_accessor(data_path, unit_path + "conv2_BatchNorm_beta.npy"), 0.0000100099996416f) .set_name(unit_name + "conv2/BatchNorm") << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(unit_name + "conv1/Relu") << ConvolutionLayer( 1U, 1U, base_depth * 4, get_weights_accessor(data_path, unit_path + "conv3_weights.npy", weights_layout), std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 0, 0)) .set_name(unit_name + "conv3/convolution") << BatchNormalizationLayer( get_weights_accessor(data_path, unit_path + "conv3_BatchNorm_moving_mean.npy"), get_weights_accessor(data_path, unit_path + "conv3_BatchNorm_moving_variance.npy"), get_weights_accessor(data_path, unit_path + "conv3_BatchNorm_gamma.npy"), get_weights_accessor(data_path, unit_path + "conv3_BatchNorm_beta.npy"), 0.0000100099996416f) .set_name(unit_name + "conv2/BatchNorm"); if(i == 0) { SubStream left(graph); left << ConvolutionLayer( 1U, 1U, base_depth * 4, get_weights_accessor(data_path, unit_path + "shortcut_weights.npy", weights_layout), std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 0, 0)) .set_name(unit_name + "shortcut/convolution") << BatchNormalizationLayer( get_weights_accessor(data_path, unit_path + "shortcut_BatchNorm_moving_mean.npy"), get_weights_accessor(data_path, unit_path + "shortcut_BatchNorm_moving_variance.npy"), get_weights_accessor(data_path, unit_path + "shortcut_BatchNorm_gamma.npy"), get_weights_accessor(data_path, unit_path + "shortcut_BatchNorm_beta.npy"), 0.0000100099996416f) .set_name(unit_name + "shortcut/BatchNorm"); graph << EltwiseLayer(std::move(left), std::move(right), EltwiseOperation::Add).set_name(unit_name + "add"); } else if(middle_stride > 1) { SubStream left(graph); left << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 1, PadStrideInfo(middle_stride, middle_stride, 0, 0), true)).set_name(unit_name + "shortcut/MaxPool"); graph << EltwiseLayer(std::move(left), std::move(right), EltwiseOperation::Add).set_name(unit_name + "add"); } else { SubStream left(graph); graph << EltwiseLayer(std::move(left), std::move(right), EltwiseOperation::Add).set_name(unit_name + "add"); } graph << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(unit_name + "Relu"); } } }; /** Main program for ResNetV1_50 * * Model is based on: * https://arxiv.org/abs/1512.03385 * "Deep Residual Learning for Image Recognition" * Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun * * @note To list all the possible arguments execute the binary appended with the --help option * * @param[in] argc Number of arguments * @param[in] argv Arguments */ int main(int argc, char **argv) { return arm_compute::utils::run_example<GraphResNetV1_50Example>(argc, argv); }
INCLUDE "constants/SoundSystemNotes.inc" INCLUDE "constants/SoundSystem.def" INCLUDE "constants/SoundSystem.inc" ; tabs=8,hard ;*************************************************************************************************************************** ;* default behaviors ;*************************************************************************************************************************** ; force support for color gameboy-specific roms to be disabled if not user-specified IF !DEF(SOUNDSYSTEM_GBC_COMPATIBLE) SOUNDSYSTEM_GBC_COMPATIBLE EQU 0 ENDC ; force support for banking if not user-specified IF !DEF(SOUNDSYSTEM_ROM_BANKING) SOUNDSYSTEM_ROM_BANKING EQU 1 ENDC ; force support for large roms to be disabled if not user-specified IF !DEF(SOUNDSYSTEM_LARGE_ROM) SOUNDSYSTEM_LARGE_ROM EQU 0 ENDC ; force the code to reside in bank 0 if not user-specified IF !DEF(SOUNDSYSTEM_CODE_BANK) SOUNDSYSTEM_CODE_BANK EQU 0 ENDC ; force the variables to reside in wram bank 0 if not user-specified IF !DEF(SOUNDSYSTEM_WRAM_BANK) SOUNDSYSTEM_WRAM_BANK EQU 0 ENDC ; force the sfx to be enabled if not user-specified if !DEF(SOUNDSYSTEM_ENABLE_SFX) SOUNDSYSTEM_ENABLE_SFX EQU 1 ENDC ; force the vu meters to be disabled if not user-specified if !DEF(SOUNDSYSTEM_ENABLE_VUM) SOUNDSYSTEM_ENABLE_VUM EQU 0 ENDC ; force certain settings if the rom is not specific to color gameboy IF (SOUNDSYSTEM_GBC_COMPATIBLE == 0) PURGE SOUNDSYSTEM_WRAM_BANK SOUNDSYSTEM_WRAM_BANK EQU 0 ENDC ; do some sanity checking IF (SOUNDSYSTEM_GBC_COMPATIBLE != 0) ASSERT(SOUNDSYSTEM_WRAM_BANK < 8) ; force boolean PURGE SOUNDSYSTEM_GBC_COMPATIBLE SOUNDSYSTEM_GBC_COMPATIBLE EQU 1 ENDC IF (SOUNDSYSTEM_LARGE_ROM != 0) ASSERT(SOUNDSYSTEM_ROM_BANKING != 0) ASSERT(SOUNDSYSTEM_CODE_BANK < 512) ; force boolean PURGE SOUNDSYSTEM_LARGE_ROM SOUNDSYSTEM_LARGE_ROM EQU 1 ENDC IF (SOUNDSYSTEM_ENABLE_SFX != 0) ; force boolean PURGE SOUNDSYSTEM_ENABLE_SFX SOUNDSYSTEM_ENABLE_SFX EQU 1 ENDC IF (SOUNDSYSTEM_ENABLE_VUM != 0) ; force boolean PURGE SOUNDSYSTEM_ENABLE_VUM SOUNDSYSTEM_ENABLE_VUM EQU 1 ENDC sizeof_BANK_VAR = 1+SOUNDSYSTEM_LARGE_ROM ; the size, in bytes, of the bank variables ; display the configuration PRINTLN "SoundSystem Configuration:" IF (SOUNDSYSTEM_GBC_COMPATIBLE == 0) PRINTLN " GBC Only: no" ELSE PRINTLN " GBC Only: YES" ENDC IF (SOUNDSYSTEM_LARGE_ROM == 0) PRINTLN " Large ROM: no" ELSE PRINTLN " Large ROM: YES" ENDC PRINTLN " Code Bank: {SOUNDSYSTEM_CODE_BANK}" PRINTLN " WRAM Bank: {SOUNDSYSTEM_WRAM_BANK}" IF (SOUNDSYSTEM_ROM_BANKING == 0) PRINTLN " ROM Banking: disabled" ELSE PRINTLN " ROM Banking: ENABLED" ENDC IF (SOUNDSYSTEM_ENABLE_SFX == 0) PRINTLN " SFX: disabled" ELSE PRINTLN " SFX: ENABLED" ENDC IF (SOUNDSYSTEM_ENABLE_VUM == 0) PRINTLN " VU Meters: disabled" ELSE PRINTLN " VU Meters: ENABLED" ENDC ;*************************************************************************************************************************** ;* hardware registers ;*************************************************************************************************************************** rROMB0 EQU $2000 ; $2000->$2FFF rROMB1 EQU $3000 ; $3000->$3FFF - If more than 256 ROM banks are present. rSVBK EQU $FF70 rAUD1SWEEP EQU $FF10 rAUD1LEN EQU $FF11 rAUD1ENV EQU $FF12 rAUD1LOW EQU $FF13 rAUD1HIGH EQU $FF14 rAUD2LEN EQU $FF16 rAUD2ENV EQU $FF17 rAUD2LOW EQU $FF18 rAUD2HIGH EQU $FF19 rAUD3ENA EQU $FF1A rAUD3LEN EQU $FF1B rAUD3LEVEL EQU $FF1C rAUD3LOW EQU $FF1D rAUD3HIGH EQU $FF1E rAUD4LEN EQU $FF20 rAUD4ENV EQU $FF21 rAUD4POLY EQU $FF22 rAUD4GO EQU $FF23 rAUDVOL EQU $FF24 rAUDTERM EQU $FF25 rAUDENA EQU $FF26 _AUD3WAVERAM EQU $FF30 ; $FF30->$FF3F ; values for rAUD1LEN, rAUD2LEN AUDLEN_DUTY_75 EQU %11000000 ; 75% AUDLEN_DUTY_50 EQU %10000000 ; 50% AUDLEN_DUTY_25 EQU %01000000 ; 25% AUDLEN_DUTY_12_5 EQU %00000000 ; 12.5% AUDLEN_LENGTHMASK EQU %00111111 ; values for rAUD1HIGH, rAUD2HIGH, rAUD3HIGH AUDHIGH_RESTART EQU %10000000 AUDHIGH_LENGTH_ON EQU %01000000 AUDHIGH_LENGTH_OFF EQU %00000000 ; values for rAUD3ENA AUD3ENA_ON EQU %10000000 ; values for rAUDVOL AUDVOL_VIN_LEFT EQU %10000000 ; SO2 AUDVOL_VIN_RIGHT EQU %00001000 ; SO1 ; values for rAUDTERM ; SO2 AUDTERM_4_LEFT EQU %10000000 AUDTERM_3_LEFT EQU %01000000 AUDTERM_2_LEFT EQU %00100000 AUDTERM_1_LEFT EQU %00010000 ; SO1 AUDTERM_4_RIGHT EQU %00001000 AUDTERM_3_RIGHT EQU %00000100 AUDTERM_2_RIGHT EQU %00000010 AUDTERM_1_RIGHT EQU %00000001 AUDTERM_ALL EQU $FF ; shorthand instead of ORing all the EQUs together ;*************************************************************************************************************************** ;* supported music commands ;*************************************************************************************************************************** RSSET 0 MUSIC_CMD_ENDOFFRAME RB 1 MUSIC_CMD_PLAYINSTNOTE RB 1 MUSIC_CMD_PLAYINST RB 1 MUSIC_CMD_SETVOLUME RB 1 MUSIC_CMD_VIBRATO_ON RB 1 MUSIC_CMD_EFFECT_OFF RB 1 MUSIC_CMD_SYNCFLAG RB 1 MUSIC_CMD_ENDOFPATTERN RB 1 MUSIC_CMD_GOTOORDER RB 1 MUSIC_CMD_ENDOFSONG RB 1 MUSIC_CMD_SETSPEED RB 1 MUSIC_CMD_ENDOFFRAME1X RB 1 MUSIC_CMD_ENDOFFRAME2X RB 1 MUSIC_CMD_ENDOFFRAME3X RB 1 MUSIC_CMD_ENDOFFRAME4X RB 1 MUSIC_CMD_PITCHUP_ON RB 1 MUSIC_CMD_PITCHDOWN_ON RB 1 MUSIC_CMD_TRIPLENOTE_ON RB 1 MUSIC_CMD_EXTRA RB 1 ;*************************************************************************************************************************** ;* supported music effects ;*************************************************************************************************************************** RSRESET MUSIC_FX_NONE RB 1 MUSIC_FX_VIB1 RB 1 MUSIC_FX_VIB2 RB 1 MUSIC_FX_TRIPLEFREQ1 RB 1 MUSIC_FX_TRIPLEFREQ2 RB 1 MUSIC_FX_TRIPLEFREQ3 RB 1 MUSIC_FX_PITCHUP RB 1 MUSIC_FX_PITCHDOWN RB 1 ;*************************************************************************************************************************** ;* supported instrument commands ;*************************************************************************************************************************** RSRESET ; common commands MUSIC_INSTCMD_X_FRAMEEND RB 1 MUSIC_INSTCMD_X_START RB 1 MUSIC_INSTCMD_X_END RB 1 MUSIC_INSTCMD_X_ENVELOPE RB 1 MUSIC_INSTCMD_X_STARTFREQ RB 1 MUSIC_INSTCMD_X_ENVELOPEVOL RB 1 MUSIC_INSTCMD_X_STARTENVVOLFREQ RB 1 MUSIC_INSTCMD_X_PANMID RB 1 MUSIC_INSTCMD_X_PANRIGHT RB 1 MUSIC_INSTCMD_X_PANLEFT RB 1 ; count of common instrument commands MUSIC_INSTCMD_COMMONCOUNT RB 0 ; specific commands ; channels 1 and 2 RSSET MUSIC_INSTCMD_COMMONCOUNT MUSIC_INSTCMD_12_PULSELEN RB 1 MUSIC_INSTCMD_1_SWEEP RB 1 ; channel 3 RSSET MUSIC_INSTCMD_COMMONCOUNT MUSIC_INSTCMD_3_WAVE RB 1 MUSIC_INSTCMD_3_LEN RB 1 ; channel 4 RSSET MUSIC_INSTCMD_COMMONCOUNT MUSIC_INSTCMD_4_POLYLOAD RB 1 MUSIC_INSTCMD_4_LEN RB 1 ;*************************************************************************************************************************** ;* wSoundFXLock bit definitions ;*************************************************************************************************************************** SFXLOCKF_4_LEFT EQU AUDTERM_4_LEFT SFXLOCKF_3_LEFT EQU AUDTERM_3_LEFT SFXLOCKF_2_LEFT EQU AUDTERM_2_LEFT SFXLOCKF_1_LEFT EQU AUDTERM_1_LEFT SFXLOCKF_4_RIGHT EQU AUDTERM_4_RIGHT SFXLOCKF_3_RIGHT EQU AUDTERM_3_RIGHT SFXLOCKF_2_RIGHT EQU AUDTERM_2_RIGHT SFXLOCKF_1_RIGHT EQU AUDTERM_1_RIGHT SFXLOCKB_CHANNEL4 EQU 3 SFXLOCKB_CHANNEL3 EQU 2 SFXLOCKB_CHANNEL2 EQU 1 SFXLOCKB_CHANNEL1 EQU 0 ;*************************************************************************************************************************** ;* work ram ;*************************************************************************************************************************** IF (SOUNDSYSTEM_WRAM_BANK == 0) SECTION "SoundSystem Variables",WRAM0,ALIGN[7] ELSE SECTION "SoundSystem Variables",WRAMX,BANK[SOUNDSYSTEM_WRAM_BANK],ALIGN[7] ENDC wMusicSyncData:: DS 1 ; arbitrary value set by the song to sync visual effects with bg music ; soundfx variables wSoundFXLock: DS 1 ; bitfield (see above), 1 = Music, 0 = SFX Locked wSoundFXTable: DS 2 ; table of soundfx pointers IF (SOUNDSYSTEM_ROM_BANKING != 0) wSoundFXBank: DS sizeof_BANK_VAR ; bank of soundfxs ENDC wSoundFXStart: DS 4 ; sound fx to start wSoundFXNote: DS 1 ; sound fx's start note ; music/sfx shared variables wMusicSFXPanning:: DS 1 wMusicSFXInstPause1: DS 1 ; frames left before instrument/soundfx update for channel 1 wMusicSFXInstPause2: DS 1 ; frames left before instrument/soundfx update for channel 2 wMusicSFXInstPause3: DS 1 ; frames left before instrument/soundfx update for channel 3 wMusicSFXInstPause4: DS 1 ; frames left before instrument/soundfx update for channel 4 wMusicSFXInstPtr1: DS 2 ; pointer to playing instrument/soundfx for channel 1 wMusicSFXInstPtr2: DS 2 ; pointer to playing instrument/soundfx for channel 2 wMusicSFXInstPtr3: DS 2 ; pointer to playing instrument/soundfx for channel 3 wMusicSFXInstPtr4: DS 2 ; pointer to playing instrument/soundfx for channel 4 IF (SOUNDSYSTEM_ROM_BANKING != 0) wMusicSFXInstBank1: DS sizeof_BANK_VAR ; bank of active instrument for channel 1 wMusicSFXInstBank2: DS sizeof_BANK_VAR ; bank of active instrument for channel 2 wMusicSFXInstBank3: DS sizeof_BANK_VAR ; bank of active instrument for channel 3 wMusicSFXInstBank4: DS sizeof_BANK_VAR ; bank of active instrument for channel 4 ENDC wMusicSFXInstChnl3WaveID: DS 1 ; current waveid loaded, IDs of 255 in instruments will load, whatever the value here wMusicSFXInstChnl3Lock: DS 1 ; 0 = no lock, 1 = external lock ; music variables wMusicPlayState:: DS 1 ; current music playback state, 0 = stopped, 1 = playing wMusicNextFrame: DS 1 ; number of frames until the next music commands wMusicCommandPtr: DS 2 ; position of playing music IF (SOUNDSYSTEM_ROM_BANKING != 0) wMusicCommandBank: DS sizeof_BANK_VAR ; bank of playing music ENDC wMusicOrderPtr: DS 2 ; position of pattern order list (list of pointers to start of patterns) IF (SOUNDSYSTEM_ROM_BANKING != 0) wMusicOrderBank: DS sizeof_BANK_VAR ; bank of order list ENDC wMusicInstrumentTable: DS 2 ; table of instrument pointers IF (SOUNDSYSTEM_ROM_BANKING != 0) wMusicInstrumentBank: DS sizeof_BANK_VAR ; bank of instruments ENDC ; miscellaneous variables wChannelMask:: DS 1 ; mask for AUDTERM (NR51) wChannelMusicFreq1: DS 2 ; GB frequency of channel 1 for music backup wChannelMusicFreq2: DS 2 ; GB frequency of channel 2 for music backup wChannelMusicFreq3: DS 2 ; GB frequency of channel 3 for music backup wChannelMusicFreq4: DS 2 ; GB frequency of channel 4 for music backup wChannelMusicNote1: DS 1 ; note of channel 1 for music backup wChannelMusicNote2: DS 1 ; note of channel 2 for music backup wChannelMusicNote3: DS 1 ; note of channel 3 for music backup wChannelMusicNote4: DS 1 ; note of channel 4 for music backup wChannelFreq1: DS 2 ; GB frequency of channel 1 wChannelFreq2: DS 2 ; GB frequency of channel 2 wChannelFreq3: DS 2 ; GB frequency of channel 3 wChannelFreq4: DS 2 ; GB frequency of channel 4 wChannelVol1: DS 1 ; volumes of channel 1, byte[4:VOL,4:xxxx] wChannelVol2: DS 1 ; volumes of channel 2, byte[4:VOL,4:xxxx] wChannelVol3: DS 1 ; volumes of channel 3, byte[4:VOL,4:xxxx] wChannelVol4: DS 1 ; volumes of channel 4, byte[4:VOL,4:xxxx] wMusicSpeed: DS 1 ; speed ; effect variables wChannelMusicEffect1: DS 1 ; active effect for channel 1, 0 = none wChannelMusicEffect2: DS 1 ; active effect for channel 2, 0 = none wChannelMusicEffect3: DS 1 ; active effect for channel 3, 0 = none wChannelMusicEffect4: DS 1 ; active effect for channel 4, 0 = none wChannelMusicFXParamA1: DS 2 ; effect parameters for channel 1 wChannelMusicFXParamA2: DS 2 ; effect parameters for channel 2 wChannelMusicFXParamA3: DS 2 ; effect parameters for channel 3 wChannelMusicFXParamA4: DS 2 ; effect parameters for channel 4 wChannelMusicFXParamB1: DS 2 ; effect parameters for channel 1 wChannelMusicFXParamB2: DS 2 ; effect parameters for channel 2 wChannelMusicFXParamB3: DS 2 ; effect parameters for channel 3 wChannelMusicFXParamB4: DS 2 ; effect parameters for channel 4 wTemp: DS 2 ; temporary storage for player calcs IF (SOUNDSYSTEM_ENABLE_VUM) wVUMeter1:: DS 1 ; vu meter data for channel 1 wVUMeter2:: DS 1 ; vu meter data for channel 2 wVUMeter3:: DS 1 ; vu meter data for channel 3 wVUMeter4:: DS 1 ; vu meter data for channel 4 ENDC ;*************************************************************************************************************************** ;* Identification ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Identity",ROM0 ELSE SECTION "SoundSystem_Identity",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SoundSystem_Version:: DB "SoundSystem v20.249",$00 SoundSystem_Author:: DB "Code: S. Hockenhull",$00 ;*************************************************************************************************************************** ;* SoundSystem_Init ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Init",ROM0 ELSE SECTION "SoundSystem_Init",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SoundSystem_Init:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ; set all channel samples to 'stop' ld hl,wMusicSFXInstPtr1 ld e,4 .instptrloop: ld a,LOW(Music_InstrumentEnd) ld [hl+],a ld a,HIGH(Music_InstrumentEnd) ld [hl+],a dec e jr nz,.instptrloop IF (SOUNDSYSTEM_ROM_BANKING != 0) ; set all channel banks to be the bank with the stop instrument ld hl,wMusicSFXInstBank1 ld e,4 IF (SOUNDSYSTEM_LARGE_ROM) .instbankloop: ASSERT(BANK(Music_InstrumentEnd) == 0) ; use bank 1 instead of 0 so as to not trigger a bgb exception ld a,LOW(1) ld [hl+],a ASSERT(HIGH(1) == 0) xor a ld [hl+],a dec e jr nz,.instbankloop ELSE ld a,1 .instbankloop: ld [hl+],a dec e jr nz,.instbankloop ENDC ENDC ; set all channel volumes to 8 ld a,$80 ld hl,wChannelVol1 REPT 4 ld [hl+],a ENDR ; set all channel sfxs to unused (etc.) ld a,$FF ld hl,wSoundFXStart REPT 4 ld [hl+],a ENDR ld [wSoundFXLock],a ld [wMusicSFXPanning],a ld [wMusicSFXInstChnl3WaveID],a ; clear all channel music effects xor a ld hl,wChannelMusicEffect1 REPT 4 ld [hl+],a ENDR ld [wMusicSFXInstChnl3Lock],a ; clear all sfx pause timers ld hl,wMusicSFXInstPause1 REPT 4 ld [hl+],a ENDR ; clear all channel music frequencies ld hl,wChannelMusicFreq1 REPT 8 ld [hl+],a ENDR IF (SOUNDSYSTEM_ENABLE_VUM) ; clear all vu meter values ld hl,wVUMeter1 REPT 4 ld [hl+],a ENDR ENDC ; enable sound ld a,AUD3ENA_ON ldh [rAUDENA],a ; channel 1 xor a ldh [rAUD1SWEEP],a ; all channels off call Music_Pause ; general ld a,(AUDVOL_VIN_LEFT|AUDVOL_VIN_RIGHT) ^ $FF ; same as ~(), but ~ here triggers a false warning ldh [rAUDVOL],a ld a,AUDTERM_ALL ldh [rAUDTERM],a ld [wChannelMask],a ret ; dummy instrument to init/clear instrument pointers Music_InstrumentEnd: DB MUSIC_INSTCMD_X_END ;*************************************************************************************************************************** ;* SoundSystem_Process ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Process",ROM0 ELSE SECTION "SoundSystem_Process",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SoundSystem_Process:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC IF (SOUNDSYSTEM_ENABLE_SFX) ; sfx start process ld hl,wSoundFXStart ld c,4 .multisfx: ld a,[hl] push hl push bc xor $FF jp z,.nonewsfx ld b,a ; save IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wSoundFXBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [rROMB1],a ENDC ENDC ; lock & update SFX ld a,b ; restore cpl ; calculate table plus index address ld b,a ;save ld a,[wSoundFXTable] ld e,a ld a,[wSoundFXTable+1] ld d,a ld a,b ;restore ld b,0 add a rl b add a rl b add a ; 4 words rl b add e ld l,a ld a,0 ; can't xor a here becuase of the adc adc d add b ld h,a push hl ld a,[wSoundFXNote] add a ld l,a ld h,HIGH(FrequencyTable) ASSERT LOW(FrequencyTable) == 0 ld a,[hl+] ld [wTemp],a ld a,[hl] ld [wTemp+1],a ; store note freq pop hl ; update wSoundFXLock ld a,[wSoundFXLock] ld d,a ; load channel 1 ld a,[hl+] ld c,a ld a,[hl+] ld b,a or c jr z,.nosfxchnl1 ld a,c ld [wMusicSFXInstPtr1],a ld a,b ld [wMusicSFXInstPtr1+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wSoundFXBank] ld [wMusicSFXInstBank1],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [wMusicSFXInstBank1+1],a ENDC ENDC ld a,[wTemp] ld [wChannelFreq1],a ld a,[wTemp+1] ld [wChannelFreq1+1],a ld a,d and ~(SFXLOCKF_1_LEFT|SFXLOCKF_1_RIGHT) ld d,a ld a,1 ; set counter to immediate start ld [wMusicSFXInstPause1],a .nosfxchnl1: ; load channel 2 ld a,[hl+] ld c,a ld a,[hl+] ld b,a or c jr z,.nosfxchnl2 ld a,c ld [wMusicSFXInstPtr2],a ld a,b ld [wMusicSFXInstPtr2+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wSoundFXBank] ld [wMusicSFXInstBank2],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [wMusicSFXInstBank2+1],a ENDC ENDC ld a,[wTemp] ld [wChannelFreq2],a ld a,[wTemp+1] ld [wChannelFreq2+1],a ld a,d and ~(SFXLOCKF_2_LEFT|SFXLOCKF_2_RIGHT) ld d,a ld a,1 ; set counter to immediate start ld [wMusicSFXInstPause2],a .nosfxchnl2: ; load channel 3 ld a,[hl+] ld c,a ld a,[hl+] ld b,a or c jr z,.nosfxchnl3 ld a,[wMusicSFXInstChnl3Lock] or a jr nz,.nosfxchnl3 ld a,c ld [wMusicSFXInstPtr3],a ld a,b ld [wMusicSFXInstPtr3+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wSoundFXBank] ld [wMusicSFXInstBank3],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [wMusicSFXInstBank3+1],a ENDC ENDC ld a,[wTemp] ld [wChannelFreq3],a ld a,[wTemp+1] ld [wChannelFreq3+1],a ld a,d and ~(SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT) ld d,a ld a,1 ; set counter to immediate start ld [wMusicSFXInstPause3],a .nosfxchnl3: ; load channel 4 ld a,[hl+] ld c,a ld a,[hl+] ld b,a or c jr z,.nosfxchnl4 ld a,c ld [wMusicSFXInstPtr4],a ld a,b ld [wMusicSFXInstPtr4+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wSoundFXBank] ld [wMusicSFXInstBank4],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wSoundFXBank+1] ld [wMusicSFXInstBank4+1],a ENDC ENDC ld a,d and (SFXLOCKF_4_LEFT|SFXLOCKF_4_RIGHT) ^ $FF ; same as ~(), but ~ here triggers a false warning ld d,a ld a,1 ; set counter to immediate start ld [wMusicSFXInstPause4],a .nosfxchnl4: pop bc pop hl ; update wSoundFXLock ld a,d ld [wSoundFXLock],a ; de-flag sfx start ld a,$FF ld [hl+],a dec c jp nz,.multisfx jr .newsfxdone .nonewsfx: add sp,4 .newsfxdone: ENDC ;------------------------------- ; instruments and SFX process ;------------------------------- ; channel 1 ld hl,wMusicSFXInstPause1 dec [hl] jr nz,SSFP_Inst1UpdateDone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicSFXInstBank1] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicSFXInstBank1+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicSFXInstPtr1 ld a,[hl+] ld d,[hl] ld e,a jp SSFP_Inst1Update SSFP_Inst1UpdateFrameEnd: ; save back ld hl,wMusicSFXInstPtr1 ld a,e ld [hl+],a ld [hl],d SSFP_Inst1UpdateDone: ;------------------------------- ; channel 2 ld hl,wMusicSFXInstPause2 dec [hl] jr nz,SSFP_Inst2UpdateDone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicSFXInstBank2] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicSFXInstBank2+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicSFXInstPtr2 ld a,[hl+] ld d,[hl] ld e,a jp SSFP_Inst2Update SSFP_Inst2UpdateFrameEnd: ; save back ld hl,wMusicSFXInstPtr2 ld a,e ld [hl+],a ld [hl],d SSFP_Inst2UpdateDone: ;------------------------------- ; channel 3 ld hl,wMusicSFXInstPause3 dec [hl] jr nz,SSFP_Inst3UpdateDone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicSFXInstBank3] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicSFXInstBank3+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicSFXInstPtr3 ld a,[hl+] ld d,[hl] ld e,a jp SSFP_Inst3Update SSFP_Inst3UpdateFrameEnd: ; save back ld hl,wMusicSFXInstPtr3 ld a,e ld [hl+],a ld [hl],d SSFP_Inst3UpdateDone: ;------------------------------- ; channel 4 ld hl,wMusicSFXInstPause4 dec [hl] jr nz,SSFP_Inst4UpdateDone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicSFXInstBank4] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicSFXInstBank4+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicSFXInstPtr4 ld a,[hl+] ld d,[hl] ld e,a jp SSFP_Inst4Update SSFP_Inst4UpdateFrameEnd: ; save back ld hl,wMusicSFXInstPtr4 ld a,e ld [hl+],a ld [hl],d SSFP_Inst4UpdateDone: ;------------------------------- ; process music ld a,[wMusicPlayState] or a ; is music playing? ret z ; no, exit early (nothing to do) ;------------------------------- ; update music effects ;------------------------------- ; channel 1 ld a,[wChannelMusicEffect1] or a ; is channel 1 playing music fx? jr z,SSFP_MusicFX_Done1 ; no, skip to the next channel ; check if sound effect active (no music fx then) ld b,a ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL1,a ; is channel 1 playing fx? jr z,SSFP_MusicFX_Done1 ; no, skip to the next channel ; call the fx handler ld a,b ld hl,SSFP_MusicFX_JumpTable1 add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl SSFP_MusicFX_Done1: ; some handlers return here ;------------------------------- ; channel 2 ld a,[wChannelMusicEffect2] or a ; is channel 2 playing music fx? jr z,SSFP_MusicFX_Done2 ; no, skip to the next channel ; check if sound effect active (no music fx then) ld b,a ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL2,a ; is channel 2 playing fx? jr z,SSFP_MusicFX_Done2 ; no, skip to the next channel ; call the fx handler ld a,b ld hl,SSFP_MusicFX_JumpTable2 add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl SSFP_MusicFX_Done2: ; some handlers return here ;------------------------------- ; channel 3 ld a,[wChannelMusicEffect3] or a ; is channel 3 playing music fx? jr z,SSFP_MusicFX_Done3 ; no, skip to the next channel ; check if sound effect active (no music fx then) ld b,a ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL3,a ; is channel 3 playing fx? jr z,SSFP_MusicFX_Done3 ; no, skip to the next channel ; call the fx handler ld a,b ld hl,SSFP_MusicFX_JumpTable3 add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl SSFP_MusicFX_Done3: ; some handlers return here ;------------------------------- ; update music ; determine if music should update this frame ld a,[wMusicNextFrame] dec a ld [wMusicNextFrame],a ret nz ; no update needed IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicCommandBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicCommandBank+1] ld [rROMB1],a ENDC ENDC ; put the music command handler in de ld hl,wMusicCommandPtr ld a,[hl+] ld e,a ld d,[hl] ;------------------------------- SSFP_MusicUpdate: ; some handlers return here ld a,[de] inc de ld hl,SSFP_Music_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ;------------------------------- SSFP_MusicUpdateFrameEnd: ; some handlers return here ; update the ptr for next time ld hl,wMusicCommandPtr ld a,e ld [hl+],a ld [hl],d ret ;*************************************************************************************************************************** ;* Music_PrepareInst ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Music_PrepareInst",ROM0 ELSE SECTION "SoundSystem_Music_PrepareInst",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC Music_PrepareInst:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ld hl,wMusicInstrumentTable ld a,e ld [hl+],a ld a,d ld [hl+],a ; hl = wMusicInstrumentBank IF (SOUNDSYSTEM_ROM_BANKING != 0) ASSERT wMusicInstrumentBank == wMusicInstrumentTable+2 ld a,c ld [hl+],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,b ld [hl],a ENDC ENDC ret ;*************************************************************************************************************************** ;* Music_Play ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Music_Play",ROM0 ELSE SECTION "SoundSystem_Music_Play",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC Music_Play:: ; save current bank to restore when finished ldh a,[hCurrentBank] push af IF (SOUNDSYSTEM_ROM_BANKING != 0) push bc ENDC call Music_Pause IF (SOUNDSYSTEM_ROM_BANKING != 0) pop bc ENDC IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change to the rom bank containting the order list ld a,c ld [wMusicOrderBank],a ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,b ld [wMusicOrderBank+1],a ld [rROMB1],a ENDC ENDC ; set to advance on next frame ld a,1 ld [wMusicNextFrame],a ; clear misc variables ld a,-1 ld [wMusicSyncData],a ; clear effects xor a,a ld hl,wChannelMusicEffect1 ld [hl+],a ld [hl+],a ld [hl+],a ld [hl],a IF (SOUNDSYSTEM_ENABLE_VUM) ; clear all vu meter values ld hl,wVUMeter1 ld [hl+],a ld [hl+],a ld [hl+],a ld [hl],a ENDC ; set command pointer to value of first order ld h,d ld l,e ld a,[hl+] ld [wMusicCommandPtr],a ld a,[hl+] ld [wMusicCommandPtr+1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ld a,[hl+] ld [wMusicCommandBank],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[hl] ld [wMusicCommandBank+1],a ENDC ENDC ; set order pointer to next order ld a,e add 4 ld [wMusicOrderPtr],a ld a,d adc 0 ld [wMusicOrderPtr+1],a ; turn on the music ld a,MUSIC_STATE_PLAYING ld [wMusicPlayState],a ; restore caller's bank pop af ldh [hCurrentBank],a ld [rROMB0],a ret ;*************************************************************************************************************************** ;* Music_Pause ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Music_Pause",ROM0 ELSE SECTION "SoundSystem_Music_Pause",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC Music_Pause:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ; stop playing xor a ld [wMusicPlayState],a ; turn off channels used by music ld a,[wSoundFXLock] ld b,a ld c,AUDHIGH_RESTART ;------------------------------- ; channel 1 bit SFXLOCKB_CHANNEL1,b ; is channel 1 playing music? jr z,.nomusic1 ; no, skip to the next channel ; clear the channel 1 registers xor a ldh [rAUD1ENV],a ld a,c ldh [rAUD1HIGH],a ; set the stop command ld hl,wMusicSFXInstPtr1 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nomusic1: ;------------------------------- ; channel 2 bit SFXLOCKB_CHANNEL2,b ; is channel 2 playing music? jr z,.nomusic2 ; no, skip to the next channel ; clear the channel 2 registers xor a ldh [rAUD2ENV],a ld a,c ldh [rAUD2HIGH],a ; set the stop command ld hl,wMusicSFXInstPtr2 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nomusic2: ;------------------------------- ; channel 3 bit SFXLOCKB_CHANNEL3,b ; is channel 3 playing music? jr z,.nomusic3 ; no, skip to the next channel ; clear the channel 3 registers xor a ldh [rAUD3ENA],a ; set the stop command ld hl,wMusicSFXInstPtr3 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nomusic3: ;------------------------------- ; channel 4 bit SFXLOCKB_CHANNEL4,b ; is channel 4 playing music? ret z ; no, exit ; clear the channel 4 registers xor a ldh [rAUD4ENV],a ld a,c ldh [rAUD4GO],a ; set the stop command ld hl,wMusicSFXInstPtr4 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) ret ;*************************************************************************************************************************** ;* Music_Resume ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_Music_Resume",ROM0 ELSE SECTION "SoundSystem_Music_Resume",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC Music_Resume:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ld a,MUSIC_STATE_PLAYING ld [wMusicPlayState],a ret ;*************************************************************************************************************************** ;* SFX_Prepare ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_Prepare",ROM0 ELSE SECTION "SoundSystem_SFX_Prepare",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_Prepare:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ld hl,wSoundFXTable ld a,e ld [hl+],a ld a,d ld [hl+],a ; hl = wSoundFXBank here IF (SOUNDSYSTEM_ROM_BANKING != 0) ASSERT wSoundFXBank == wSoundFXTable+2 ld a,c ld [hl+],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,b ld [hl],a ENDC ENDC ret ENDC ;*************************************************************************************************************************** ;* SFX_Play ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_Play",ROM0 ELSE SECTION "SoundSystem_SFX_Play",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_Play:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ; find an open channel, else put it on channel 4 ld hl,wSoundFXStart ld d,4 .loop: ld a,[hl] xor $FF ; is this channel open? jr z,.found ; yes, store the sfx data inc hl dec d jr nz,.loop .found: ld a,b ld [hl],a ld a,c ld [wSoundFXNote],a ret ENDC ;*************************************************************************************************************************** ;* SFX_Stop ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_Stop",ROM0 ELSE SECTION "SoundSystem_SFX_Stop",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_Stop:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ; turn off channels used by sfx ld a,[wSoundFXLock] ld b,a ld c,AUDHIGH_RESTART ; channel 1 bit SFXLOCKB_CHANNEL1,b ; is channel 1 playing sfx? jr nz,.nosfx1 ; no, skip to the next channel xor a ld [rAUD1ENV],a ld a,c ld [rAUD1HIGH],a ld hl,wMusicSFXInstPtr1 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nosfx1: ; channel 2 bit SFXLOCKB_CHANNEL2,b ; is channel 2 playing sfx? jr nz,.nosfx2 ; no, skip to the next channel xor a ld [rAUD2ENV],a ld a,c ld [rAUD2HIGH],a ld hl,wMusicSFXInstPtr2 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nosfx2: ; channel 3 bit SFXLOCKB_CHANNEL3,b ; is channel 3 playing sfx? jr nz,.nosfx3 ; no, skip to the next channel ld a,[wMusicSFXInstChnl3Lock] or a jr nz,.nosfx3 ld [rAUD3ENA],a ; a = 0 here ld hl,wMusicSFXInstPtr3 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) .nosfx3: ; channel 4 bit SFXLOCKB_CHANNEL4,b ; is channel 4 playing sfx? ret nz ; no, exit xor a ld [rAUD4ENV],a ld a,c ld [rAUD4GO],a ld hl,wMusicSFXInstPtr4 ld [hl],LOW(Music_InstrumentEnd) inc l ld [hl],HIGH(Music_InstrumentEnd) ret ENDC ;*************************************************************************************************************************** ;* SFX_LockChannel3 ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_LockChannel3",ROM0 ELSE SECTION "SoundSystem_SFX_LockChannel3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_LockChannel3:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC ld a,1 ld [wMusicSFXInstChnl3Lock],a ld a,[wSoundFXLock] and ~(SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT) ld [wSoundFXLock],a ld hl,wMusicSFXInstPtr1 ld a,LOW(Music_InstrumentEnd) ld [hl+],a ld a,HIGH(Music_InstrumentEnd) ld [hl],a ret ENDC ;*************************************************************************************************************************** ;* SFX_UnlockChannel3 ;*************************************************************************************************************************** IF (SOUNDSYSTEM_ENABLE_SFX) IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SFX_UnlockChannel3",ROM0 ELSE SECTION "SoundSystem_SFX_UnlockChannel3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SFX_UnlockChannel3:: IF (SOUNDSYSTEM_WRAM_BANK != 0) ld a,SOUNDSYSTEM_WRAM_BANK ldh [rSVBK],a ENDC xor a ld [wMusicSFXInstChnl3Lock],a ld a,[wSoundFXLock] or SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT ld [wSoundFXLock],a ret ENDC ;*************************************************************************************************************************** ;* music fx handlers ;*************************************************************************************************************************** ; channel 1 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_VIB1: ld hl,wChannelFreq1 ld a,[hl] add 1 ; can't use inc a here because of the adc ld [hl+],a ldh [rAUD1LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD1HIGH],a ld hl,wChannelMusicFXParamA1+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done1 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB2 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_VIB2: ld hl,wChannelFreq1 ld a,[hl] add $FF ; can't use dec a here because of the adc ld [hl+],a ldh [rAUD1LOW],a ld a,[hl] adc $FF and $07 ld [hl],a ldh [rAUD1HIGH],a ld hl,wChannelMusicFXParamA1+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done1 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB1 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_TF1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_TF1: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote1] ld c,a ld a,[wChannelMusicFXParamA1] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD1LOW],a ld a,[hl] ldh [rAUD1HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ2 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_TF2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_TF2: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote1] ld c,a ld a,[wChannelMusicFXParamA1+1] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD1LOW],a ld a,[hl] ldh [rAUD1HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ3 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_TF3",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_TF3: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote1] add a ld l,a ld a,[hl+] ldh [rAUD1LOW],a ld a,[hl] ldh [rAUD1HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ1 ld [wChannelMusicEffect1],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHUP",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_PITCHUP: ld hl,wChannelMusicFXParamA1 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done1 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB1 ld b,[hl] ld hl,wChannelFreq1 ld a,[hl] add b ld [hl+],a ldh [rAUD1LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD1HIGH],a jp SSFP_MusicFX_Done1 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHDOWN",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX1_PITCHDOWN: ld hl,wChannelMusicFXParamA1 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done1 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB1 ld b,[hl] ld hl,wChannelFreq1 ld a,[hl] sub b ld [hl+],a ldh [rAUD1LOW],a ld a,[hl] sbc 0 and $07 ld [hl],a ldh [rAUD1HIGH],a jp SSFP_MusicFX_Done1 ; ========================================================================================================================== ; channel 2 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_VIB1: ld hl,wChannelFreq2 ld a,[hl] add 1 ; can't use inc a here because of the adc ld [hl+],a ldh [rAUD2LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD2HIGH],a ld hl,wChannelMusicFXParamA2+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done2 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB2 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_VIB2: ld hl,wChannelFreq2 ld a,[hl] add $FF ; can't use dec a here because of the adc ld [hl+],a ldh [rAUD2LOW],a ld a,[hl] adc $FF and $07 ld [hl],a ldh [rAUD2HIGH],a ld hl,wChannelMusicFXParamA2+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done2 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB1 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_TF1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_TF1: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote2] ld c,a ld a,[wChannelMusicFXParamA2] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD2LOW],a ld a,[hl] ldh [rAUD2HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ2 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_TF2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_TF2: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote2] ld c,a ld a,[wChannelMusicFXParamA2+1] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD2LOW],a ld a,[hl] ldh [rAUD2HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ3 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_TF3",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_TF3: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote2] add a ld l,a ld a,[hl+] ldh [rAUD2LOW],a ld a,[hl] ldh [rAUD2HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ1 ld [wChannelMusicEffect2],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHUP",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_PITCHUP: ld hl,wChannelMusicFXParamA2 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done2 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB2 ld b,[hl] ld hl,wChannelFreq2 ld a,[hl] add b ld [hl+],a ldh [rAUD2LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD2HIGH],a jp SSFP_MusicFX_Done2 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHDOWN",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX2_PITCHDOWN: ld hl,wChannelMusicFXParamA2 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done2 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB2 ld b,[hl] ld hl,wChannelFreq2 ld a,[hl] sub b ld [hl+],a ldh [rAUD2LOW],a ld a,[hl] sbc 0 and $07 ld [hl],a ldh [rAUD2HIGH],a jp SSFP_MusicFX_Done2 ; ========================================================================================================================== ; channel 3 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_VIB1: ld hl,wChannelFreq3 ld a,[hl] add 1 ; can't use inc a here because of the adc ld [hl+],a ldh [rAUD3LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD3HIGH],a ld hl,wChannelMusicFXParamA3+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done3 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB2 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_VIB2: ld hl,wChannelFreq3 ld a,[hl] add $FF ; can't use dec a here because of the adc ld [hl+],a ldh [rAUD3LOW],a ld a,[hl] adc $FF and $07 ld [hl],a ldh [rAUD3HIGH],a ld hl,wChannelMusicFXParamA3+1 dec [hl] dec hl jp nz,SSFP_MusicFX_Done3 ld a,[hl+] ld [hl],a ; store the fx id ld a,MUSIC_FX_VIB1 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_TF1",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_TF1: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote3] ld c,a ld a,[wChannelMusicFXParamA3] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD3LOW],a ld a,[hl] ldh [rAUD3HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ2 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_TF2",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_TF2: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote3] ld c,a ld a,[wChannelMusicFXParamA3+1] add c cp NUM_NOTES jr c,.noteok ld a,NUM_NOTES-1 .noteok: add a ld l,a ld a,[hl+] ldh [rAUD3LOW],a ld a,[hl] ldh [rAUD3HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ3 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_TF3",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_TF3: ld hl,FrequencyTable ASSERT LOW(FrequencyTable) == 0 ld a,[wChannelMusicNote3] add a ld l,a ld a,[hl+] ldh [rAUD3LOW],a ld a,[hl] ldh [rAUD3HIGH],a ; store the fx id ld a,MUSIC_FX_TRIPLEFREQ1 ld [wChannelMusicEffect3],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHUP",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_PITCHUP: ld hl,wChannelMusicFXParamA3 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done3 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB3 ld b,[hl] ld hl,wChannelFreq3 ld a,[hl] add b ld [hl+],a ldh [rAUD3LOW],a ld a,[hl] adc 0 and $07 ld [hl],a ldh [rAUD3HIGH],a jp SSFP_MusicFX_Done3 ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHDOWN",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_FX3_PITCHDOWN: ld hl,wChannelMusicFXParamA3 ld a,[hl] dec a ld [hl+],a jp nz,SSFP_MusicFX_Done3 ld a,[hl-] ld [hl],a ld hl,wChannelMusicFXParamB3 ld b,[hl] ld hl,wChannelFreq3 ld a,[hl] sub b ld [hl+],a ldh [rAUD3LOW],a ld a,[hl] sbc 0 and $07 ld [hl],a ldh [rAUD3HIGH],a jp SSFP_MusicFX_Done3 ;*************************************************************************************************************************** ;* music command handlers ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME: ld a,[de] inc de ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_PLAYINST/NOTE",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_PLAYINST/NOTE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_PLAYINSTNOTE: ld a,[de] inc de ld l,a ld a,[de] and $03 ld b,HIGH(wChannelMusicNote1) add LOW(wChannelMusicNote1) ld c,a ld a,l ld [bc],a ld a,l add a ld l,a ld h,HIGH(FrequencyTable) ASSERT LOW(FrequencyTable) == 0 ld b,HIGH(wChannelMusicFreq1) ld a,[de] and $03 add a add LOW(wChannelMusicFreq1) ld c,a ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a ; store note freq ; fall-through ; -------------------------------------------------------------------------------------------------------------------------- SSFP_MUSIC_CMD_PLAYINST: ld a,[de] inc de ld b,a ;save and $FC srl a ld c,a ld hl,wMusicInstrumentTable ld a,[hl+] add c ld c,a ld a,[hl] adc 0 ld h,a ld l,c ; check for lock ld a,[wSoundFXLock] ld c,a ld a,b ;restore and $03 jp z,.playchannel1 dec a jr z,.playchannel2 dec a jr z,.playchannel3 .playchannel4: bit SFXLOCKB_CHANNEL4,c jp z,.channeldone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicInstrumentBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [rROMB1],a ENDC ENDC ld a,[hl+] ld [wMusicSFXInstPtr4],a ld a,[hl] ld [wMusicSFXInstPtr4+1],a ld a,1 ld [wMusicSFXInstPause4],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wMusicInstrumentBank] ld [wMusicSFXInstBank4],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [wMusicSFXInstBank4+1],a ENDC ENDC ld hl,wChannelMusicFreq4 ld bc,wChannelFreq4 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jr .channeldone .playchannel2: bit SFXLOCKB_CHANNEL2,c jr z,.channeldone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicInstrumentBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [rROMB1],a ENDC ENDC ld a,[hl+] ld [wMusicSFXInstPtr2],a ld a,[hl] ld [wMusicSFXInstPtr2+1],a ld a,1 ld [wMusicSFXInstPause2],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wMusicInstrumentBank] ld [wMusicSFXInstBank2],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [wMusicSFXInstBank2+1],a ENDC ENDC ld hl,wChannelMusicFreq2 ld bc,wChannelFreq2 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jr .channeldone .playchannel3: bit SFXLOCKB_CHANNEL3,c jr z,.channeldone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicInstrumentBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [rROMB1],a ENDC ENDC ld a,[hl+] ld [wMusicSFXInstPtr3],a ld a,[hl] ld [wMusicSFXInstPtr3+1],a ld a,1 ld [wMusicSFXInstPause3],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wMusicInstrumentBank] ld [wMusicSFXInstBank3],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [wMusicSFXInstBank3+1],a ENDC ENDC ld hl,wChannelMusicFreq3 ld bc,wChannelFreq3 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jr .channeldone .playchannel1: bit SFXLOCKB_CHANNEL1,c jr z,.channeldone IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicInstrumentBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [rROMB1],a ENDC ENDC ld a,[hl+] ld [wMusicSFXInstPtr1],a ld a,[hl] ld [wMusicSFXInstPtr1+1],a ld a,1 ld [wMusicSFXInstPause1],a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; update the rom bank ld a,[wMusicInstrumentBank] ld [wMusicSFXInstBank1],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicInstrumentBank+1] ld [wMusicSFXInstBank1+1],a ENDC ENDC ld hl,wChannelMusicFreq1 ld bc,wChannelFreq1 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a .channeldone: IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicCommandBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicCommandBank+1] ld [rROMB1],a ENDC ENDC jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_SETVOLUME",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_SETVOLUME",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_SETVOLUME: ld a,[de] inc de ld c,a and $03 add LOW(wChannelVol1) ld l,a ld a,HIGH(wChannelVol1) adc 0 ld h,a ld a,c and $F0 ld [hl],a jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_VIBRATO_ON",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_VIBRATO_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_VIBRATO_ON: ld a,[de] ld c,a and $03 add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_VIB1 sub LOW(wChannelMusicEffect1) add a add LOW(wChannelMusicFXParamA1) ld c,a ld b,HIGH(wChannelMusicFXParamA1) ld a,[de] swap a and $0F ld [bc],a ; store max inc bc ld l,a and $01 srl l or l ld [bc],a ; store max inc de jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_EFFECT_OFF",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_EFFECT_OFF",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_EFFECT_OFF: ld a,[de] inc de add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_NONE jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_SYNCFLAG",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_SYNCFLAG",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_SYNCFLAG: ld a,[de] inc de ld [wMusicSyncData],a jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFPATTERN",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFPATTERN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFPATTERN: IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change the rom bank ld a,[wMusicOrderBank] ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[wMusicOrderBank+1] ld [rROMB1],a ENDC ENDC ld hl,wMusicOrderPtr ld a,[hl+] ld h,[hl] ld l,a add 4 ld [wMusicOrderPtr],a ld a,h adc 0 ld [wMusicOrderPtr+1],a ld a,[hl+] ld e,a ld a,[hl+] ld d,a IF (SOUNDSYSTEM_ROM_BANKING != 0) ; change and update the rom bank ld a,[hl+] ld [wMusicCommandBank],a ld [rROMB0],a IF (SOUNDSYSTEM_LARGE_ROM != 0) ld a,[hl] ld [wMusicCommandBank+1],a ld [rROMB1],a ENDC ENDC ld a,1 ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_GOTOORDER",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_GOTOORDER",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_GOTOORDER: ld a,[wMusicOrderPtr] ld c,a ld a,[wMusicOrderPtr+1] ld b,a ld a,[de] inc de ld l,a ld a,[de] inc de ld h,a add hl,bc ld a,h ld [wMusicOrderPtr+1],a ld a,l ld [wMusicOrderPtr],a jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFSONG",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFSONG",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFSONG: xor a ld [wMusicPlayState],a dec de jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_SETSPEED",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_SETSPEED",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_SETSPEED: ld a,[de] inc de ld [wMusicSpeed],a jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME1X",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME1X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME1X: ld a,[wMusicSpeed] ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME2X",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME2X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME2X: ld a,[wMusicSpeed] add a ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME3X",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME3X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME3X: ld a,[wMusicSpeed] ld c,a add a add c ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME4X",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME4X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_ENDOFFRAME4X: ld a,[wMusicSpeed] add a add a ld [wMusicNextFrame],a jp SSFP_MusicUpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_PITCHUPDOWN_ON",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_PITCHUPDOWN_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_PITCHUP_ON: ld a,[de] and $03 add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_PITCHUP jr SSFP_MUSIC_CMD_PITCHUP_reuse SSFP_MUSIC_CMD_PITCHDOWN_ON: ld a,[de] and $03 add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_PITCHDOWN SSFP_MUSIC_CMD_PITCHUP_reuse: sub LOW(wChannelMusicEffect1) add a add LOW(wChannelMusicFXParamA1) ld c,a ld b,HIGH(wChannelMusicFXParamA1) ld a,[de] swap a and $0F ld [bc],a ; store max inc c ld [bc],a ; store max ld a,7 add c ld c,a ld a,[de] srl a srl a and $03 inc a ld [bc],a inc de jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_TRIPLENOTE_ON",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_TRIPLENOTE_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_TRIPLENOTE_ON: ld a,[de] inc de ; note ld l,a ld b,HIGH(wChannelMusicFXParamA1) ld a,[de] and $03 add a add LOW(wChannelMusicFXParamA1) ld c,a ld a,l swap a and $0F ld [bc],a inc c ld a,l and $0F ld [bc],a ; store note freq ld a,[de] inc de ld c,a and $03 add LOW(wChannelMusicEffect1) ld h,HIGH(wChannelMusicEffect1) ld l,a ld [hl],MUSIC_FX_TRIPLEFREQ1 jp SSFP_MusicUpdate ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_MUSIC_CMD_EXTRA",ROM0 ELSE SECTION "SoundSystem_SSFP_MUSIC_CMD_EXTRA",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_MUSIC_CMD_EXTRA: ld a,[de] inc de ld c,a and $03 jr z,SSFP_MUSIC_CMD_EXTRA_chnl1 dec a jr z,SSFP_MUSIC_CMD_EXTRA_chnl2 dec a jr z,SSFP_MUSIC_CMD_EXTRA_chnl3 ; chnl 4 jp SSFP_MusicUpdate SSFP_MUSIC_CMD_EXTRA_chnl1: ld a,c and $FC ldh [rAUD1LEN],a jp SSFP_MusicUpdate SSFP_MUSIC_CMD_EXTRA_chnl2: ld a,c and $FC ldh [rAUD2LEN],a jp SSFP_MusicUpdate SSFP_MUSIC_CMD_EXTRA_chnl3: ld a,[wMusicSFXInstChnl3Lock] or a jp nz,SSFP_MusicUpdate ld a,c and $FC ldh [rAUD3LEVEL],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a sla a and $0C dec a xor $0C ld [wVUMeter3],a ENDC jp SSFP_MusicUpdate ;*************************************************************************************************************************** ;* instrument command handlers ;*************************************************************************************************************************** ; channel 1 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1Update",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1Update: ld a,[de] inc de ld hl,SSFP_Inst1_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_FRAMEEND",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_FRAMEEND: ld a,[de] inc de ld [wMusicSFXInstPause1],a ; load new pause jp SSFP_Inst1UpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_START",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_START: ld a,[wChannelFreq1] ldh [rAUD1LOW],a ld a,[de] inc de ld hl,wChannelFreq1+1 or [hl] ldh [rAUD1HIGH],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_END",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_END: dec de ; rewind counter ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL1,a jp nz,SSFP_Inst1UpdateFrameEnd or SFXLOCKF_1_LEFT|SFXLOCKF_1_RIGHT ld [wSoundFXLock],a ; restore music freq ld hl,wChannelMusicFreq1 ld bc,wChannelFreq1 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jp SSFP_Inst1UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait) ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_ENVELOPE: ld a,[de] inc de ld hl,wChannelVol1 or [hl] ldh [rAUD1ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter1],a ENDC jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_STARTFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_STARTFREQ: ld a,[de] inc de ldh [rAUD1LOW],a ld a,[de] inc de ldh [rAUD1HIGH],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPEVOL",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_ENVELOPEVOL: ld a,[de] inc de ldh [rAUD1ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter1],a ENDC jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_STARTENVVOLFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_STARTENVVOLFREQ: ld a,[de] inc de ldh [rAUD1ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter1],a ENDC ld a,[de] inc de ldh [rAUD1LOW],a ld a,[de] inc de ldh [rAUD1HIGH],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_PANMID",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_PANMID: ld hl,wMusicSFXPanning ld a,AUDTERM_1_LEFT|AUDTERM_1_RIGHT or [hl] ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_PANRIGHT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_PANRIGHT: ld hl,wMusicSFXPanning ld a,AUDTERM_1_RIGHT or [hl] and ~AUDTERM_1_LEFT ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_PANLEFT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_PANLEFT: ld hl,wMusicSFXPanning ld a,AUDTERM_1_LEFT or [hl] and ~AUDTERM_1_RIGHT ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_PULSELEN",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_PULSELEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_PULSELEN: ld a,[de] inc de ldh [rAUD1LEN],a jp SSFP_Inst1Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst1_CMD_SWEEP",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst1_CMD_SWEEP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst1_CMD_SWEEP: ld a,[de] inc de ldh [rAUD1SWEEP],a jp SSFP_Inst1Update ; ========================================================================================================================== ; channel 2 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2Update",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2Update: ld a,[de] inc de ld hl,SSFP_Inst2_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_FRAMEEND",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_FRAMEEND: ld a,[de] inc de ld [wMusicSFXInstPause2],a ; load new pause jp SSFP_Inst2UpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_START",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_START: ld a,[wChannelFreq2] ldh [rAUD2LOW],a ld a,[de] inc de ld hl,wChannelFreq2+1 or [hl] ldh [rAUD2HIGH],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_END",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_END: dec de ; rewind counter ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL2,a jp nz,SSFP_Inst2UpdateFrameEnd or SFXLOCKF_2_LEFT|SFXLOCKF_2_RIGHT ld [wSoundFXLock],a ; restore music freq ld hl,wChannelMusicFreq2 ld bc,wChannelFreq2 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jp SSFP_Inst2UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait) ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_ENVELOPE: ld a,[de] inc de ld hl,wChannelVol2 or [hl] ldh [rAUD2ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter2],a ENDC jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_STARTFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_STARTFREQ: ld a,[de] inc de ldh [rAUD2LOW],a ld a,[de] inc de ldh [rAUD2HIGH],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPEVOL",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_ENVELOPEVOL: ld a,[de] inc de ldh [rAUD2ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter2],a ENDC jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_STARTENVVOLFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_STARTENVVOLFREQ: ld a,[de] inc de ldh [rAUD2ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter2],a ENDC ld a,[de] inc de ldh [rAUD2LOW],a ld a,[de] inc de ldh [rAUD2HIGH],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_PANMID",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_PANMID: ld hl,wMusicSFXPanning ld a,AUDTERM_2_LEFT|AUDTERM_2_RIGHT or [hl] ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_PANRIGHT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_PANRIGHT: ld hl,wMusicSFXPanning ld a,AUDTERM_2_RIGHT or [hl] and ~AUDTERM_2_LEFT ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_PANLEFT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_PANLEFT: ld hl,wMusicSFXPanning ld a,AUDTERM_2_LEFT or [hl] and ~AUDTERM_2_RIGHT ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_PULSELEN",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_PULSELEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_PULSELEN: ld a,[de] inc de ldh [rAUD2LEN],a jp SSFP_Inst2Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst2_CMD_SWEEP",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst2_CMD_SWEEP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst2_CMD_SWEEP: inc de ; ignore jp SSFP_Inst2Update ; ========================================================================================================================== ; channel 3 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3Update",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3Update: ld a,[de] inc de ld hl,SSFP_Inst3_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_FRAMEEND",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_FRAMEEND: ld a,[de] inc de ld [wMusicSFXInstPause3],a ; load new pause jp SSFP_Inst3UpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_START",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_START: ld a,[wChannelFreq3] ldh [rAUD3LOW],a ld a,AUD3ENA_ON ldh [rAUD3ENA],a ld a,[de] inc de ld hl,wChannelFreq3+1 or [hl] ldh [rAUD3HIGH],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_END",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_END: dec de ; rewind counter xor a ldh [rAUD3ENA],a IF (SOUNDSYSTEM_ENABLE_VUM) ld [wVUMeter3],a ENDC ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL3,a jp nz,SSFP_Inst3UpdateFrameEnd or SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT ld [wSoundFXLock],a ; restore music freq ld hl,wChannelMusicFreq3 ld bc,wChannelFreq3 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jp SSFP_Inst3UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait) ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_ENVELOPE: ld a,[de] inc de ld hl,wChannelVol3 or [hl] ldh [rAUD3LEVEL],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a sla a and $0C dec a xor $0C ld [wVUMeter3],a ENDC jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_STARTFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_STARTFREQ: ld a,[de] inc de ldh [rAUD3LOW],a ld a,AUD3ENA_ON ldh [rAUD3ENA],a ld a,[de] inc de ldh [rAUD3HIGH],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPEVOL",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_ENVELOPEVOL: ld a,[de] inc de ldh [rAUD3LEVEL],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a sla a and $0C dec a xor $0C ld [wVUMeter3],a ENDC jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_STARTENVVOLFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_STARTENVVOLFREQ: ld a,[de] inc de ldh [rAUD3LEVEL],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a sla a and $0C dec a xor $0C ld [wVUMeter3],a ENDC ld a,[de] inc de ldh [rAUD3LOW],a ld a,AUD3ENA_ON ldh [rAUD3ENA],a ld a,[de] inc de ldh [rAUD3HIGH],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_PANMID",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_PANMID: ld hl,wMusicSFXPanning ld a,AUDTERM_3_LEFT|AUDTERM_3_RIGHT or [hl] ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_PANRIGHT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_PANRIGHT: ld hl,wMusicSFXPanning ld a,AUDTERM_3_RIGHT or [hl] and ~AUDTERM_3_LEFT ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_PANLEFT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_PANLEFT: ld hl,wMusicSFXPanning ld a,AUDTERM_3_LEFT or [hl] and ~AUDTERM_3_RIGHT ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_WAVE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_WAVE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_WAVE: ld hl,wMusicSFXInstChnl3WaveID ld a,[de] inc de cp 255 jr z,.loadlong cp [hl] jr z,.skip .loadlong: ld hl,_AUD3WAVERAM xor a ldh [rAUD3ENA],a REPT 16 ld a,[de] inc de ld [hl+],a ENDR jp SSFP_Inst3Update .skip: ld a,e add 16 ld e,a ld a,d adc 0 ld d,a jp SSFP_Inst3Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst3_CMD_LEN",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst3_CMD_LEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst3_CMD_LEN: ld a,[de] inc de ldh [rAUD3LEN],a jp SSFP_Inst3Update ; ========================================================================================================================== ; channel 4 IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4Update",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4Update: ld a,[de] inc de ld hl,SSFP_Inst4_JumpTable add a add l ld l,a ld a,[hl+] ld h,[hl] ld l,a jp hl ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_FRAMEEND",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_FRAMEEND: ld a,[de] inc de ld [wMusicSFXInstPause4],a ; load new pause jp SSFP_Inst4UpdateFrameEnd ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_START",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_START: ld a,[de] inc de ldh [rAUD4GO],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_END",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_END: dec de ; rewind counter ld a,[wSoundFXLock] bit SFXLOCKB_CHANNEL4,a jp nz,SSFP_Inst4UpdateFrameEnd or SFXLOCKF_4_LEFT|SFXLOCKF_4_RIGHT ld [wSoundFXLock],a ; restore music freq ld hl,wChannelMusicFreq4 ld bc,wChannelFreq4 ld a,[hl+] ld [bc],a inc c ld a,[hl] ld [bc],a jp SSFP_Inst4UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait) ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPE",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_ENVELOPE: ld a,[de] inc de ld hl,wChannelVol4 or [hl] ldh [rAUD4ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter4],a ENDC jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_STARTFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_STARTFREQ: ld a,[de] inc de ldh [rAUD4POLY],a ld a,[de] inc de ldh [rAUD4GO],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPEVOL",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_ENVELOPEVOL: ld a,[de] inc de ldh [rAUD4ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter4],a ENDC jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_STARTENVVOLFREQ",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_STARTENVVOLFREQ: ld a,[de] inc de ldh [rAUD4ENV],a IF (SOUNDSYSTEM_ENABLE_VUM) swap a and $0F ld [wVUMeter4],a ENDC ld a,[de] inc de ldh [rAUD4POLY],a ld a,[de] inc de ldh [rAUD4GO],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_PANMID",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_PANMID: ld hl,wMusicSFXPanning ld a,AUDTERM_4_LEFT|AUDTERM_4_RIGHT or [hl] ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_PANRIGHT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_PANRIGHT: ld hl,wMusicSFXPanning ld a,AUDTERM_4_RIGHT or [hl] and AUDTERM_4_LEFT ^ $FF ; same as ~, but ~ here triggers a false warning ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_PANLEFT",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_PANLEFT: ld hl,wMusicSFXPanning ld a,AUDTERM_4_LEFT or [hl] and ~AUDTERM_4_RIGHT ld [hl],a ld a,[wChannelMask] and [hl] ldh [rAUDTERM],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_POLYLOAD",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_POLYLOAD",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_POLYLOAD: ld a,[de] inc de ldh [rAUD4POLY],a jp SSFP_Inst4Update ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem_SSFP_Inst4_CMD_LEN",ROM0 ELSE SECTION "SoundSystem_SSFP_Inst4_CMD_LEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK] ENDC SSFP_Inst4_CMD_LEN: ld a,[de] inc de ldh [rAUD4LEN],a jp SSFP_Inst4Update ;*************************************************************************************************************************** ;* tables of fx/command handlers ;*************************************************************************************************************************** IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Music FX Table 1",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Music FX Table 1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_MusicFX_JumpTable1: DW $0000 ; dummy DW SSFP_MUSIC_FX1_VIB1 DW SSFP_MUSIC_FX1_VIB2 DW SSFP_MUSIC_FX1_TF1 DW SSFP_MUSIC_FX1_TF2 DW SSFP_MUSIC_FX1_TF3 DW SSFP_MUSIC_FX1_PITCHUP DW SSFP_MUSIC_FX1_PITCHDOWN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Music FX Table 2",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Music FX Table 2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_MusicFX_JumpTable2: DW $0000 ; dummy DW SSFP_MUSIC_FX2_VIB1 DW SSFP_MUSIC_FX2_VIB2 DW SSFP_MUSIC_FX2_TF1 DW SSFP_MUSIC_FX2_TF2 DW SSFP_MUSIC_FX2_TF3 DW SSFP_MUSIC_FX2_PITCHUP DW SSFP_MUSIC_FX2_PITCHDOWN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Music FX Table 3",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Music FX Table 3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_MusicFX_JumpTable3: DW $0000 ; dummy DW SSFP_MUSIC_FX3_VIB1 DW SSFP_MUSIC_FX3_VIB2 DW SSFP_MUSIC_FX3_TF1 DW SSFP_MUSIC_FX3_TF2 DW SSFP_MUSIC_FX3_TF3 DW SSFP_MUSIC_FX3_PITCHUP DW SSFP_MUSIC_FX3_PITCHDOWN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Music Table",ROM0,ALIGN[6] ELSE SECTION "SoundSystem Music Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[6] ENDC SSFP_Music_JumpTable: DW SSFP_MUSIC_CMD_ENDOFFRAME DW SSFP_MUSIC_CMD_PLAYINSTNOTE DW SSFP_MUSIC_CMD_PLAYINST DW SSFP_MUSIC_CMD_SETVOLUME DW SSFP_MUSIC_CMD_VIBRATO_ON DW SSFP_MUSIC_CMD_EFFECT_OFF DW SSFP_MUSIC_CMD_SYNCFLAG DW SSFP_MUSIC_CMD_ENDOFPATTERN DW SSFP_MUSIC_CMD_GOTOORDER DW SSFP_MUSIC_CMD_ENDOFSONG DW SSFP_MUSIC_CMD_SETSPEED DW SSFP_MUSIC_CMD_ENDOFFRAME1X DW SSFP_MUSIC_CMD_ENDOFFRAME2X DW SSFP_MUSIC_CMD_ENDOFFRAME3X DW SSFP_MUSIC_CMD_ENDOFFRAME4X DW SSFP_MUSIC_CMD_PITCHUP_ON DW SSFP_MUSIC_CMD_PITCHDOWN_ON DW SSFP_MUSIC_CMD_TRIPLENOTE_ON DW SSFP_MUSIC_CMD_EXTRA ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Inst1 Table",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Inst1 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_Inst1_JumpTable: ; common commands DW SSFP_Inst1_CMD_FRAMEEND DW SSFP_Inst1_CMD_START DW SSFP_Inst1_CMD_END DW SSFP_Inst1_CMD_ENVELOPE DW SSFP_Inst1_CMD_STARTFREQ DW SSFP_Inst1_CMD_ENVELOPEVOL DW SSFP_Inst1_CMD_STARTENVVOLFREQ DW SSFP_Inst1_CMD_PANMID DW SSFP_Inst1_CMD_PANRIGHT DW SSFP_Inst1_CMD_PANLEFT ; specific commands DW SSFP_Inst1_CMD_PULSELEN DW SSFP_Inst1_CMD_SWEEP ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Inst2 Table",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Inst2 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_Inst2_JumpTable: ; common commands DW SSFP_Inst2_CMD_FRAMEEND DW SSFP_Inst2_CMD_START DW SSFP_Inst2_CMD_END DW SSFP_Inst2_CMD_ENVELOPE DW SSFP_Inst2_CMD_STARTFREQ DW SSFP_Inst2_CMD_ENVELOPEVOL DW SSFP_Inst2_CMD_STARTENVVOLFREQ DW SSFP_Inst2_CMD_PANMID DW SSFP_Inst2_CMD_PANRIGHT DW SSFP_Inst2_CMD_PANLEFT ; specific commands DW SSFP_Inst2_CMD_PULSELEN DW SSFP_Inst2_CMD_SWEEP ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Inst3 Table",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Inst3 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_Inst3_JumpTable: ; common commands DW SSFP_Inst3_CMD_FRAMEEND DW SSFP_Inst3_CMD_START DW SSFP_Inst3_CMD_END DW SSFP_Inst3_CMD_ENVELOPEVOL ; prevent crash DW SSFP_Inst3_CMD_STARTFREQ DW SSFP_Inst3_CMD_ENVELOPEVOL DW SSFP_Inst3_CMD_STARTENVVOLFREQ DW SSFP_Inst3_CMD_PANMID DW SSFP_Inst3_CMD_PANRIGHT DW SSFP_Inst3_CMD_PANLEFT ; specific commands DW SSFP_Inst3_CMD_WAVE DW SSFP_Inst3_CMD_LEN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Inst4 Table",ROM0,ALIGN[5] ELSE SECTION "SoundSystem Inst4 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5] ENDC SSFP_Inst4_JumpTable: ; common commands DW SSFP_Inst4_CMD_FRAMEEND DW SSFP_Inst4_CMD_START DW SSFP_Inst4_CMD_END DW SSFP_Inst4_CMD_ENVELOPE DW SSFP_Inst4_CMD_STARTFREQ DW SSFP_Inst4_CMD_ENVELOPEVOL DW SSFP_Inst4_CMD_STARTENVVOLFREQ DW SSFP_Inst4_CMD_PANMID DW SSFP_Inst4_CMD_PANRIGHT DW SSFP_Inst4_CMD_PANLEFT ; specific commands DW SSFP_Inst4_CMD_POLYLOAD DW SSFP_Inst4_CMD_LEN ; -------------------------------------------------------------------------------------------------------------------------- IF (SOUNDSYSTEM_CODE_BANK == 0) SECTION "SoundSystem Frequency Table",ROM0,ALIGN[8] ELSE SECTION "SoundSystem Frequency Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[8] ENDC FrequencyTable: ; C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B DW $0020,$0091,$00FC,$0160,$01C0,$0219,$026E,$02BE,$030a,$0351,$0394,$03D4 ; octave 2 DW $0410,$0448,$047E,$04B0,$04E0,$050D,$0537,$055F,$0585,$05A8,$05Ca,$05EA ; octave 3 DW $0608,$0624,$063F,$0658,$0670,$0686,$069C,$06B0,$06C2,$06D4,$06E5,$06F5 ; octave 4 DW $0704,$0712,$071F,$072C,$0738,$0743,$074E,$0758,$0761,$076a,$0773,$077A ; octave 5 DW $0782,$0789,$0790,$0796,$079C,$07A2,$07A7,$07AC,$07B1,$07B5,$07B9,$07BD ; octave 6 DW $07C1,$07C5,$07C8,$07CB,$07CE,$07D1,$07D3,$07D6,$07D8,$07DB,$07DD,$07DF ; octave 7
//===--- CGBlocks.cpp - Emit LLVM Code for declarations ---------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This contains code to emit blocks. // //===----------------------------------------------------------------------===// #include "CGBlocks.h" #include "CGDebugInfo.h" #include "CGObjCRuntime.h" #include "CodeGenFunction.h" #include "CodeGenModule.h" #include "clang/CodeGen/ConstantInitBuilder.h" #include "clang/AST/DeclObjC.h" #include "llvm/ADT/SmallSet.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Module.h" #include <algorithm> #include <cstdio> using namespace clang; using namespace CodeGen; CGBlockInfo::CGBlockInfo(const BlockDecl *block, StringRef name) : Name(name), CXXThisIndex(0), CanBeGlobal(false), NeedsCopyDispose(false), HasCXXObject(false), UsesStret(false), HasCapturedVariableLayout(false), LocalAddress(Address::invalid()), StructureType(nullptr), Block(block), DominatingIP(nullptr) { // Skip asm prefix, if any. 'name' is usually taken directly from // the mangled name of the enclosing function. if (!name.empty() && name[0] == '\01') name = name.substr(1); } // Anchor the vtable to this translation unit. BlockByrefHelpers::~BlockByrefHelpers() {} /// Build the given block as a global block. static llvm::Constant *buildGlobalBlock(CodeGenModule &CGM, const CGBlockInfo &blockInfo, llvm::Constant *blockFn); /// Build the helper function to copy a block. static llvm::Constant *buildCopyHelper(CodeGenModule &CGM, const CGBlockInfo &blockInfo) { return CodeGenFunction(CGM).GenerateCopyHelperFunction(blockInfo); } /// Build the helper function to dispose of a block. static llvm::Constant *buildDisposeHelper(CodeGenModule &CGM, const CGBlockInfo &blockInfo) { return CodeGenFunction(CGM).GenerateDestroyHelperFunction(blockInfo); } /// buildBlockDescriptor - Build the block descriptor meta-data for a block. /// buildBlockDescriptor is accessed from 5th field of the Block_literal /// meta-data and contains stationary information about the block literal. /// Its definition will have 4 (or optinally 6) words. /// \code /// struct Block_descriptor { /// unsigned long reserved; /// unsigned long size; // size of Block_literal metadata in bytes. /// void *copy_func_helper_decl; // optional copy helper. /// void *destroy_func_decl; // optioanl destructor helper. /// void *block_method_encoding_address; // @encode for block literal signature. /// void *block_layout_info; // encoding of captured block variables. /// }; /// \endcode static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM, const CGBlockInfo &blockInfo) { ASTContext &C = CGM.getContext(); llvm::IntegerType *ulong = cast<llvm::IntegerType>(CGM.getTypes().ConvertType(C.UnsignedLongTy)); llvm::PointerType *i8p = nullptr; if (CGM.getLangOpts().OpenCL) i8p = llvm::Type::getInt8PtrTy( CGM.getLLVMContext(), C.getTargetAddressSpace(LangAS::opencl_constant)); else i8p = CGM.VoidPtrTy; ConstantInitBuilder builder(CGM); auto elements = builder.beginStruct(); // reserved elements.addInt(ulong, 0); // Size // FIXME: What is the right way to say this doesn't fit? We should give // a user diagnostic in that case. Better fix would be to change the // API to size_t. elements.addInt(ulong, blockInfo.BlockSize.getQuantity()); // Optional copy/dispose helpers. if (blockInfo.NeedsCopyDispose) { // copy_func_helper_decl elements.add(buildCopyHelper(CGM, blockInfo)); // destroy_func_decl elements.add(buildDisposeHelper(CGM, blockInfo)); } // Signature. Mandatory ObjC-style method descriptor @encode sequence. std::string typeAtEncoding = CGM.getContext().getObjCEncodingForBlock(blockInfo.getBlockExpr()); elements.add(llvm::ConstantExpr::getBitCast( CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer(), i8p)); // GC layout. if (C.getLangOpts().ObjC1) { if (CGM.getLangOpts().getGC() != LangOptions::NonGC) elements.add(CGM.getObjCRuntime().BuildGCBlockLayout(CGM, blockInfo)); else elements.add(CGM.getObjCRuntime().BuildRCBlockLayout(CGM, blockInfo)); } else elements.addNullPointer(i8p); unsigned AddrSpace = 0; if (C.getLangOpts().OpenCL) AddrSpace = C.getTargetAddressSpace(LangAS::opencl_constant); llvm::GlobalVariable *global = elements.finishAndCreateGlobal("__block_descriptor_tmp", CGM.getPointerAlign(), /*constant*/ true, llvm::GlobalValue::InternalLinkage, AddrSpace); return llvm::ConstantExpr::getBitCast(global, CGM.getBlockDescriptorType()); } /* Purely notional variadic template describing the layout of a block. template <class _ResultType, class... _ParamTypes, class... _CaptureTypes> struct Block_literal { /// Initialized to one of: /// extern void *_NSConcreteStackBlock[]; /// extern void *_NSConcreteGlobalBlock[]; /// /// In theory, we could start one off malloc'ed by setting /// BLOCK_NEEDS_FREE, giving it a refcount of 1, and using /// this isa: /// extern void *_NSConcreteMallocBlock[]; struct objc_class *isa; /// These are the flags (with corresponding bit number) that the /// compiler is actually supposed to know about. /// 25. BLOCK_HAS_COPY_DISPOSE - indicates that the block /// descriptor provides copy and dispose helper functions /// 26. BLOCK_HAS_CXX_OBJ - indicates that there's a captured /// object with a nontrivial destructor or copy constructor /// 28. BLOCK_IS_GLOBAL - indicates that the block is allocated /// as global memory /// 29. BLOCK_USE_STRET - indicates that the block function /// uses stret, which objc_msgSend needs to know about /// 30. BLOCK_HAS_SIGNATURE - indicates that the block has an /// @encoded signature string /// And we're not supposed to manipulate these: /// 24. BLOCK_NEEDS_FREE - indicates that the block has been moved /// to malloc'ed memory /// 27. BLOCK_IS_GC - indicates that the block has been moved to /// to GC-allocated memory /// Additionally, the bottom 16 bits are a reference count which /// should be zero on the stack. int flags; /// Reserved; should be zero-initialized. int reserved; /// Function pointer generated from block literal. _ResultType (*invoke)(Block_literal *, _ParamTypes...); /// Block description metadata generated from block literal. struct Block_descriptor *block_descriptor; /// Captured values follow. _CapturesTypes captures...; }; */ namespace { /// A chunk of data that we actually have to capture in the block. struct BlockLayoutChunk { CharUnits Alignment; CharUnits Size; Qualifiers::ObjCLifetime Lifetime; const BlockDecl::Capture *Capture; // null for 'this' llvm::Type *Type; QualType FieldType; BlockLayoutChunk(CharUnits align, CharUnits size, Qualifiers::ObjCLifetime lifetime, const BlockDecl::Capture *capture, llvm::Type *type, QualType fieldType) : Alignment(align), Size(size), Lifetime(lifetime), Capture(capture), Type(type), FieldType(fieldType) {} /// Tell the block info that this chunk has the given field index. void setIndex(CGBlockInfo &info, unsigned index, CharUnits offset) { if (!Capture) { info.CXXThisIndex = index; info.CXXThisOffset = offset; } else { auto C = CGBlockInfo::Capture::makeIndex(index, offset, FieldType); info.Captures.insert({Capture->getVariable(), C}); } } }; /// Order by 1) all __strong together 2) next, all byfref together 3) next, /// all __weak together. Preserve descending alignment in all situations. bool operator<(const BlockLayoutChunk &left, const BlockLayoutChunk &right) { if (left.Alignment != right.Alignment) return left.Alignment > right.Alignment; auto getPrefOrder = [](const BlockLayoutChunk &chunk) { if (chunk.Capture && chunk.Capture->isByRef()) return 1; if (chunk.Lifetime == Qualifiers::OCL_Strong) return 0; if (chunk.Lifetime == Qualifiers::OCL_Weak) return 2; return 3; }; return getPrefOrder(left) < getPrefOrder(right); } } // end anonymous namespace /// Determines if the given type is safe for constant capture in C++. static bool isSafeForCXXConstantCapture(QualType type) { const RecordType *recordType = type->getBaseElementTypeUnsafe()->getAs<RecordType>(); // Only records can be unsafe. if (!recordType) return true; const auto *record = cast<CXXRecordDecl>(recordType->getDecl()); // Maintain semantics for classes with non-trivial dtors or copy ctors. if (!record->hasTrivialDestructor()) return false; if (record->hasNonTrivialCopyConstructor()) return false; // Otherwise, we just have to make sure there aren't any mutable // fields that might have changed since initialization. return !record->hasMutableFields(); } /// It is illegal to modify a const object after initialization. /// Therefore, if a const object has a constant initializer, we don't /// actually need to keep storage for it in the block; we'll just /// rematerialize it at the start of the block function. This is /// acceptable because we make no promises about address stability of /// captured variables. static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM, CodeGenFunction *CGF, const VarDecl *var) { // Return if this is a function paramter. We shouldn't try to // rematerialize default arguments of function parameters. if (isa<ParmVarDecl>(var)) return nullptr; QualType type = var->getType(); // We can only do this if the variable is const. if (!type.isConstQualified()) return nullptr; // Furthermore, in C++ we have to worry about mutable fields: // C++ [dcl.type.cv]p4: // Except that any class member declared mutable can be // modified, any attempt to modify a const object during its // lifetime results in undefined behavior. if (CGM.getLangOpts().CPlusPlus && !isSafeForCXXConstantCapture(type)) return nullptr; // If the variable doesn't have any initializer (shouldn't this be // invalid?), it's not clear what we should do. Maybe capture as // zero? const Expr *init = var->getInit(); if (!init) return nullptr; return CGM.EmitConstantInit(*var, CGF); } /// Get the low bit of a nonzero character count. This is the /// alignment of the nth byte if the 0th byte is universally aligned. static CharUnits getLowBit(CharUnits v) { return CharUnits::fromQuantity(v.getQuantity() & (~v.getQuantity() + 1)); } static void initializeForBlockHeader(CodeGenModule &CGM, CGBlockInfo &info, SmallVectorImpl<llvm::Type*> &elementTypes) { // The header is basically 'struct { void *; int; int; void *; void *; }'. // Assert that that struct is packed. assert(CGM.getIntSize() <= CGM.getPointerSize()); assert(CGM.getIntAlign() <= CGM.getPointerAlign()); assert((2 * CGM.getIntSize()).isMultipleOf(CGM.getPointerAlign())); info.BlockAlign = CGM.getPointerAlign(); info.BlockSize = 3 * CGM.getPointerSize() + 2 * CGM.getIntSize(); assert(elementTypes.empty()); elementTypes.push_back(CGM.VoidPtrTy); elementTypes.push_back(CGM.IntTy); elementTypes.push_back(CGM.IntTy); elementTypes.push_back(CGM.VoidPtrTy); elementTypes.push_back(CGM.getBlockDescriptorType()); } static QualType getCaptureFieldType(const CodeGenFunction &CGF, const BlockDecl::Capture &CI) { const VarDecl *VD = CI.getVariable(); // If the variable is captured by an enclosing block or lambda expression, // use the type of the capture field. if (CGF.BlockInfo && CI.isNested()) return CGF.BlockInfo->getCapture(VD).fieldType(); if (auto *FD = CGF.LambdaCaptureFields.lookup(VD)) return FD->getType(); return VD->getType(); } /// Compute the layout of the given block. Attempts to lay the block /// out with minimal space requirements. static void computeBlockInfo(CodeGenModule &CGM, CodeGenFunction *CGF, CGBlockInfo &info) { ASTContext &C = CGM.getContext(); const BlockDecl *block = info.getBlockDecl(); SmallVector<llvm::Type*, 8> elementTypes; initializeForBlockHeader(CGM, info, elementTypes); if (!block->hasCaptures()) { info.StructureType = llvm::StructType::get(CGM.getLLVMContext(), elementTypes, true); info.CanBeGlobal = true; return; } else if (C.getLangOpts().ObjC1 && CGM.getLangOpts().getGC() == LangOptions::NonGC) info.HasCapturedVariableLayout = true; // Collect the layout chunks. SmallVector<BlockLayoutChunk, 16> layout; layout.reserve(block->capturesCXXThis() + (block->capture_end() - block->capture_begin())); CharUnits maxFieldAlign; // First, 'this'. if (block->capturesCXXThis()) { assert(CGF && CGF->CurFuncDecl && isa<CXXMethodDecl>(CGF->CurFuncDecl) && "Can't capture 'this' outside a method"); QualType thisType = cast<CXXMethodDecl>(CGF->CurFuncDecl)->getThisType(C); // Theoretically, this could be in a different address space, so // don't assume standard pointer size/align. llvm::Type *llvmType = CGM.getTypes().ConvertType(thisType); std::pair<CharUnits,CharUnits> tinfo = CGM.getContext().getTypeInfoInChars(thisType); maxFieldAlign = std::max(maxFieldAlign, tinfo.second); layout.push_back(BlockLayoutChunk(tinfo.second, tinfo.first, Qualifiers::OCL_None, nullptr, llvmType, thisType)); } // Next, all the block captures. for (const auto &CI : block->captures()) { const VarDecl *variable = CI.getVariable(); if (CI.isByRef()) { // We have to copy/dispose of the __block reference. info.NeedsCopyDispose = true; // Just use void* instead of a pointer to the byref type. CharUnits align = CGM.getPointerAlign(); maxFieldAlign = std::max(maxFieldAlign, align); layout.push_back(BlockLayoutChunk(align, CGM.getPointerSize(), Qualifiers::OCL_None, &CI, CGM.VoidPtrTy, variable->getType())); continue; } // Otherwise, build a layout chunk with the size and alignment of // the declaration. if (llvm::Constant *constant = tryCaptureAsConstant(CGM, CGF, variable)) { info.Captures[variable] = CGBlockInfo::Capture::makeConstant(constant); continue; } // If we have a lifetime qualifier, honor it for capture purposes. // That includes *not* copying it if it's __unsafe_unretained. Qualifiers::ObjCLifetime lifetime = variable->getType().getObjCLifetime(); if (lifetime) { switch (lifetime) { case Qualifiers::OCL_None: llvm_unreachable("impossible"); case Qualifiers::OCL_ExplicitNone: case Qualifiers::OCL_Autoreleasing: break; case Qualifiers::OCL_Strong: case Qualifiers::OCL_Weak: info.NeedsCopyDispose = true; } // Block pointers require copy/dispose. So do Objective-C pointers. } else if (variable->getType()->isObjCRetainableType()) { // But honor the inert __unsafe_unretained qualifier, which doesn't // actually make it into the type system. if (variable->getType()->isObjCInertUnsafeUnretainedType()) { lifetime = Qualifiers::OCL_ExplicitNone; } else { info.NeedsCopyDispose = true; // used for mrr below. lifetime = Qualifiers::OCL_Strong; } // So do types that require non-trivial copy construction. } else if (CI.hasCopyExpr()) { info.NeedsCopyDispose = true; info.HasCXXObject = true; // And so do types with destructors. } else if (CGM.getLangOpts().CPlusPlus) { if (const CXXRecordDecl *record = variable->getType()->getAsCXXRecordDecl()) { if (!record->hasTrivialDestructor()) { info.HasCXXObject = true; info.NeedsCopyDispose = true; } } } QualType VT = getCaptureFieldType(*CGF, CI); CharUnits size = C.getTypeSizeInChars(VT); CharUnits align = C.getDeclAlign(variable); maxFieldAlign = std::max(maxFieldAlign, align); llvm::Type *llvmType = CGM.getTypes().ConvertTypeForMem(VT); layout.push_back( BlockLayoutChunk(align, size, lifetime, &CI, llvmType, VT)); } // If that was everything, we're done here. if (layout.empty()) { info.StructureType = llvm::StructType::get(CGM.getLLVMContext(), elementTypes, true); info.CanBeGlobal = true; return; } // Sort the layout by alignment. We have to use a stable sort here // to get reproducible results. There should probably be an // llvm::array_pod_stable_sort. std::stable_sort(layout.begin(), layout.end()); // Needed for blocks layout info. info.BlockHeaderForcedGapOffset = info.BlockSize; info.BlockHeaderForcedGapSize = CharUnits::Zero(); CharUnits &blockSize = info.BlockSize; info.BlockAlign = std::max(maxFieldAlign, info.BlockAlign); // Assuming that the first byte in the header is maximally aligned, // get the alignment of the first byte following the header. CharUnits endAlign = getLowBit(blockSize); // If the end of the header isn't satisfactorily aligned for the // maximum thing, look for things that are okay with the header-end // alignment, and keep appending them until we get something that's // aligned right. This algorithm is only guaranteed optimal if // that condition is satisfied at some point; otherwise we can get // things like: // header // next byte has alignment 4 // something_with_size_5; // next byte has alignment 1 // something_with_alignment_8; // which has 7 bytes of padding, as opposed to the naive solution // which might have less (?). if (endAlign < maxFieldAlign) { SmallVectorImpl<BlockLayoutChunk>::iterator li = layout.begin() + 1, le = layout.end(); // Look for something that the header end is already // satisfactorily aligned for. for (; li != le && endAlign < li->Alignment; ++li) ; // If we found something that's naturally aligned for the end of // the header, keep adding things... if (li != le) { SmallVectorImpl<BlockLayoutChunk>::iterator first = li; for (; li != le; ++li) { assert(endAlign >= li->Alignment); li->setIndex(info, elementTypes.size(), blockSize); elementTypes.push_back(li->Type); blockSize += li->Size; endAlign = getLowBit(blockSize); // ...until we get to the alignment of the maximum field. if (endAlign >= maxFieldAlign) { break; } } // Don't re-append everything we just appended. layout.erase(first, li); } } assert(endAlign == getLowBit(blockSize)); // At this point, we just have to add padding if the end align still // isn't aligned right. if (endAlign < maxFieldAlign) { CharUnits newBlockSize = blockSize.alignTo(maxFieldAlign); CharUnits padding = newBlockSize - blockSize; // If we haven't yet added any fields, remember that there was an // initial gap; this need to go into the block layout bit map. if (blockSize == info.BlockHeaderForcedGapOffset) { info.BlockHeaderForcedGapSize = padding; } elementTypes.push_back(llvm::ArrayType::get(CGM.Int8Ty, padding.getQuantity())); blockSize = newBlockSize; endAlign = getLowBit(blockSize); // might be > maxFieldAlign } assert(endAlign >= maxFieldAlign); assert(endAlign == getLowBit(blockSize)); // Slam everything else on now. This works because they have // strictly decreasing alignment and we expect that size is always a // multiple of alignment. for (SmallVectorImpl<BlockLayoutChunk>::iterator li = layout.begin(), le = layout.end(); li != le; ++li) { if (endAlign < li->Alignment) { // size may not be multiple of alignment. This can only happen with // an over-aligned variable. We will be adding a padding field to // make the size be multiple of alignment. CharUnits padding = li->Alignment - endAlign; elementTypes.push_back(llvm::ArrayType::get(CGM.Int8Ty, padding.getQuantity())); blockSize += padding; endAlign = getLowBit(blockSize); } assert(endAlign >= li->Alignment); li->setIndex(info, elementTypes.size(), blockSize); elementTypes.push_back(li->Type); blockSize += li->Size; endAlign = getLowBit(blockSize); } info.StructureType = llvm::StructType::get(CGM.getLLVMContext(), elementTypes, true); } /// Enter the scope of a block. This should be run at the entrance to /// a full-expression so that the block's cleanups are pushed at the /// right place in the stack. static void enterBlockScope(CodeGenFunction &CGF, BlockDecl *block) { assert(CGF.HaveInsertPoint()); // Allocate the block info and place it at the head of the list. CGBlockInfo &blockInfo = *new CGBlockInfo(block, CGF.CurFn->getName()); blockInfo.NextBlockInfo = CGF.FirstBlockInfo; CGF.FirstBlockInfo = &blockInfo; // Compute information about the layout, etc., of this block, // pushing cleanups as necessary. computeBlockInfo(CGF.CGM, &CGF, blockInfo); // Nothing else to do if it can be global. if (blockInfo.CanBeGlobal) return; // Make the allocation for the block. blockInfo.LocalAddress = CGF.CreateTempAlloca(blockInfo.StructureType, blockInfo.BlockAlign, "block"); // If there are cleanups to emit, enter them (but inactive). if (!blockInfo.NeedsCopyDispose) return; // Walk through the captures (in order) and find the ones not // captured by constant. for (const auto &CI : block->captures()) { // Ignore __block captures; there's nothing special in the // on-stack block that we need to do for them. if (CI.isByRef()) continue; // Ignore variables that are constant-captured. const VarDecl *variable = CI.getVariable(); CGBlockInfo::Capture &capture = blockInfo.getCapture(variable); if (capture.isConstant()) continue; // Ignore objects that aren't destructed. QualType VT = getCaptureFieldType(CGF, CI); QualType::DestructionKind dtorKind = VT.isDestructedType(); if (dtorKind == QualType::DK_none) continue; CodeGenFunction::Destroyer *destroyer; // Block captures count as local values and have imprecise semantics. // They also can't be arrays, so need to worry about that. if (dtorKind == QualType::DK_objc_strong_lifetime) { destroyer = CodeGenFunction::destroyARCStrongImprecise; } else { destroyer = CGF.getDestroyer(dtorKind); } // GEP down to the address. Address addr = CGF.Builder.CreateStructGEP(blockInfo.LocalAddress, capture.getIndex(), capture.getOffset()); // We can use that GEP as the dominating IP. if (!blockInfo.DominatingIP) blockInfo.DominatingIP = cast<llvm::Instruction>(addr.getPointer()); CleanupKind cleanupKind = InactiveNormalCleanup; bool useArrayEHCleanup = CGF.needsEHCleanup(dtorKind); if (useArrayEHCleanup) cleanupKind = InactiveNormalAndEHCleanup; CGF.pushDestroy(cleanupKind, addr, VT, destroyer, useArrayEHCleanup); // Remember where that cleanup was. capture.setCleanup(CGF.EHStack.stable_begin()); } } /// Enter a full-expression with a non-trivial number of objects to /// clean up. This is in this file because, at the moment, the only /// kind of cleanup object is a BlockDecl*. void CodeGenFunction::enterNonTrivialFullExpression(const ExprWithCleanups *E) { assert(E->getNumObjects() != 0); ArrayRef<ExprWithCleanups::CleanupObject> cleanups = E->getObjects(); for (ArrayRef<ExprWithCleanups::CleanupObject>::iterator i = cleanups.begin(), e = cleanups.end(); i != e; ++i) { enterBlockScope(*this, *i); } } /// Find the layout for the given block in a linked list and remove it. static CGBlockInfo *findAndRemoveBlockInfo(CGBlockInfo **head, const BlockDecl *block) { while (true) { assert(head && *head); CGBlockInfo *cur = *head; // If this is the block we're looking for, splice it out of the list. if (cur->getBlockDecl() == block) { *head = cur->NextBlockInfo; return cur; } head = &cur->NextBlockInfo; } } /// Destroy a chain of block layouts. void CodeGenFunction::destroyBlockInfos(CGBlockInfo *head) { assert(head && "destroying an empty chain"); do { CGBlockInfo *cur = head; head = cur->NextBlockInfo; delete cur; } while (head != nullptr); } /// Emit a block literal expression in the current function. llvm::Value *CodeGenFunction::EmitBlockLiteral(const BlockExpr *blockExpr) { // If the block has no captures, we won't have a pre-computed // layout for it. if (!blockExpr->getBlockDecl()->hasCaptures()) { if (llvm::Constant *Block = CGM.getAddrOfGlobalBlockIfEmitted(blockExpr)) return Block; CGBlockInfo blockInfo(blockExpr->getBlockDecl(), CurFn->getName()); computeBlockInfo(CGM, this, blockInfo); blockInfo.BlockExpression = blockExpr; return EmitBlockLiteral(blockInfo); } // Find the block info for this block and take ownership of it. std::unique_ptr<CGBlockInfo> blockInfo; blockInfo.reset(findAndRemoveBlockInfo(&FirstBlockInfo, blockExpr->getBlockDecl())); blockInfo->BlockExpression = blockExpr; return EmitBlockLiteral(*blockInfo); } llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) { // Using the computed layout, generate the actual block function. bool isLambdaConv = blockInfo.getBlockDecl()->isConversionFromLambda(); llvm::Constant *blockFn = CodeGenFunction(CGM, true).GenerateBlockFunction(CurGD, blockInfo, LocalDeclMap, isLambdaConv, blockInfo.CanBeGlobal); blockFn = llvm::ConstantExpr::getBitCast(blockFn, VoidPtrTy); // If there is nothing to capture, we can emit this as a global block. if (blockInfo.CanBeGlobal) return CGM.getAddrOfGlobalBlockIfEmitted(blockInfo.BlockExpression); // Otherwise, we have to emit this as a local block. llvm::Constant *isa = CGM.getNSConcreteStackBlock(); isa = llvm::ConstantExpr::getBitCast(isa, VoidPtrTy); // Build the block descriptor. llvm::Constant *descriptor = buildBlockDescriptor(CGM, blockInfo); Address blockAddr = blockInfo.LocalAddress; assert(blockAddr.isValid() && "block has no address!"); // Compute the initial on-stack block flags. BlockFlags flags = BLOCK_HAS_SIGNATURE; if (blockInfo.HasCapturedVariableLayout) flags |= BLOCK_HAS_EXTENDED_LAYOUT; if (blockInfo.NeedsCopyDispose) flags |= BLOCK_HAS_COPY_DISPOSE; if (blockInfo.HasCXXObject) flags |= BLOCK_HAS_CXX_OBJ; if (blockInfo.UsesStret) flags |= BLOCK_USE_STRET; auto projectField = [&](unsigned index, CharUnits offset, const Twine &name) -> Address { return Builder.CreateStructGEP(blockAddr, index, offset, name); }; auto storeField = [&](llvm::Value *value, unsigned index, CharUnits offset, const Twine &name) { Builder.CreateStore(value, projectField(index, offset, name)); }; // Initialize the block header. { // We assume all the header fields are densely packed. unsigned index = 0; CharUnits offset; auto addHeaderField = [&](llvm::Value *value, CharUnits size, const Twine &name) { storeField(value, index, offset, name); offset += size; index++; }; addHeaderField(isa, getPointerSize(), "block.isa"); addHeaderField(llvm::ConstantInt::get(IntTy, flags.getBitMask()), getIntSize(), "block.flags"); addHeaderField(llvm::ConstantInt::get(IntTy, 0), getIntSize(), "block.reserved"); addHeaderField(blockFn, getPointerSize(), "block.invoke"); addHeaderField(descriptor, getPointerSize(), "block.descriptor"); } // Finally, capture all the values into the block. const BlockDecl *blockDecl = blockInfo.getBlockDecl(); // First, 'this'. if (blockDecl->capturesCXXThis()) { Address addr = projectField(blockInfo.CXXThisIndex, blockInfo.CXXThisOffset, "block.captured-this.addr"); Builder.CreateStore(LoadCXXThis(), addr); } // Next, captured variables. for (const auto &CI : blockDecl->captures()) { const VarDecl *variable = CI.getVariable(); const CGBlockInfo::Capture &capture = blockInfo.getCapture(variable); // Ignore constant captures. if (capture.isConstant()) continue; QualType type = capture.fieldType(); // This will be a [[type]]*, except that a byref entry will just be // an i8**. Address blockField = projectField(capture.getIndex(), capture.getOffset(), "block.captured"); // Compute the address of the thing we're going to move into the // block literal. Address src = Address::invalid(); if (blockDecl->isConversionFromLambda()) { // The lambda capture in a lambda's conversion-to-block-pointer is // special; we'll simply emit it directly. src = Address::invalid(); } else if (CI.isByRef()) { if (BlockInfo && CI.isNested()) { // We need to use the capture from the enclosing block. const CGBlockInfo::Capture &enclosingCapture = BlockInfo->getCapture(variable); // This is a [[type]]*, except that a byref entry wil just be an i8**. src = Builder.CreateStructGEP(LoadBlockStruct(), enclosingCapture.getIndex(), enclosingCapture.getOffset(), "block.capture.addr"); } else { auto I = LocalDeclMap.find(variable); assert(I != LocalDeclMap.end()); src = I->second; } } else { DeclRefExpr declRef(const_cast<VarDecl *>(variable), /*RefersToEnclosingVariableOrCapture*/ CI.isNested(), type.getNonReferenceType(), VK_LValue, SourceLocation()); src = EmitDeclRefLValue(&declRef).getAddress(); }; // For byrefs, we just write the pointer to the byref struct into // the block field. There's no need to chase the forwarding // pointer at this point, since we're building something that will // live a shorter life than the stack byref anyway. if (CI.isByRef()) { // Get a void* that points to the byref struct. llvm::Value *byrefPointer; if (CI.isNested()) byrefPointer = Builder.CreateLoad(src, "byref.capture"); else byrefPointer = Builder.CreateBitCast(src.getPointer(), VoidPtrTy); // Write that void* into the capture field. Builder.CreateStore(byrefPointer, blockField); // If we have a copy constructor, evaluate that into the block field. } else if (const Expr *copyExpr = CI.getCopyExpr()) { if (blockDecl->isConversionFromLambda()) { // If we have a lambda conversion, emit the expression // directly into the block instead. AggValueSlot Slot = AggValueSlot::forAddr(blockField, Qualifiers(), AggValueSlot::IsDestructed, AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsNotAliased); EmitAggExpr(copyExpr, Slot); } else { EmitSynthesizedCXXCopyCtor(blockField, src, copyExpr); } // If it's a reference variable, copy the reference into the block field. } else if (type->isReferenceType()) { Builder.CreateStore(src.getPointer(), blockField); // If this is an ARC __strong block-pointer variable, don't do a // block copy. // // TODO: this can be generalized into the normal initialization logic: // we should never need to do a block-copy when initializing a local // variable, because the local variable's lifetime should be strictly // contained within the stack block's. } else if (type.getObjCLifetime() == Qualifiers::OCL_Strong && type->isBlockPointerType()) { // Load the block and do a simple retain. llvm::Value *value = Builder.CreateLoad(src, "block.captured_block"); value = EmitARCRetainNonBlock(value); // Do a primitive store to the block field. Builder.CreateStore(value, blockField); // Otherwise, fake up a POD copy into the block field. } else { // Fake up a new variable so that EmitScalarInit doesn't think // we're referring to the variable in its own initializer. ImplicitParamDecl blockFieldPseudoVar(getContext(), /*DC*/ nullptr, SourceLocation(), /*name*/ nullptr, type); // We use one of these or the other depending on whether the // reference is nested. DeclRefExpr declRef(const_cast<VarDecl *>(variable), /*RefersToEnclosingVariableOrCapture*/ CI.isNested(), type, VK_LValue, SourceLocation()); ImplicitCastExpr l2r(ImplicitCastExpr::OnStack, type, CK_LValueToRValue, &declRef, VK_RValue); // FIXME: Pass a specific location for the expr init so that the store is // attributed to a reasonable location - otherwise it may be attributed to // locations of subexpressions in the initialization. EmitExprAsInit(&l2r, &blockFieldPseudoVar, MakeAddrLValue(blockField, type, AlignmentSource::Decl), /*captured by init*/ false); } // Activate the cleanup if layout pushed one. if (!CI.isByRef()) { EHScopeStack::stable_iterator cleanup = capture.getCleanup(); if (cleanup.isValid()) ActivateCleanupBlock(cleanup, blockInfo.DominatingIP); } } // Cast to the converted block-pointer type, which happens (somewhat // unfortunately) to be a pointer to function type. llvm::Value *result = Builder.CreateBitCast(blockAddr.getPointer(), ConvertType(blockInfo.getBlockExpr()->getType())); return result; } llvm::Type *CodeGenModule::getBlockDescriptorType() { if (BlockDescriptorType) return BlockDescriptorType; llvm::Type *UnsignedLongTy = getTypes().ConvertType(getContext().UnsignedLongTy); // struct __block_descriptor { // unsigned long reserved; // unsigned long block_size; // // // later, the following will be added // // struct { // void (*copyHelper)(); // void (*copyHelper)(); // } helpers; // !!! optional // // const char *signature; // the block signature // const char *layout; // reserved // }; BlockDescriptorType = llvm::StructType::create("struct.__block_descriptor", UnsignedLongTy, UnsignedLongTy, nullptr); // Now form a pointer to that. unsigned AddrSpace = 0; if (getLangOpts().OpenCL) AddrSpace = getContext().getTargetAddressSpace(LangAS::opencl_constant); BlockDescriptorType = llvm::PointerType::get(BlockDescriptorType, AddrSpace); return BlockDescriptorType; } llvm::Type *CodeGenModule::getGenericBlockLiteralType() { if (GenericBlockLiteralType) return GenericBlockLiteralType; llvm::Type *BlockDescPtrTy = getBlockDescriptorType(); // struct __block_literal_generic { // void *__isa; // int __flags; // int __reserved; // void (*__invoke)(void *); // struct __block_descriptor *__descriptor; // }; GenericBlockLiteralType = llvm::StructType::create("struct.__block_literal_generic", VoidPtrTy, IntTy, IntTy, VoidPtrTy, BlockDescPtrTy, nullptr); return GenericBlockLiteralType; } RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue) { const BlockPointerType *BPT = E->getCallee()->getType()->getAs<BlockPointerType>(); llvm::Value *BlockPtr = EmitScalarExpr(E->getCallee()); // Get a pointer to the generic block literal. llvm::Type *BlockLiteralTy = llvm::PointerType::getUnqual(CGM.getGenericBlockLiteralType()); // Bitcast the callee to a block literal. BlockPtr = Builder.CreateBitCast(BlockPtr, BlockLiteralTy, "block.literal"); // Get the function pointer from the literal. llvm::Value *FuncPtr = Builder.CreateStructGEP(CGM.getGenericBlockLiteralType(), BlockPtr, 3); BlockPtr = Builder.CreateBitCast(BlockPtr, VoidPtrTy); // Add the block literal. CallArgList Args; Args.add(RValue::get(BlockPtr), getContext().VoidPtrTy); QualType FnType = BPT->getPointeeType(); // And the rest of the arguments. EmitCallArgs(Args, FnType->getAs<FunctionProtoType>(), E->arguments()); // Load the function. llvm::Value *Func = Builder.CreateAlignedLoad(FuncPtr, getPointerAlign()); const FunctionType *FuncTy = FnType->castAs<FunctionType>(); const CGFunctionInfo &FnInfo = CGM.getTypes().arrangeBlockFunctionCall(Args, FuncTy); // Cast the function pointer to the right type. llvm::Type *BlockFTy = CGM.getTypes().GetFunctionType(FnInfo); llvm::Type *BlockFTyPtr = llvm::PointerType::getUnqual(BlockFTy); Func = Builder.CreateBitCast(Func, BlockFTyPtr); // Prepare the callee. CGCallee Callee(CGCalleeInfo(), Func); // And call the block. return EmitCall(FnInfo, Callee, ReturnValue, Args); } Address CodeGenFunction::GetAddrOfBlockDecl(const VarDecl *variable, bool isByRef) { assert(BlockInfo && "evaluating block ref without block information?"); const CGBlockInfo::Capture &capture = BlockInfo->getCapture(variable); // Handle constant captures. if (capture.isConstant()) return LocalDeclMap.find(variable)->second; Address addr = Builder.CreateStructGEP(LoadBlockStruct(), capture.getIndex(), capture.getOffset(), "block.capture.addr"); if (isByRef) { // addr should be a void** right now. Load, then cast the result // to byref*. auto &byrefInfo = getBlockByrefInfo(variable); addr = Address(Builder.CreateLoad(addr), byrefInfo.ByrefAlignment); auto byrefPointerType = llvm::PointerType::get(byrefInfo.Type, 0); addr = Builder.CreateBitCast(addr, byrefPointerType, "byref.addr"); addr = emitBlockByrefAddress(addr, byrefInfo, /*follow*/ true, variable->getName()); } if (auto refType = capture.fieldType()->getAs<ReferenceType>()) addr = EmitLoadOfReference(addr, refType); return addr; } void CodeGenModule::setAddrOfGlobalBlock(const BlockExpr *BE, llvm::Constant *Addr) { bool Ok = EmittedGlobalBlocks.insert(std::make_pair(BE, Addr)).second; (void)Ok; assert(Ok && "Trying to replace an already-existing global block!"); } llvm::Constant * CodeGenModule::GetAddrOfGlobalBlock(const BlockExpr *BE, StringRef Name) { if (llvm::Constant *Block = getAddrOfGlobalBlockIfEmitted(BE)) return Block; CGBlockInfo blockInfo(BE->getBlockDecl(), Name); blockInfo.BlockExpression = BE; // Compute information about the layout, etc., of this block. computeBlockInfo(*this, nullptr, blockInfo); // Using that metadata, generate the actual block function. { CodeGenFunction::DeclMapTy LocalDeclMap; CodeGenFunction(*this).GenerateBlockFunction( GlobalDecl(), blockInfo, LocalDeclMap, /*IsLambdaConversionToBlock*/ false, /*BuildGlobalBlock*/ true); } return getAddrOfGlobalBlockIfEmitted(BE); } static llvm::Constant *buildGlobalBlock(CodeGenModule &CGM, const CGBlockInfo &blockInfo, llvm::Constant *blockFn) { assert(blockInfo.CanBeGlobal); // Callers should detect this case on their own: calling this function // generally requires computing layout information, which is a waste of time // if we've already emitted this block. assert(!CGM.getAddrOfGlobalBlockIfEmitted(blockInfo.BlockExpression) && "Refusing to re-emit a global block."); // Generate the constants for the block literal initializer. ConstantInitBuilder builder(CGM); auto fields = builder.beginStruct(); // isa fields.add(CGM.getNSConcreteGlobalBlock()); // __flags BlockFlags flags = BLOCK_IS_GLOBAL | BLOCK_HAS_SIGNATURE; if (blockInfo.UsesStret) flags |= BLOCK_USE_STRET; fields.addInt(CGM.IntTy, flags.getBitMask()); // Reserved fields.addInt(CGM.IntTy, 0); // Function fields.add(blockFn); // Descriptor fields.add(buildBlockDescriptor(CGM, blockInfo)); llvm::Constant *literal = fields.finishAndCreateGlobal("__block_literal_global", blockInfo.BlockAlign, /*constant*/ true); // Return a constant of the appropriately-casted type. llvm::Type *RequiredType = CGM.getTypes().ConvertType(blockInfo.getBlockExpr()->getType()); llvm::Constant *Result = llvm::ConstantExpr::getBitCast(literal, RequiredType); CGM.setAddrOfGlobalBlock(blockInfo.BlockExpression, Result); return Result; } void CodeGenFunction::setBlockContextParameter(const ImplicitParamDecl *D, unsigned argNum, llvm::Value *arg) { assert(BlockInfo && "not emitting prologue of block invocation function?!"); llvm::Value *localAddr = nullptr; if (CGM.getCodeGenOpts().OptimizationLevel == 0) { // Allocate a stack slot to let the debug info survive the RA. Address alloc = CreateMemTemp(D->getType(), D->getName() + ".addr"); Builder.CreateStore(arg, alloc); localAddr = Builder.CreateLoad(alloc); } if (CGDebugInfo *DI = getDebugInfo()) { if (CGM.getCodeGenOpts().getDebugInfo() >= codegenoptions::LimitedDebugInfo) { DI->setLocation(D->getLocation()); DI->EmitDeclareOfBlockLiteralArgVariable(*BlockInfo, arg, argNum, localAddr, Builder); } } SourceLocation StartLoc = BlockInfo->getBlockExpr()->getBody()->getLocStart(); ApplyDebugLocation Scope(*this, StartLoc); // Instead of messing around with LocalDeclMap, just set the value // directly as BlockPointer. BlockPointer = Builder.CreateBitCast(arg, BlockInfo->StructureType->getPointerTo(), "block"); } Address CodeGenFunction::LoadBlockStruct() { assert(BlockInfo && "not in a block invocation function!"); assert(BlockPointer && "no block pointer set!"); return Address(BlockPointer, BlockInfo->BlockAlign); } llvm::Function * CodeGenFunction::GenerateBlockFunction(GlobalDecl GD, const CGBlockInfo &blockInfo, const DeclMapTy &ldm, bool IsLambdaConversionToBlock, bool BuildGlobalBlock) { const BlockDecl *blockDecl = blockInfo.getBlockDecl(); CurGD = GD; CurEHLocation = blockInfo.getBlockExpr()->getLocEnd(); BlockInfo = &blockInfo; // Arrange for local static and local extern declarations to appear // to be local to this function as well, in case they're directly // referenced in a block. for (DeclMapTy::const_iterator i = ldm.begin(), e = ldm.end(); i != e; ++i) { const auto *var = dyn_cast<VarDecl>(i->first); if (var && !var->hasLocalStorage()) setAddrOfLocalVar(var, i->second); } // Begin building the function declaration. // Build the argument list. FunctionArgList args; // The first argument is the block pointer. Just take it as a void* // and cast it later. QualType selfTy = getContext().VoidPtrTy; IdentifierInfo *II = &CGM.getContext().Idents.get(".block_descriptor"); ImplicitParamDecl selfDecl(getContext(), const_cast<BlockDecl*>(blockDecl), SourceLocation(), II, selfTy); args.push_back(&selfDecl); // Now add the rest of the parameters. args.append(blockDecl->param_begin(), blockDecl->param_end()); // Create the function declaration. const FunctionProtoType *fnType = blockInfo.getBlockExpr()->getFunctionType(); const CGFunctionInfo &fnInfo = CGM.getTypes().arrangeBlockFunctionDeclaration(fnType, args); if (CGM.ReturnSlotInterferesWithArgs(fnInfo)) blockInfo.UsesStret = true; llvm::FunctionType *fnLLVMType = CGM.getTypes().GetFunctionType(fnInfo); StringRef name = CGM.getBlockMangledName(GD, blockDecl); llvm::Function *fn = llvm::Function::Create( fnLLVMType, llvm::GlobalValue::InternalLinkage, name, &CGM.getModule()); CGM.SetInternalFunctionAttributes(blockDecl, fn, fnInfo); if (BuildGlobalBlock) buildGlobalBlock(CGM, blockInfo, llvm::ConstantExpr::getBitCast(fn, VoidPtrTy)); // Begin generating the function. StartFunction(blockDecl, fnType->getReturnType(), fn, fnInfo, args, blockDecl->getLocation(), blockInfo.getBlockExpr()->getBody()->getLocStart()); // Okay. Undo some of what StartFunction did. // At -O0 we generate an explicit alloca for the BlockPointer, so the RA // won't delete the dbg.declare intrinsics for captured variables. llvm::Value *BlockPointerDbgLoc = BlockPointer; if (CGM.getCodeGenOpts().OptimizationLevel == 0) { // Allocate a stack slot for it, so we can point the debugger to it Address Alloca = CreateTempAlloca(BlockPointer->getType(), getPointerAlign(), "block.addr"); // Set the DebugLocation to empty, so the store is recognized as a // frame setup instruction by llvm::DwarfDebug::beginFunction(). auto NL = ApplyDebugLocation::CreateEmpty(*this); Builder.CreateStore(BlockPointer, Alloca); BlockPointerDbgLoc = Alloca.getPointer(); } // If we have a C++ 'this' reference, go ahead and force it into // existence now. if (blockDecl->capturesCXXThis()) { Address addr = Builder.CreateStructGEP(LoadBlockStruct(), blockInfo.CXXThisIndex, blockInfo.CXXThisOffset, "block.captured-this"); CXXThisValue = Builder.CreateLoad(addr, "this"); } // Also force all the constant captures. for (const auto &CI : blockDecl->captures()) { const VarDecl *variable = CI.getVariable(); const CGBlockInfo::Capture &capture = blockInfo.getCapture(variable); if (!capture.isConstant()) continue; CharUnits align = getContext().getDeclAlign(variable); Address alloca = CreateMemTemp(variable->getType(), align, "block.captured-const"); Builder.CreateStore(capture.getConstant(), alloca); setAddrOfLocalVar(variable, alloca); } // Save a spot to insert the debug information for all the DeclRefExprs. llvm::BasicBlock *entry = Builder.GetInsertBlock(); llvm::BasicBlock::iterator entry_ptr = Builder.GetInsertPoint(); --entry_ptr; if (IsLambdaConversionToBlock) EmitLambdaBlockInvokeBody(); else { PGO.assignRegionCounters(GlobalDecl(blockDecl), fn); incrementProfileCounter(blockDecl->getBody()); EmitStmt(blockDecl->getBody()); } // Remember where we were... llvm::BasicBlock *resume = Builder.GetInsertBlock(); // Go back to the entry. ++entry_ptr; Builder.SetInsertPoint(entry, entry_ptr); // Emit debug information for all the DeclRefExprs. // FIXME: also for 'this' if (CGDebugInfo *DI = getDebugInfo()) { for (const auto &CI : blockDecl->captures()) { const VarDecl *variable = CI.getVariable(); DI->EmitLocation(Builder, variable->getLocation()); if (CGM.getCodeGenOpts().getDebugInfo() >= codegenoptions::LimitedDebugInfo) { const CGBlockInfo::Capture &capture = blockInfo.getCapture(variable); if (capture.isConstant()) { auto addr = LocalDeclMap.find(variable)->second; DI->EmitDeclareOfAutoVariable(variable, addr.getPointer(), Builder); continue; } DI->EmitDeclareOfBlockDeclRefVariable( variable, BlockPointerDbgLoc, Builder, blockInfo, entry_ptr == entry->end() ? nullptr : &*entry_ptr); } } // Recover location if it was changed in the above loop. DI->EmitLocation(Builder, cast<CompoundStmt>(blockDecl->getBody())->getRBracLoc()); } // And resume where we left off. if (resume == nullptr) Builder.ClearInsertionPoint(); else Builder.SetInsertPoint(resume); FinishFunction(cast<CompoundStmt>(blockDecl->getBody())->getRBracLoc()); return fn; } /* notes.push_back(HelperInfo()); HelperInfo &note = notes.back(); note.index = capture.getIndex(); note.RequiresCopying = (ci->hasCopyExpr() || BlockRequiresCopying(type)); note.cxxbar_import = ci->getCopyExpr(); if (ci->isByRef()) { note.flag = BLOCK_FIELD_IS_BYREF; if (type.isObjCGCWeak()) note.flag |= BLOCK_FIELD_IS_WEAK; } else if (type->isBlockPointerType()) { note.flag = BLOCK_FIELD_IS_BLOCK; } else { note.flag = BLOCK_FIELD_IS_OBJECT; } */ /// Generate the copy-helper function for a block closure object: /// static void block_copy_helper(block_t *dst, block_t *src); /// The runtime will have previously initialized 'dst' by doing a /// bit-copy of 'src'. /// /// Note that this copies an entire block closure object to the heap; /// it should not be confused with a 'byref copy helper', which moves /// the contents of an individual __block variable to the heap. llvm::Constant * CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) { ASTContext &C = getContext(); FunctionArgList args; ImplicitParamDecl dstDecl(getContext(), nullptr, SourceLocation(), nullptr, C.VoidPtrTy); args.push_back(&dstDecl); ImplicitParamDecl srcDecl(getContext(), nullptr, SourceLocation(), nullptr, C.VoidPtrTy); args.push_back(&srcDecl); const CGFunctionInfo &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args); // FIXME: it would be nice if these were mergeable with things with // identical semantics. llvm::FunctionType *LTy = CGM.getTypes().GetFunctionType(FI); llvm::Function *Fn = llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage, "__copy_helper_block_", &CGM.getModule()); IdentifierInfo *II = &CGM.getContext().Idents.get("__copy_helper_block_"); FunctionDecl *FD = FunctionDecl::Create(C, C.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II, C.VoidTy, nullptr, SC_Static, false, false); CGM.SetInternalFunctionAttributes(nullptr, Fn, FI); auto NL = ApplyDebugLocation::CreateEmpty(*this); StartFunction(FD, C.VoidTy, Fn, FI, args); // Create a scope with an artificial location for the body of this function. auto AL = ApplyDebugLocation::CreateArtificial(*this); llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo(); Address src = GetAddrOfLocalVar(&srcDecl); src = Address(Builder.CreateLoad(src), blockInfo.BlockAlign); src = Builder.CreateBitCast(src, structPtrTy, "block.source"); Address dst = GetAddrOfLocalVar(&dstDecl); dst = Address(Builder.CreateLoad(dst), blockInfo.BlockAlign); dst = Builder.CreateBitCast(dst, structPtrTy, "block.dest"); const BlockDecl *blockDecl = blockInfo.getBlockDecl(); for (const auto &CI : blockDecl->captures()) { const VarDecl *variable = CI.getVariable(); QualType type = variable->getType(); const CGBlockInfo::Capture &capture = blockInfo.getCapture(variable); if (capture.isConstant()) continue; const Expr *copyExpr = CI.getCopyExpr(); BlockFieldFlags flags; bool useARCWeakCopy = false; bool useARCStrongCopy = false; if (copyExpr) { assert(!CI.isByRef()); // don't bother computing flags } else if (CI.isByRef()) { flags = BLOCK_FIELD_IS_BYREF; if (type.isObjCGCWeak()) flags |= BLOCK_FIELD_IS_WEAK; } else if (type->isObjCRetainableType()) { flags = BLOCK_FIELD_IS_OBJECT; bool isBlockPointer = type->isBlockPointerType(); if (isBlockPointer) flags = BLOCK_FIELD_IS_BLOCK; // Special rules for ARC captures: Qualifiers qs = type.getQualifiers(); // We need to register __weak direct captures with the runtime. if (qs.getObjCLifetime() == Qualifiers::OCL_Weak) { useARCWeakCopy = true; // We need to retain the copied value for __strong direct captures. } else if (qs.getObjCLifetime() == Qualifiers::OCL_Strong) { // If it's a block pointer, we have to copy the block and // assign that to the destination pointer, so we might as // well use _Block_object_assign. Otherwise we can avoid that. if (!isBlockPointer) useARCStrongCopy = true; // Non-ARC captures of retainable pointers are strong and // therefore require a call to _Block_object_assign. } else if (!qs.getObjCLifetime() && !getLangOpts().ObjCAutoRefCount) { // fall through // Otherwise the memcpy is fine. } else { continue; } // For all other types, the memcpy is fine. } else { continue; } unsigned index = capture.getIndex(); Address srcField = Builder.CreateStructGEP(src, index, capture.getOffset()); Address dstField = Builder.CreateStructGEP(dst, index, capture.getOffset()); // If there's an explicit copy expression, we do that. if (copyExpr) { EmitSynthesizedCXXCopyCtor(dstField, srcField, copyExpr); } else if (useARCWeakCopy) { EmitARCCopyWeak(dstField, srcField); } else { llvm::Value *srcValue = Builder.CreateLoad(srcField, "blockcopy.src"); if (useARCStrongCopy) { // At -O0, store null into the destination field (so that the // storeStrong doesn't over-release) and then call storeStrong. // This is a workaround to not having an initStrong call. if (CGM.getCodeGenOpts().OptimizationLevel == 0) { auto *ty = cast<llvm::PointerType>(srcValue->getType()); llvm::Value *null = llvm::ConstantPointerNull::get(ty); Builder.CreateStore(null, dstField); EmitARCStoreStrongCall(dstField, srcValue, true); // With optimization enabled, take advantage of the fact that // the blocks runtime guarantees a memcpy of the block data, and // just emit a retain of the src field. } else { EmitARCRetainNonBlock(srcValue); // We don't need this anymore, so kill it. It's not quite // worth the annoyance to avoid creating it in the first place. cast<llvm::Instruction>(dstField.getPointer())->eraseFromParent(); } } else { srcValue = Builder.CreateBitCast(srcValue, VoidPtrTy); llvm::Value *dstAddr = Builder.CreateBitCast(dstField.getPointer(), VoidPtrTy); llvm::Value *args[] = { dstAddr, srcValue, llvm::ConstantInt::get(Int32Ty, flags.getBitMask()) }; bool copyCanThrow = false; if (CI.isByRef() && variable->getType()->getAsCXXRecordDecl()) { const Expr *copyExpr = CGM.getContext().getBlockVarCopyInits(variable); if (copyExpr) { copyCanThrow = true; // FIXME: reuse the noexcept logic } } if (copyCanThrow) { EmitRuntimeCallOrInvoke(CGM.getBlockObjectAssign(), args); } else { EmitNounwindRuntimeCall(CGM.getBlockObjectAssign(), args); } } } } FinishFunction(); return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy); } /// Generate the destroy-helper function for a block closure object: /// static void block_destroy_helper(block_t *theBlock); /// /// Note that this destroys a heap-allocated block closure object; /// it should not be confused with a 'byref destroy helper', which /// destroys the heap-allocated contents of an individual __block /// variable. llvm::Constant * CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) { ASTContext &C = getContext(); FunctionArgList args; ImplicitParamDecl srcDecl(getContext(), nullptr, SourceLocation(), nullptr, C.VoidPtrTy); args.push_back(&srcDecl); const CGFunctionInfo &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args); // FIXME: We'd like to put these into a mergable by content, with // internal linkage. llvm::FunctionType *LTy = CGM.getTypes().GetFunctionType(FI); llvm::Function *Fn = llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage, "__destroy_helper_block_", &CGM.getModule()); IdentifierInfo *II = &CGM.getContext().Idents.get("__destroy_helper_block_"); FunctionDecl *FD = FunctionDecl::Create(C, C.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II, C.VoidTy, nullptr, SC_Static, false, false); CGM.SetInternalFunctionAttributes(nullptr, Fn, FI); // Create a scope with an artificial location for the body of this function. auto NL = ApplyDebugLocation::CreateEmpty(*this); StartFunction(FD, C.VoidTy, Fn, FI, args); auto AL = ApplyDebugLocation::CreateArtificial(*this); llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo(); Address src = GetAddrOfLocalVar(&srcDecl); src = Address(Builder.CreateLoad(src), blockInfo.BlockAlign); src = Builder.CreateBitCast(src, structPtrTy, "block"); const BlockDecl *blockDecl = blockInfo.getBlockDecl(); CodeGenFunction::RunCleanupsScope cleanups(*this); for (const auto &CI : blockDecl->captures()) { const VarDecl *variable = CI.getVariable(); QualType type = variable->getType(); const CGBlockInfo::Capture &capture = blockInfo.getCapture(variable); if (capture.isConstant()) continue; BlockFieldFlags flags; const CXXDestructorDecl *dtor = nullptr; bool useARCWeakDestroy = false; bool useARCStrongDestroy = false; if (CI.isByRef()) { flags = BLOCK_FIELD_IS_BYREF; if (type.isObjCGCWeak()) flags |= BLOCK_FIELD_IS_WEAK; } else if (const CXXRecordDecl *record = type->getAsCXXRecordDecl()) { if (record->hasTrivialDestructor()) continue; dtor = record->getDestructor(); } else if (type->isObjCRetainableType()) { flags = BLOCK_FIELD_IS_OBJECT; if (type->isBlockPointerType()) flags = BLOCK_FIELD_IS_BLOCK; // Special rules for ARC captures. Qualifiers qs = type.getQualifiers(); // Use objc_storeStrong for __strong direct captures; the // dynamic tools really like it when we do this. if (qs.getObjCLifetime() == Qualifiers::OCL_Strong) { useARCStrongDestroy = true; // Support __weak direct captures. } else if (qs.getObjCLifetime() == Qualifiers::OCL_Weak) { useARCWeakDestroy = true; // Non-ARC captures are strong, and we need to use _Block_object_dispose. } else if (!qs.hasObjCLifetime() && !getLangOpts().ObjCAutoRefCount) { // fall through // Otherwise, we have nothing to do. } else { continue; } } else { continue; } Address srcField = Builder.CreateStructGEP(src, capture.getIndex(), capture.getOffset()); // If there's an explicit copy expression, we do that. if (dtor) { PushDestructorCleanup(dtor, srcField); // If this is a __weak capture, emit the release directly. } else if (useARCWeakDestroy) { EmitARCDestroyWeak(srcField); // Destroy strong objects with a call if requested. } else if (useARCStrongDestroy) { EmitARCDestroyStrong(srcField, ARCImpreciseLifetime); // Otherwise we call _Block_object_dispose. It wouldn't be too // hard to just emit this as a cleanup if we wanted to make sure // that things were done in reverse. } else { llvm::Value *value = Builder.CreateLoad(srcField); value = Builder.CreateBitCast(value, VoidPtrTy); BuildBlockRelease(value, flags); } } cleanups.ForceCleanup(); FinishFunction(); return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy); } namespace { /// Emits the copy/dispose helper functions for a __block object of id type. class ObjectByrefHelpers final : public BlockByrefHelpers { BlockFieldFlags Flags; public: ObjectByrefHelpers(CharUnits alignment, BlockFieldFlags flags) : BlockByrefHelpers(alignment), Flags(flags) {} void emitCopy(CodeGenFunction &CGF, Address destField, Address srcField) override { destField = CGF.Builder.CreateBitCast(destField, CGF.VoidPtrTy); srcField = CGF.Builder.CreateBitCast(srcField, CGF.VoidPtrPtrTy); llvm::Value *srcValue = CGF.Builder.CreateLoad(srcField); unsigned flags = (Flags | BLOCK_BYREF_CALLER).getBitMask(); llvm::Value *flagsVal = llvm::ConstantInt::get(CGF.Int32Ty, flags); llvm::Value *fn = CGF.CGM.getBlockObjectAssign(); llvm::Value *args[] = { destField.getPointer(), srcValue, flagsVal }; CGF.EmitNounwindRuntimeCall(fn, args); } void emitDispose(CodeGenFunction &CGF, Address field) override { field = CGF.Builder.CreateBitCast(field, CGF.Int8PtrTy->getPointerTo(0)); llvm::Value *value = CGF.Builder.CreateLoad(field); CGF.BuildBlockRelease(value, Flags | BLOCK_BYREF_CALLER); } void profileImpl(llvm::FoldingSetNodeID &id) const override { id.AddInteger(Flags.getBitMask()); } }; /// Emits the copy/dispose helpers for an ARC __block __weak variable. class ARCWeakByrefHelpers final : public BlockByrefHelpers { public: ARCWeakByrefHelpers(CharUnits alignment) : BlockByrefHelpers(alignment) {} void emitCopy(CodeGenFunction &CGF, Address destField, Address srcField) override { CGF.EmitARCMoveWeak(destField, srcField); } void emitDispose(CodeGenFunction &CGF, Address field) override { CGF.EmitARCDestroyWeak(field); } void profileImpl(llvm::FoldingSetNodeID &id) const override { // 0 is distinguishable from all pointers and byref flags id.AddInteger(0); } }; /// Emits the copy/dispose helpers for an ARC __block __strong variable /// that's not of block-pointer type. class ARCStrongByrefHelpers final : public BlockByrefHelpers { public: ARCStrongByrefHelpers(CharUnits alignment) : BlockByrefHelpers(alignment) {} void emitCopy(CodeGenFunction &CGF, Address destField, Address srcField) override { // Do a "move" by copying the value and then zeroing out the old // variable. llvm::Value *value = CGF.Builder.CreateLoad(srcField); llvm::Value *null = llvm::ConstantPointerNull::get(cast<llvm::PointerType>(value->getType())); if (CGF.CGM.getCodeGenOpts().OptimizationLevel == 0) { CGF.Builder.CreateStore(null, destField); CGF.EmitARCStoreStrongCall(destField, value, /*ignored*/ true); CGF.EmitARCStoreStrongCall(srcField, null, /*ignored*/ true); return; } CGF.Builder.CreateStore(value, destField); CGF.Builder.CreateStore(null, srcField); } void emitDispose(CodeGenFunction &CGF, Address field) override { CGF.EmitARCDestroyStrong(field, ARCImpreciseLifetime); } void profileImpl(llvm::FoldingSetNodeID &id) const override { // 1 is distinguishable from all pointers and byref flags id.AddInteger(1); } }; /// Emits the copy/dispose helpers for an ARC __block __strong /// variable that's of block-pointer type. class ARCStrongBlockByrefHelpers final : public BlockByrefHelpers { public: ARCStrongBlockByrefHelpers(CharUnits alignment) : BlockByrefHelpers(alignment) {} void emitCopy(CodeGenFunction &CGF, Address destField, Address srcField) override { // Do the copy with objc_retainBlock; that's all that // _Block_object_assign would do anyway, and we'd have to pass the // right arguments to make sure it doesn't get no-op'ed. llvm::Value *oldValue = CGF.Builder.CreateLoad(srcField); llvm::Value *copy = CGF.EmitARCRetainBlock(oldValue, /*mandatory*/ true); CGF.Builder.CreateStore(copy, destField); } void emitDispose(CodeGenFunction &CGF, Address field) override { CGF.EmitARCDestroyStrong(field, ARCImpreciseLifetime); } void profileImpl(llvm::FoldingSetNodeID &id) const override { // 2 is distinguishable from all pointers and byref flags id.AddInteger(2); } }; /// Emits the copy/dispose helpers for a __block variable with a /// nontrivial copy constructor or destructor. class CXXByrefHelpers final : public BlockByrefHelpers { QualType VarType; const Expr *CopyExpr; public: CXXByrefHelpers(CharUnits alignment, QualType type, const Expr *copyExpr) : BlockByrefHelpers(alignment), VarType(type), CopyExpr(copyExpr) {} bool needsCopy() const override { return CopyExpr != nullptr; } void emitCopy(CodeGenFunction &CGF, Address destField, Address srcField) override { if (!CopyExpr) return; CGF.EmitSynthesizedCXXCopyCtor(destField, srcField, CopyExpr); } void emitDispose(CodeGenFunction &CGF, Address field) override { EHScopeStack::stable_iterator cleanupDepth = CGF.EHStack.stable_begin(); CGF.PushDestructorCleanup(VarType, field); CGF.PopCleanupBlocks(cleanupDepth); } void profileImpl(llvm::FoldingSetNodeID &id) const override { id.AddPointer(VarType.getCanonicalType().getAsOpaquePtr()); } }; } // end anonymous namespace static llvm::Constant * generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo, BlockByrefHelpers &generator) { ASTContext &Context = CGF.getContext(); QualType R = Context.VoidTy; FunctionArgList args; ImplicitParamDecl dst(CGF.getContext(), nullptr, SourceLocation(), nullptr, Context.VoidPtrTy); args.push_back(&dst); ImplicitParamDecl src(CGF.getContext(), nullptr, SourceLocation(), nullptr, Context.VoidPtrTy); args.push_back(&src); const CGFunctionInfo &FI = CGF.CGM.getTypes().arrangeBuiltinFunctionDeclaration(R, args); llvm::FunctionType *LTy = CGF.CGM.getTypes().GetFunctionType(FI); // FIXME: We'd like to put these into a mergable by content, with // internal linkage. llvm::Function *Fn = llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage, "__Block_byref_object_copy_", &CGF.CGM.getModule()); IdentifierInfo *II = &Context.Idents.get("__Block_byref_object_copy_"); FunctionDecl *FD = FunctionDecl::Create(Context, Context.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II, R, nullptr, SC_Static, false, false); CGF.CGM.SetInternalFunctionAttributes(nullptr, Fn, FI); CGF.StartFunction(FD, R, Fn, FI, args); if (generator.needsCopy()) { llvm::Type *byrefPtrType = byrefInfo.Type->getPointerTo(0); // dst->x Address destField = CGF.GetAddrOfLocalVar(&dst); destField = Address(CGF.Builder.CreateLoad(destField), byrefInfo.ByrefAlignment); destField = CGF.Builder.CreateBitCast(destField, byrefPtrType); destField = CGF.emitBlockByrefAddress(destField, byrefInfo, false, "dest-object"); // src->x Address srcField = CGF.GetAddrOfLocalVar(&src); srcField = Address(CGF.Builder.CreateLoad(srcField), byrefInfo.ByrefAlignment); srcField = CGF.Builder.CreateBitCast(srcField, byrefPtrType); srcField = CGF.emitBlockByrefAddress(srcField, byrefInfo, false, "src-object"); generator.emitCopy(CGF, destField, srcField); } CGF.FinishFunction(); return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy); } /// Build the copy helper for a __block variable. static llvm::Constant *buildByrefCopyHelper(CodeGenModule &CGM, const BlockByrefInfo &byrefInfo, BlockByrefHelpers &generator) { CodeGenFunction CGF(CGM); return generateByrefCopyHelper(CGF, byrefInfo, generator); } /// Generate code for a __block variable's dispose helper. static llvm::Constant * generateByrefDisposeHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo, BlockByrefHelpers &generator) { ASTContext &Context = CGF.getContext(); QualType R = Context.VoidTy; FunctionArgList args; ImplicitParamDecl src(CGF.getContext(), nullptr, SourceLocation(), nullptr, Context.VoidPtrTy); args.push_back(&src); const CGFunctionInfo &FI = CGF.CGM.getTypes().arrangeBuiltinFunctionDeclaration(R, args); llvm::FunctionType *LTy = CGF.CGM.getTypes().GetFunctionType(FI); // FIXME: We'd like to put these into a mergable by content, with // internal linkage. llvm::Function *Fn = llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage, "__Block_byref_object_dispose_", &CGF.CGM.getModule()); IdentifierInfo *II = &Context.Idents.get("__Block_byref_object_dispose_"); FunctionDecl *FD = FunctionDecl::Create(Context, Context.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II, R, nullptr, SC_Static, false, false); CGF.CGM.SetInternalFunctionAttributes(nullptr, Fn, FI); CGF.StartFunction(FD, R, Fn, FI, args); if (generator.needsDispose()) { Address addr = CGF.GetAddrOfLocalVar(&src); addr = Address(CGF.Builder.CreateLoad(addr), byrefInfo.ByrefAlignment); auto byrefPtrType = byrefInfo.Type->getPointerTo(0); addr = CGF.Builder.CreateBitCast(addr, byrefPtrType); addr = CGF.emitBlockByrefAddress(addr, byrefInfo, false, "object"); generator.emitDispose(CGF, addr); } CGF.FinishFunction(); return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy); } /// Build the dispose helper for a __block variable. static llvm::Constant *buildByrefDisposeHelper(CodeGenModule &CGM, const BlockByrefInfo &byrefInfo, BlockByrefHelpers &generator) { CodeGenFunction CGF(CGM); return generateByrefDisposeHelper(CGF, byrefInfo, generator); } /// Lazily build the copy and dispose helpers for a __block variable /// with the given information. template <class T> static T *buildByrefHelpers(CodeGenModule &CGM, const BlockByrefInfo &byrefInfo, T &&generator) { llvm::FoldingSetNodeID id; generator.Profile(id); void *insertPos; BlockByrefHelpers *node = CGM.ByrefHelpersCache.FindNodeOrInsertPos(id, insertPos); if (node) return static_cast<T*>(node); generator.CopyHelper = buildByrefCopyHelper(CGM, byrefInfo, generator); generator.DisposeHelper = buildByrefDisposeHelper(CGM, byrefInfo, generator); T *copy = new (CGM.getContext()) T(std::forward<T>(generator)); CGM.ByrefHelpersCache.InsertNode(copy, insertPos); return copy; } /// Build the copy and dispose helpers for the given __block variable /// emission. Places the helpers in the global cache. Returns null /// if no helpers are required. BlockByrefHelpers * CodeGenFunction::buildByrefHelpers(llvm::StructType &byrefType, const AutoVarEmission &emission) { const VarDecl &var = *emission.Variable; QualType type = var.getType(); auto &byrefInfo = getBlockByrefInfo(&var); // The alignment we care about for the purposes of uniquing byref // helpers is the alignment of the actual byref value field. CharUnits valueAlignment = byrefInfo.ByrefAlignment.alignmentAtOffset(byrefInfo.FieldOffset); if (const CXXRecordDecl *record = type->getAsCXXRecordDecl()) { const Expr *copyExpr = CGM.getContext().getBlockVarCopyInits(&var); if (!copyExpr && record->hasTrivialDestructor()) return nullptr; return ::buildByrefHelpers( CGM, byrefInfo, CXXByrefHelpers(valueAlignment, type, copyExpr)); } // Otherwise, if we don't have a retainable type, there's nothing to do. // that the runtime does extra copies. if (!type->isObjCRetainableType()) return nullptr; Qualifiers qs = type.getQualifiers(); // If we have lifetime, that dominates. if (Qualifiers::ObjCLifetime lifetime = qs.getObjCLifetime()) { switch (lifetime) { case Qualifiers::OCL_None: llvm_unreachable("impossible"); // These are just bits as far as the runtime is concerned. case Qualifiers::OCL_ExplicitNone: case Qualifiers::OCL_Autoreleasing: return nullptr; // Tell the runtime that this is ARC __weak, called by the // byref routines. case Qualifiers::OCL_Weak: return ::buildByrefHelpers(CGM, byrefInfo, ARCWeakByrefHelpers(valueAlignment)); // ARC __strong __block variables need to be retained. case Qualifiers::OCL_Strong: // Block pointers need to be copied, and there's no direct // transfer possible. if (type->isBlockPointerType()) { return ::buildByrefHelpers(CGM, byrefInfo, ARCStrongBlockByrefHelpers(valueAlignment)); // Otherwise, we transfer ownership of the retain from the stack // to the heap. } else { return ::buildByrefHelpers(CGM, byrefInfo, ARCStrongByrefHelpers(valueAlignment)); } } llvm_unreachable("fell out of lifetime switch!"); } BlockFieldFlags flags; if (type->isBlockPointerType()) { flags |= BLOCK_FIELD_IS_BLOCK; } else if (CGM.getContext().isObjCNSObjectType(type) || type->isObjCObjectPointerType()) { flags |= BLOCK_FIELD_IS_OBJECT; } else { return nullptr; } if (type.isObjCGCWeak()) flags |= BLOCK_FIELD_IS_WEAK; return ::buildByrefHelpers(CGM, byrefInfo, ObjectByrefHelpers(valueAlignment, flags)); } Address CodeGenFunction::emitBlockByrefAddress(Address baseAddr, const VarDecl *var, bool followForward) { auto &info = getBlockByrefInfo(var); return emitBlockByrefAddress(baseAddr, info, followForward, var->getName()); } Address CodeGenFunction::emitBlockByrefAddress(Address baseAddr, const BlockByrefInfo &info, bool followForward, const llvm::Twine &name) { // Chase the forwarding address if requested. if (followForward) { Address forwardingAddr = Builder.CreateStructGEP(baseAddr, 1, getPointerSize(), "forwarding"); baseAddr = Address(Builder.CreateLoad(forwardingAddr), info.ByrefAlignment); } return Builder.CreateStructGEP(baseAddr, info.FieldIndex, info.FieldOffset, name); } /// BuildByrefInfo - This routine changes a __block variable declared as T x /// into: /// /// struct { /// void *__isa; /// void *__forwarding; /// int32_t __flags; /// int32_t __size; /// void *__copy_helper; // only if needed /// void *__destroy_helper; // only if needed /// void *__byref_variable_layout;// only if needed /// char padding[X]; // only if needed /// T x; /// } x /// const BlockByrefInfo &CodeGenFunction::getBlockByrefInfo(const VarDecl *D) { auto it = BlockByrefInfos.find(D); if (it != BlockByrefInfos.end()) return it->second; llvm::StructType *byrefType = llvm::StructType::create(getLLVMContext(), "struct.__block_byref_" + D->getNameAsString()); QualType Ty = D->getType(); CharUnits size; SmallVector<llvm::Type *, 8> types; // void *__isa; types.push_back(Int8PtrTy); size += getPointerSize(); // void *__forwarding; types.push_back(llvm::PointerType::getUnqual(byrefType)); size += getPointerSize(); // int32_t __flags; types.push_back(Int32Ty); size += CharUnits::fromQuantity(4); // int32_t __size; types.push_back(Int32Ty); size += CharUnits::fromQuantity(4); // Note that this must match *exactly* the logic in buildByrefHelpers. bool hasCopyAndDispose = getContext().BlockRequiresCopying(Ty, D); if (hasCopyAndDispose) { /// void *__copy_helper; types.push_back(Int8PtrTy); size += getPointerSize(); /// void *__destroy_helper; types.push_back(Int8PtrTy); size += getPointerSize(); } bool HasByrefExtendedLayout = false; Qualifiers::ObjCLifetime Lifetime; if (getContext().getByrefLifetime(Ty, Lifetime, HasByrefExtendedLayout) && HasByrefExtendedLayout) { /// void *__byref_variable_layout; types.push_back(Int8PtrTy); size += CharUnits::fromQuantity(PointerSizeInBytes); } // T x; llvm::Type *varTy = ConvertTypeForMem(Ty); bool packed = false; CharUnits varAlign = getContext().getDeclAlign(D); CharUnits varOffset = size.alignTo(varAlign); // We may have to insert padding. if (varOffset != size) { llvm::Type *paddingTy = llvm::ArrayType::get(Int8Ty, (varOffset - size).getQuantity()); types.push_back(paddingTy); size = varOffset; // Conversely, we might have to prevent LLVM from inserting padding. } else if (CGM.getDataLayout().getABITypeAlignment(varTy) > varAlign.getQuantity()) { packed = true; } types.push_back(varTy); byrefType->setBody(types, packed); BlockByrefInfo info; info.Type = byrefType; info.FieldIndex = types.size() - 1; info.FieldOffset = varOffset; info.ByrefAlignment = std::max(varAlign, getPointerAlign()); auto pair = BlockByrefInfos.insert({D, info}); assert(pair.second && "info was inserted recursively?"); return pair.first->second; } /// Initialize the structural components of a __block variable, i.e. /// everything but the actual object. void CodeGenFunction::emitByrefStructureInit(const AutoVarEmission &emission) { // Find the address of the local. Address addr = emission.Addr; // That's an alloca of the byref structure type. llvm::StructType *byrefType = cast<llvm::StructType>( cast<llvm::PointerType>(addr.getPointer()->getType())->getElementType()); unsigned nextHeaderIndex = 0; CharUnits nextHeaderOffset; auto storeHeaderField = [&](llvm::Value *value, CharUnits fieldSize, const Twine &name) { auto fieldAddr = Builder.CreateStructGEP(addr, nextHeaderIndex, nextHeaderOffset, name); Builder.CreateStore(value, fieldAddr); nextHeaderIndex++; nextHeaderOffset += fieldSize; }; // Build the byref helpers if necessary. This is null if we don't need any. BlockByrefHelpers *helpers = buildByrefHelpers(*byrefType, emission); const VarDecl &D = *emission.Variable; QualType type = D.getType(); bool HasByrefExtendedLayout; Qualifiers::ObjCLifetime ByrefLifetime; bool ByRefHasLifetime = getContext().getByrefLifetime(type, ByrefLifetime, HasByrefExtendedLayout); llvm::Value *V; // Initialize the 'isa', which is just 0 or 1. int isa = 0; if (type.isObjCGCWeak()) isa = 1; V = Builder.CreateIntToPtr(Builder.getInt32(isa), Int8PtrTy, "isa"); storeHeaderField(V, getPointerSize(), "byref.isa"); // Store the address of the variable into its own forwarding pointer. storeHeaderField(addr.getPointer(), getPointerSize(), "byref.forwarding"); // Blocks ABI: // c) the flags field is set to either 0 if no helper functions are // needed or BLOCK_BYREF_HAS_COPY_DISPOSE if they are, BlockFlags flags; if (helpers) flags |= BLOCK_BYREF_HAS_COPY_DISPOSE; if (ByRefHasLifetime) { if (HasByrefExtendedLayout) flags |= BLOCK_BYREF_LAYOUT_EXTENDED; else switch (ByrefLifetime) { case Qualifiers::OCL_Strong: flags |= BLOCK_BYREF_LAYOUT_STRONG; break; case Qualifiers::OCL_Weak: flags |= BLOCK_BYREF_LAYOUT_WEAK; break; case Qualifiers::OCL_ExplicitNone: flags |= BLOCK_BYREF_LAYOUT_UNRETAINED; break; case Qualifiers::OCL_None: if (!type->isObjCObjectPointerType() && !type->isBlockPointerType()) flags |= BLOCK_BYREF_LAYOUT_NON_OBJECT; break; default: break; } if (CGM.getLangOpts().ObjCGCBitmapPrint) { printf("\n Inline flag for BYREF variable layout (%d):", flags.getBitMask()); if (flags & BLOCK_BYREF_HAS_COPY_DISPOSE) printf(" BLOCK_BYREF_HAS_COPY_DISPOSE"); if (flags & BLOCK_BYREF_LAYOUT_MASK) { BlockFlags ThisFlag(flags.getBitMask() & BLOCK_BYREF_LAYOUT_MASK); if (ThisFlag == BLOCK_BYREF_LAYOUT_EXTENDED) printf(" BLOCK_BYREF_LAYOUT_EXTENDED"); if (ThisFlag == BLOCK_BYREF_LAYOUT_STRONG) printf(" BLOCK_BYREF_LAYOUT_STRONG"); if (ThisFlag == BLOCK_BYREF_LAYOUT_WEAK) printf(" BLOCK_BYREF_LAYOUT_WEAK"); if (ThisFlag == BLOCK_BYREF_LAYOUT_UNRETAINED) printf(" BLOCK_BYREF_LAYOUT_UNRETAINED"); if (ThisFlag == BLOCK_BYREF_LAYOUT_NON_OBJECT) printf(" BLOCK_BYREF_LAYOUT_NON_OBJECT"); } printf("\n"); } } storeHeaderField(llvm::ConstantInt::get(IntTy, flags.getBitMask()), getIntSize(), "byref.flags"); CharUnits byrefSize = CGM.GetTargetTypeStoreSize(byrefType); V = llvm::ConstantInt::get(IntTy, byrefSize.getQuantity()); storeHeaderField(V, getIntSize(), "byref.size"); if (helpers) { storeHeaderField(helpers->CopyHelper, getPointerSize(), "byref.copyHelper"); storeHeaderField(helpers->DisposeHelper, getPointerSize(), "byref.disposeHelper"); } if (ByRefHasLifetime && HasByrefExtendedLayout) { auto layoutInfo = CGM.getObjCRuntime().BuildByrefLayout(CGM, type); storeHeaderField(layoutInfo, getPointerSize(), "byref.layout"); } } void CodeGenFunction::BuildBlockRelease(llvm::Value *V, BlockFieldFlags flags) { llvm::Value *F = CGM.getBlockObjectDispose(); llvm::Value *args[] = { Builder.CreateBitCast(V, Int8PtrTy), llvm::ConstantInt::get(Int32Ty, flags.getBitMask()) }; EmitNounwindRuntimeCall(F, args); // FIXME: throwing destructors? } namespace { /// Release a __block variable. struct CallBlockRelease final : EHScopeStack::Cleanup { llvm::Value *Addr; CallBlockRelease(llvm::Value *Addr) : Addr(Addr) {} void Emit(CodeGenFunction &CGF, Flags flags) override { // Should we be passing FIELD_IS_WEAK here? CGF.BuildBlockRelease(Addr, BLOCK_FIELD_IS_BYREF); } }; } // end anonymous namespace /// Enter a cleanup to destroy a __block variable. Note that this /// cleanup should be a no-op if the variable hasn't left the stack /// yet; if a cleanup is required for the variable itself, that needs /// to be done externally. void CodeGenFunction::enterByrefCleanup(const AutoVarEmission &emission) { // We don't enter this cleanup if we're in pure-GC mode. if (CGM.getLangOpts().getGC() == LangOptions::GCOnly) return; EHStack.pushCleanup<CallBlockRelease>(NormalAndEHCleanup, emission.Addr.getPointer()); } /// Adjust the declaration of something from the blocks API. static void configureBlocksRuntimeObject(CodeGenModule &CGM, llvm::Constant *C) { auto *GV = cast<llvm::GlobalValue>(C->stripPointerCasts()); if (CGM.getTarget().getTriple().isOSBinFormatCOFF()) { IdentifierInfo &II = CGM.getContext().Idents.get(C->getName()); TranslationUnitDecl *TUDecl = CGM.getContext().getTranslationUnitDecl(); DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl); assert((isa<llvm::Function>(C->stripPointerCasts()) || isa<llvm::GlobalVariable>(C->stripPointerCasts())) && "expected Function or GlobalVariable"); const NamedDecl *ND = nullptr; for (const auto &Result : DC->lookup(&II)) if ((ND = dyn_cast<FunctionDecl>(Result)) || (ND = dyn_cast<VarDecl>(Result))) break; // TODO: support static blocks runtime if (GV->isDeclaration() && (!ND || !ND->hasAttr<DLLExportAttr>())) { GV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); GV->setLinkage(llvm::GlobalValue::ExternalLinkage); } else { GV->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); GV->setLinkage(llvm::GlobalValue::ExternalLinkage); } } if (!CGM.getLangOpts().BlocksRuntimeOptional) return; if (GV->isDeclaration() && GV->hasExternalLinkage()) GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage); } llvm::Constant *CodeGenModule::getBlockObjectDispose() { if (BlockObjectDispose) return BlockObjectDispose; llvm::Type *args[] = { Int8PtrTy, Int32Ty }; llvm::FunctionType *fty = llvm::FunctionType::get(VoidTy, args, false); BlockObjectDispose = CreateRuntimeFunction(fty, "_Block_object_dispose"); configureBlocksRuntimeObject(*this, BlockObjectDispose); return BlockObjectDispose; } llvm::Constant *CodeGenModule::getBlockObjectAssign() { if (BlockObjectAssign) return BlockObjectAssign; llvm::Type *args[] = { Int8PtrTy, Int8PtrTy, Int32Ty }; llvm::FunctionType *fty = llvm::FunctionType::get(VoidTy, args, false); BlockObjectAssign = CreateRuntimeFunction(fty, "_Block_object_assign"); configureBlocksRuntimeObject(*this, BlockObjectAssign); return BlockObjectAssign; } llvm::Constant *CodeGenModule::getNSConcreteGlobalBlock() { if (NSConcreteGlobalBlock) return NSConcreteGlobalBlock; NSConcreteGlobalBlock = GetOrCreateLLVMGlobal("_NSConcreteGlobalBlock", Int8PtrTy->getPointerTo(), nullptr); configureBlocksRuntimeObject(*this, NSConcreteGlobalBlock); return NSConcreteGlobalBlock; } llvm::Constant *CodeGenModule::getNSConcreteStackBlock() { if (NSConcreteStackBlock) return NSConcreteStackBlock; NSConcreteStackBlock = GetOrCreateLLVMGlobal("_NSConcreteStackBlock", Int8PtrTy->getPointerTo(), nullptr); configureBlocksRuntimeObject(*this, NSConcreteStackBlock); return NSConcreteStackBlock; }
LMMasks label byte word C_BLACK Bitmap <71,100,0,BMF_MONO> db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 db 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c db 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc db 0xaa, 0xb8, 0x1f, 0xfc, 0x0e, 0xaa, 0xaa, 0xaa, 0xa8 db 0xd5, 0x60, 0x00, 0x00, 0x03, 0x55, 0x55, 0x55, 0x54 db 0xab, 0x80, 0x00, 0x00, 0x00, 0xea, 0xaa, 0xaa, 0xa8 db 0xfe, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfc db 0x84, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00 db 0x88, 0x10, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00 db 0x88, 0x23, 0xc0, 0x01, 0xe4, 0x08, 0x00, 0x00, 0x00 db 0xf8, 0x46, 0x02, 0x10, 0x32, 0x0f, 0xff, 0xff, 0xfc db 0xb0, 0x8c, 0x01, 0xe0, 0x19, 0x06, 0xaa, 0xaa, 0xa8 db 0xd0, 0x18, 0x00, 0x00, 0x0c, 0x05, 0x55, 0x55, 0x54 db 0xb0, 0x30, 0x00, 0x00, 0x06, 0x06, 0xaa, 0xaa, 0xa8 db 0xf0, 0x40, 0x00, 0x00, 0x01, 0x07, 0xff, 0xff, 0xfc db 0x91, 0x80, 0xe0, 0x03, 0x80, 0xc6, 0x80, 0x00, 0x00 db 0x93, 0x07, 0xf0, 0x07, 0xf0, 0x65, 0x40, 0x00, 0x00 db 0x92, 0x3f, 0xf0, 0x07, 0xfe, 0x26, 0xa0, 0x00, 0x00 db 0xf2, 0x5f, 0xf8, 0x0f, 0xfd, 0x27, 0xff, 0xff, 0xfc db 0xb0, 0x1f, 0xe4, 0x13, 0xfc, 0x07, 0xea, 0xaa, 0xa8 db 0xd0, 0x0f, 0xe0, 0x03, 0xf8, 0x07, 0xf5, 0x55, 0x54 db 0xb0, 0x47, 0xc0, 0x81, 0xf1, 0x07, 0xfa, 0xaa, 0xa8 db 0xf0, 0x40, 0x00, 0x80, 0x01, 0x07, 0xff, 0xff, 0xfc db 0x90, 0x20, 0x00, 0x80, 0x02, 0x06, 0xa0, 0x00, 0x00 db 0x90, 0x1c, 0x00, 0x80, 0x1c, 0x05, 0x50, 0x00, 0x00 db 0x90, 0x00, 0x00, 0x80, 0x00, 0x06, 0xa0, 0x00, 0x00 db 0xf0, 0x00, 0x00, 0x80, 0x00, 0x07, 0xff, 0xff, 0xfc db 0xb0, 0x00, 0x00, 0x80, 0x00, 0x07, 0xfa, 0xaa, 0xa8 db 0xd0, 0x00, 0x00, 0x80, 0x00, 0x07, 0xf5, 0x55, 0x54 db 0xb0, 0x00, 0x80, 0x80, 0x80, 0x07, 0xfa, 0xaa, 0xa8 db 0xf0, 0x01, 0x00, 0x80, 0x40, 0x07, 0xff, 0xff, 0xfc db 0x90, 0x01, 0x30, 0x06, 0x40, 0x06, 0xa0, 0x00, 0x00 db 0x90, 0x01, 0x38, 0x0e, 0x40, 0x05, 0x50, 0x00, 0x00 db 0x90, 0x07, 0x9c, 0x1c, 0xf0, 0x06, 0xa0, 0x00, 0x00 db 0xf0, 0x08, 0x43, 0xe1, 0x08, 0x07, 0xff, 0xff, 0xfc db 0xb0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfa, 0xaa, 0xa8 db 0xd0, 0x00, 0x7e, 0x3f, 0x00, 0x07, 0xf5, 0x55, 0x54 db 0xb0, 0x01, 0xff, 0xff, 0xc0, 0x07, 0xfa, 0xaa, 0xa8 db 0xf8, 0x03, 0xff, 0xff, 0xe0, 0x0f, 0xff, 0xff, 0xfc db 0x88, 0x27, 0xff, 0xff, 0xf2, 0x0a, 0xa0, 0x00, 0x00 db 0x84, 0x47, 0xff, 0xff, 0xf1, 0x1d, 0x50, 0x00, 0x00 db 0x84, 0x4f, 0xe3, 0xe3, 0xf9, 0x1a, 0xa0, 0x00, 0x00 db 0xfe, 0x4f, 0xc0, 0x01, 0xf9, 0x3f, 0xff, 0xff, 0xfc db 0xaa, 0x4f, 0x80, 0x00, 0xf9, 0x3f, 0xfa, 0xaa, 0xa8 db 0xd5, 0x37, 0x03, 0xe0, 0x72, 0x7f, 0xf5, 0x55, 0x54 db 0xab, 0x00, 0x44, 0x11, 0x1f, 0xff, 0xff, 0xea, 0xa8 db 0xff, 0x81, 0x80, 0x00, 0xe0, 0x7f, 0xf0, 0x3f, 0xfc db 0x80, 0x40, 0x00, 0x01, 0x80, 0x00, 0x00, 0x0c, 0x00 db 0x80, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00 db 0x80, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x80 db 0xff, 0xfc, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x7c db 0xaa, 0xae, 0x00, 0x20, 0x00, 0xff, 0xf8, 0x00, 0x28 db 0xd5, 0x5f, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x34 db 0xaa, 0xaf, 0xf0, 0x20, 0x40, 0x00, 0x00, 0x10, 0x28 db 0xff, 0xff, 0xff, 0xc0, 0x80, 0x00, 0x00, 0x08, 0x1c db 0x80, 0x02, 0xaa, 0xc1, 0x1f, 0x00, 0x07, 0xc4, 0x10 db 0x80, 0x01, 0x55, 0xc0, 0x20, 0x00, 0x00, 0x20, 0x10 db 0x80, 0x00, 0xaa, 0xc0, 0x40, 0x07, 0x00, 0x10, 0x1c db 0xff, 0xff, 0xff, 0xc3, 0x00, 0x00, 0x00, 0x06, 0x1c db 0xaa, 0xaa, 0xbf, 0xc0, 0x1f, 0x80, 0x0f, 0xc0, 0x1c db 0xd5, 0x55, 0x5f, 0xc0, 0xff, 0xc7, 0x1f, 0xf8, 0x1c db 0xaa, 0xaa, 0xaf, 0xdd, 0x7f, 0xa0, 0x2f, 0xf5, 0xdc db 0xff, 0xff, 0xff, 0xc0, 0x7f, 0x00, 0x07, 0xf0, 0x1c db 0x80, 0x00, 0x00, 0x44, 0x3c, 0x40, 0x11, 0xe1, 0x18 db 0x80, 0x00, 0x00, 0x49, 0x00, 0x42, 0x10, 0x04, 0x94 db 0x80, 0x00, 0x00, 0x40, 0xf8, 0x82, 0x08, 0xf8, 0x18 db 0xff, 0xff, 0xff, 0xc0, 0x00, 0x02, 0x00, 0x00, 0x1c db 0xaa, 0xaa, 0xaa, 0xc0, 0x00, 0x02, 0x00, 0x00, 0x1c db 0xd5, 0x55, 0x55, 0x80, 0x00, 0x02, 0x00, 0x00, 0x1c db 0xaa, 0xaa, 0xaa, 0x80, 0x00, 0x02, 0x00, 0x00, 0x1c db 0xff, 0xff, 0xff, 0x80, 0x00, 0x02, 0x00, 0x02, 0x1c db 0x80, 0x00, 0x00, 0x82, 0x00, 0x02, 0x00, 0x01, 0x18 db 0x80, 0x00, 0x00, 0x84, 0x02, 0x02, 0x02, 0x00, 0x14 db 0x80, 0x00, 0x00, 0x80, 0x04, 0x02, 0x01, 0x00, 0x18 db 0xff, 0xff, 0xff, 0x80, 0xe4, 0xc0, 0x19, 0x38, 0x1c db 0xaa, 0xaa, 0xaa, 0x81, 0x14, 0xe0, 0x39, 0x44, 0x1c db 0xd5, 0x55, 0x55, 0x40, 0x0e, 0x70, 0x73, 0x80, 0x1c db 0xaa, 0xaa, 0xaa, 0xc0, 0x01, 0x0f, 0x84, 0x00, 0x1c db 0xff, 0xff, 0xff, 0xc4, 0x78, 0x00, 0x00, 0xf1, 0x1c db 0x80, 0x00, 0x00, 0x44, 0xfe, 0x00, 0x03, 0xf9, 0x18 db 0x80, 0x00, 0x00, 0x40, 0xff, 0x80, 0x0f, 0xf8, 0x14 db 0x80, 0x00, 0x00, 0x20, 0x7f, 0xe0, 0x3f, 0xf0, 0x28 db 0xff, 0xff, 0xff, 0xe1, 0x3f, 0xff, 0xff, 0xe4, 0x3c db 0xaa, 0xaa, 0xaa, 0xb0, 0x9f, 0xff, 0xff, 0xc8, 0x7c db 0xd5, 0x55, 0x55, 0x50, 0x47, 0xff, 0xff, 0x10, 0x7c db 0xaa, 0xaa, 0xaa, 0xa8, 0x00, 0x7f, 0xf0, 0x00, 0xfc db 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x01, 0xfc db 0x80, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0xa8 db 0x80, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x80, 0x07, 0x54 db 0x80, 0x00, 0x00, 0x01, 0x80, 0x30, 0x60, 0x0e, 0xa8 db 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x1f, 0xfc db 0xaa, 0xaa, 0xaa, 0xaa, 0xe0, 0x00, 0x00, 0x3f, 0xfc db 0xd5, 0x55, 0x55, 0x55, 0x70, 0x00, 0x00, 0x7f, 0xfc db 0xaa, 0xaa, 0xaa, 0xaa, 0xf8, 0x00, 0x00, 0xff, 0xfc db 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x01, 0xff, 0xfc db 0x80, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0xaa, 0xa8 db 0x80, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x1f, 0x55, 0x54 db 0x40, 0x00, 0x00, 0x00, 0x05, 0x7f, 0xfa, 0xaa, 0xac db 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.include "defaults_mod.asm" table_file_jp equ "exe4-utf8.tbl" table_file_en equ "bn4-utf8.tbl" game_code_len equ 3 game_code equ 0x4234574A // B4WJ game_code_2 equ 0x42345745 // B4WE game_code_3 equ 0x42345750 // B4WP card_type equ 1 card_id equ 32 card_no equ "032" card_sub equ "Mod Card 032" card_sub_x equ 64 card_desc_len equ 2 card_desc_1 equ "Address 0C" card_desc_2 equ "MAX HP +350" card_desc_3 equ "" card_name_jp_full equ "マックスHP+350" card_name_jp_game equ "マックスHP+350" card_name_en_full equ "MAX HP +350" card_name_en_game equ "MAX HP +350" card_address equ "0C" card_address_id equ 2 card_bug equ 0 card_wrote_en equ "MAX HP +350" card_wrote_jp equ "マックスHP+350"
/** * @file fontutils.cpp * @brief help functions for font and char * @author Yunhui Fu (yhfudev@gmail.com) * @version 1.0 * @date 2016-08-19 * @copyright GPL/BSD */ #include "../inc/MarlinConfig.h" #if HAS_SPI_LCD #include "ultralcd.h" #include "../MarlinCore.h" #endif #include "fontutils.h" uint8_t read_byte_ram(uint8_t * str) { return *str; } uint8_t read_byte_rom(uint8_t * str) { return pgm_read_byte(str); } /** * @brief Using binary search to find the position by data_pin * * @param userdata : User's data * @param num_data : the item number of the sorted data * @param cb_comp : the callback function to compare the user's data and pin * @param data_pin : The reference data to be found * @param ret_idx : the position of the required data; If failed, then it is the failed position, which is the insert position if possible. * * @return 0 on found, <0 on failed(fail position is saved by ret_idx) * * Using binary search to find the position by data_pin. The user's data should be sorted. */ int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp, void *data_pinpoint, size_t *ret_idx) { int retcomp; if (num_data < 1) { *ret_idx = 0; return -1; } size_t i = 0, ileft = 1, iright = num_data; bool flg_found = false; for (; ileft <= iright;) { i = (ileft + iright) / 2 - 1; /* cb_comp should return the *userdata[i] - *data_pinpoint */ retcomp = cb_comp (userdata, i, data_pinpoint); if (retcomp > 0) iright = i; else if (retcomp < 0) ileft = i + 2; else { /* found ! */ flg_found = true; break; } } if (flg_found) { *ret_idx = i; return 0; } if (iright <= i) *ret_idx = i; else if (ileft >= i + 2) *ret_idx = i + 1; return -1; } /* This function gets the character at the pstart position, interpreting UTF8 multybyte sequences and returns the pointer to the next character */ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) { uint32_t val = 0; uint8_t *p = pstart; uint8_t valcur = cb_read_byte(p); if (0 == (0x80 & valcur)) { val = valcur; p++; } else if (0xC0 == (0xE0 & valcur)) { val = valcur & 0x1F; val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); p++; } else if (0xE0 == (0xF0 & valcur)) { val = valcur & 0x0F; val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); p++; } else if (0xF0 == (0xF8 & valcur)) { val = valcur & 0x07; val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); p++; } else if (0xF8 == (0xFC & valcur)) { val = valcur & 0x03; val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); p++; } else if (0xFC == (0xFE & valcur)) { val = valcur & 0x01; val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); p++; } else if (0x80 == (0xC0 & valcur)) for (; 0x80 == (0xC0 & valcur); ) { p++; valcur = cb_read_byte(p); } else for (; ((0xFE & valcur) > 0xFC); ) { p++; valcur = cb_read_byte(p); } if (pval) *pval = val; return p; } static inline uint8_t utf8_strlen_cb(const char *pstart, read_byte_cb_t cb_read_byte) { uint8_t cnt = 0; uint8_t *pnext = (uint8_t *)pstart; for (;;) { wchar_t ch; pnext = get_utf8_value_cb(pnext, cb_read_byte, &ch); if (!ch) break; cnt++; } return cnt; } uint8_t utf8_strlen(const char *pstart) { return utf8_strlen_cb(pstart, read_byte_ram); } uint8_t utf8_strlen_P(PGM_P pstart) { return utf8_strlen_cb(pstart, read_byte_rom); }
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1994 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: egaLoader.asm AUTHOR: Gene Anderson, Feb 24, 1994 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Gene 2/24/94 Initial revision DESCRIPTION: $Id: loader.asm,v 1.1 97/04/04 17:27:08 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LOADER_DEFAULT_GRAPHIC_BACKGROUND_COLOR equ (0xff shl 8) or C_BLACK kcode segment para public 'CODE' cgroup group kcode, stack include main.asm include locate.asm include strings.asm include ini.asm include load.asm include heap.asm include path.asm ifndef NO_AUTODETECT include videoDetect.asm ifndef NO_SPLASH_SCREEN include videoDisplay.asm include videoVGA.asm include videoSVGA.asm include videoEGA.asm include videoMCGA.asm include videoCGA.asm include videoHGC.asm include videoEGAImageLogo.asm endif endif kcode ends end LoadGeos
// // $Id: proctran.cpp 1195 2009-08-14 22:12:04Z chambm $ // // // Darren Kessner <darren@proteowizard.org> // // Copyright 2009 Spielberg Family Center for Applied Proteomics // Cedars Sinai Medical Center, Los Angeles, California 90048 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include "pwiz/analysis/frequency/PeakDetectorNaive.hpp" #include "pwiz/analysis/frequency/PeakDetectorMatchedFilter.hpp" #include "pwiz/analysis/frequency/FrequencyEstimatorSimple.hpp" #include "pwiz/analysis/frequency/FrequencyEstimatorPhysicalModel.hpp" #include "pwiz/analysis/calibration/Calibrator.hpp" #include "pwiz/analysis/calibration/MassDatabase.hpp" #include "pwiz/data/misc/CalibrationParameters.hpp" #include "pwiz_aux/sfcap/transient/TransientData.hpp" #include "pwiz/data/misc/FrequencyData.hpp" #include "pwiz/data/misc/PeakData.hpp" #include "pwiz/utility/proteome/IsotopeEnvelopeEstimator.hpp" #include "RecalibratorKnownMassList.hpp" #include "RecalibratorSimple.hpp" #include "pwiz_aux/sfcap/peptideSieve/fasta.h" // interface to fasta file handling using bioinfo::fasta; #include "pwiz_aux/sfcap/peptideSieve/digest.hpp"// interface for doing trivial tryptic digests #include "boost/filesystem/operations.hpp" #include "boost/filesystem/fstream.hpp" #include "boost/filesystem/exception.hpp" #include "boost/filesystem/convenience.hpp" #include "boost/program_options.hpp" #include <iostream> #include <fstream> #include <map> #include <stdexcept> #include <iterator> using namespace std; using namespace pwiz::calibration; using namespace pwiz::data; using namespace pwiz::frequency; using namespace pwiz::data::peakdata; using namespace pwiz::pdanalysis; using namespace pwiz::proteome; namespace bfs = boost::filesystem; namespace po = boost::program_options; struct Configuration { // misc bool write_logs; const char* label_write_logs; // fft unsigned int fft_zero_padding; const char* label_fft_zero_padding; // PeakDetector type const char* peak_detector_type_naive; const char* peak_detector_type_matched_filter; string peak_detector_type; const char* label_peak_detector_type; // PeakDetectorNaive parameters double detect_naive_noise_factor; const char* label_detect_naive_noise_factor; unsigned int detect_naive_detection_radius; const char* label_detect_naive_detection_radius; // PeakDetectorMatchedFilter parameters int detect_mf_filterMatchRate; const char* label_detect_mf_filterMatchRate; int detect_mf_filterSampleRadius; const char* label_detect_mf_filterSampleRadius; double detect_mf_peakThresholdFactor; const char* label_detect_mf_peakThresholdFactor; double detect_mf_peakMaxCorrelationAngle; const char* label_detect_mf_peakMaxCorrelationAngle; double detect_mf_isotopeThresholdFactor; const char* label_detect_mf_isotopeThresholdFactor; int detect_mf_isotopeMaxChargeState; const char* label_detect_mf_isotopeMaxChargeState; int detect_mf_isotopeMaxNeutronCount; const char* label_detect_mf_isotopeMaxNeutronCount; double detect_mf_collapseRadius; const char* label_detect_mf_collapseRadius; // FrequencyEstimator type const char* freqest_type_parabola; const char* freqest_type_lorentzian; const char* freqest_type_physical; string freqest_type; const char* label_freqest_type; // FrequencyEstimatorPhysicalModel parameters unsigned int freqest_physical_window_radius; const char* label_freqest_physical_window_radius; unsigned int freqest_physical_iteration_count; const char* label_freqest_physical_iteration_count; // Calibrator parameters string calibrate_database_filename; const char* label_calibrate_database_filename; double calibrate_initial_error_estimate; const char* label_calibrate_initial_error_estimate; unsigned int calibrate_error_estimator_iteration_count; const char* label_calibrate_error_estimator_iteration_count; unsigned int calibrate_calibrator_iteration_count; const char* label_calibrate_calibrator_iteration_count; // least squares recalibration const char* recal_type_5pep; const char* recal_type_calmix; const char* recal_type_db; string recal_type; const char* label_recal_type; string lsq_calibrate_database_filename; const char* label_lsq_calibrate_database_filename; Configuration() : write_logs(false), label_write_logs("write_logs"), fft_zero_padding(1), label_fft_zero_padding("fft_zero_padding"), peak_detector_type_naive("naive"), peak_detector_type_matched_filter("matched_filter"), peak_detector_type(peak_detector_type_matched_filter), label_peak_detector_type("peak_detector_type"), detect_naive_noise_factor(5), label_detect_naive_noise_factor("detect_naive_noise_factor"), detect_naive_detection_radius(2), label_detect_naive_detection_radius("detect_naive_detection_radius"), detect_mf_filterMatchRate(4), label_detect_mf_filterMatchRate("detect_mf_filter_match_rate"), detect_mf_filterSampleRadius(2), label_detect_mf_filterSampleRadius("detect_mf_filter_sample_radius"), detect_mf_peakThresholdFactor(10), label_detect_mf_peakThresholdFactor("detect_mf_peak_threshold_factor"), detect_mf_peakMaxCorrelationAngle(30), label_detect_mf_peakMaxCorrelationAngle("detect_mf_peak_max_correlation_angle"), detect_mf_isotopeThresholdFactor(10), label_detect_mf_isotopeThresholdFactor("detect_mf_isotope_threshold_factor"), detect_mf_isotopeMaxChargeState(6), label_detect_mf_isotopeMaxChargeState("detect_mf_isotope_max_charge_state"), detect_mf_isotopeMaxNeutronCount(4), label_detect_mf_isotopeMaxNeutronCount("detect_mf_isotope_max_neutron_count"), detect_mf_collapseRadius(15), label_detect_mf_collapseRadius("detect_mf_collapse_radius"), freqest_type_parabola("parabola"), freqest_type_lorentzian("lorentzian"), freqest_type_physical("physical"), freqest_type(freqest_type_physical), label_freqest_type("freqest_type"), freqest_physical_window_radius(10), label_freqest_physical_window_radius("freqest_physical_window_radius"), freqest_physical_iteration_count(20), label_freqest_physical_iteration_count("freqest_physical_iteration_count"), calibrate_database_filename("trypsin0_pro_uniq_mass.pdb"), label_calibrate_database_filename("calibrate_database_filename"), calibrate_initial_error_estimate(5e-6), label_calibrate_initial_error_estimate("calibrate_initial_error_estimate"), calibrate_error_estimator_iteration_count(20), label_calibrate_error_estimator_iteration_count("calibrate_error_estimator_iteration_count"), calibrate_calibrator_iteration_count(20), label_calibrate_calibrator_iteration_count("calibrate_calibrator_iteration_count"), recal_type_5pep("5pep"), recal_type_calmix("calmix"), recal_type_db("db"), recal_type(recal_type_5pep), label_recal_type("recal_type"), lsq_calibrate_database_filename("lsq_db.tfa"), label_lsq_calibrate_database_filename("lsq_calibrate_database_filename") {} }; ostream& operator<<(ostream& os, const Configuration& config) { os.precision(12); os << config.label_write_logs << " = " << config.write_logs << endl << config.label_fft_zero_padding << " = " << config.fft_zero_padding << endl << config.label_peak_detector_type << " = " << config.peak_detector_type << endl << config.label_detect_naive_noise_factor << " = " << config.detect_naive_noise_factor << endl << config.label_detect_naive_detection_radius << " = " << config.detect_naive_detection_radius << endl << config.label_detect_mf_filterMatchRate << " = " << config.detect_mf_filterMatchRate << endl << config.label_detect_mf_filterSampleRadius << " = " << config.detect_mf_filterSampleRadius << endl << config.label_detect_mf_peakThresholdFactor << " = " << config.detect_mf_peakThresholdFactor << endl << config.label_detect_mf_peakMaxCorrelationAngle << " = " << config.detect_mf_peakMaxCorrelationAngle<< endl << config.label_detect_mf_isotopeThresholdFactor << " = " << config.detect_mf_isotopeThresholdFactor << endl << config.label_detect_mf_isotopeMaxChargeState << " = " << config.detect_mf_isotopeMaxChargeState << endl << config.label_detect_mf_isotopeMaxNeutronCount << " = " << config.detect_mf_isotopeMaxNeutronCount << endl << config.label_detect_mf_collapseRadius << " = " << config.detect_mf_collapseRadius<< endl << config.label_freqest_type << " = " << config.freqest_type << endl << config.label_freqest_physical_window_radius << " = " << config.freqest_physical_window_radius << endl << config.label_freqest_physical_iteration_count << " = " << config.freqest_physical_iteration_count << endl << config.label_calibrate_database_filename << " = " << config.calibrate_database_filename << endl << config.label_calibrate_initial_error_estimate << " = " << config.calibrate_initial_error_estimate << endl << config.label_calibrate_error_estimator_iteration_count << " = " << config.calibrate_error_estimator_iteration_count << endl << config.label_calibrate_calibrator_iteration_count << " = " << config.calibrate_calibrator_iteration_count << endl << config.label_recal_type << " = " << config.recal_type << endl << config.label_lsq_calibrate_database_filename << " = " << config.lsq_calibrate_database_filename << endl; return os; } typedef int (*Subcommand)(const vector<string>& args, const Configuration& config); int defaults(const vector<string>& args, const Configuration& config) { cout << Configuration(); return 0; } int fft(const TransientData& td, FrequencyData& fd, const Configuration& config, const string& filenameOut) { cerr << "Computing FFT..." << flush; td.computeFFT(config.fft_zero_padding, fd); //fd.write(filenameOut); cerr << "done.\n"; return 0; } int fft(const vector<string>& args, const Configuration& config) { if (args.size() < 3) throw runtime_error("Wrong number of arguments."); const string& filenameIn = args[1]; const string& filenameOut = args[2]; TransientData td(filenameIn); FrequencyData fd; return fft(td, fd, config, filenameOut); } auto_ptr<IsotopeEnvelopeEstimator> createIsotopeEnvelopeEstimator() { const double abundanceCutoff = .01; const double massPrecision = .1; IsotopeCalculator isotopeCalculator(abundanceCutoff, massPrecision); IsotopeEnvelopeEstimator::Config config; config.isotopeCalculator = &isotopeCalculator; return auto_ptr<IsotopeEnvelopeEstimator>(new IsotopeEnvelopeEstimator(config)); } auto_ptr<IsotopeEnvelopeEstimator> isotopeEnvelopeEstimator_; auto_ptr<PeakDetector> createPeakDetector(const Configuration& config, ostream* log) { auto_ptr<PeakDetector> pd; if (config.peak_detector_type == config.peak_detector_type_naive) { pd = PeakDetectorNaive::create(config.detect_naive_noise_factor, config.detect_naive_detection_radius); } else if (config.peak_detector_type == config.peak_detector_type_matched_filter) { isotopeEnvelopeEstimator_ = createIsotopeEnvelopeEstimator(); PeakDetectorMatchedFilter::Config pdconfig; pdconfig.isotopeEnvelopeEstimator = isotopeEnvelopeEstimator_.get(); pdconfig.filterMatchRate = config.detect_mf_filterMatchRate; pdconfig.filterSampleRadius = config.detect_mf_filterSampleRadius; pdconfig.peakThresholdFactor = config.detect_mf_peakThresholdFactor; pdconfig.peakMaxCorrelationAngle = config.detect_mf_peakMaxCorrelationAngle; pdconfig.isotopeThresholdFactor = config.detect_mf_isotopeThresholdFactor; pdconfig.isotopeMaxChargeState = config.detect_mf_isotopeMaxChargeState; pdconfig.isotopeMaxNeutronCount = config.detect_mf_isotopeMaxNeutronCount; pdconfig.collapseRadius = config.detect_mf_collapseRadius; pdconfig.log = log; pd = PeakDetectorMatchedFilter::create(pdconfig); } else { throw runtime_error("Peak detector type '" + config.peak_detector_type + "' not supported."); } return pd; } int detect(const FrequencyData& fd, peakdata::Scan& scan, const Configuration& config, ostream& report, ostream* log = 0) { cerr << "Running peak detector..." << flush; auto_ptr<PeakDetector> pd = createPeakDetector(config, log); pd->findPeaks(fd, scan); cerr << "done.\n"; cerr << "Peaks found: " << scan.peakFamilies.size() << endl; report.precision(12); report << scan << endl; return 0; } int detect(const vector<string>& args, const Configuration& config) { if (args.size() != 2) throw runtime_error("Wrong number of arguments."); const string& filename = args[1]; const FrequencyData fd(filename); peakdata::Scan scan; return detect(fd, scan, config, cout, &cerr); } class EnvelopeEstimator { public: EnvelopeEstimator(const FrequencyEstimator& estimator, const FrequencyData& fd) : estimator_(estimator), fd_(fd) {} peakdata::PeakFamily operator()(const peakdata::PeakFamily& in) const { peakdata::PeakFamily out; out.mzMonoisotopic = in.mzMonoisotopic; out.charge = in.charge; try { // estimate each peak in the envelope for (vector<peakdata::Peak>::const_iterator it=in.peaks.begin(); it!=in.peaks.end(); ++it) out.peaks.push_back(estimator_.estimate(fd_, *it)); } catch (exception&) { cerr << "[proctran::EnvelopeEstimator] Caught exception from FrequencyEstimator.\n" << "envelope:\n" << in << endl; } return out; } private: const FrequencyEstimator& estimator_; const FrequencyData& fd_; }; int freqest(const FrequencyData& fd, const peakdata::Scan& scanIn, peakdata::Scan& scanOut, const Configuration& config, const string& outputDirectory, ostream& report) { // instantiate FrequencyEstimator auto_ptr<FrequencyEstimator> fe; if (config.freqest_type == config.freqest_type_physical) { FrequencyEstimatorPhysicalModel::Config fepmConfig; fepmConfig.windowRadius = config.freqest_physical_window_radius; fepmConfig.iterationCount = config.freqest_physical_iteration_count; fepmConfig.outputDirectory = outputDirectory; fe = FrequencyEstimatorPhysicalModel::create(fepmConfig); } else if (config.freqest_type == config.freqest_type_parabola) { fe = FrequencyEstimatorSimple::create(FrequencyEstimatorSimple::Parabola); } else if (config.freqest_type == config.freqest_type_lorentzian) { fe = FrequencyEstimatorSimple::create(FrequencyEstimatorSimple::Lorentzian); } else { throw runtime_error("Unknown frequency estimator type."); } if (!fe.get()) throw runtime_error("Error instantiating frequency estimator."); // fill in metadata scanOut.scanNumber = scanIn.scanNumber; scanOut.retentionTime = scanIn.retentionTime; scanOut.observationDuration = scanIn.observationDuration; scanOut.calibrationParameters = scanIn.calibrationParameters; scanOut.peakFamilies.clear(); // run the estimator on each envelope in the scan cerr << "Running " << config.freqest_type << " frequency estimator..." << flush; transform(scanIn.peakFamilies.begin(), scanIn.peakFamilies.end(), back_inserter(scanOut.peakFamilies), EnvelopeEstimator(*fe, fd)); cerr << "done.\n"; report.precision(12); report << scanOut << endl; return 0; } // hack to preserve current functionality -- TODO: make this go away peakdata::Scan readPeakInfoFile(const string& filename) { ifstream is(filename.c_str()); if (!is) throw runtime_error(("[freqest] Unable to open file " + filename).c_str()); peakdata::Scan result; while (is) { double frequency; complex<double> value; int charge; is >> frequency >> value >> charge; if (!is) break; peakdata::Peak peak; peak.frequency = frequency; peak.intensity = abs(value); peak.phase = std::arg(value); peakdata::PeakFamily envelope; envelope.charge = charge; envelope.peaks.push_back(peak); result.peakFamilies.push_back(envelope); } return result; } int freqest(const vector<string>& args, const Configuration& config) { if (args.size() < 3) throw runtime_error("Wrong number of arguments."); const string& filenameCfd = args[1]; const string& filenamePeaks = args[2]; string outputDirectory = args.size()>3 ? args[3] : ""; const FrequencyData fd(filenameCfd); peakdata::Scan detected = readPeakInfoFile(filenamePeaks); peakdata::Scan estimated; return freqest(fd, detected, estimated, config, outputDirectory, cout); } vector<Calibrator::Measurement> createMeasurements(const peakdata::Scan& scan) { vector<Calibrator::Measurement> result; for (vector<peakdata::PeakFamily>::const_iterator it=scan.peakFamilies.begin(); it!=scan.peakFamilies.end(); ++it) result.push_back(Calibrator::Measurement(it->peaks.empty() ? 0 : it->peaks[0].frequency, it->charge)); return result; } int calibrate(const FrequencyData& fd, const peakdata::Scan& scan, const Configuration& config, const string& outputDirectory) { try { const string& pdbFilename = config.calibrate_database_filename; cout << "Using database " << pdbFilename << endl; auto_ptr<MassDatabase> mdb = MassDatabase::createFromPeptideDatabase(pdbFilename); vector<Calibrator::Measurement> measurements = createMeasurements(scan); if (measurements.empty()) throw runtime_error("No measurements read."); CalibrationParameters cp = fd.calibrationParameters(); bfs::create_directories(outputDirectory); cerr << "Running calibrator..." << flush; auto_ptr<Calibrator> calibrator = Calibrator::create(*mdb, measurements, cp, config.calibrate_initial_error_estimate, config.calibrate_error_estimator_iteration_count, outputDirectory); for (unsigned int i=0; i<config.calibrate_calibrator_iteration_count; i++) calibrator->iterate(); cerr << "done.\n"; cout << "A: " << calibrator->parameters().A << " B: " << calibrator->parameters().B << endl; } catch (exception& e) { cerr << e.what() << endl; } return 0; } int calibrate(const vector<string>& args, const Configuration& config) { throw runtime_error("calibrate broken"); /* if (args.size() != 4) throw runtime_error("Wrong number of arguments."); const string& filenameCfd = args[1]; const string& filenamePeaks = args[2]; const string& outputDirectory = args[3]; const FrequencyData fd(filenameCfd); vector<PeakInfo> peaks; ifstream is(filenamePeaks.c_str()); if (!is) throw runtime_error(("[calibrate] Unable to open file " + filenamePeaks).c_str()); copy(istream_iterator<PeakInfo>(is), istream_iterator<PeakInfo>(), back_inserter(peaks)); return calibrate(fd, peaks, config, outputDirectory); */ } void computePrintCalibrationStatistics(const KnownMassList::MatchResult & before, const CalibrationParameters & cpBefore, const KnownMassList::MatchResult & after,const CalibrationParameters & cpAfter,const bfs::path& pathOutput,const string& filenameBase,const string& addendum) { KnownMassList::MatchResult prunedAfter; string filename = (pathOutput / (filenameBase + ".recal." + addendum +".txt")).string(); ofstream os(filename.c_str()); if (!os) throw runtime_error(("Unable to open file " + filename).c_str()); os << "# label mzKnown frequency mzOriginalF mzOriginal dmz frequency mzRecalF mzRecal dmzRecal ddmz dmzOrigRecal\n"; //this is Parag's hack - might want to rollback later. /* if (before.matches.size() != after.matches.size() || before.matchCount != after.matchCount) throw runtime_error("[proctran] Matches don't match!"); */ for (unsigned int i=0; i<before.matches.size(); ++i){ if (!before.matches[i].entry) throw runtime_error("[proctran] Null KnownMassList::entry."); const KnownMassList::Entry* entry = before.matches[i].entry; const peakdata::PeakFamily* orig = before.matches[i].peakFamily; for (unsigned int j=0; j<after.matches.size(); ++j){ //this could be searched smarter const peakdata::PeakFamily* recal = after.matches[j].peakFamily; double beforeFrequency = orig && !orig->peaks.empty() ? orig->peaks[0].frequency : 0; double afterFrequency = recal && !recal->peaks.empty() ? recal->peaks[0].frequency : 0; if((beforeFrequency != 0) && (beforeFrequency == afterFrequency)){ prunedAfter.matches.push_back(after.matches[j]); os << setprecision(10) << entry->label << "\t" << entry->mz << "\t" << beforeFrequency << "\t" << cpBefore.mz(beforeFrequency)<<"\t" << (orig ? orig->mzMonoisotopic : 0) << "\t" << 1.0e6 * ((entry->mz - (orig ? orig->mzMonoisotopic : 0)) / entry->mz) << "\t" << cpAfter.mz(beforeFrequency)<<"\t" << (recal ? recal->mzMonoisotopic : 0) << "\t" << 1.0e6 * ((entry->mz - (recal ? recal->mzMonoisotopic : 0))/entry->mz) << "\t" << abs(entry->mz - (orig ? orig->mzMonoisotopic : 0)) - abs(entry->mz - (recal ? recal->mzMonoisotopic : 0))<< "\t" << abs((recal ? recal->mzMonoisotopic : 0) - (orig ? orig->mzMonoisotopic : 0)) << "\n"; continue; } } } // output recalibration data prunedAfter.reComputeStatistics(); string filenameStats = (pathOutput / (filenameBase + ".recal." + addendum + ".stats")).string(); ofstream osStats(filenameStats.c_str()); if (!osStats) throw runtime_error(("Unable to open file " + filenameStats).c_str()); osStats << "# label A B matchCount dmzMean dmz2Mean dmzRel2Mean rmsAbs rmsRel\n"; osStats << setprecision(10) << "original\t" << cpBefore.A << "\t" << cpBefore.B << "\t" << before.matchCount << "\t" << before.dmzMean << "\t" << before.dmz2Mean << "\t" << before.dmzRel2Mean << "\t" << sqrt(before.dmz2Mean) << "\t" << sqrt(before.dmzRel2Mean) << "\n"; /* osStats << "recalibrated\t" << cpAfter.A << "\t" << cpAfter.B << "\t" << after.matchCount << "\t" << after.dmzMean << "\t" << after.dmz2Mean << "\t" << after.dmzRel2Mean << "\t" << sqrt(after.dmz2Mean) << "\t" << sqrt(after.dmzRel2Mean) << "\n"; */ osStats << "re-recalibrated\t" << cpAfter.A << "\t" << cpAfter.B << "\t" << prunedAfter.matchCount << "\t" << prunedAfter.dmzMean << "\t" << prunedAfter.dmz2Mean << "\t" << prunedAfter.dmzRel2Mean << "\t" << sqrt(prunedAfter.dmz2Mean) << "\t" << sqrt(prunedAfter.dmzRel2Mean) << "\n"; } void recalibrateLeastSquares(peakdata::Scan& scan, const bfs::path& pathOutput, const string& filenameBase, const Configuration& config) { KnownMassList kml_train; if (config.recal_type == config.recal_type_5pep) { cout << "Recalibrating using least squares with 5-Peptide masses." << endl; kml_train.insert_5pep(); } else if (config.recal_type == config.recal_type_calmix) { cout << "Recalibrating using least squares with Calmix masses." << endl; kml_train.insert_calmix(); } else if (config.recal_type == config.recal_type_db) { cout << "Recalibrating using least squares with masses from database." << endl; fasta<string> mf(config.lsq_calibrate_database_filename); std::vector<std::string> peptideVector; for(fasta<string>::const_iterator seqIter = mf.begin();seqIter != mf.end();seqIter++){ const fasta_seq<string>* fseq = *seqIter; const string& str = fseq->get_seq(); // std::cout<<str<<endl<<endl; Digest peptides(str); for(size_t pepNdx=0;pepNdx<peptides.numPeptides();pepNdx++){ string peptide = peptides.currentPeptide(); // std::cout<<peptide<<endl; peptide.erase(0,1); //drop the first character peptide.erase(peptide.length() - 1,1); //drop the last character // std::cout<<peptide<<endl; peptideVector.push_back(peptide); peptides.next(); } } kml_train.insert_db(peptideVector); } else { cout << "[proctran] Unknown recalibration type.\n"; return; } Scan scanBefore = scan; CalibrationParameters cpBefore = scan.calibrationParameters; RecalibratorSimple rks(cpBefore); //this fixes the mz of peaks in the scan? rks.recalibrate(scan); rks.recalibrate(scanBefore); //determine which peaks are actually around. KnownMassList::MatchResult before_train = kml_train.match(scanBefore, 4.2); //PM Change kml_train.replace_entryVector(before_train.getMatchedEntries()); //pull a subset of peaks for testing purposes KnownMassList kml_test; kml_test.insert_entryVector(kml_train.splitEntries(.33)); //do the match for real on the training set. before_train = kml_train.match(scanBefore, 4.2); //PM Change //do the match for real on the testing set. KnownMassList::MatchResult before_test = kml_test.match(scanBefore, 4.2); //PM Change //recalibrate RecalibratorKnownMassList rkml(kml_train); rkml.recalibrate(scan); KnownMassList::MatchResult after_train = kml_train.match(scan, 100.00); //PM Change KnownMassList::MatchResult after_test = kml_test.match(scan, 100.00); //PM Change CalibrationParameters cpAfter = scan.calibrationParameters; computePrintCalibrationStatistics(before_train,cpBefore,after_train,cpAfter,pathOutput,filenameBase,"train"); computePrintCalibrationStatistics(before_test,cpBefore,after_test,cpAfter,pathOutput,filenameBase,"test"); } void writePeakDataFile(const peakdata::Scan& scan, const bfs::path& filename) { peakdata::PeakData pd; pd.scans.push_back(scan); bfs::ofstream os(filename); os << pd; } int all(const vector<string>& args, const Configuration& config) { if (args.size() != 3) throw runtime_error("Wrong number of arguments."); bfs::path pathTransient(args[1]); bfs::path pathOutput(args[2]); string filenameBase = basename(pathTransient); bfs::create_directories(pathOutput); cout << "filename: " << pathTransient.string() << endl; cout << "outputDirectory: " << pathOutput.string() << endl; // fft TransientData td(pathTransient.string()); FrequencyData fd; bfs::path pathCFD = pathOutput / (filenameBase + ".cfd"); if (exists(pathCFD)) throw runtime_error(("[proctran] " + pathCFD.string() + " already exists.").c_str()); fft(td, fd, config, pathCFD.string()); // detect peakdata::Scan scanDetected; bfs::path pathPeaksDetected = pathOutput / (filenameBase + ".detected.txt"); bfs::ofstream osPeaksDetected(pathPeaksDetected); bfs::path pathPeakDetectorLog = pathOutput / (filenameBase + ".detected.log"); bfs::ofstream osPeakDetectorLog; //(pathPeakDetectorLog); detect(fd, scanDetected, config, osPeaksDetected, &osPeakDetectorLog); writePeakDataFile(scanDetected, pathOutput / (filenameBase + ".detected.peaks")); // freqest peakdata::Scan scanEstimated; bfs::path pathPeaksEstimated = pathOutput / (filenameBase + ".estimated.txt"); bfs::ofstream osPeaksEstimated(pathPeaksEstimated); string outputDirectoryFreqest = config.write_logs ? (pathOutput / (filenameBase + ".estimated.logs")).string() : ""; freqest(fd, scanDetected, scanEstimated, config, outputDirectoryFreqest, osPeaksEstimated); writePeakDataFile(scanEstimated, pathOutput / (filenameBase + ".estimated.peaks")); // calibrate string outputDirectoryCalibration = config.write_logs ? (pathOutput / (filenameBase + ".dbcalibration.logs")).string() : ""; calibrate(fd, scanEstimated, config, outputDirectoryCalibration); // recalibrate least squares peakdata::Scan scanRecalibrated = scanEstimated; // make a copy recalibrateLeastSquares(scanRecalibrated, pathOutput, filenameBase, config); writePeakDataFile(scanRecalibrated, pathOutput / (filenameBase + ".recal.peaks")); cout << endl; return 0; } void initializeSubcommands(map<string, Subcommand>& subcommands, string& usage) { subcommands["defaults"] = defaults; usage += " defaults\n"; usage += " (outputs default options)\n\n"; subcommands["fft"] = fft; usage += " fft filename.dat filename.cfd\n"; usage += " (converts MIDAS file to FrequencyData)\n\n"; subcommands["detect"] = detect; usage += " detect filename.cfd\n"; usage += " (runs peak detector on frequency data)\n\n"; subcommands["freqest"] = freqest; usage += " freqest filename.cfd peaklist.txt [outputDirectory]\n"; usage += " (runs frequency estimator)\n\n"; subcommands["calibrate"] = calibrate; usage += " calibrate filename.cfd peaklist.txt outputDirectory\n"; usage += " (runs calibrator)\n\n"; subcommands["all"] = all; usage += " all filename.dat outputDirectory\n"; usage += " (runs everything)\n\n"; } void parseCommandLine(int argc, char* argv[], Configuration& config, vector<string>& args, string& usage) { string configFilename = "proctran.cfg"; const char* label_config_file = "config_file"; po::options_description od_config("Options"); od_config.add_options() (label_config_file, po::value<string>(&configFilename)->default_value(configFilename), "") (config.label_write_logs, po::value<bool>(&config.write_logs) ->default_value(config.write_logs), "") (config.label_fft_zero_padding, po::value<unsigned int>(&config.fft_zero_padding) ->default_value(config.fft_zero_padding), "") (config.label_peak_detector_type, po::value<string>(&config.peak_detector_type) ->default_value(config.peak_detector_type), "") (config.label_detect_naive_noise_factor, po::value<double>(&config.detect_naive_noise_factor) ->default_value(config.detect_naive_noise_factor), "") (config.label_detect_naive_detection_radius, po::value<unsigned int>(&config.detect_naive_detection_radius) ->default_value(config.detect_naive_detection_radius), "") (config.label_detect_mf_filterMatchRate, po::value<int>(&config.detect_mf_filterMatchRate) ->default_value(config.detect_mf_filterMatchRate), "") (config.label_detect_mf_filterSampleRadius, po::value<int>(&config.detect_mf_filterSampleRadius) ->default_value(config.detect_mf_filterSampleRadius), "") (config.label_detect_mf_peakThresholdFactor, po::value<double>(&config.detect_mf_peakThresholdFactor) ->default_value(config.detect_mf_peakThresholdFactor), "") (config.label_detect_mf_peakMaxCorrelationAngle, po::value<double>(&config.detect_mf_peakMaxCorrelationAngle) ->default_value(config.detect_mf_peakMaxCorrelationAngle), "") (config.label_detect_mf_isotopeThresholdFactor, po::value<double>(&config.detect_mf_isotopeThresholdFactor) ->default_value(config.detect_mf_isotopeThresholdFactor), "") (config.label_detect_mf_isotopeMaxChargeState, po::value<int>(&config.detect_mf_isotopeMaxChargeState) ->default_value(config.detect_mf_isotopeMaxChargeState), "") (config.label_detect_mf_isotopeMaxNeutronCount, po::value<int>(&config.detect_mf_isotopeMaxNeutronCount) ->default_value(config.detect_mf_isotopeMaxNeutronCount), "") (config.label_detect_mf_collapseRadius, po::value<double>(&config.detect_mf_collapseRadius) ->default_value(config.detect_mf_collapseRadius), "") (config.label_freqest_type, po::value<string>(&config.freqest_type) ->default_value(config.freqest_type_physical), "") (config.label_freqest_physical_window_radius, po::value<unsigned int>(&config.freqest_physical_window_radius) ->default_value(config.freqest_physical_window_radius), "") (config.label_freqest_physical_iteration_count, po::value<unsigned int>(&config.freqest_physical_iteration_count) ->default_value(config.freqest_physical_iteration_count), "") (config.label_calibrate_database_filename, po::value<string>(&config.calibrate_database_filename) ->default_value(config.calibrate_database_filename), "") (config.label_calibrate_initial_error_estimate, po::value<double>(&config.calibrate_initial_error_estimate) ->default_value(config.calibrate_initial_error_estimate), "") (config.label_calibrate_error_estimator_iteration_count, po::value<unsigned int>(&config.calibrate_error_estimator_iteration_count) ->default_value(config.calibrate_error_estimator_iteration_count), "") (config.label_calibrate_calibrator_iteration_count, po::value<unsigned int>(&config.calibrate_calibrator_iteration_count) ->default_value(config.calibrate_calibrator_iteration_count), "") (config.label_recal_type, po::value<string>(&config.recal_type) ->default_value(config.recal_type), "") (config.label_lsq_calibrate_database_filename, po::value<string>(&config.lsq_calibrate_database_filename) ->default_value(config.lsq_calibrate_database_filename), "") ; // append options description to usage string ostringstream usage_options; usage_options << od_config << endl; usage += usage_options.str(); usage += "Notes:\n"; usage += " Options will be read from the specified config file if it exists.\n"; usage += "\n"; usage += " To recreate the default config file, use:\n"; usage += " proctran defaults > proctran.cfg\n"; usage += "\n"; usage += " freqest_type = physical | parabola | lorentzian\n"; usage += "\n"; usage += " peak_detector_type = naive | matched_filter\n"; usage += "\n"; usage += " recal_type = 5pep | calmix | db\n"; // handle positional arguments const char* label_args = "args"; po::options_description od_args; od_args.add_options() (label_args, po::value< vector<string> >(), "") ; po::options_description od_parse; od_parse.add(od_config).add(od_args); po::positional_options_description pod_args; pod_args.add(label_args, -1); // parse and save results po::variables_map vm; po::store(po::command_line_parser(argc, argv). options(od_parse).positional(pod_args).run(), vm); ifstream is(vm[label_config_file].as<string>().c_str()); po::store(parse_config_file(is, od_config), vm); po::notify(vm); if (vm.count(label_args)) args = vm[label_args].as< vector<string> >(); } int main(int argc, char* argv[]) { try { string usage("Usage: proctran subcommand [args] [options]\n\nSubcommands:\n\n"); map<string, Subcommand> subcommands; initializeSubcommands(subcommands, usage); Configuration config; vector<string> args; parseCommandLine(argc, argv, config, args, usage); Subcommand subcommand = args.empty() ? 0 : subcommands[args[0]]; if (!subcommand) throw runtime_error(usage); if (subcommand != defaults) cerr << config << endl; return subcommand(args, config); } catch (exception& e) { cout << e.what() << endl << endl; return 1; } }
; A086275: Number of distinct Gaussian primes in the factorization of n. ; Submitted by Christian Krause ; 0,1,1,1,2,2,1,1,1,3,1,2,2,2,3,1,2,2,1,3,2,2,1,2,2,3,1,2,2,4,1,1,2,3,3,2,2,2,3,3,2,3,1,2,3,2,1,2,1,3,3,3,2,2,3,2,2,3,1,4,2,2,2,1,4,3,1,3,2,4,1,2,2,3,3,2,2,4,1,3,1,3,1,3,4,2,3,2,2,4,3,2,2,2,3,2,2,2,2,3 seq $0,332476 ; The number of unitary divisors of n in Gaussian integers. lpb $0 dif $0,2 add $1,1 lpe mov $0,$1
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x187e5, %rdx nop nop add $61354, %r15 mov (%rdx), %r13w nop nop sub $52950, %r10 lea addresses_WT_ht+0x1a011, %rsi lea addresses_WC_ht+0xfe69, %rdi nop nop dec %rbp mov $45, %rcx rep movsq nop nop nop cmp %rdi, %rdi lea addresses_UC_ht+0xb08a, %r10 nop nop nop nop nop and %rdx, %rdx mov (%r10), %di sub $30908, %rcx lea addresses_D_ht+0x1cece, %rsi nop nop nop nop cmp %rdx, %rdx mov $0x6162636465666768, %rbp movq %rbp, %xmm2 vmovups %ymm2, (%rsi) sub %rdi, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %r8 push %rbx push %rdi push %rdx // Load lea addresses_D+0xc51, %r11 nop nop xor $34359, %rbx movb (%r11), %r12b nop nop and $8673, %r15 // Store lea addresses_WC+0x5451, %r8 clflush (%r8) nop nop add $56443, %rdx mov $0x5152535455565758, %rdi movq %rdi, (%r8) nop nop nop nop add %r15, %r15 // Faulty Load lea addresses_WC+0x5451, %r15 nop nop nop nop nop sub %rdx, %rdx movb (%r15), %bl lea oracles, %r8 and $0xff, %rbx shlq $12, %rbx mov (%r8,%rbx,1), %rbx pop %rdx pop %rdi pop %rbx pop %r8 pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_D', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_WC', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}} {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
/* * This test verifies that basic logical operations * (and, xor, or, not) work. */ lc r100, 0x10000000 // test result output pointer lc r101, halt lc r102, failure lc r0, 0xD54B65C0 lc r1, 0xCE8870A8 lc r16, 0x10000004 // destination pointer and r2, r0, r1 sw r16, r2 lc r3, 0xC4086080 cjmpne r102, r2, r3 or r2, r0, r1 sw r16, r2 lc r3, 0xDFCB75E8 cjmpne r102, r2, r3 xor r2, r0, r1 sw r16, r2 lc r3, 0x1BC31568 cjmpne r102, r2, r3 // Note: "not dst, src" is just an alias for "xor dst, src, -1" not r2, r0 sw r16, r2 lc r3, 0x2AB49A3F cjmpne r102, r2, r3 sw r100, 1 jmp r101 failure: sw r100, 2 halt: hlt jmp r101
;------------------- ; test for in/out ;------------------- .equ ioreg0 = 0x00 ; i/o register dummy .equ ioreg1 = 0x01 ; i/o register dummy .equ ioreg2 = 0x02 ; i/o register dummy .equ ioreg3 = 0x1f ; i/o register dummy .equ ioreg4 = 0x3c ; i/o register dummy .equ spl = 0x3d ; stack pointer low byte .equ sph = 0x3e ; stack pointer high byte .equ sreg = 0x3f ; status register .equ extio0 = 0x9e ; extended i/o dummy .equ extio1 = 0x9f ; extended i/o dummy .equ extio2 = 0xa0 ; extended i/o dummy .equ extio3 = 0xa1 ; extended i/o dummy .def zl = r30 .def zh = r31 ldi zh ,0x00 ;------------------- ldi r16,0x10 ldi r24,0x20 mov r7 ,r16 mov r8 ,r24 ldi r16,0x30 ldi r24,0x40 out ioreg0,r7 out ioreg1,r8 out ioreg2,r16 out ioreg3,r24 inc r7 inc r8 inc r16 inc r24 out ioreg4,r7 out spl ,r8 out sph ,r16 out sreg ,r24 in r26,sreg inc r7 inc r8 inc r16 inc r24 sts extio0,r7 ldi zl ,extio1 st z+ ,r8 st z+ ,r16 st z ,r24 ;------------------- in r6 ,ioreg0 in r9 ,ioreg1 in r17,ioreg2 in r25,ioreg3 in r5 ,ioreg4 in r10,spl in r18,sph ;in r26,sreg lds r4 ,extio0 ldi zl ,extio1 ld r11,z+ ld r19,z+ ld r27,z ;------------------- com r24 com r16 com r8 com r7 sts extio3,r24 ldi zl ,extio2 st z ,r16 st -z ,r8 st -z ,r7 inc r24 inc r16 inc r8 inc r7 out sreg ,r24 out sph ,r16 out spl ,r8 out ioreg4,r7 in r29,sreg inc r24 inc r16 inc r8 inc r7 out ioreg3,r24 out ioreg2,r16 out ioreg1,r8 out ioreg0,r7 ;------------------- in r3 ,ioreg0 in r12,ioreg1 in r20,ioreg2 in r28,ioreg3 in r2 ,ioreg4 in r13,spl in r21,sph ;in r29,sreg lds r23,extio3 ldi zl ,extio2 ld r22,z ld r14,-z ld r15,-z ;------------------- ldi zh,0x01 ldi zl,0x00 st z+,r6 ; (in) ioreg0 st z+,r9 ; (in) ioreg1 st z+,r17 ; (in) ioreg2 st z+,r25 ; (in) ioreg3 st z+,r5 ; (in) ioreg4 st z+,r10 ; (in) spl st z+,r18 ; (in) sph st z+,r26 ; (in) sreg st z+,r4 ; (ld) extio0 st z+,r11 ; (ld) extio1 st z+,r19 ; (ld) extio2 st z+,r27 ; (ld) extio3 ldi zh,0x01 ldi zl,0x10 st z+,r3 ; (in) ioreg0 st z+,r12 ; (in) ioreg1 st z+,r20 ; (in) ioreg2 st z+,r28 ; (in) ioreg3 st z+,r2 ; (in) ioreg4 st z+,r13 ; (in) spl st z+,r21 ; (in) sph st z+,r29 ; (in) sreg st z+,r15 ; (ld) extio0 st z+,r14 ; (ld) extio1 st z+,r22 ; (ld) extio2 st z+,r23 ; (ld) extio3 ;------------------- ldi r16,0xff sts 0xffff,r16 halt: rjmp halt
#pragma once // This file is generated from the Game's Reflection data #include <cstdint> #include <RED4ext/Common.hpp> #include <RED4ext/Handle.hpp> #include <RED4ext/Scripting/Natives/Generated/AI/behavior/TreeNodeDefinition.hpp> namespace RED4ext { namespace AI::behavior { struct TreeNodeDefinition; } namespace AI::behavior { struct DecoratorNodeDefinition : AI::behavior::TreeNodeDefinition { static constexpr const char* NAME = "AIbehaviorDecoratorNodeDefinition"; static constexpr const char* ALIAS = NAME; Handle<AI::behavior::TreeNodeDefinition> child; // 30 }; RED4EXT_ASSERT_SIZE(DecoratorNodeDefinition, 0x40); } // namespace AI::behavior } // namespace RED4ext
; A021979: Decimal expansion of 1/975. ; 0,0,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1,0,2,5,6,4,1 mov $2,1 lpb $0 sub $0,1 trn $0,1 sub $3,3 add $2,$3 mov $4,$2 add $4,$0 sub $4,$3 mov $1,$4 mov $3,1 add $3,$0 add $0,1 add $2,1 trn $2,5 add $3,5 sub $3,$4 add $3,4 lpe
; A062953: Multiplicative with a(p^e) = -p. ; 1,-2,-3,-2,-5,6,-7,-2,-3,10,-11,6,-13,14,15,-2,-17,6,-19,10,21,22,-23,6,-5,26,-3,14,-29,-30,-31,-2,33,34,35,6,-37,38,39,10,-41,-42,-43,22,15,46,-47,6,-7,10,51,26,-53,6,55,14,57,58,-59,-30,-61,62,21,-2,65,-66,-67,34,69,-70,-71,6,-73,74,15,38,77,-78,-79,10,-3,82,-83,-42,85,86,87,22,-89,-30,91,46,93,94,95,6,-97,14,33,10 add $0,1 mov $1,1 mov $3,$0 mov $4,$0 lpb $3 sub $2,2 mov $5,$4 mov $6,0 lpb $5 sub $3,1 add $6,1 mov $7,$0 div $0,$2 mod $7,$2 cmp $7,0 sub $5,$7 lpe cmp $6,0 cmp $6,0 mov $7,$2 pow $7,$6 mul $1,$7 add $2,1 mov $7,$0 cmp $7,1 cmp $7,0 sub $3,$7 lpe mov $0,$1
// COMMAND #0A: BOOTSTRAP THE SYSTEM @256 // set the start of the stack to addr 256 D=A // store the current address as a value @SP // write value of D to "SP" M=D // write value of D to current location // COMMAND #0B: CALL Sys.init @Sys.init$ret.11 D=A // D=retAddr @SP // >>> push retAddr onto stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @LCL // >>> saving "LCL" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @ARG // >>> saving "ARG" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THIS // >>> saving "THIS" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THAT // >>> saving "THAT" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @SP // >>> reposition: LCL = SP D=M // store the stack pointer (after pushing the retAddr & segments) @LCL M=D // save SP to LCL // this should be 5 more than after pushing retAddr @5 // >>> reposition ARG = SP-n-5 D=D-A // subtract (frame + num of args) from the stored SP @ARG M=D // save SP-n-5 to ARG @Sys.init // jump to the function 0;JMP (Sys.init$ret.11) // return point for the just-called function // execution continues (after called function returns)... // *** FILE: Class1.vm *** (Class1.set) // COMMAND #1: function Class1.set 0 @SP D=M // store SP value @LCL M=D // store stack address in LCL (no local vars so we're done) // COMMAND #2: push argument 0 @ARG // move to argument D=M // store the "argument" base address @0 // move to address representing offset A=D+A // new addr = base addr + offset D=M // store current memory value in D @SP // >>> push memory value to top of stack A=M // move to top of stack M=D // write value of D to current location // COMMAND #3: pop static 0 @SP // >> pop stack to Class1.0 << (SP decremented above) A=M // move to top of stack D=M // store the top stack value into D @Class1.0 M=D // write value of D to current location // COMMAND #4: push argument 1 @ARG // move to argument D=M // store the "argument" base address @1 // move to address representing offset A=D+A // new addr = base addr + offset D=M // store current memory value in D @SP // >>> push memory value to top of stack A=M // move to top of stack M=D // write value of D to current location // COMMAND #5: pop static 1 @SP // >> pop stack to Class1.1 << (SP decremented above) A=M // move to top of stack D=M // store the top stack value into D @Class1.1 M=D // write value of D to current location // COMMAND #6: push constant 0 @0 D=A // store the current address as a value @SP // >> push constant value (0) onto stack << A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 // COMMAND #7: return @LCL // >>> store LCL as FRAME D=M // store current memory value @FRAME // go to "FRAME" M=D // save the stored value in "FRAME" @5 // >>> save RET A=D-A // move to location of retAddr (RET=FRAME-5) D=M // store current memory value @RET // go to "RET" M=D // save the stored value in "RET" @SP // >> pop stack to *ARG << M=M-1 A=M // move to top of stack D=M // store the top stack value into D @ARG A=M // move to "ARG" M=D // write value of D to current location D=A // >>> restore caller's SP. (in prev step, A=ARG) @SP M=D+1 // point SP to ARG+1 (one past returned value) @LCL // >>> restoring saved "THAT" A=M-1 // move to LCL-1: saved "THAT" D=M // store saved "THAT" @THAT M=D // restore saved "THAT" @LCL // >>> restoring saved "THIS" A=M-1 // move to LCL-2: saved "THIS" A=A-1 D=M // store saved "THIS" @THIS M=D // restore saved "THIS" @LCL // >>> restoring saved "ARG" A=M-1 // move to LCL-3: saved "ARG" A=A-1 A=A-1 D=M // store saved "ARG" @ARG M=D // restore saved "ARG" @LCL // >>> restoring saved "LCL" A=M-1 // move to LCL-4: saved "LCL" A=A-1 A=A-1 A=A-1 D=M // store saved "LCL" @LCL M=D // restore saved "LCL" @RET // >>> move to the return address, to restore control to caller A=M // prepare to jump to address stored in RET 0;JMP (Class1.get) // COMMAND #8: function Class1.get 0 @SP D=M // store SP value @LCL M=D // store stack address in LCL (no local vars so we're done) // COMMAND #9: push static 0 @Class1.0 D=M // store current memory value in D @SP // >>> push memory value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 // COMMAND #10: push static 1 @Class1.1 D=M // store current memory value in D @SP // >>> push memory value to top of stack A=M // move to top of stack M=D // write value of D to current location // COMMAND #11: sub @SP // PREPARE Y (pop Y into D) (SP decremented above) A=M // move to top of stack D=M // store the top stack value into D @SP // "pop" X M=M-1 A=M // PREPARE X (prep X "into" M) M=M-D // perform binary operation: sub @SP // increment stack pointer M=M+1 // COMMAND #12: return @LCL // >>> store LCL as FRAME D=M // store current memory value @FRAME // go to "FRAME" M=D // save the stored value in "FRAME" @5 // >>> save RET A=D-A // move to location of retAddr (RET=FRAME-5) D=M // store current memory value @RET // go to "RET" M=D // save the stored value in "RET" @SP // >> pop stack to *ARG << M=M-1 A=M // move to top of stack D=M // store the top stack value into D @ARG A=M // move to "ARG" M=D // write value of D to current location D=A // >>> restore caller's SP. (in prev step, A=ARG) @SP M=D+1 // point SP to ARG+1 (one past returned value) @LCL // >>> restoring saved "THAT" A=M-1 // move to LCL-1: saved "THAT" D=M // store saved "THAT" @THAT M=D // restore saved "THAT" @LCL // >>> restoring saved "THIS" A=M-1 // move to LCL-2: saved "THIS" A=A-1 D=M // store saved "THIS" @THIS M=D // restore saved "THIS" @LCL // >>> restoring saved "ARG" A=M-1 // move to LCL-3: saved "ARG" A=A-1 A=A-1 D=M // store saved "ARG" @ARG M=D // restore saved "ARG" @LCL // >>> restoring saved "LCL" A=M-1 // move to LCL-4: saved "LCL" A=A-1 A=A-1 A=A-1 D=M // store saved "LCL" @LCL M=D // restore saved "LCL" @RET // >>> move to the return address, to restore control to caller A=M // prepare to jump to address stored in RET 0;JMP // *** FILE: Class2.vm *** (Class2.set) // COMMAND #1: function Class2.set 0 @SP D=M // store SP value @LCL M=D // store stack address in LCL (no local vars so we're done) // COMMAND #2: push argument 0 @ARG // move to argument D=M // store the "argument" base address @0 // move to address representing offset A=D+A // new addr = base addr + offset D=M // store current memory value in D @SP // >>> push memory value to top of stack A=M // move to top of stack M=D // write value of D to current location // COMMAND #3: pop static 0 @SP // >> pop stack to Class2.0 << (SP decremented above) A=M // move to top of stack D=M // store the top stack value into D @Class2.0 M=D // write value of D to current location // COMMAND #4: push argument 1 @ARG // move to argument D=M // store the "argument" base address @1 // move to address representing offset A=D+A // new addr = base addr + offset D=M // store current memory value in D @SP // >>> push memory value to top of stack A=M // move to top of stack M=D // write value of D to current location // COMMAND #5: pop static 1 @SP // >> pop stack to Class2.1 << (SP decremented above) A=M // move to top of stack D=M // store the top stack value into D @Class2.1 M=D // write value of D to current location // COMMAND #6: push constant 0 @0 D=A // store the current address as a value @SP // >> push constant value (0) onto stack << A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 // COMMAND #7: return @LCL // >>> store LCL as FRAME D=M // store current memory value @FRAME // go to "FRAME" M=D // save the stored value in "FRAME" @5 // >>> save RET A=D-A // move to location of retAddr (RET=FRAME-5) D=M // store current memory value @RET // go to "RET" M=D // save the stored value in "RET" @SP // >> pop stack to *ARG << M=M-1 A=M // move to top of stack D=M // store the top stack value into D @ARG A=M // move to "ARG" M=D // write value of D to current location D=A // >>> restore caller's SP. (in prev step, A=ARG) @SP M=D+1 // point SP to ARG+1 (one past returned value) @LCL // >>> restoring saved "THAT" A=M-1 // move to LCL-1: saved "THAT" D=M // store saved "THAT" @THAT M=D // restore saved "THAT" @LCL // >>> restoring saved "THIS" A=M-1 // move to LCL-2: saved "THIS" A=A-1 D=M // store saved "THIS" @THIS M=D // restore saved "THIS" @LCL // >>> restoring saved "ARG" A=M-1 // move to LCL-3: saved "ARG" A=A-1 A=A-1 D=M // store saved "ARG" @ARG M=D // restore saved "ARG" @LCL // >>> restoring saved "LCL" A=M-1 // move to LCL-4: saved "LCL" A=A-1 A=A-1 A=A-1 D=M // store saved "LCL" @LCL M=D // restore saved "LCL" @RET // >>> move to the return address, to restore control to caller A=M // prepare to jump to address stored in RET 0;JMP (Class2.get) // COMMAND #8: function Class2.get 0 @SP D=M // store SP value @LCL M=D // store stack address in LCL (no local vars so we're done) // COMMAND #9: push static 0 @Class2.0 D=M // store current memory value in D @SP // >>> push memory value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 // COMMAND #10: push static 1 @Class2.1 D=M // store current memory value in D @SP // >>> push memory value to top of stack A=M // move to top of stack M=D // write value of D to current location // COMMAND #11: sub @SP // PREPARE Y (pop Y into D) (SP decremented above) A=M // move to top of stack D=M // store the top stack value into D @SP // "pop" X M=M-1 A=M // PREPARE X (prep X "into" M) M=M-D // perform binary operation: sub @SP // increment stack pointer M=M+1 // COMMAND #12: return @LCL // >>> store LCL as FRAME D=M // store current memory value @FRAME // go to "FRAME" M=D // save the stored value in "FRAME" @5 // >>> save RET A=D-A // move to location of retAddr (RET=FRAME-5) D=M // store current memory value @RET // go to "RET" M=D // save the stored value in "RET" @SP // >> pop stack to *ARG << M=M-1 A=M // move to top of stack D=M // store the top stack value into D @ARG A=M // move to "ARG" M=D // write value of D to current location D=A // >>> restore caller's SP. (in prev step, A=ARG) @SP M=D+1 // point SP to ARG+1 (one past returned value) @LCL // >>> restoring saved "THAT" A=M-1 // move to LCL-1: saved "THAT" D=M // store saved "THAT" @THAT M=D // restore saved "THAT" @LCL // >>> restoring saved "THIS" A=M-1 // move to LCL-2: saved "THIS" A=A-1 D=M // store saved "THIS" @THIS M=D // restore saved "THIS" @LCL // >>> restoring saved "ARG" A=M-1 // move to LCL-3: saved "ARG" A=A-1 A=A-1 D=M // store saved "ARG" @ARG M=D // restore saved "ARG" @LCL // >>> restoring saved "LCL" A=M-1 // move to LCL-4: saved "LCL" A=A-1 A=A-1 A=A-1 D=M // store saved "LCL" @LCL M=D // restore saved "LCL" @RET // >>> move to the return address, to restore control to caller A=M // prepare to jump to address stored in RET 0;JMP // *** FILE: Sys.vm *** (Sys.init) // COMMAND #1: function Sys.init 0 @SP D=M // store SP value @LCL M=D // store stack address in LCL (no local vars so we're done) // COMMAND #2: push constant 6 @6 D=A // store the current address as a value @SP // >> push constant value (6) onto stack << A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 // COMMAND #3: push constant 8 @8 D=A // store the current address as a value @SP // >> push constant value (8) onto stack << A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 // COMMAND #4: call Class1.set 2 @Class1.set$ret.7 D=A // D=retAddr @SP // >>> push retAddr onto stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @LCL // >>> saving "LCL" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @ARG // >>> saving "ARG" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THIS // >>> saving "THIS" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THAT // >>> saving "THAT" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @SP // >>> reposition: LCL = SP D=M // store the stack pointer (after pushing the retAddr & segments) @LCL M=D // save SP to LCL // this should be 5 more than after pushing retAddr @7 // >>> reposition ARG = SP-n-5 D=D-A // subtract (frame + num of args) from the stored SP @ARG M=D // save SP-n-5 to ARG @Class1.set // jump to the function 0;JMP (Class1.set$ret.7) // return point for the just-called function // execution continues (after called function returns)... // COMMAND #5: pop temp 0 @SP // >> pop stack to 5 << M=M-1 A=M // move to top of stack D=M // store the top stack value into D @5 M=D // write value of D to current location // COMMAND #6: push constant 23 @23 D=A // store the current address as a value @SP // >> push constant value (23) onto stack << A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 // COMMAND #7: push constant 15 @15 D=A // store the current address as a value @SP // >> push constant value (15) onto stack << A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 // COMMAND #8: call Class2.set 2 @Class2.set$ret.8 D=A // D=retAddr @SP // >>> push retAddr onto stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @LCL // >>> saving "LCL" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @ARG // >>> saving "ARG" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THIS // >>> saving "THIS" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THAT // >>> saving "THAT" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @SP // >>> reposition: LCL = SP D=M // store the stack pointer (after pushing the retAddr & segments) @LCL M=D // save SP to LCL // this should be 5 more than after pushing retAddr @7 // >>> reposition ARG = SP-n-5 D=D-A // subtract (frame + num of args) from the stored SP @ARG M=D // save SP-n-5 to ARG @Class2.set // jump to the function 0;JMP (Class2.set$ret.8) // return point for the just-called function // execution continues (after called function returns)... // COMMAND #9: pop temp 0 @SP // >> pop stack to 5 << M=M-1 A=M // move to top of stack D=M // store the top stack value into D @5 M=D // write value of D to current location // COMMAND #10: call Class1.get 0 @Class1.get$ret.9 D=A // D=retAddr @SP // >>> push retAddr onto stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @LCL // >>> saving "LCL" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @ARG // >>> saving "ARG" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THIS // >>> saving "THIS" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THAT // >>> saving "THAT" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @SP // >>> reposition: LCL = SP D=M // store the stack pointer (after pushing the retAddr & segments) @LCL M=D // save SP to LCL // this should be 5 more than after pushing retAddr @5 // >>> reposition ARG = SP-n-5 D=D-A // subtract (frame + num of args) from the stored SP @ARG M=D // save SP-n-5 to ARG @Class1.get // jump to the function 0;JMP (Class1.get$ret.9) // return point for the just-called function // execution continues (after called function returns)... // COMMAND #11: call Class2.get 0 @Class2.get$ret.10 D=A // D=retAddr @SP // >>> push retAddr onto stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @LCL // >>> saving "LCL" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @ARG // >>> saving "ARG" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THIS // >>> saving "THIS" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @THAT // >>> saving "THAT" D=M // store current memory value in D @SP // > push stored value to top of stack A=M // move to top of stack M=D // write value of D to current location @SP // increment stack pointer M=M+1 @SP // >>> reposition: LCL = SP D=M // store the stack pointer (after pushing the retAddr & segments) @LCL M=D // save SP to LCL // this should be 5 more than after pushing retAddr @5 // >>> reposition ARG = SP-n-5 D=D-A // subtract (frame + num of args) from the stored SP @ARG M=D // save SP-n-5 to ARG @Class2.get // jump to the function 0;JMP (Class2.get$ret.10) // return point for the just-called function // execution continues (after called function returns)... (WHILE.VM) // COMMAND #12: label WHILE // COMMAND #13: goto WHILE @WHILE.VM 0;JMP
; =============================================================== ; Dec 2013 ; =============================================================== ; ; char *stpncpy(char * restrict s1, const char * restrict s2, size_t n) ; ; Copy at most n chars from string s2 to string s1, return address ; of first NUL char written to s1 or &s1[n] if no NUL is written. ; ; If strlen(s2) < n, s1 is padded with 0 bytes such that n ; chars are always written to s1. ; ; Note that s1 will not be 0 terminated if strlen(s2) >= n. ; ; =============================================================== SECTION code_clib SECTION code_string PUBLIC asm_stpncpy asm_stpncpy: ; enter : de = char *s1 = dst ; hl = char *s2 = src ; bc = size_t n ; ; exit : hl = address in s1 of first NUL written or &s1[n ; bc = 0 ; z flag set if NUL was written to s1 ; ; uses : af, bc, de, hl ld a,b or c jr z, exit ; copy src to dst xor a loop: cp (hl) ldi jp po, done ; reached max number of chars jr nz, loop ; now pad with zeroes ld l,e ld h,d dec hl push hl ; save addr of first NUL in s1 ldir pop hl ret done: jr nz, exit ; if last char was not NUL dec de ; move back to NUL exit: ex de,hl ret
; A056653: Composite numbers together with 1 but excluding 4. ; Submitted by Jon Maiga ; 1,6,8,9,10,12,14,15,16,18,20,21,22,24,25,26,27,28,30,32,33,34,35,36,38,39,40,42,44,45,46,48,49,50,51,52,54,55,56,57,58,60,62,63,64,65,66,68,69,70,72,74,75,76,77,78,80,81,82,84,85,86,87,88,90,91,92,93,94,95,96,98,99,100,102,104,105,106,108,110,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,128,129,130,132,133 add $0,3 seq $0,122825 ; a(n) = n + number of previous prime terms, a(1) = 1. sub $0,2 lpb $0 bin $0,3 lpe add $0,1
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x483e, %r13 nop nop nop sub $10350, %rbx mov (%r13), %r14d nop nop nop nop nop xor $19629, %r10 lea addresses_WC_ht+0x1404b, %r15 nop nop nop nop nop inc %rdx mov (%r15), %di nop nop nop nop add $54871, %rbx lea addresses_D_ht+0x923e, %r14 nop nop nop add %rdx, %rdx movw $0x6162, (%r14) nop xor $53837, %r10 lea addresses_normal_ht+0x273e, %rdx and %r15, %r15 movups (%rdx), %xmm3 vpextrq $0, %xmm3, %r14 nop cmp %r10, %r10 lea addresses_normal_ht+0xa63e, %rsi lea addresses_A_ht+0xb73e, %rdi nop add %r15, %r15 mov $103, %rcx rep movsq nop nop nop nop sub $3250, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %rbx push %rdi push %rdx push %rsi // Store lea addresses_PSE+0x1f00, %rdi nop nop nop nop nop sub $60629, %rsi movw $0x5152, (%rdi) nop nop nop nop cmp $19104, %rbx // Store lea addresses_UC+0xdc24, %rsi nop nop and $63358, %rbx mov $0x5152535455565758, %rdx movq %rdx, (%rsi) nop and $38842, %rdx // Store lea addresses_normal+0x16bbe, %rdi and %r12, %r12 movw $0x5152, (%rdi) nop nop cmp %r8, %r8 // Store lea addresses_PSE+0x1f7de, %r12 nop nop nop nop nop xor %rdx, %rdx mov $0x5152535455565758, %r8 movq %r8, %xmm5 vmovntdq %ymm5, (%r12) nop nop nop nop and %r12, %r12 // Faulty Load lea addresses_A+0x1223e, %rbx clflush (%rbx) nop xor $5276, %r11 mov (%rbx), %rdi lea oracles, %r11 and $0xff, %rdi shlq $12, %rdi mov (%r11,%rdi,1), %rdi pop %rsi pop %rdx pop %rdi pop %rbx pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 32, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'47': 23, '48': 2, '3b': 1, '44': 32, '00': 123, 'de': 2} 00 00 47 00 00 00 00 47 00 00 47 00 47 00 00 de 00 44 00 00 00 00 00 00 44 00 00 44 00 00 00 00 de 44 44 00 00 00 47 00 47 00 47 44 44 00 00 00 00 00 47 00 47 47 00 00 00 00 00 00 00 00 44 44 44 47 00 00 00 44 00 00 44 00 00 00 00 00 00 00 47 44 00 00 47 00 44 00 00 44 00 00 00 00 47 00 00 00 47 47 47 44 00 00 00 00 00 00 44 00 00 00 00 00 00 00 44 00 00 00 00 00 48 00 00 00 00 00 00 48 00 00 00 3b 00 00 00 00 44 44 00 47 00 00 00 00 00 00 00 00 44 47 00 00 47 44 47 47 44 00 44 44 00 44 00 00 44 00 00 44 44 00 47 00 44 44 44 00 00 00 00 00 00 */
; A077885: Expansion of (1-x)^(-1)/(1-2*x^3). ; 1,1,1,3,3,3,7,7,7,15,15,15,31,31,31,63,63,63,127,127,127,255,255,255,511,511,511,1023,1023,1023,2047,2047,2047,4095,4095,4095,8191,8191,8191,16383,16383,16383,32767,32767,32767,65535,65535,65535,131071,131071,131071,262143 div $0,3 mov $1,2 pow $1,$0 mul $1,2 sub $1,1 mov $0,$1
; void __CALLEE__ sp1_InsertCharStruct_callee(struct sp1_update *u, struct sp1_cs *cs) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version PUBLIC sp1_InsertCharStruct_callee PUBLIC ASMDISP_SP1_INSERTCHARSTRUCT_CALLEE EXTERN SP1AddSprChar .sp1_InsertCharStruct_callee pop hl pop de ex (sp),hl ex de,hl .asmentry ; hl = struct sp1_cs * ; de = struct sp1_update * inc hl inc hl ld (hl),d ; store sp1_update into sp1_cs.update inc hl ld (hl),e inc hl ld a,(hl) ; a = plane inc hl ; hl = & sp1_cs.type bit 7,(hl) ; is it occluding type? ex de,hl jr z, notoccluding inc (hl) ; increase # occluding sprites in update struct .notoccluding inc de ld c,e ld b,d ; bc = & sp1_cs.ss_draw inc hl inc hl inc hl ; hl = & sp1_update.slist jp SP1AddSprChar DEFC ASMDISP_SP1_INSERTCHARSTRUCT_CALLEE = # asmentry - sp1_InsertCharStruct_callee
Name: kart-drive-bak.asm Type: file Size: 13387 Last-Modified: '1991-11-07T08:14:06Z' SHA-1: 0EFF95402AF37F1BD2226E7626B6942707142C23 Description: null
; Program to add two numbers without carry, uses memory address for A& variable ; You can use the BASIC loader below to POKE it into memory, and RUN it ; Compare assembled program to BASIC loader values ; Program from Pocket Computer Newsletter, Machine Language Programming, 1983 ; ; 10:POKE &78C0,&B5,&03,&AE,&78,&D0,&EF,&78,&D0,&04,&9A ; 20:CALL &78C0 ; 30:PRINT PEEK &78D0 ; 40:END #define BRB(n) &+2-n ; calculate backward branch #define BRF(n) &+n ; calculate forward branch .ORG $78C0 ; using Sharp Assembler Syntax ; begin: ; LDI A,$03 ; Load Immedate Accumulator ; STA ($78D0) ; Store Accumulator to address &78D0 ; ADI ($78D0),$04 ; Add No Carry address &78D0 and immediate value &04 ; RTN ; Return form subroutine ; .END ; using Z80 Assembler Syntax begin: LD A,$03 ; Load Immedate Accumulator LD ($78D0),A ; Store Accumulator to address &78D0 ADD ($78D0),$04 ; Add No Carry address &78D0 and immediate value &04 RET ; Return form subroutine .END
; A193581: Sort-and-subtract: a(n) = n - A004185(n). ; Submitted by Simon Strandgaard ; 0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,18,9,0,0,0,0,0,0,0,0,27,18,9,0,0,0,0,0,0,0,36,27,18,9,0,0,0,0,0,0,45,36,27,18,9,0,0,0,0,0,54,45,36,27,18,9,0,0,0,0,63,54,45,36,27,18,9,0,0,0,72,63,54,45,36,27,18,9,0,0,81,72,63,54,45,36,27,18,9,0 mov $1,$0 seq $1,4185 ; Arrange digits of n in increasing order, then (for n>0) omit the zeros. sub $0,$1
; Find the summation of primes below 2 Million global _start extern printf extern asm_prime section .text _start: ; rbx represents our running summation, rcx is our counter mov rbx, 2 mov rcx, 3 _trial_iter: cmp rcx, 2000000 jg _complete_result mov rdi, rcx push rbx push rcx call asm_prime pop rcx pop rbx cmp eax, 1 jne _inc_count add rbx, rcx _inc_count: add rcx, 2 jmp _trial_iter _complete_result: mov rdi, rbx call print_result call _end_execution print_result: mov rsi, rdi push rdi mov rdi, format xor rax, rax call printf pop rdi ret _end_execution: mov rax, 60 mov rdi, 0 syscall ret section .data format: db "%ld", 10, 0 ; vim: ft=nasm
/*========================================================================= Program: Visualization Toolkit Module: vtkPointLocator.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkPointLocator.h" #include "vtkCellArray.h" #include "vtkIdList.h" #include "vtkIntArray.h" #include "vtkMath.h" #include "vtkObjectFactory.h" #include "vtkPolyData.h" #include <algorithm> //std::sort vtkStandardNewMacro(vtkPointLocator); static const int VTK_INITIAL_SIZE=1000; //----------------------------------------------------------------------------- // Utility class to store an array of ijk values class vtkNeighborPoints { public: vtkNeighborPoints() { this->Count = 0; this->P=&(this->InitialBuffer[0]); this->MaxSize = VTK_INITIAL_SIZE; } ~vtkNeighborPoints() { this->Count = 0; if ( this->P != &(this->InitialBuffer[0]) ) { delete[] this->P; } } int GetNumberOfNeighbors() { return this->Count; } void Reset() { this->Count = 0; } int *GetPoint(int i) { return (this->Count > i ? &(this->P[3*i]) : 0); } int InsertNextPoint(const int x[3]) { int* tmp; // Re-allocate if beyond the current max size. // (Increase by VTK_INITIAL_SIZE) if (this->Count == this->MaxSize) { tmp = this->P; this->MaxSize += VTK_INITIAL_SIZE; this->P = new int[this->MaxSize*3]; for(int i=0; i<3*this->Count; i++) { this->P[i] = tmp[i]; } if ( tmp != &(this->InitialBuffer[0]) ) { delete[] tmp; } } this->P[3*this->Count] = x[0]; this->P[3*this->Count+1] = x[1]; this->P[3*this->Count+2] = x[2]; this->Count++; return this->Count-1; } protected: // Start with an array to avoid memory allocation overhead int InitialBuffer[VTK_INITIAL_SIZE*3]; int *P; int Count; int MaxSize; }; //----------------------------------------------------------------------------- // Construct with automatic computation of divisions, averaging // 3 points per bucket. vtkPointLocator::vtkPointLocator() { this->Points = NULL; this->Divisions[0] = this->Divisions[1] = this->Divisions[2] = 50; this->NumberOfPointsPerBucket = 3; this->HashTable = NULL; this->H[0] = this->H[1] = this->H[2] = 0.0; this->InsertionPointId = 0; this->InsertionTol2 = 0.0001; this->InsertionLevel = 0; } //----------------------------------------------------------------------------- vtkPointLocator::~vtkPointLocator() { if ( this->Points ) { this->Points->UnRegister(this); this->Points = NULL; } this->FreeSearchStructure(); } //----------------------------------------------------------------------------- void vtkPointLocator::Initialize() { if ( this->Points ) { this->Points->UnRegister(this); this->Points = NULL; } this->FreeSearchStructure(); } //----------------------------------------------------------------------------- void vtkPointLocator::FreeSearchStructure() { vtkIdList *ptIds; vtkIdType i; if ( this->HashTable ) { for (i=0; i<this->NumberOfBuckets; i++) { if ( (ptIds = this->HashTable[i]) ) { ptIds->Delete(); } } delete [] this->HashTable; this->HashTable = NULL; } } //----------------------------------------------------------------------------- // Initialize internal performance variables void vtkPointLocator::ComputePerformanceFactors() { this->HX = this->H[0]; this->HY = this->H[1]; this->HZ = this->H[2]; this->FX = 1.0 / this->H[0]; this->FY = 1.0 / this->H[1]; this->FZ = 1.0 / this->H[2]; this->BX = this->Bounds[0]; this->BY = this->Bounds[2]; this->BZ = this->Bounds[4]; this->XD = this->Divisions[0]; this->YD = this->Divisions[1]; this->ZD = this->Divisions[2]; this->SliceSize = this->Divisions[0] * this->Divisions[1]; } //----------------------------------------------------------------------------- // Given a position x, return the id of the point closest to it. vtkIdType vtkPointLocator::FindClosestPoint(const double x[3]) { int i, j; double minDist2; double dist2 = VTK_DOUBLE_MAX; double pt[3]; int closest, level; vtkIdType ptId, cno, nids; vtkIdList *ptIds; int ijk[3], *nei; vtkNeighborPoints buckets; if ( !this->DataSet || this->DataSet->GetNumberOfPoints() < 1 ) { return -1; } this->BuildLocator(); // will subdivide if modified; otherwise returns // // Find bucket point is in. // this->GetBucketIndices(x, ijk); // // Need to search this bucket for closest point. If there are no // points in this bucket, search 1st level neighbors, and so on, // until closest point found. // for (closest=(-1),minDist2=VTK_DOUBLE_MAX,level=0; (closest == -1) && (level < this->Divisions[0] || level < this->Divisions[1] || level < this->Divisions[2]); level++) { this->GetBucketNeighbors (&buckets, ijk, this->Divisions, level); for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); this->DataSet->GetPoint(ptId, pt); if ( (dist2 = vtkMath::Distance2BetweenPoints(x,pt)) < minDist2 ) { closest = ptId; minDist2 = dist2; } } } } } // // Because of the relative location of the points in the buckets, the // point found previously may not be the closest point. Have to // search those bucket neighbors that might also contain point. // if ( minDist2 > 0.0 ) { this->GetOverlappingBuckets (&buckets, x, ijk, sqrt(minDist2),0); for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); this->DataSet->GetPoint(ptId, pt); if ( (dist2 = vtkMath::Distance2BetweenPoints(x,pt)) < minDist2 ) { closest = ptId; minDist2 = dist2; } }//for each point }//if points in bucket }//for each overlapping bucket }//if not identical point return closest; } //----------------------------------------------------------------------------- vtkIdType vtkPointLocator::FindClosestPointWithinRadius(double radius, const double x[3], double& dist2) { return this->FindClosestPointWithinRadius(radius, x, this->DataSet->GetLength(), dist2); } //----------------------------------------------------------------------------- vtkIdType vtkPointLocator::FindClosestPointWithinRadius(double radius, const double x[3], double inputDataLength, double& dist2) { int i, j; double pt[3]; vtkIdType ptId, nids, closest = -1; vtkIdList *ptIds; int ijk[3], *nei; double minDist2; double refinedRadius, radius2, refinedRadius2; double currentRadius; double distance2ToDataBounds, maxDistance; int ii, radiusLevels[3], radiusLevel, prevMinLevel[3], prevMaxLevel[3]; vtkNeighborPoints buckets; this->BuildLocator(); // will subdivide if modified; otherwise returns dist2 = -1.0; radius2 = radius*radius; minDist2 = 1.01*radius2; // something slightly bigger.... vtkDataArray *pointData = static_cast<vtkPointSet *>(this->DataSet)->GetPoints()->GetData(); int flag = 1; // // Find bucket point is in. // this->GetBucketIndices(x, ijk); // Start by searching the bucket that the point is in. // if ( (ptIds = this->HashTable[ijk[0] + ijk[1]*this->XD + ijk[2]*this->SliceSize]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); if (flag) { pointData->GetTuple(ptId, pt); } else { this->DataSet->GetPoint(ptId, pt); } if ( (dist2 = vtkMath::Distance2BetweenPoints(x,pt)) < minDist2 ) { closest = ptId; minDist2 = dist2; } } } // Now, search only those buckets that are within a radius. The radius used // is the smaller of sqrt(dist2) and the radius that is passed in. To avoid // checking a large number of buckets unnecessarily, if the radius is // larger than the dimensions of a bucket, we search outward using a // simple heuristic of rings. This heuristic ends up collecting inner // buckets multiple times, but this only happens in the case where these // buckets are empty, so they are discarded quickly. // if ( minDist2 < radius2 ) { refinedRadius = sqrt(dist2); refinedRadius2 = dist2; } else { refinedRadius = radius; refinedRadius2 = radius2; } if (inputDataLength != 0.0) { distance2ToDataBounds = this->Distance2ToBounds(x, this->Bounds); maxDistance = sqrt(distance2ToDataBounds) + inputDataLength; if (refinedRadius > maxDistance) { refinedRadius = maxDistance; refinedRadius2 = maxDistance*maxDistance; } } for (i = 0; i < 3; i++) { radiusLevels[i] = static_cast<int>(refinedRadius/this->H[i]); if (radiusLevels[i] > this->Divisions[i] / 2) { radiusLevels[i] = this->Divisions[i] / 2; } } radiusLevel = radiusLevels[0]; radiusLevel = radiusLevels[1] > radiusLevel ? radiusLevels[1] : radiusLevel; radiusLevel = radiusLevels[2] > radiusLevel ? radiusLevels[2] : radiusLevel; if (radiusLevel == 0) { radiusLevel = 1; } // radius schedule increases the radius each iteration, this is currently // implemented by decreasing ii by 1 each iteration. another alternative // is to double the radius each iteration, i.e. ii = ii >> 1 // In practice, reducing ii by one has been found to be more efficient. prevMinLevel[0] = prevMaxLevel[0] = ijk[0]; prevMinLevel[1] = prevMaxLevel[1] = ijk[1]; prevMinLevel[2] = prevMaxLevel[2] = ijk[2]; for (ii=radiusLevel; ii >= 1; ii--) { currentRadius = refinedRadius; // used in if at bottom of this for loop // Build up a list of buckets that are arranged in rings this->GetOverlappingBuckets(&buckets, x, refinedRadius/ii, prevMinLevel, prevMaxLevel); for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); // do we still need to test this bucket? if (this->Distance2ToBucket(x, nei) < refinedRadius2) { ptIds = this->HashTable[nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize]; nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); if (flag) { pointData->GetTuple(ptId, pt); } else { this->DataSet->GetPoint(ptId, pt); } if ( (dist2 = vtkMath::Distance2BetweenPoints(x,pt)) < minDist2 ) { closest = ptId; minDist2 = dist2; refinedRadius = sqrt(minDist2); refinedRadius2 = minDist2; } }//for each pt in bucket }//if bucket is within the current best distance }//for each overlapping bucket // don't want to checker a smaller radius than we just checked so update // ii appropriately if (refinedRadius < currentRadius && ii > 2) //always check ii==1 { ii = static_cast<int>(static_cast<double>(ii) * (refinedRadius / currentRadius)) + 1; if (ii < 2) { ii = 2; } } }//for each radius in the radius schedule if ((closest != -1) && (minDist2 <= radius2)) { dist2 = minDist2; } else { closest = -1; } return closest; } namespace { //----------------------------------------------------------------------------- // Sorting closest points class IdTuple { public: vtkIdType PtId; double Dist2; bool operator< (const IdTuple& tuple) const {return Dist2 < tuple.Dist2;} }; } //----------------------------------------------------------------------------- void vtkPointLocator::FindDistributedPoints(int N, double x, double y, double z, vtkIdList *result, int M) { double p[3]; p[0] = x; p[1] = y; p[2] = z; this->FindDistributedPoints(N,p,result, M); } //----------------------------------------------------------------------------- static int GetOctant(const double x[3], const double pt[3]) { double tmp[3]; int res = 0; tmp[0] = pt[0] - x[0]; tmp[1] = pt[1] - x[1]; tmp[2] = pt[2] - x[2]; if (tmp[0] > 0.0) { res += 1; } if (tmp[1] > 0.0) { res += 2; } if (tmp[2] > 0.0) { res += 4; } return res; } //----------------------------------------------------------------------------- static int GetMin(const int foo[8]) { int result = foo[0]; int i; for (i = 1; i < 8; i++) { if (foo[i] < result) { result = foo[i]; } } return result; } //----------------------------------------------------------------------------- static double GetMax(const double foo[8]) { double result = foo[0]; int i; for (i = 1; i < 8; i++) { if (foo[i] > result) { result = foo[i]; } } return result; } //----------------------------------------------------------------------------- void vtkPointLocator::FindDistributedPoints(int N, const double x[3], vtkIdList *result, int M) { int i, j; double dist2; double pt[3]; int level; vtkIdType ptId, nids, cno; vtkIdList *ptIds; int ijk[3], *nei; int oct; int pointsChecked = 0; vtkNeighborPoints buckets; // clear out the result result->Reset(); this->BuildLocator(); // will subdivide if modified; otherwise returns // // Make sure candidate point is in bounds. If not, it is outside. // for (i=0; i<3; i++) { if ( x[i] < this->Bounds[2*i] || x[i] > this->Bounds[2*i+1] ) { return; } } // // Find bucket point is in. // this->GetBucketIndices(x, ijk); // there are two steps, first a simple expanding wave of buckets until // we have enough points. Then a refinement to make sure we have the // N closest points. level = 0; double maxDistance[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; int currentCount[8] = {0,0,0,0,0,0,0,0}; int minCurrentCount = 0; IdTuple *res[8]; for (i = 0; i < 8; i++) { res[i] = new IdTuple [N]; } this->GetBucketNeighbors (&buckets, ijk, this->Divisions, level); while (buckets.GetNumberOfNeighbors() && minCurrentCount < N && pointsChecked < M) { for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { pointsChecked++; ptId = ptIds->GetId(j); this->DataSet->GetPoint(ptId, pt); dist2 = vtkMath::Distance2BetweenPoints(x,pt); oct = GetOctant(x,pt); if (currentCount[oct] < N) { res[oct][currentCount[oct]].Dist2 = dist2; res[oct][currentCount[oct]].PtId = ptId; if (dist2 > maxDistance[oct]) { maxDistance[oct] = dist2; } currentCount[oct] = currentCount[oct] + 1; // compute new minCurrentCount minCurrentCount = GetMin(currentCount); if (currentCount[oct] == N) { std::sort(res[oct], res[oct]+currentCount[oct]); } } else if (dist2 < maxDistance[oct]) { res[oct][N-1].Dist2 = dist2; res[oct][N-1].PtId = ptId; std::sort(res[oct], res[oct]+N); maxDistance[oct] = res[oct][N-1].Dist2; } } } } level++; this->GetBucketNeighbors (&buckets, ijk, this->Divisions, level); } // do a sort for (i = 0; i < 8; i++) { std::sort(res[i], res[i]+currentCount[i]); } // Now do the refinement this->GetOverlappingBuckets (&buckets, x, ijk, sqrt(GetMax(maxDistance)),level-1); for (i=0; pointsChecked < M && i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { pointsChecked++; ptId = ptIds->GetId(j); this->DataSet->GetPoint(ptId, pt); dist2 = vtkMath::Distance2BetweenPoints(x,pt); oct = GetOctant(x,pt); if (dist2 < maxDistance[oct]) { res[oct][N-1].Dist2 = dist2; res[oct][N-1].PtId = ptId; std::sort(res[oct], res[oct]+N); maxDistance[oct] = res[oct][N-1].Dist2; } } } } // Fill in the IdList for (j = 0; j < 8; j++) { for (i = 0; i < currentCount[j]; i++) { result->InsertNextId(res[j][i].PtId); } delete [] res[j]; } } //----------------------------------------------------------------------------- void vtkPointLocator::FindClosestNPoints(int N, const double x[3], vtkIdList *result) { int i, j; double dist2; double pt[3]; int level; vtkIdType ptId, nids, cno; vtkIdList *ptIds; int ijk[3], *nei; vtkNeighborPoints buckets; // clear out the result result->Reset(); this->BuildLocator(); // will subdivide if modified; otherwise returns // // Find bucket point is in. // this->GetBucketIndices(x, ijk); // there are two steps, first a simple expanding wave of buckets until // we have enough points. Then a refinement to make sure we have the // N closest points. level = 0; double maxDistance = 0.0; int currentCount = 0; IdTuple *res = new IdTuple [N]; this->GetBucketNeighbors (&buckets, ijk, this->Divisions, level); while (buckets.GetNumberOfNeighbors() && currentCount < N) { for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); this->DataSet->GetPoint(ptId, pt); dist2 = vtkMath::Distance2BetweenPoints(x,pt); if (currentCount < N) { res[currentCount].Dist2 = dist2; res[currentCount].PtId = ptId; if (dist2 > maxDistance) { maxDistance = dist2; } currentCount++; if (currentCount == N) { std::sort(res, res+currentCount); } } else if (dist2 < maxDistance) { res[N-1].Dist2 = dist2; res[N-1].PtId = ptId; std::sort(res, res+N); maxDistance = res[N-1].Dist2; } } } } level++; this->GetBucketNeighbors (&buckets, ijk, this->Divisions, level); } // do a sort std::sort(res, res+currentCount); // Now do the refinement this->GetOverlappingBuckets (&buckets, x, ijk, sqrt(maxDistance),level-1); for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); this->DataSet->GetPoint(ptId, pt); dist2 = vtkMath::Distance2BetweenPoints(x,pt); if (dist2 < maxDistance) { res[N-1].Dist2 = dist2; res[N-1].PtId = ptId; std::sort(res, res+N); maxDistance = res[N-1].Dist2; } } } } // Fill in the IdList result->SetNumberOfIds(currentCount); for (i = 0; i < currentCount; i++) { result->SetId(i,res[i].PtId); } delete [] res; } //----------------------------------------------------------------------------- void vtkPointLocator::FindPointsWithinRadius(double R, const double x[3], vtkIdList *result) { int i, j; double dist2; double pt[3]; vtkIdType ptId, nids, cno; vtkIdList *ptIds; int ijk[3], *nei; double R2 = R*R; vtkNeighborPoints buckets; this->BuildLocator(); // will subdivide if modified; otherwise returns // // Find bucket point is in. // this->GetBucketIndices(x, ijk); // get all buckets within a distance this->GetOverlappingBuckets (&buckets, x, ijk, R, 0); // add the original bucket buckets.InsertNextPoint(ijk); // clear out the result result->Reset(); for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); this->DataSet->GetPoint(ptId, pt); dist2 = vtkMath::Distance2BetweenPoints(x,pt); if (dist2 <= R2) { result->InsertNextId(ptId); } } } } } //----------------------------------------------------------------------------- // Method to form subdivision of space based on the points provided and // subject to the constraints of levels and NumberOfPointsPerBucket. // The result is directly addressable and of uniform subdivision. // void vtkPointLocator::BuildLocator() { vtkIdType numBuckets; double level; int ndivs[3]; int i; vtkIdType idx; vtkIdList *bucket; vtkIdType numPts; double x[3]; typedef vtkIdList *vtkIdListPtr; if ( (this->HashTable != NULL) && (this->BuildTime > this->MTime) && (this->BuildTime > this->DataSet->GetMTime()) ) { return; } vtkDebugMacro( << "Hashing points..." ); this->Level = 1; //only single lowest level if ( !this->DataSet || (numPts = this->DataSet->GetNumberOfPoints()) < 1 ) { vtkErrorMacro( << "No points to subdivide"); return; } // // Make sure the appropriate data is available // if ( this->HashTable ) { this->FreeSearchStructure(); } // // Size the root bucket. Initialize bucket data structure, compute // level and divisions. // const double *bounds = this->DataSet->GetBounds(); for (i=0; i<3; i++) { this->Bounds[2*i] = bounds[2*i]; this->Bounds[2*i+1] = bounds[2*i+1]; if ( this->Bounds[2*i+1] <= this->Bounds[2*i] ) //prevent zero width { this->Bounds[2*i+1] = this->Bounds[2*i] + 1.0; } } if ( this->Automatic ) { level = static_cast<double>(numPts) / this->NumberOfPointsPerBucket; level = ceil( pow(static_cast<double>(level), static_cast<double>(0.33333333))); for (i=0; i<3; i++) { ndivs[i] = static_cast<int>(level); } } else { for (i=0; i<3; i++) { ndivs[i] = static_cast<int>(this->Divisions[i]); } } for (i=0; i<3; i++) { ndivs[i] = (ndivs[i] > 0 ? ndivs[i] : 1); this->Divisions[i] = ndivs[i]; } this->NumberOfBuckets = numBuckets = ndivs[0]*ndivs[1]*ndivs[2]; this->HashTable = new vtkIdListPtr[numBuckets]; memset (this->HashTable, 0, numBuckets*sizeof(vtkIdListPtr)); // // Compute width of bucket in three directions // for (i=0; i<3; i++) { this->H[i] = (this->Bounds[2*i+1] - this->Bounds[2*i]) / ndivs[i] ; } // Compute local variables (for performance reasons) // Setup internal data members for more efficient processing. this->ComputePerformanceFactors(); // Insert each point into the appropriate bucket. Make sure point // falls within bucket. // for (i=0; i<numPts; i++) { this->DataSet->GetPoint(i, x); idx = this->GetBucketIndex(x); bucket = this->HashTable[idx]; if ( ! bucket ) { bucket = vtkIdList::New(); bucket->Allocate(this->NumberOfPointsPerBucket, this->NumberOfPointsPerBucket/3); this->HashTable[idx] = bucket; } bucket->InsertNextId(i); } // Okay we're done update mtime this->BuildTime.Modified(); } //----------------------------------------------------------------------------- // Internal function to get bucket neighbors at specified level // void vtkPointLocator::GetBucketNeighbors(vtkNeighborPoints* buckets, const int ijk[3], const int ndivs[3], int level) { int i, j, k, min, max, minLevel[3], maxLevel[3]; int nei[3]; // // Initialize // buckets->Reset(); // // If at this bucket, just place into list // if ( level == 0 ) { buckets->InsertNextPoint(ijk); return; } // // Create permutations of the ijk indices that are at the level // required. If these are legal buckets, add to list for searching. // for ( i=0; i<3; i++ ) { min = ijk[i] - level; max = ijk[i] + level; minLevel[i] = ( min > 0 ? min : 0); maxLevel[i] = ( max < (ndivs[i]-1) ? max : (ndivs[i]-1)); } for ( i= minLevel[0]; i <= maxLevel[0]; i++ ) { for ( j= minLevel[1]; j <= maxLevel[1]; j++ ) { for ( k= minLevel[2]; k <= maxLevel[2]; k++ ) { if (i == (ijk[0] + level) || i == (ijk[0] - level) || j == (ijk[1] + level) || j == (ijk[1] - level) || k == (ijk[2] + level) || k == (ijk[2] - level) ) { nei[0]=i; nei[1]=j; nei[2]=k; buckets->InsertNextPoint(nei); } } } } return; } //----------------------------------------------------------------------------- // Internal method to find those buckets that are within distance specified // only those buckets outside of level radiuses of ijk are returned void vtkPointLocator::GetOverlappingBuckets(vtkNeighborPoints* buckets, const double x[3], const int ijk[3], double dist, int level) { int i, j, k, nei[3], minLevel[3], maxLevel[3]; double xMin[3], xMax[3]; // Initialize buckets->Reset(); // Determine the range of indices in each direction // Determine the range of indices in each direction xMin[0] = x[0] - dist; xMin[1] = x[1] - dist; xMin[2] = x[2] - dist; xMax[0] = x[0] + dist; xMax[1] = x[1] + dist; xMax[2] = x[2] + dist; this->GetBucketIndices(xMin,minLevel); this->GetBucketIndices(xMax,maxLevel); for ( i= minLevel[0]; i <= maxLevel[0]; i++ ) { for ( j= minLevel[1]; j <= maxLevel[1]; j++ ) { for ( k= minLevel[2]; k <= maxLevel[2]; k++ ) { if ( i < (ijk[0]-level) || i > (ijk[0]+level) || j < (ijk[1]-level) || j > (ijk[1]+level) || k < (ijk[2]-level) || k > (ijk[2]+level)) { nei[0]=i; nei[1]=j; nei[2]=k; buckets->InsertNextPoint(nei); } } } } } //----------------------------------------------------------------------------- // Internal method to find those buckets that are within distance specified // only those buckets outside of level radiuses of ijk are returned void vtkPointLocator::GetOverlappingBuckets(vtkNeighborPoints* buckets, const double x[3], double dist, int prevMinLevel[3], int prevMaxLevel[3]) { int i, j, k, nei[3], minLevel[3], maxLevel[3]; int kFactor, jFactor; int jkSkipFlag, kSkipFlag; double xMin[3], xMax[3]; // Initialize buckets->Reset(); // Determine the range of indices in each direction // Determine the range of indices in each direction xMin[0] = x[0] - dist; xMin[1] = x[1] - dist; xMin[2] = x[2] - dist; xMax[0] = x[0] + dist; xMax[1] = x[1] + dist; xMax[2] = x[2] + dist; this->GetBucketIndices(xMin,minLevel); this->GetBucketIndices(xMax,maxLevel); if (minLevel[0] == prevMinLevel[0] && maxLevel[0] == prevMaxLevel[0] && minLevel[1] == prevMinLevel[1] && maxLevel[1] == prevMaxLevel[1] && minLevel[2] == prevMinLevel[2] && maxLevel[2] == prevMaxLevel[2] ) { return; } for ( k= minLevel[2]; k <= maxLevel[2]; k++ ) { kFactor = k * this->SliceSize; if (k >= prevMinLevel[2] && k <= prevMaxLevel[2]) { kSkipFlag = 1; } else { kSkipFlag = 0; } for ( j= minLevel[1]; j <= maxLevel[1]; j++ ) { if (kSkipFlag && j >= prevMinLevel[1] && j <= prevMaxLevel[1]) { jkSkipFlag = 1; } else { jkSkipFlag = 0; } jFactor = j * this->XD; for ( i= minLevel[0]; i <= maxLevel[0]; i++ ) { if ( jkSkipFlag && i == prevMinLevel[0] ) { i = prevMaxLevel[0]; continue; } // if this bucket has any cells, add it to the list if (this->HashTable[i + jFactor + kFactor]) { nei[0]=i; nei[1]=j; nei[2]=k; buckets->InsertNextPoint(nei); } } } } prevMinLevel[0] = minLevel[0]; prevMinLevel[1] = minLevel[1]; prevMinLevel[2] = minLevel[2]; prevMaxLevel[0] = maxLevel[0]; prevMaxLevel[1] = maxLevel[1]; prevMaxLevel[2] = maxLevel[2]; } //----------------------------------------------------------------------------- // Initialize the point insertion process. The newPts is an object representing // point coordinates into which incremental insertion methods place their // data. Bounds are the box that the points lie in. int vtkPointLocator::InitPointInsertion(vtkPoints *newPts, const double bounds[6]) { return this->InitPointInsertion(newPts,bounds,0); } //----------------------------------------------------------------------------- // Initialize the point insertion process. The newPts is an object representing // point coordinates into which incremental insertion methods place their // data. Bounds are the box that the points lie in. int vtkPointLocator::InitPointInsertion(vtkPoints *newPts, const double bounds[6], vtkIdType estNumPts) { int i; int maxDivs; typedef vtkIdList *vtkIdListPtr; double hmin; int ndivs[3]; double level; this->InsertionPointId = 0; if ( this->HashTable ) { this->FreeSearchStructure(); } if ( newPts == NULL ) { vtkErrorMacro(<<"Must define points for point insertion"); return 0; } if (this->Points != NULL) { this->Points->UnRegister(this); } this->Points = newPts; this->Points->Register(this); for (i=0; i<3; i++) { this->Bounds[2*i] = bounds[2*i]; this->Bounds[2*i+1] = bounds[2*i+1]; if ( this->Bounds[2*i+1] <= this->Bounds[2*i] ) { this->Bounds[2*i+1] = this->Bounds[2*i] + 1.0; } } if ( this->Automatic && (estNumPts > 0) ) { level = static_cast<double>(estNumPts) / this->NumberOfPointsPerBucket; level = ceil( pow(static_cast<double>(level), static_cast<double>(0.33333333)) ); for (i=0; i<3; i++) { ndivs[i] = static_cast<int>(level); } } else { for (i=0; i<3; i++) { ndivs[i] = static_cast<int>(this->Divisions[i]); } } for (i=0; i<3; i++) { ndivs[i] = (ndivs[i] > 0 ? ndivs[i] : 1); this->Divisions[i] = ndivs[i]; } this->NumberOfBuckets = ndivs[0]*ndivs[1]*ndivs[2]; this->HashTable = new vtkIdListPtr[this->NumberOfBuckets]; memset (this->HashTable, 0, this->NumberOfBuckets* sizeof(vtkIdListPtr)); // // Compute width of bucket in three directions // for (i=0; i<3; i++) { this->H[i] = (this->Bounds[2*i+1] - this->Bounds[2*i]) / ndivs[i] ; } this->InsertionTol2 = this->Tolerance * this->Tolerance; for (maxDivs=0, hmin=VTK_DOUBLE_MAX, i=0; i<3; i++) { hmin = (this->H[i] < hmin ? this->H[i] : hmin); maxDivs = (maxDivs > this->Divisions[i] ? maxDivs : this->Divisions[i]); } this->InsertionLevel = ceil (static_cast<double>(this->Tolerance) / hmin); this->InsertionLevel = (this->InsertionLevel > maxDivs ? maxDivs : this->InsertionLevel); // Update internal performance variables this->ComputePerformanceFactors(); return 1; } //----------------------------------------------------------------------------- // Incrementally insert a point into search structure. The method returns // the insertion location (i.e., point id). You should use the method // IsInsertedPoint() to see whether this point has already been // inserted (that is, if you desire to prevent dulicate points). // Before using this method you must make sure that newPts have been // supplied, the bounds has been set properly, and that divs are // properly set. (See InitPointInsertion().) vtkIdType vtkPointLocator::InsertNextPoint(const double x[3]) { vtkIdType idx; vtkIdList *bucket; idx = this->GetBucketIndex(x); if ( ! (bucket = this->HashTable[idx]) ) { bucket = vtkIdList::New(); bucket->Allocate(this->NumberOfPointsPerBucket/2, this->NumberOfPointsPerBucket/3); this->HashTable[idx] = bucket; } bucket->InsertNextId(this->InsertionPointId); this->Points->InsertPoint(this->InsertionPointId,x); return this->InsertionPointId++; } //----------------------------------------------------------------------------- // Incrementally insert a point into search structure with a particular // index value. You should use the method IsInsertedPoint() to see whether // this point has already been inserted (that is, if you desire to prevent // duplicate points). Before using this method you must make sure that // newPts have been supplied, the bounds has been set properly, and that // divs are properly set. (See InitPointInsertion().) void vtkPointLocator::InsertPoint(vtkIdType ptId, const double x[3]) { vtkIdType idx; vtkIdList *bucket; idx = this->GetBucketIndex(x); if ( ! (bucket = this->HashTable[idx]) ) { bucket = vtkIdList::New(); bucket->Allocate(this->NumberOfPointsPerBucket, this->NumberOfPointsPerBucket/3); this->HashTable[idx] = bucket; } bucket->InsertNextId(ptId); this->Points->InsertPoint(ptId,x); } //----------------------------------------------------------------------------- // Determine whether point given by x[3] has been inserted into points list. // Return id of previously inserted point if this is true, otherwise return // -1. vtkIdType vtkPointLocator::IsInsertedPoint(const double x[3]) { int i, j, ijk[3]; vtkNeighborPoints buckets; vtkIdType nids; // Locate bucket that point is in. // this->GetBucketIndices(x, ijk); // Check the list of points in that bucket for merging. Also need to // search all neighboring buckets within the tolerance. The number // and level of neighbors to search depends upon the tolerance and // the bucket width. // int *nei, lvtk; vtkIdType ptId, cno; vtkIdList *ptIds; double pt[3]; for (lvtk=0; lvtk <= this->InsertionLevel; lvtk++) { this->GetBucketNeighbors (&buckets, ijk, this->Divisions, lvtk); for ( i=0; i < buckets.GetNumberOfNeighbors(); i++ ) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); this->Points->GetPoint(ptId, pt); if ( vtkMath::Distance2BetweenPoints(x,pt) <= this->InsertionTol2 ) { return ptId; } } } //if points in bucket } //for each neighbor } //for neighbors at this level return -1; } //----------------------------------------------------------------------------- int vtkPointLocator::InsertUniquePoint(const double x[3], vtkIdType &id) { vtkIdType ptId; ptId = this->IsInsertedPoint(x); if (ptId > -1) { id = ptId; return 0; } else { id = this->InsertNextPoint(x); return 1; } } //----------------------------------------------------------------------------- // Given a position x, return the id of the point closest to it. This method // is used when performing incremental point insertion. vtkIdType vtkPointLocator::FindClosestInsertedPoint(const double x[3]) { int i; double minDist2, dist2; double pt[3]; int level; vtkIdType closest, j; vtkIdType ptId, nids, cno; vtkIdList *ptIds; int ijk[3], *nei; int MULTIPLES; double diff; vtkNeighborPoints buckets; // // Make sure candidate point is in bounds. If not, it is outside. // for (i=0; i<3; i++) { if ( x[i] < this->Bounds[2*i] || x[i] > this->Bounds[2*i+1] ) { return -1; } } // Find bucket point is in. // this->GetBucketIndices(x, ijk); // Need to search this bucket for closest point. If there are no // points in this bucket, search 1st level neighbors, and so on, // until closest point found. // for (closest=0,minDist2=VTK_DOUBLE_MAX,level=0; (closest == 0) && (level < this->Divisions[0] || level < this->Divisions[1] || level < this->Divisions[2]); level++) { this->GetBucketNeighbors (&buckets, ijk, this->Divisions, level); for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) != NULL ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); this->Points->GetPoint(ptId, pt); if ( (dist2 = vtkMath::Distance2BetweenPoints(x,pt)) < minDist2 ) { closest = ptId; minDist2 = dist2; } } } } } // // Because of the relative location of the points in the spatial_hash, this // may not be the closest point. Have to search those bucket // neighbors (one level further out) that might also contain point. // this->GetBucketNeighbors (&buckets, ijk, this->Divisions, level); // // Don't want to search all the neighbors, only those that could // possibly have points closer than the current closest. // for (i=0; i<buckets.GetNumberOfNeighbors(); i++) { nei = buckets.GetPoint(i); for (dist2=0,j=0; j<3; j++) { if ( ijk[j] != nei[j] ) { MULTIPLES = (ijk[j]>nei[j] ? (nei[j]+1) : nei[j]); diff = (this->Bounds[2*j] + MULTIPLES * this->H[j]) - x[j]; dist2 += diff*diff; } } if ( dist2 < minDist2 ) { cno = nei[0] + nei[1]*this->XD + nei[2]*this->SliceSize; if ( (ptIds = this->HashTable[cno]) ) { nids = ptIds->GetNumberOfIds(); for (j=0; j < nids; j++) { ptId = ptIds->GetId(j); this->Points->GetPoint(ptId, pt); if ( (dist2 = vtkMath::Distance2BetweenPoints(x,pt)) < minDist2 ) { closest = ptId; minDist2 = dist2; } } } } } return closest; } //----------------------------------------------------------------------------- // Return the list of points in the bucket containing x. vtkIdList *vtkPointLocator::GetPointsInBucket(const double x[3], int ijk[3]) { int i; // Make sure candidate point is in bounds. If not, it is outside. // for (i=0; i<3; i++) { if ( x[i] < this->Bounds[2*i] || x[i] > this->Bounds[2*i+1] ) { return NULL; } } this->GetBucketIndices(x, ijk); // Get the id list, if any if ( this->HashTable ) { vtkIdType idx = this->GetBucketIndex(x); return this->HashTable[idx]; } return NULL; } //----------------------------------------------------------------------------- // Build polygonal representation of locator. Create faces that separate // inside/outside buckets, or separate inside/boundary of locator. void vtkPointLocator::GenerateRepresentation(int vtkNotUsed(level), vtkPolyData *pd) { vtkPoints *pts; vtkCellArray *polys; int ii, i, j, k, idx, offset[3], minusOffset[3], inside, sliceSize; if ( this->HashTable == NULL ) { vtkErrorMacro(<<"Can't build representation...no data!"); return; } pts = vtkPoints::New(); pts->Allocate(5000); polys = vtkCellArray::New(); polys->Allocate(10000); // loop over all buckets, creating appropriate faces sliceSize = this->Divisions[0] * this->Divisions[1]; for ( k=0; k < this->Divisions[2]; k++) { offset[2] = k * sliceSize; minusOffset[2] = (k-1) * sliceSize; for ( j=0; j < this->Divisions[1]; j++) { offset[1] = j * this->Divisions[0]; minusOffset[1] = (j-1) * this->Divisions[0]; for ( i=0; i < this->Divisions[0]; i++) { offset[0] = i; minusOffset[0] = i - 1; idx = offset[0] + offset[1] + offset[2]; if ( this->HashTable[idx] == NULL ) { inside = 0; } else { inside = 1; } //check "negative" neighbors for (ii=0; ii < 3; ii++) { if ( minusOffset[ii] < 0 ) { if ( inside ) { this->GenerateFace(ii,i,j,k,pts,polys); } } else { if ( ii == 0 ) { idx = minusOffset[0] + offset[1] + offset[2]; } else if ( ii == 1 ) { idx = offset[0] + minusOffset[1] + offset[2]; } else { idx = offset[0] + offset[1] + minusOffset[2]; } if ( (this->HashTable[idx] == NULL && inside) || (this->HashTable[idx] != NULL && !inside) ) { this->GenerateFace(ii,i,j,k,pts,polys); } } //those buckets on "positive" boundaries can generate faces specially if ( (i+1) >= this->Divisions[0] && inside ) { this->GenerateFace(0,i+1,j,k,pts,polys); } if ( (j+1) >= this->Divisions[1] && inside ) { this->GenerateFace(1,i,j+1,k,pts,polys); } if ( (k+1) >= this->Divisions[2] && inside ) { this->GenerateFace(2,i,j,k+1,pts,polys); } }//over negative faces }//over i divisions }//over j divisions }//over k divisions pd->SetPoints(pts); pts->Delete(); pd->SetPolys(polys); polys->Delete(); pd->Squeeze(); } //----------------------------------------------------------------------------- void vtkPointLocator::GenerateFace(int face, int i, int j, int k, vtkPoints *pts, vtkCellArray *polys) { vtkIdType ids[4]; double origin[3], x[3]; // define first corner origin[0] = this->Bounds[0] + i * this->HX; origin[1] = this->Bounds[2] + j * this->HY; origin[2] = this->Bounds[4] + k * this->HZ; ids[0] = pts->InsertNextPoint(origin); if ( face == 0 ) //x face { x[0] = origin[0]; x[1] = origin[1] + this->HY; x[2] = origin[2]; ids[1] = pts->InsertNextPoint(x); x[0] = origin[0]; x[1] = origin[1] + this->HY; x[2] = origin[2] + this->HZ; ids[2] = pts->InsertNextPoint(x); x[0] = origin[0]; x[1] = origin[1]; x[2] = origin[2] + this->HZ; ids[3] = pts->InsertNextPoint(x); } else if ( face == 1 ) //y face { x[0] = origin[0] + this->HX; x[1] = origin[1]; x[2] = origin[2]; ids[1] = pts->InsertNextPoint(x); x[0] = origin[0] + this->HX; x[1] = origin[1]; x[2] = origin[2] + this->HZ; ids[2] = pts->InsertNextPoint(x); x[0] = origin[0]; x[1] = origin[1]; x[2] = origin[2] + this->HZ; ids[3] = pts->InsertNextPoint(x); } else //z face { x[0] = origin[0] + this->HX; x[1] = origin[1]; x[2] = origin[2]; ids[1] = pts->InsertNextPoint(x); x[0] = origin[0] + this->HX; x[1] = origin[1] + this->HY; x[2] = origin[2]; ids[2] = pts->InsertNextPoint(x); x[0] = origin[0]; x[1] = origin[1] + this->HY; x[2] = origin[2]; ids[3] = pts->InsertNextPoint(x); } polys->InsertNextCell(4,ids); } //----------------------------------------------------------------------------- // Calculate the distance between the point x to the bucket "nei". // // WARNING!!!!! Be very careful altering this routine. Simple changes to this // routine can make is 25% slower!!!! // double vtkPointLocator::Distance2ToBucket(const double x[3], const int nei[3]) { double bounds[6]; bounds[0] = nei[0]*this->HX + this->BX; bounds[1] = (nei[0]+1)*this->HX + this->BX; bounds[2] = nei[1]*this->HY + this->BY; bounds[3] = (nei[1]+1)*this->HY + this->BY; bounds[4] = nei[2]*this->HZ + this->BZ; bounds[5] = (nei[2]+1)*this->HZ + this->BZ; return this->Distance2ToBounds(x, bounds); } //----------------------------------------------------------------------------- // Calculate the distance between the point x and the specified bounds // // WARNING!!!!! Be very careful altering this routine. Simple changes to this // routine can make is 25% slower!!!! double vtkPointLocator::Distance2ToBounds(const double x[3], const double bounds[6]) { double distance; double deltas[3]; // Are we within the bounds? if (x[0] >= bounds[0] && x[0] <= bounds[1] && x[1] >= bounds[2] && x[1] <= bounds[3] && x[2] >= bounds[4] && x[2] <= bounds[5]) { return 0.0; } deltas[0] = deltas[1] = deltas[2] = 0.0; // dx // if (x[0] < bounds[0]) { deltas[0] = bounds[0] - x[0]; } else if (x[0] > bounds[1]) { deltas[0] = x[0] - bounds[1]; } // dy // if (x[1] < bounds[2]) { deltas[1] = bounds[2] - x[1]; } else if (x[1] > bounds[3]) { deltas[1] = x[1] - bounds[3]; } // dz // if (x[2] < bounds[4]) { deltas[2] = bounds[4] - x[2]; } else if (x[2] > bounds[5]) { deltas[2] = x[2] - bounds[5]; } distance = vtkMath::Dot(deltas, deltas); return distance; } //----------------------------------------------------------------------------- void vtkPointLocator::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); os << indent << "Number of Points Per Bucket: " << this->NumberOfPointsPerBucket << "\n"; os << indent << "Divisions: (" << this->Divisions[0] << ", " << this->Divisions[1] << ", " << this->Divisions[2] << ")\n"; if ( this->Points ) { os << indent << "Points:\n"; this->Points->PrintSelf(os,indent.GetNextIndent()); } else { os << indent << "Points: (none)\n"; } }
; A314886: Coordination sequence Gal.5.114.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Jamie Morken(l1) ; 1,5,9,14,19,23,27,32,37,41,46,51,55,60,65,69,73,78,83,87,92,97,101,106,111,115,119,124,129,133,138,143,147,152,157,161,165,170,175,179,184,189,193,198,203,207,211,216,221,225 mov $1,1 mov $4,$0 mov $5,$0 lpb $0 mov $0,6 mul $0,$4 add $4,4 mov $2,$4 mod $2,10 add $0,$2 div $0,10 mov $1,$0 lpe mov $3,$5 mul $3,4 add $1,$3 mov $0,$1
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memcpy_14.cpp Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806.label.xml Template File: sources-sink-14.tmpl.cpp */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: memcpy * BadSink : Copy data to string using memcpy * Flow Variant: 14 Control flow: if(globalFive==5) and if(globalFive!=5) * * */ #include "std_testcase.h" #include <wchar.h> namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memcpy_14 { #ifndef OMITBAD void bad() { char * data; data = new char[100]; if(globalFive==5) { /* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */ memset(data, 'A', 100-1); /* fill with 'A's */ data[100-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memcpy(dest, data, strlen(data)*sizeof(char)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); delete [] data; } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the globalFive==5 to globalFive!=5 */ static void goodG2B1() { char * data; data = new char[100]; if(globalFive!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memcpy(dest, data, strlen(data)*sizeof(char)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); delete [] data; } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; data = new char[100]; if(globalFive==5) { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memcpy(dest, data, strlen(data)*sizeof(char)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); delete [] data; } } void good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memcpy_14; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
; Options: ; startup=1 --> RAM mode ; startup=2 --> ROM mode (position code at location 0 and provide minimal interrupt services) ; ; CRT_ORG_CODE = start address ; CRT_ORG_BSS = address for bss variables ; CRT_MODEL = 0 (RAM), 1 = (ROM, code copied), 2 = (ROM, code compressed) ; ; djm 18/5/99 ; ; $Id: spec_crt0.asm,v 1.53 2016-07-16 07:06:27 dom Exp $ ; MODULE zx82_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- defc crt0 = 1 INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- EXTERN _main ; main() is always external to crt0 code PUBLIC cleanup ; jp'd to by exit() PUBLIC l_dcal ; jp(hl) PUBLIC call_rom3 ; Interposer PUBLIC _FRAMES defc _FRAMES = 23672 ; Timer PUBLIC __SYSVAR_BORDCR defc __SYSVAR_BORDCR = 23624 IF DEFINED_ZXVGS IF !DEFINED_CRT_ORG_CODE DEFC CRT_ORG_CODE = $5CCB ; repleaces BASIC program defc DEFINED_CRT_ORG_CODE = 1 ENDIF defc TAR__register_sp = 0xff57 ; below UDG, keep eye when using banks ENDIF IF !DEFINED_CRT_ORG_CODE IF (startup=2) ; ROM ? defc CRT_ORG_CODE = 0 defc TAR__register_sp = 32767 ELSE defc CRT_ORG_CODE = 32768 ENDIF ENDIF ; We default to the 64 column terminal driver defc CONSOLE_COLUMNS = 64 defc CONSOLE_ROWS = 24 ; We use the generic driver by default defc TAR__fputc_cons_generic = 1 defc DEF__register_sp = -1 defc TAR__clib_exit_stack_size = 32 defc CRT_KEY_DEL = 12 defc __CPU_CLOCK = 3500000 INCLUDE "crt/classic/crt_rules.inc" org CRT_ORG_CODE start: ; --- startup=2 ---> build a ROM IF (startup=2) di ; put hardware in a stable state ld a,$3F ld i,a jr init ; go over rst 8, bypass shadow ROM defs $0008-ASMPC if (ASMPC<>$0008) defs CODE_ALIGNMENT_ERROR endif ; --- rst 8 --- ld hl,($5c5d) ; It was the address reached by CH-ADD. nop ; one byte still, to jump over the ; Opus Discovery and similar shadowing traps ; --- nothing more ? init: im 1 INCLUDE "crt/classic/crt_init_sp.asm" INCLUDE "crt/classic/crt_init_atexit.asm" ld a,@111000 ; White PAPER, black INK call zx_internal_cls ld (hl),0 ld bc,42239 ldir ei ELSE ; --- startup=[default] --- ld iy,23610 ; restore the right iy value, ; fixing the self-relocating trick, if any IF !DEFINED_ZXVGS ld (start1+1),sp ; Save entry stack ENDIF INCLUDE "crt/classic/crt_init_sp.asm" INCLUDE "crt/classic/crt_init_atexit.asm" call crt0_init_bss ld (exitsp),sp ; Optional definition for auto MALLOC init; it takes ; all the space between the end of the program and UDG IF DEFINED_USING_amalloc defc CRT_MAX_HEAP_ADDRESS = 65535 - 169 INCLUDE "crt/classic/crt_init_amalloc.asm" ENDIF IF DEFINED_ZXVGS ;setting variables needed for proper keyboard reading LD (IY+1),$CD ; FLAGS #5C3B LD (IY+48),1 ; FLAGS2 #5C6A EI ; ZXVGS starts with disabled interrupts ENDIF ; ld a,2 ; open the upper display (uneeded?) ; call 5633 ENDIF IF DEFINED_NEEDresidos call residos_detect jp c,cleanup_exit ENDIF call _main ; Call user program cleanup: ; ; Deallocate memory which has been allocated here! ; push hl IF CRT_ENABLE_STDIO = 1 EXTERN closeall call closeall ENDIF IF (startup=2) ; ROM ? cleanup_exit: rst 0 defs 56-cleanup_exit-1 if (ASMPC<>$0038) defs CODE_ALIGNMENT_ERROR endif ; ######## IM 1 MODE INTERRUPT ENTRY ######## INCLUDE "target/zx/classic/spec_crt0_rom_isr.asm" ; ######## END OF ROM INTERRUPT HANDLER ######## PUBLIC zx_internal_cls zx_internal_cls: ld hl,$4000 ; cls ld d,h ld e,l inc de ld (hl),0 ld bc,$1800 ldir ld (hl),a ld bc,768 ldir rrca rrca rrca out (254),a ret ELSE IF DEFINED_ZXVGS POP BC ;let's say exit code goes to BC RST 8 DEFB $FD ;Program finished ELSE cleanup_exit: ld hl,10072 ;Restore hl' to what basic wants exx pop bc start1: ld sp,0 ;Restore stack to entry value ret ENDIF ENDIF l_dcal: jp (hl) ;Used for function pointer calls ; Runtime selection IF NEED_fzxterminal PUBLIC fputc_cons PUBLIC _fputc_cons PUBLIC _fgets_cons_erase_character PUBLIC fgets_cons_erase_character EXTERN fputc_cons_fzx EXTERN fgets_cons_erase_character_fzx defc DEFINED_fputc_cons = 1 defc fputc_cons = fputc_cons_fzx defc _fputc_cons = fputc_cons_fzx defc fgets_cons_erase_character = fgets_cons_erase_character_fzx defc _fgets_cons_erase_character = fgets_cons_erase_character_fzx ENDIF INCLUDE "crt/classic/crt_runtime_selection.asm" ;--------------------------------------------- ; Some +3 stuff - this needs to be below 49152 ;--------------------------------------------- IF DEFINED_NEEDresidos INCLUDE "arch/zx/def/idedos.def" defc ERR_NR=$5c3a ; BASIC system variables defc ERR_SP=$5c3d PUBLIC dodos EXTERN dodos_residos defc dodos = dodos_residos ; Detect an installed version of ResiDOS. ; ; This should be done before you attempt to call any other ResiDOS/+3DOS/IDEDOS ; routines, and ensures that the Spectrum is running with ResiDOS installed. ; Since +3DOS and IDEDOS are present only from v1.40, this version must ; be checked for before making any further calls. ; ; If you need to use calls that were only provided from a certain version of ; ResiDOS, you can check that here as well. ; ; The ResiDOS version call is made with a special hook-code after a RST 8, ; which will cause an error on Speccies without ResiDOS v1.20+ installed, ; or error 0 (OK) if ResiDOS v1.20+ is present. Therefore, we need ; to trap any errors here. residos_detect: ld hl,(ERR_SP) push hl ; save the existing ERR_SP ld hl,detect_error push hl ; stack error-handler return address ld hl,0 add hl,sp ld (ERR_SP),hl ; set the error-handler SP rst RST_HOOK ; invoke the version info hook code defb HOOK_VERSION pop hl ; ResiDOS doesn't return, so if we get jr noresidos ; here, some other hardware is present detect_error: pop hl ld (ERR_SP),hl ; restore the old ERR_SP ld a,(ERR_NR) inc a ; is the error code now "OK"? jr nz,noresidos ; if not, ResiDOS was not detected ex de,hl ; get HL=ResiDOS version push hl ; save the version ld de,$0140 ; DE=minimum version to run with and a sbc hl,de pop bc ; restore the version to BC ret nc ; and return with it if at least v1.40 noresidos: ld bc,0 ; no ResiDOS ld a,$ff ld (ERR_NR),a ; clear error ret ENDIF ; Call a routine in the spectrum ROM ; The routine to call is stored in the two bytes following call_rom3: exx ; Use alternate registers IF DEFINED_NEED_ZXMMC push af xor a ; standard ROM out ($7F),a ; ZXMMC FASTPAGE pop af ENDIF ex (sp),hl ; get return address ld c,(hl) inc hl ld b,(hl) ; BC=BASIC address inc hl ex (sp),hl ; restore return address push bc exx ; Back to the regular set ret IF (startup=2) ;ROM IF !DEFINED_CRT_ORG_BSS defc CRT_ORG_BSS = 24576 defc DEFINED_CRT_ORG_BSS = 1 ENDIF ; If we were given a model then use it IF DEFINED_CRT_MODEL defc __crt_model = CRT_MODEL ELSE defc __crt_model = 1 ENDIF ENDIF ; If we were given an address for the BSS then use it IF DEFINED_CRT_ORG_BSS defc __crt_org_bss = CRT_ORG_BSS ENDIF INCLUDE "crt/classic/crt_section.asm" SECTION code_crt_init ld a,@111000 ; White PAPER, black INK ld ($5c48),a ; BORDCR ld ($5c8d),a ; ATTR_P ld ($5c8f),a ; ATTR_T SECTION bss_crt IF startup=2 PUBLIC romsvc romsvc: defs 10 ; Pointer to the end of the sysdefvars ; used by the ROM version of some library ENDIF SECTION rodata_clib ; Default block size for "gendos.lib" ; every single block (up to 36) is written in a separate file ; the bigger RND_BLOCKSIZE, bigger can be the output file size ; but this comes at cost of the malloc'd space for the internal buffer ; Current block size is kept in a control block (just a structure saved ; in a separate file, so changing this value ; at runtime before creating a file is perfectly legal. _RND_BLOCKSIZE: defw 1000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Define Memory Banks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IFNDEF CRT_ORG_BANK_0 defc CRT_ORG_BANK_0 = 0xc000 ENDIF IFNDEF CRT_ORG_BANK_1 defc CRT_ORG_BANK_1 = 0xc000 ENDIF IFNDEF CRT_ORG_BANK_2 defc CRT_ORG_BANK_2 = 0xc000 ENDIF IFNDEF CRT_ORG_BANK_3 defc CRT_ORG_BANK_3 = 0xc000 ENDIF IFNDEF CRT_ORG_BANK_4 defc CRT_ORG_BANK_4 = 0xc000 ENDIF IFNDEF CRT_ORG_BANK_5 defc CRT_ORG_BANK_5 = 0xc000 ENDIF IFNDEF CRT_ORG_BANK_6 defc CRT_ORG_BANK_6 = 0xc000 ENDIF IFNDEF CRT_ORG_BANK_7 defc CRT_ORG_BANK_7 = 0xc000 ENDIF SECTION BANK_0 org CRT_ORG_BANK_0 SECTION BANK_1 org CRT_ORG_BANK_1 SECTION BANK_2 org CRT_ORG_BANK_2 SECTION BANK_3 org CRT_ORG_BANK_3 SECTION BANK_4 org CRT_ORG_BANK_4 SECTION BANK_5 org CRT_ORG_BANK_5 SECTION BANK_6 org CRT_ORG_BANK_6 SECTION BANK_7 org CRT_ORG_BANK_7
; 0107 - STX Absolute .segment "VECTORS" .word $eaea .word init .word $eaea .code init: stx $4000 ; Positive number, X will be $42. stx $4000 ; Zero, X will be $00. stx $4000 ; Negative number, X will be %10010101.
; A022267: a(n) = n*(9*n + 1)/2. ; 0,5,19,42,74,115,165,224,292,369,455,550,654,767,889,1020,1160,1309,1467,1634,1810,1995,2189,2392,2604,2825,3055,3294,3542,3799,4065,4340,4624,4917,5219,5530,5850,6179,6517,6864,7220,7585,7959,8342,8734,9135,9545,9964,10392,10829,11275,11730,12194,12667,13149,13640,14140,14649,15167,15694,16230,16775,17329,17892,18464,19045,19635,20234,20842,21459,22085,22720,23364,24017,24679,25350,26030,26719,27417,28124,28840,29565,30299,31042,31794,32555,33325,34104,34892,35689,36495,37310,38134,38967,39809,40660,41520,42389,43267,44154 mul $0,-9 bin $0,2 div $0,9
_MuseumChallenge:: text "MOON STONE?" para "I gotta steal-" line "!" para "You didn't hear" line "that, right?" para "I'm just an" line "ordinary citizen!" done _MuseumPre:: text "You'll regret that!" line "I'm calling backup!" done _MuseumDefeat:: text "Buzz off!" done _MuseumVictory:: text "I give!" done _MuseumBye:: text "I'll be good! I" line "wasted my money..." done _Museum2FText2:: text "July 20, 1969!" para "The 1st lunar" line "landing!" para "I bought a color" line "TV to watch it!" done _Museum2FText3:: text "We have a space" line "exhibit now." done _Museum2FText4:: text "I want a PIKACHU!" line "It's so cute!" para "I asked my Daddy" line "to catch me one!" done _Museum2FText5:: text "Yeah, a PIKACHU" line "soon, I promise!" done _Museum2FPikachuText1:: text "Your PKMN looks" line "untamed." cont "May I have it for" cont "my daughter?" done _Museum2FPikachuText2:: text "I'd like to get" line "that PKMN off" cont "you, but it's too" cont "attached to you." done _Museum2FText6:: text "SPACE SHUTTLE" line "COLUMBIA" done _Museum2FText7:: text "Meteorite that" line "fell on MT.MOON." cont "(MOON STONE?)" done
; ::: include #subruledef inner { a => 0x11 b => 0x22 c.w => 0x33 } #ruledef test { ld {reg: inner}, {x} => 0x55 @ reg`8 @ x`8 } ; ::: ld a, 0xaa ; = 0x5511aa ; ::: ld b, 0xaa ; = 0x5522aa ; ::: ld c.w, 0xaa ; = 0x5533aa ; ::: ld ; error: no match ; ::: ld 0xaa; error: no match ; ::: ld a; error: no match ; ::: ld a 0xaa; error: no match ; ::: ld c, 0xaa ; error: no match ; ::: ld a, x ; error: unknown ; =========== ; ::: include ; ::: #subruledef inner { a => 0x11 } #ruledef test { ld {reg: unk} => 0x55 @ reg`8 ; error: unknown }
//============================================================================ // Copyright 2017 ECMWF. // This software is licensed under the terms of the Apache Licence version 2.0 // which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. // In applying this licence, ECMWF does not waive the privileges and immunities // granted to it by virtue of its status as an intergovernmental organisation // nor does it submit to any jurisdiction. // //============================================================================ #ifndef VLABEL_HPP #define VLABEL_HPP #include "VAttribute.hpp" #include "VAttributeType.hpp" #include <QStringList> #include <string> #include <vector> class AttributeFilter; class VAttributeType; class VNode; class Label; class VLabelAttrType : public VAttributeType { public: explicit VLabelAttrType(); QString toolTip(QStringList d) const override; QString definition(QStringList d) const override; void encode(const Label& label,QStringList& data,bool firstLine) const; void encode_empty(QStringList& data) const; private: enum DataIndex {TypeIndex=0,NameIndex=1,ValueIndex=2}; }; class VLabelAttr : public VAttribute { public: VLabelAttr(VNode *parent,const Label&,int index); int lineNum() const override; VAttributeType* type() const override; QStringList data(bool firstLine) const override; std::string strName() const override; static void scan(VNode* vnode,std::vector<VAttribute*>& vec); }; #endif // VLABEL_HPP
; double hypot(double x, double y) SECTION code_fp_math48 PUBLIC am48_hypot EXTERN am48_fabs, am48_dequate, am48_dmul, am48_dadd, am48_sqrt am48_hypot: ; compute hypotenuse sqrt(x^2+y^2) ; ; enter : AC = double x ; AC' = double y ; ; exit : success ; ; AC' = sqrt(x^2+y^2) ; carry reset ; ; fail if overflow ; ; AC' = +inf ; carry set, errno set ; ; uses : af, bc, de, hl, af', bc', de', hl' ; zero has special encoding ld a,l or a jp z, am48_fabs ; if x == 0 return |y| exx ld a,l or a jp z, am48_fabs ; if y == 0 return |x| ; compare magnitudes exx sub l ; a = exponent difference jp p, cmp_mag ; if AC' has larger magnitude neg exx cmp_mag: ; AC'= largest magnitude x ; AC = y ; a = |exp diff| cp 21 jp nc, am48_fabs ; if |y| << |x| return |x| push bc ; save y push de push hl exx call am48_dequate call am48_dmul ; AC'= x^2 pop hl ; AC = y pop de pop bc ret c ; if overflow exx push bc ; save x^2 push de push hl exx call am48_dequate call am48_dmul ; AC'= y^2 pop hl ; AC = x^2 pop de pop bc call am48_dadd ; AC = x^2 + y^2 ret c ; if overflow jp am48_sqrt
/* Copyright (c) 2006-2014, Arvid Norberg & Daniel Wallin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <libtorrent/kademlia/refresh.hpp> #include <libtorrent/kademlia/rpc_manager.hpp> #include <libtorrent/kademlia/node.hpp> #include <libtorrent/performance_counters.hpp> #include <libtorrent/io.hpp> namespace libtorrent { namespace dht { #ifdef TORRENT_DHT_VERBOSE_LOGGING TORRENT_DECLARE_LOG(traversal); #endif observer_ptr bootstrap::new_observer(void* ptr , udp::endpoint const& ep, node_id const& id) { observer_ptr o(new (ptr) get_peers_observer(this, ep, id)); #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS o->m_in_constructor = false; #endif return o; } bool bootstrap::invoke(observer_ptr o) { entry e; e["y"] = "q"; entry& a = e["a"]; e["q"] = "get_peers"; a["info_hash"] = target().to_string(); // e["q"] = "find_node"; // a["target"] = target().to_string(); m_node.stats_counters().inc_stats_counter(counters::dht_find_node_out); return m_node.m_rpc.invoke(e, o->target_ep(), o); } bootstrap::bootstrap( node_impl& node , node_id target , done_callback const& callback) : get_peers(node, target, get_peers::data_callback(), callback, false) { } char const* bootstrap::name() const { return "bootstrap"; } void bootstrap::trim_seed_nodes() { // when we're bootstrapping, we want to start as far away from our ID as // possible, to cover as much as possible of the ID space. So, remove all // nodes except for the 32 that are farthest away from us if (m_results.size() > 32) m_results.erase(m_results.begin(), m_results.end() - 32); } void bootstrap::done() { #ifdef TORRENT_DHT_VERBOSE_LOGGING TORRENT_LOG(traversal) << "[" << this << "]" << " bootstrap done, pinging remaining nodes"; #endif for (std::vector<observer_ptr>::iterator i = m_results.begin() , end(m_results.end()); i != end; ++i) { if ((*i)->flags & observer::flag_queried) continue; // this will send a ping m_node.add_node((*i)->target_ep()); } get_peers::done(); } } } // namespace libtorrent::dht
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.0.0 #11528 (Linux) ;-------------------------------------------------------- ; Processed by Z88DK ;-------------------------------------------------------- EXTERN __divschar EXTERN __divschar_callee EXTERN __divsint EXTERN __divsint_callee EXTERN __divslong EXTERN __divslong_callee EXTERN __divslonglong EXTERN __divslonglong_callee EXTERN __divsuchar EXTERN __divsuchar_callee EXTERN __divuchar EXTERN __divuchar_callee EXTERN __divuint EXTERN __divuint_callee EXTERN __divulong EXTERN __divulong_callee EXTERN __divulonglong EXTERN __divulonglong_callee EXTERN __divuschar EXTERN __divuschar_callee EXTERN __modschar EXTERN __modschar_callee EXTERN __modsint EXTERN __modsint_callee EXTERN __modslong EXTERN __modslong_callee EXTERN __modslonglong EXTERN __modslonglong_callee EXTERN __modsuchar EXTERN __modsuchar_callee EXTERN __moduchar EXTERN __moduchar_callee EXTERN __moduint EXTERN __moduint_callee EXTERN __modulong EXTERN __modulong_callee EXTERN __modulonglong EXTERN __modulonglong_callee EXTERN __moduschar EXTERN __moduschar_callee EXTERN __mulint EXTERN __mulint_callee EXTERN __mullong EXTERN __mullong_callee EXTERN __mullonglong EXTERN __mullonglong_callee EXTERN __mulschar EXTERN __mulschar_callee EXTERN __mulsuchar EXTERN __mulsuchar_callee EXTERN __muluschar EXTERN __muluschar_callee EXTERN __rlslonglong EXTERN __rlslonglong_callee EXTERN __rlulonglong EXTERN __rlulonglong_callee EXTERN __rrslonglong EXTERN __rrslonglong_callee EXTERN __rrulonglong EXTERN __rrulonglong_callee EXTERN ___sdcc_call_hl EXTERN ___sdcc_call_iy EXTERN ___sdcc_enter_ix EXTERN _banked_call EXTERN _banked_ret EXTERN ___fs2schar EXTERN ___fs2schar_callee EXTERN ___fs2sint EXTERN ___fs2sint_callee EXTERN ___fs2slong EXTERN ___fs2slong_callee EXTERN ___fs2slonglong EXTERN ___fs2slonglong_callee EXTERN ___fs2uchar EXTERN ___fs2uchar_callee EXTERN ___fs2uint EXTERN ___fs2uint_callee EXTERN ___fs2ulong EXTERN ___fs2ulong_callee EXTERN ___fs2ulonglong EXTERN ___fs2ulonglong_callee EXTERN ___fsadd EXTERN ___fsadd_callee EXTERN ___fsdiv EXTERN ___fsdiv_callee EXTERN ___fseq EXTERN ___fseq_callee EXTERN ___fsgt EXTERN ___fsgt_callee EXTERN ___fslt EXTERN ___fslt_callee EXTERN ___fsmul EXTERN ___fsmul_callee EXTERN ___fsneq EXTERN ___fsneq_callee EXTERN ___fssub EXTERN ___fssub_callee EXTERN ___schar2fs EXTERN ___schar2fs_callee EXTERN ___sint2fs EXTERN ___sint2fs_callee EXTERN ___slong2fs EXTERN ___slong2fs_callee EXTERN ___slonglong2fs EXTERN ___slonglong2fs_callee EXTERN ___uchar2fs EXTERN ___uchar2fs_callee EXTERN ___uint2fs EXTERN ___uint2fs_callee EXTERN ___ulong2fs EXTERN ___ulong2fs_callee EXTERN ___ulonglong2fs EXTERN ___ulonglong2fs_callee EXTERN ____sdcc_2_copy_src_mhl_dst_deix EXTERN ____sdcc_2_copy_src_mhl_dst_bcix EXTERN ____sdcc_4_copy_src_mhl_dst_deix EXTERN ____sdcc_4_copy_src_mhl_dst_bcix EXTERN ____sdcc_4_copy_src_mhl_dst_mbc EXTERN ____sdcc_4_ldi_nosave_bc EXTERN ____sdcc_4_ldi_save_bc EXTERN ____sdcc_4_push_hlix EXTERN ____sdcc_4_push_mhl EXTERN ____sdcc_lib_setmem_hl EXTERN ____sdcc_ll_add_de_bc_hl EXTERN ____sdcc_ll_add_de_bc_hlix EXTERN ____sdcc_ll_add_de_hlix_bc EXTERN ____sdcc_ll_add_de_hlix_bcix EXTERN ____sdcc_ll_add_deix_bc_hl EXTERN ____sdcc_ll_add_deix_hlix EXTERN ____sdcc_ll_add_hlix_bc_deix EXTERN ____sdcc_ll_add_hlix_deix_bc EXTERN ____sdcc_ll_add_hlix_deix_bcix EXTERN ____sdcc_ll_asr_hlix_a EXTERN ____sdcc_ll_asr_mbc_a EXTERN ____sdcc_ll_copy_src_de_dst_hlix EXTERN ____sdcc_ll_copy_src_de_dst_hlsp EXTERN ____sdcc_ll_copy_src_deix_dst_hl EXTERN ____sdcc_ll_copy_src_deix_dst_hlix EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp EXTERN ____sdcc_ll_copy_src_hl_dst_de EXTERN ____sdcc_ll_copy_src_hlsp_dst_de EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm EXTERN ____sdcc_ll_lsl_hlix_a EXTERN ____sdcc_ll_lsl_mbc_a EXTERN ____sdcc_ll_lsr_hlix_a EXTERN ____sdcc_ll_lsr_mbc_a EXTERN ____sdcc_ll_push_hlix EXTERN ____sdcc_ll_push_mhl EXTERN ____sdcc_ll_sub_de_bc_hl EXTERN ____sdcc_ll_sub_de_bc_hlix EXTERN ____sdcc_ll_sub_de_hlix_bc EXTERN ____sdcc_ll_sub_de_hlix_bcix EXTERN ____sdcc_ll_sub_deix_bc_hl EXTERN ____sdcc_ll_sub_deix_hlix EXTERN ____sdcc_ll_sub_hlix_bc_deix EXTERN ____sdcc_ll_sub_hlix_deix_bc EXTERN ____sdcc_ll_sub_hlix_deix_bcix EXTERN ____sdcc_load_debc_deix EXTERN ____sdcc_load_dehl_deix EXTERN ____sdcc_load_debc_mhl EXTERN ____sdcc_load_hlde_mhl EXTERN ____sdcc_store_dehl_bcix EXTERN ____sdcc_store_debc_hlix EXTERN ____sdcc_store_debc_mhl EXTERN ____sdcc_cpu_pop_ei EXTERN ____sdcc_cpu_pop_ei_jp EXTERN ____sdcc_cpu_push_di EXTERN ____sdcc_outi EXTERN ____sdcc_outi_128 EXTERN ____sdcc_outi_256 EXTERN ____sdcc_ldi EXTERN ____sdcc_ldi_128 EXTERN ____sdcc_ldi_256 EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_or_src_dehl_dst_bcix EXTERN ____sdcc_4_xor_src_dehl_dst_bcix EXTERN ____sdcc_4_and_src_dehl_dst_bcix EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_cpl_src_mhl_dst_debc EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- GLOBAL _m32_modff ;-------------------------------------------------------- ; Externals used ;-------------------------------------------------------- GLOBAL _m32_polyf GLOBAL _m32_hypotf GLOBAL _m32_ldexpf GLOBAL _m32_frexpf GLOBAL _m32_invsqrtf GLOBAL _m32_sqrtf GLOBAL _m32_invf GLOBAL _m32_sqrf GLOBAL _m32_div2f GLOBAL _m32_mul2f GLOBAL _m32_fmodf GLOBAL _m32_roundf GLOBAL _m32_floorf GLOBAL _m32_fabsf GLOBAL _m32_ceilf GLOBAL _m32_powf GLOBAL _m32_log10f GLOBAL _m32_log2f GLOBAL _m32_logf GLOBAL _m32_exp10f GLOBAL _m32_exp2f GLOBAL _m32_expf GLOBAL _m32_atanhf GLOBAL _m32_acoshf GLOBAL _m32_asinhf GLOBAL _m32_tanhf GLOBAL _m32_coshf GLOBAL _m32_sinhf GLOBAL _m32_atan2f GLOBAL _m32_atanf GLOBAL _m32_acosf GLOBAL _m32_asinf GLOBAL _m32_tanf GLOBAL _m32_cosf GLOBAL _m32_sinf GLOBAL __MAX_OPEN ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- SECTION bss_compiler ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- IF 0 ; .area _INITIALIZED removed by z88dk ENDIF ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- SECTION IGNORE ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- SECTION code_crt_init ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- SECTION IGNORE ;-------------------------------------------------------- ; code ;-------------------------------------------------------- SECTION code_compiler ; --------------------------------- ; Function m32_modff ; --------------------------------- _m32_modff: push ix ld ix,0 add ix,sp ld l,(ix+8) ld h,(ix+9) push hl ld l,(ix+6) ld h,(ix+7) push hl ld l,(ix+4) ld h,(ix+5) push hl call ___fs2slong_callee push de push hl call ___slong2fs_callee ld c, l ld b, h pop hl push hl ld (hl), c inc hl ld (hl), b inc hl ld (hl), e inc hl ld (hl), d push de push bc ld l,(ix+6) ld h,(ix+7) push hl ld l,(ix+4) ld h,(ix+5) push hl call ___fssub ld sp,ix pop ix ret SECTION IGNORE
; A173191: a(n) = binomial(n + 6, 6)*9^n. ; 1,63,2268,61236,1377810,27280638,491051484,8207574804,129269303163,1939039547445,27922169483208,388371993720984,5243021915233284,68965903654222428,886704475554288360,11172476391984033336,138259395350802412533,1683511461036241140843,20202137532434893690116,239235839199886898961900,2799059318638676717854230,32389114972818973449456090,371002589688653695875587940,4210072865597331070588193580,47363319737969974544117177775,528574648275744915912347703969,5854980719362097530106005336272 mov $1,9 pow $1,$0 mov $2,$0 add $2,6 bin $2,$0 mul $1,$2 mov $0,$1
; A046992: a(n) = Sum_{k=1..n} pi(k) (cf. A000720). ; 0,1,3,5,8,11,15,19,23,27,32,37,43,49,55,61,68,75,83,91,99,107,116,125,134,143,152,161,171,181,192,203,214,225,236,247,259,271,283,295,308,321,335,349,363,377,392,407,422,437,452,467,483,499,515,531,547,563,580,597,615,633,651,669,687,705,724,743,762,781,801,821,842,863,884,905,926,947,969,991,1013,1035,1058,1081,1104,1127,1150,1173,1197,1221,1245,1269,1293,1317,1341,1365,1390,1415,1440,1465 lpb $0 mov $2,$0 sub $0,1 seq $2,720 ; pi(n), the number of primes <= n. Sometimes called PrimePi(n) to distinguish it from the number 3.14159... add $1,$2 lpe mov $0,$1
; A173781: a(n) is the smallest entry of the n-th column of the matrix of Super Catalan numbers S(m,n). ; Submitted by Jon Maiga ; 1,2,4,10,28,72,198,572,1560,4420,12920,36176,104006,305900,869400,2521260,7443720,21360240,62300700,184410072,532740208,1560167752,4626704368,13432367520,39457579590,117177054540,341487416088,1005490725148,2989296750440,8737944347440,25776935824948,76702101723016,224754995746512,664048851069240,1977389912072848,5805953358852192,17175945353271068,51177306562807672,150521489890610800,445775181599116600,1328914692314347600,3914257820998623840,11602978540817349240,34605374595420164400 mov $1,672 mov $3,$0 mov $4,1 lpb $3 mul $1,$4 mul $1,2 div $2,-2 add $2,$4 div $1,$2 sub $3,1 add $4,2 lpe mov $0,$1 div $0,672
; A041057: Denominators of continued fraction convergents to sqrt(34). ; Submitted by Christian Krause ; 1,1,5,6,65,71,349,420,4549,4969,24425,29394,318365,347759,1709401,2057160,22281001,24338161,119633645,143971806,1559351705,1703323511,8372645749,10075969260,109132338349,119208307609,585965568785,705173876394,7637704332725,8342878209119,41009217169201,49352095378320,534530170952401,583882266330721,2870059236275285,3453941502606006,37409474262335345,40863415764941351,200863137322100749,241726553087042100,2618128668192521749,2859855221279563849,14057549553310777145,16917404774590340994 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 dif $2,3 mod $2,$1 mul $2,9 add $3,$1 add $3,$2 mov $2,$1 lpe dif $2,2 mov $0,$2
; A217693: Numbers of distinct integers obtained from summing up subsets of {1, 1/2, 1/3, ..., 1/n}. ; 1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 lpb $0,1 sub $0,1 add $1,9 mov $2,1 add $3,$1 sub $2,$3 add $0,$2 lpe div $1,9 add $1,1
; $Id: bit_fx_mwr.asm,v 1.4 2016-04-23 21:06:32 dom Exp $ ; ; 1 bit sound library - version for "memory write" I/O architectures ; sound effects module. ; ; Original code by Dominic Morris ; Adapted by Stefano Bodrato ; SECTION code_clib PUBLIC bit_fx PUBLIC _bit_fx INCLUDE "games/games.inc" EXTERN beeper EXTERN bit_open EXTERN bit_open_di EXTERN bit_close EXTERN bit_close_ei ;Sound routine..enter in with e holding the desired effect! .bit_fx ._bit_fx pop bc pop de push de push bc ld a,e cp 8 ret nc add a,a ld e,a ld d,0 ld hl,table add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a jp (hl) .table defw fx2 ; effect #0 defw fx5 defw fx6 defw zap0 defw zap1 defw clackson defw zap3 defw warpcall ; effect #7 ;Strange squeak hl=300,de=2 ;Game up hl=300,de=10 inc de ;-like a PACMAN sound .fx6 ld b,1 .fx6_1 push bc ld hl,300 ld de,10 .fx6_2 push hl push de call beeper pop de pop hl ; inc de ;if added in makes different sound.. ld bc,10 and a sbc hl,bc jr nc,fx6_2 pop bc djnz fx6_1 ret ;Use during key defines? .fx2 call bit_open_di ld e,150 .fx2_1 ld (sndbit_port),a xor sndbit_mask ld b,e .fx2_2 djnz fx2_2 inc e jr nz,fx2_1 call bit_close_ei ret ;Laser repeat sound .fx5 ld b,1 .fx5_1 push bc ld hl,1200 ld de,6 .fx5_2 push hl push de call beeper pop de pop hl ld bc,100 and a sbc hl,bc jr nc,fx5_2 pop bc djnz fx5_1 ret ;Eating sound .zap0 call bit_open_di ld h,4 .zap0_1 ld b,(hl) dec hl .zap0_2 djnz zap0_2 ld (sndbit_port),a xor sndbit_mask ex af,af ld a,h or l jr z,zap0_3 ex af,af jr zap0_1 .zap0_3 call bit_close_ei ret ;Clackson sound .clackson call bit_open_di .clackson_LENGHT ld b,90 ;ld c,sndbit_port .clackson_loop dec h jr nz,clackson_jump xor sndbit_mask ld (sndbit_port),a .clackson_FR_1 ld h,230 .clackson_jump dec l jr nz,clackson_loop xor sndbit_mask ld (sndbit_port),a .clackson_FR_2 ld l,255 djnz clackson_loop call bit_close_ei ret ;Beep thing .zap3 call bit_open_di .zap3_1 push bc xor sndbit_mask ld (sndbit_port),a push af xor a sub b ld b,a pop af .zap3_2 nop djnz zap3_2 xor sndbit_mask ld (sndbit_port),a pop bc push bc .zap3_3 nop djnz zap3_3 pop bc djnz zap3_1 call bit_close_ei ret ;Sound for warp .warpcall ld hl,1600 ld (warps+1),hl ld hl,-800 ld (warps1+1),hl ld hl,-100 ld (warps2+1),hl ld b,20 .warpcall1 push bc call warps pop bc djnz warpcall1 ret .warps ld hl,1600 ld de,6 call beeper .warps1 ld hl,-800 .warps2 ld de,-100 and a sbc hl,de ld (warps1+1),hl jr nz,warps3 ld de,100 ld (warps2+1),de .warps3 ex de,hl ld hl,1600 add hl,de ld (warps+1),hl ret ;Our old squelch... .zap1 call bit_open ld b,0 .zap1_1 push bc xor sndbit_mask ;oscillate between high and low bits... ld (sndbit_port),a .zap1_2 nop nop djnz zap1_2 pop bc djnz zap1_1 jp bit_close
;---------------------------------------------------------------------- ; Nach: http://en.wikipedia.org/wiki/Assembly_language#Example_listing_of_assembly_language_source_code ; zstr_count: ; Speichere die Länge eines Strings, der sich an Adresse 'eax' ; befindet, in Register ecx. Der String muss mit einem Nullbyte ; abschließen. ; ; Wir haben vier Multi-Purpose-Register: ; [Stringadresse|egal|Rückgabewert|egal] ; eax ebx ecx edx ; ; Memory-Layout an der Stringadresse: ; ; [ 'H' 'A' 'L' 'L' 'O' 0 ] ; eax eax+1 eax+2 eax+3 eax+4 eax+5 zstr_count: mov ecx, -1 ; initialisiere den Zähler auf -1 .loop: ; <--------------- ; | inc ecx ; erhöhe den Zähler um 1 (increment) | ; | cmp byte [eax + ecx], 0 ; prüfe, ob wir am Ende des Strings | ; (Nullbyte) sind (die eckige Klammer | ; inspiziert eine Adresse) | ; | jne .loop ; wiederhole Schleifendurchlauf, wenn wir | ; noch nicht beim Nullbyte sind | ; ---------------- .done: ret ; Die Länge des Strings liegt in ecx, ; wir geben zurück ans Hauptprogramm
DEVICE ZXSPECTRUM48 speed: EQU $00ff start: EQU $8000 DISPLAY_FILE: EQU $4000 ORG start ld hl,DISPLAY_FILE ; point to the beginning of DISPLAY_FILE (screen) ld (hl),$80 ; draw pixel on screen move: ld a,(hl) ; load current pixel into A scf ; set the carry flag (to do shift right with carry) rra ; rotate right pulling the carry bit in jr c,next_pixel ; if we shifted a bit out, then we're done ld (hl),a ; draw jr move next_pixel: inc l ld a, $20 and l jr z, .skip ld l,0 inc h .skip: ld (hl),$80 jr move wait: ld bc, speed .loop: dec bc ld a,b or c jr nz, .loop jr move fin: jr $ ; loop forever SAVESNA "fill-screen.sna", start
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "extensions/browser/guest_view/web_view/web_view_apitest.h" #include "base/command_line.h" #include "base/path_service.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_renderer_host.h" #include "content/public/test/test_utils.h" #include "extensions/browser/api/test/test_api.h" #include "extensions/browser/app_window/app_window.h" #include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/guest_view/guest_view_manager.h" #include "extensions/browser/guest_view/guest_view_manager_factory.h" #include "extensions/browser/guest_view/test_guest_view_manager.h" #include "extensions/browser/process_manager.h" #include "extensions/common/extension.h" #include "extensions/common/extension_paths.h" #include "extensions/shell/browser/shell_content_browser_client.h" #include "extensions/shell/browser/shell_extension_system.h" #include "extensions/shell/test/shell_test.h" #include "extensions/test/extension_test_message_listener.h" #include "net/base/filename_util.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" #include "ui/gfx/switches.h" namespace { const char kEmptyResponsePath[] = "/close-socket"; const char kRedirectResponsePath[] = "/server-redirect"; const char kRedirectResponseFullPath[] = "/guest_redirect.html"; const char kUserAgentRedirectResponsePath[] = "/detect-user-agent"; const char kTestDataDirectory[] = "testDataDirectory"; const char kTestServerPort[] = "testServer.port"; const char kTestWebSocketPort[] = "testWebSocketPort"; class EmptyHttpResponse : public net::test_server::HttpResponse { public: std::string ToResponseString() const override { return std::string(); } }; // Handles |request| by serving a redirect response if the |User-Agent| is // foobar. static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler( const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { if (!StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); std::map<std::string, std::string>::const_iterator it = request.headers.find("User-Agent"); EXPECT_TRUE(it != request.headers.end()); if (!StartsWithASCII("foobar", it->second, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_MOVED_PERMANENTLY); http_response->AddCustomHeader("Location", redirect_target.spec()); return http_response.Pass(); } class WebContentsHiddenObserver : public content::WebContentsObserver { public: WebContentsHiddenObserver(content::WebContents* web_contents, const base::Closure& hidden_callback) : WebContentsObserver(web_contents), hidden_callback_(hidden_callback), hidden_observed_(false) { } // WebContentsObserver. void WasHidden() override { hidden_observed_ = true; hidden_callback_.Run(); } bool hidden_observed() { return hidden_observed_; } private: base::Closure hidden_callback_; bool hidden_observed_; DISALLOW_COPY_AND_ASSIGN(WebContentsHiddenObserver); }; // Handles |request| by serving a redirect response. scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { if (!StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_MOVED_PERMANENTLY); http_response->AddCustomHeader("Location", redirect_target.spec()); return http_response.Pass(); } // Handles |request| by serving an empty response. scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler( const std::string& path, const net::test_server::HttpRequest& request) { if (StartsWithASCII(path, request.relative_url, true)) { return scoped_ptr<net::test_server::HttpResponse>(new EmptyHttpResponse); } return scoped_ptr<net::test_server::HttpResponse>(); } } // namespace namespace extensions { WebViewAPITest::WebViewAPITest() { GuestViewManager::set_factory_for_testing(&factory_); } void WebViewAPITest::LaunchApp(const std::string& app_location) { base::FilePath test_data_dir; PathService::Get(DIR_TEST_DATA, &test_data_dir); test_data_dir = test_data_dir.AppendASCII(app_location.c_str()); test_config_.SetString(kTestDataDirectory, net::FilePathToFileURL(test_data_dir).spec()); embedded_test_server()->ServeFilesFromDirectory(test_data_dir); const Extension* extension = extension_system_->LoadApp(test_data_dir); ASSERT_TRUE(extension); extension_system_->LaunchApp(extension->id()); ExtensionTestMessageListener launch_listener("LAUNCHED", false); launch_listener.set_failure_message("FAILURE"); ASSERT_TRUE(launch_listener.WaitUntilSatisfied()); embedder_web_contents_ = GetFirstAppWindowWebContents(); } content::WebContents* WebViewAPITest::GetFirstAppWindowWebContents() { const AppWindowRegistry::AppWindowList& app_window_list = AppWindowRegistry::Get(browser_context_)->app_windows(); DCHECK(app_window_list.size() == 1); return (*app_window_list.begin())->web_contents(); } void WebViewAPITest::RunTest(const std::string& test_name, const std::string& app_location) { LaunchApp(app_location); ExtensionTestMessageListener done_listener("TEST_PASSED", false); done_listener.set_failure_message("TEST_FAILED"); ASSERT_TRUE(content::ExecuteScript( embedder_web_contents_, base::StringPrintf("runTest('%s')", test_name.c_str()))) << "Unable to start test."; ASSERT_TRUE(done_listener.WaitUntilSatisfied()); } void WebViewAPITest::RunTestOnMainThreadLoop() { AppShellTest::RunTestOnMainThreadLoop(); GetGuestViewManager()->WaitForAllGuestsDeleted(); } void WebViewAPITest::SetUpCommandLine(base::CommandLine* command_line) { AppShellTest::SetUpCommandLine(command_line); command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); } void WebViewAPITest::SetUpOnMainThread() { AppShellTest::SetUpOnMainThread(); TestGetConfigFunction::set_test_config_state(&test_config_); base::FilePath test_data_dir; test_config_.SetInteger(kTestWebSocketPort, 0); } void WebViewAPITest::StartTestServer() { // For serving guest pages. if (!embedded_test_server()->InitializeAndWaitUntilReady()) { LOG(ERROR) << "Failed to start test server."; return; } test_config_.SetInteger(kTestServerPort, embedded_test_server()->port()); embedded_test_server()->RegisterRequestHandler( base::Bind(&RedirectResponseHandler, kRedirectResponsePath, embedded_test_server()->GetURL(kRedirectResponseFullPath))); embedded_test_server()->RegisterRequestHandler( base::Bind(&EmptyResponseHandler, kEmptyResponsePath)); embedded_test_server()->RegisterRequestHandler( base::Bind( &UserAgentResponseHandler, kUserAgentRedirectResponsePath, embedded_test_server()->GetURL(kRedirectResponseFullPath))); } void WebViewAPITest::StopTestServer() { if (!embedded_test_server()->ShutdownAndWaitUntilComplete()) { LOG(ERROR) << "Failed to shutdown test server."; } } void WebViewAPITest::TearDownOnMainThread() { TestGetConfigFunction::set_test_config_state(nullptr); AppShellTest::TearDownOnMainThread(); } void WebViewAPITest::SendMessageToEmbedder(const std::string& message) { EXPECT_TRUE( content::ExecuteScript( GetEmbedderWebContents(), base::StringPrintf("onAppCommand('%s');", message.c_str()))); } content::WebContents* WebViewAPITest::GetEmbedderWebContents() { if (!embedder_web_contents_) embedder_web_contents_ = GetFirstAppWindowWebContents(); return embedder_web_contents_; } TestGuestViewManager* WebViewAPITest::GetGuestViewManager() { return static_cast<TestGuestViewManager*>( TestGuestViewManager::FromBrowserContext( ShellContentBrowserClient::Get()->GetBrowserContext())); } void WebViewAPITest::SendMessageToGuestAndWait( const std::string& message, const std::string& wait_message) { scoped_ptr<ExtensionTestMessageListener> listener; if (!wait_message.empty()) listener.reset(new ExtensionTestMessageListener(wait_message, false)); EXPECT_TRUE( content::ExecuteScript( GetGuestWebContents(), base::StringPrintf("onAppCommand('%s');", message.c_str()))); if (listener) ASSERT_TRUE(listener->WaitUntilSatisfied()); } void WebViewDPIAPITest::SetUp() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, base::StringPrintf("%f", scale())); WebViewAPITest::SetUp(); } content::WebContents* WebViewAPITest::GetGuestWebContents() { return GetGuestViewManager()->WaitForSingleGuestCreated(); } // Occasionally hits NOTIMPLEMENTED on Linux. https://crbug.com/422998 #if defined(OS_LINUX) #define MAYBE_AcceptTouchEvents DISABLED_AcceptTouchEvents #else #define MAYBE_AcceptTouchEvents AcceptTouchEvents #endif IN_PROC_BROWSER_TEST_F(WebViewAPITest, MAYBE_AcceptTouchEvents) { LaunchApp("web_view/accept_touch_events"); content::RenderViewHost* embedder_rvh = GetEmbedderWebContents()->GetRenderViewHost(); bool embedder_has_touch_handler = content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh); EXPECT_FALSE(embedder_has_touch_handler); SendMessageToGuestAndWait("install-touch-handler", "installed-touch-handler"); // Note that we need to wait for the installed/registered touch handler to // appear in browser process before querying |embedder_rvh|. // In practice, since we do a roundrtip from browser process to guest and // back, this is sufficient. embedder_has_touch_handler = content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh); EXPECT_TRUE(embedder_has_touch_handler); SendMessageToGuestAndWait("uninstall-touch-handler", "uninstalled-touch-handler"); // Same as the note above about waiting. embedder_has_touch_handler = content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh); EXPECT_FALSE(embedder_has_touch_handler); } // This test verifies that hiding the embedder also hides the guest. IN_PROC_BROWSER_TEST_F(WebViewAPITest, EmbedderVisibilityChanged) { LaunchApp("web_view/visibility_changed"); scoped_refptr<content::MessageLoopRunner> loop_runner( new content::MessageLoopRunner); WebContentsHiddenObserver observer(GetGuestWebContents(), loop_runner->QuitClosure()); // Handled in web_view/visibility_changed/main.js SendMessageToEmbedder("hide-embedder"); if (!observer.hidden_observed()) loop_runner->Run(); } // Test for http://crbug.com/419611. IN_PROC_BROWSER_TEST_F(WebViewAPITest, DisplayNoneSetSrc) { LaunchApp("web_view/display_none_set_src"); // Navigate the guest while it's in "display: none" state. SendMessageToEmbedder("navigate-guest"); GetGuestViewManager()->WaitForSingleGuestCreated(); // Now attempt to navigate the guest again. SendMessageToEmbedder("navigate-guest"); ExtensionTestMessageListener test_passed_listener("WebViewTest.PASSED", false); // Making the guest visible would trigger loadstop. SendMessageToEmbedder("show-guest"); EXPECT_TRUE(test_passed_listener.WaitUntilSatisfied()); } // This test verifies that hiding the guest triggers WebContents::WasHidden(). IN_PROC_BROWSER_TEST_F(WebViewAPITest, GuestVisibilityChanged) { LaunchApp("web_view/visibility_changed"); scoped_refptr<content::MessageLoopRunner> loop_runner( new content::MessageLoopRunner); WebContentsHiddenObserver observer(GetGuestWebContents(), loop_runner->QuitClosure()); // Handled in web_view/visibility_changed/main.js SendMessageToEmbedder("hide-guest"); if (!observer.hidden_observed()) loop_runner->Run(); } // This test ensures that closing app window on 'loadcommit' does not crash. // The test launches an app with guest and closes the window on loadcommit. It // then launches the app window again. The process is repeated 3 times. // http://crbug.com/291278 #if defined(OS_WIN) #define MAYBE_CloseOnLoadcommit DISABLED_CloseOnLoadcommit #else #define MAYBE_CloseOnLoadcommit CloseOnLoadcommit #endif IN_PROC_BROWSER_TEST_F(WebViewAPITest, MAYBE_CloseOnLoadcommit) { LaunchApp("web_view/close_on_loadcommit"); ExtensionTestMessageListener test_done_listener("done-close-on-loadcommit", false); ASSERT_TRUE(test_done_listener.WaitUntilSatisfied()); } // This test verifies that reloading the embedder reloads the guest (and doest // not crash). IN_PROC_BROWSER_TEST_F(WebViewAPITest, ReloadEmbedder) { // Just load a guest from other test, we do not want to add a separate // app for this test. LaunchApp("web_view/visibility_changed"); ExtensionTestMessageListener launched_again_listener("LAUNCHED", false); embedder_web_contents_->GetController().Reload(false); ASSERT_TRUE(launched_again_listener.WaitUntilSatisfied()); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAllowTransparencyAttribute) { RunTest("testAllowTransparencyAttribute", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAPIMethodExistence) { RunTest("testAPIMethodExistence", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAssignSrcAfterCrash) { RunTest("testAssignSrcAfterCrash", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAutosizeAfterNavigation) { RunTest("testAutosizeAfterNavigation", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAutosizeBeforeNavigation) { RunTest("testAutosizeBeforeNavigation", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewDPIAPITest, TestAutosizeBeforeNavigation) { RunTest("testAutosizeBeforeNavigation", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAutosizeHeight) { RunTest("testAutosizeHeight", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewDPIAPITest, TestAutosizeHeight) { RunTest("testAutosizeHeight", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAutosizeRemoveAttributes) { RunTest("testAutosizeRemoveAttributes", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewDPIAPITest, TestAutosizeRemoveAttributes) { RunTest("testAutosizeRemoveAttributes", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAutosizeWithPartialAttributes) { RunTest("testAutosizeWithPartialAttributes", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestCannotMutateEventName) { RunTest("testCannotMutateEventName", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestChromeExtensionRelativePath) { RunTest("testChromeExtensionRelativePath", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestChromeExtensionURL) { RunTest("testChromeExtensionURL", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestContentLoadEvent) { RunTest("testContentLoadEvent", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDeclarativeWebRequestAPI) { StartTestServer(); RunTest("testDeclarativeWebRequestAPI", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDeclarativeWebRequestAPISendMessage) { StartTestServer(); RunTest("testDeclarativeWebRequestAPISendMessage", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDestroyOnEventListener) { RunTest("testDestroyOnEventListener", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogAlert) { RunTest("testDialogAlert", "web_view/dialog"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogConfirm) { RunTest("testDialogConfirm", "web_view/dialog"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogConfirmCancel) { RunTest("testDialogConfirmCancel", "web_view/dialog"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogConfirmDefaultCancel) { RunTest("testDialogConfirmDefaultCancel", "web_view/dialog"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogConfirmDefaultGCCancel) { RunTest("testDialogConfirmDefaultGCCancel", "web_view/dialog"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogPrompt) { RunTest("testDialogPrompt", "web_view/dialog"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDisplayNoneWebviewLoad) { RunTest("testDisplayNoneWebviewLoad", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDisplayNoneWebviewRemoveChild) { RunTest("testDisplayNoneWebviewRemoveChild", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestEventName) { RunTest("testEventName", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestExecuteScript) { RunTest("testExecuteScript", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestExecuteScriptFail) { RunTest("testExecuteScriptFail", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestExecuteScriptIsAbortedWhenWebViewSourceIsChanged) { RunTest("testExecuteScriptIsAbortedWhenWebViewSourceIsChanged", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestFindAPI) { RunTest("testFindAPI", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestFindAPI_findupdate) { RunTest("testFindAPI_findupdate", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestGetProcessId) { RunTest("testGetProcessId", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestHiddenBeforeNavigation) { RunTest("testHiddenBeforeNavigation", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestInlineScriptFromAccessibleResources) { RunTest("testInlineScriptFromAccessibleResources", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestInvalidChromeExtensionURL) { RunTest("testInvalidChromeExtensionURL", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadAbortChromeExtensionURLWrongPartition) { RunTest("testLoadAbortChromeExtensionURLWrongPartition", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadAbortEmptyResponse) { StartTestServer(); RunTest("testLoadAbortEmptyResponse", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadAbortIllegalChromeURL) { RunTest("testLoadAbortIllegalChromeURL", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadAbortIllegalFileURL) { RunTest("testLoadAbortIllegalFileURL", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadAbortIllegalJavaScriptURL) { RunTest("testLoadAbortIllegalJavaScriptURL", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadAbortInvalidNavigation) { RunTest("testLoadAbortInvalidNavigation", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadAbortNonWebSafeScheme) { RunTest("testLoadAbortNonWebSafeScheme", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadProgressEvent) { RunTest("testLoadProgressEvent", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestLoadStartLoadRedirect) { StartTestServer(); RunTest("testLoadStartLoadRedirect", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestNavigateAfterResize) { RunTest("testNavigateAfterResize", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestNavigationToExternalProtocol) { RunTest("testNavigationToExternalProtocol", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestNavOnConsecutiveSrcAttributeChanges) { RunTest("testNavOnConsecutiveSrcAttributeChanges", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestNavOnSrcAttributeChange) { RunTest("testNavOnSrcAttributeChange", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestNewWindow) { StartTestServer(); RunTest("testNewWindow", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestNewWindowNoPreventDefault) { StartTestServer(); RunTest("testNewWindowNoPreventDefault", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestNewWindowNoReferrerLink) { StartTestServer(); RunTest("testNewWindowNoReferrerLink", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestNewWindowTwoListeners) { StartTestServer(); RunTest("testNewWindowTwoListeners", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestOnEventProperty) { RunTest("testOnEventProperties", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestPartitionChangeAfterNavigation) { RunTest("testPartitionChangeAfterNavigation", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestPartitionRemovalAfterNavigationFails) { RunTest("testPartitionRemovalAfterNavigationFails", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestReassignSrcAttribute) { RunTest("testReassignSrcAttribute", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestRemoveWebviewOnExit) { StartTestServer(); // Launch the app and wait until it's ready to load a test. LaunchApp("web_view/apitest"); GURL::Replacements replace_host; replace_host.SetHostStr("localhost"); // Run the test and wait until the guest WebContents is available and has // finished loading. ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); EXPECT_TRUE(content::ExecuteScript(embedder_web_contents_, "runTest('testRemoveWebviewOnExit')")); content::WebContents* guest_web_contents = GetGuestWebContents(); EXPECT_TRUE(guest_web_contents->GetRenderProcessHost()->IsIsolatedGuest()); ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied()); content::WebContentsDestroyedWatcher destroyed_watcher(guest_web_contents); // Tell the embedder to kill the guest. EXPECT_TRUE(content::ExecuteScript(embedder_web_contents_, "removeWebviewOnExitDoCrash()")); // Wait until the guest WebContents is destroyed. destroyed_watcher.Wait(); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestReload) { RunTest("testReload", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestReloadAfterTerminate) { RunTest("testReloadAfterTerminate", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestRemoveSrcAttribute) { RunTest("testRemoveSrcAttribute", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestRemoveWebviewAfterNavigation) { RunTest("testRemoveWebviewAfterNavigation", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestResizeWebviewResizesContent) { RunTest("testResizeWebviewResizesContent", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestTerminateAfterExit) { RunTest("testTerminateAfterExit", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPI) { StartTestServer(); RunTest("testWebRequestAPI", "web_view/apitest"); StopTestServer(); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIWithHeaders) { StartTestServer(); RunTest("testWebRequestAPIWithHeaders", "web_view/apitest"); StopTestServer(); } // Tests the existence of WebRequest API event objects on the request // object, on the webview element, and hanging directly off webview. IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIExistence) { RunTest("testWebRequestAPIExistence", "web_view/apitest"); } IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIGoogleProperty) { RunTest("testWebRequestAPIGoogleProperty", "web_view/apitest"); } // This test verifies that webview.contentWindow works inside an iframe IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebViewInsideFrame) { LaunchApp("web_view/inside_iframe"); } } // namespace extensions
/****************************************************************** * Copyright (C) 2015-2021 Henrik Holmdahl <henrikh.git@gmail.com> ******************************************************************/ .filenamespace Camera // .segment Zeropage "Camera zeropage data" // Sprites with world x <= sprite cull should be culled. zpMinSpriteCullLo: .fill 1,0 zpMinSpriteCullHi: .fill 1,0 // Sprites with world x >= sprite cull should be culled. zpMaxSpriteCullLo: .fill 1,0 zpMaxSpriteCullHi: .fill 1,0 // Add this to a world position to get corresponding screen position. zpWorldToScreenPositionXLo: .fill 1,0 zpWorldToScreenPositionXHi: .fill 1,0 // .segment Code "Camera code" .label kSpriteCullMin = -kSpriteWidth .label kSpriteCullMax = kNumVisibleScreenPixels .macro @CameraPostUpdate() { lda Camera.PositionXLo clc adc #<kSpriteCullMin sta Camera.zpMinSpriteCullLo lda Camera.PositionXHi adc #>kSpriteCullMin bpl SetHi lda #0 // Clamp to 0 if negative. sta Camera.zpMinSpriteCullLo SetHi: sta Camera.zpMinSpriteCullHi lda Camera.PositionXLo clc adc #<kSpriteCullMax sta Camera.zpMaxSpriteCullLo lda Camera.PositionXHi adc #>kSpriteCullMax sta Camera.zpMaxSpriteCullHi lda #<kSpriteStartX sec sbc Camera.PositionXLo sta Camera.zpWorldToScreenPositionXLo lda #>kSpriteStartX sbc Camera.PositionXHi sta Camera.zpWorldToScreenPositionXHi } .enum { kScrollRight=kRight, kScrollStopped=kNone, kScrollLeft=kLeft } // Don't change order! .const kPositionOffset = kNumVisibleScreenPixels / 2 .const kWindowSize = 24 // < 128 // Todo: Remove FineScroll and base everything on PositionX? // Note: Scroll left/right refers to shifting screen columns left/right. Init: { ldx.zp LevelData.zpCurrent lda LevelData.StartPosLo,x sta PositionXLo lda LevelData.StartPosHi,x sta PositionXHi lda LevelData.MaxPosLo,x sta Update.LevelMaxPosLo lda LevelData.MaxPosHi,x sta Update.LevelMaxPosHi // Start stopped. lda #kScrollStopped sta ScrollDirection sta CanUndoShiftLeft // Fine scroll all the way to the right, i.e. first screen column is fully visible. lda #7 sta FineScroll bne UpdatePositionDiv2 // bra } // GetDirection: { lda #kScrollStopped ldx PositionXHi cpx IdealPositionXHi bcc ScrollLeft bne ScrollRight ldx PositionXLo cpx IdealPositionXLo bcc ScrollLeft beq Done ScrollRight:lda #kScrollRight rts ScrollLeft: lda #kScrollLeft Done: rts } // UpdatePositionDiv2: { lda PositionXLo sta PositionXDiv2Lo lda PositionXHi lsr ror PositionXDiv2Lo sta PositionXDiv2Hi rts } // IncreasePosition: { // Increase position (in pixels). inc PositionXLo bne UpdatePositionDiv2 inc PositionXHi bne UpdatePositionDiv2 // bra } // DecreasePosition: { // Decrease position (in pixels). lda #$ff dcp PositionXLo bne UpdatePositionDiv2 dec PositionXHi jmp UpdatePositionDiv2 } // Update: { // Update ideal position of left side of screen // to keep player at center of screen. lda Player.PositionLo sec sbc #<kPositionOffset tax lda Player.PositionHi sbc #>kPositionOffset tay bpl NotMin ClampMin: ldx #0 ldy #0 beq Valid // bra NotMin: cmp LevelMaxPosHi:#0 bcc Valid bne ClampMax cpx LevelMaxPosLo:#0 bcc Valid ClampMax: ldx LevelMaxPosLo ldy LevelMaxPosHi Valid: // Keep camera moving to ideal position if already moving. lda ScrollDirection bne Set // Camera not moving, allow player movement within window. cpy IdealPositionXHi bcc Side bne Side cpx IdealPositionXLo Side: php // c = 0 if position less than ideal position. txa sec sbc IdealPositionXLo plp bcs Positive eor #$ff // Negate to get abs of delta. adc #1 Positive: cmp #kWindowSize bcc Stay Set: sty IdealPositionXHi txa and #$f8 // Lowest 3 bits are zero, i.e. fine scroll is 7 at ideal position. sta IdealPositionXLo Stay: lda ScrollDirection bmi ScrollingRight bne ScrollingLeft // Stopped. jsr GetDirection tax beq Done cmp #kScrollLeft beq StartScrollLeftFromStopped bne StartScrollingRightFromStopped // bra Done: rts // ScrollingRight: lda FineScroll cmp #7 beq ScrollRightDone // Keep fine scrolling right. inc FineScroll bne DecreasePosition // bra ScrollRightDone: lda CanUndoShiftLeft beq FinishedFineScrollRight UndoShiftLeft: lda #0 sta CanUndoShiftLeft // Was scrolling left, switch to back buffer which is already shifted one column right. jsr Scroll.UndoShiftLeft jmp ResumeScrollingRight FinishedFineScrollRight: // Wait for scroll task to finish shifting screen one column right. lda Scroll.IsShiftDone beq Done // Back buffer contains screen shifted one column right when we get here. jsr GetDirection tax beq StopScroll cmp #kScrollLeft beq StartScrollLeft ContinueScrollingRight: // Back buffer contains screen shifted one column right, just flip buffers. jsr Scroll.FinishShift // Resume scrolling right after shifting screen one column right. ResumeScrollingRight: lda #0 // Fine scroll snaps from 7 to 0 here after shifting screen one column right. sta FineScroll jsr DecreasePosition jmp RequestShift // StartScrollingRightFromStopped: lda #kScrollRight sta ScrollDirection lda CanUndoShiftLeft beq ContinueScrollingRight bne UndoShiftLeft // bra // StartScrollLeft: StartScrollLeftFromStopped: // Start scrolling left. lda #kScrollLeft sta ScrollDirection jsr RequestShift ScrollingLeft: lda FineScroll beq ScrollLeftDone // Keep scrolling left. dec FineScroll jmp IncreasePosition ScrollLeftDone: // Wait for scroll task to finish shifting screen one column left. lda Scroll.IsShiftDone beq Done // Back buffer contains screen shifted one column left when we get here, just flip buffers. jsr Scroll.FinishShift lda #7 // Fine scroll snaps from 0 to 7 here after shifting screen one column left. sta FineScroll jsr IncreasePosition // Indicate that screen was shifted left last which can be undone to shift right. lda #1 sta CanUndoShiftLeft jsr GetDirection tax beq StopScroll cmp #kScrollRight beq StartScrollRight // Continue scrolling left. bne RequestShift // bra StopScroll: // Stop scroll, fine scroll is at 7 and back buffer contains screen shifted one column right lda #kScrollStopped beq SetScrollDirection // bra StartScrollRight: // Start scrolling right. lda #kScrollRight SetScrollDirection: sta ScrollDirection rts } // RequestShift: { lda ScrollDirection jmp Scroll.RequestShift } // .segment BSS2 "Camera data" PositionXLo: .fill 1, 0 PositionXHi: .fill 1, 0 PositionXDiv2Lo: .fill 1, 0 PositionXDiv2Hi: .fill 1, 0 IdealPositionXLo: .fill 1, 0 IdealPositionXHi: .fill 1, 0 // 1 = left, 0 = stopped, -1 = right ScrollDirection: .fill 1, 0 // 0-7, where 7 is max fine scroll to right. FineScroll: .fill 1, 0 // 1 = true, 0 = false // True means that back buffer is ready and we're not waiting for scroll task to finish. // It means that we last shifted left, i.e. back buffer = front buffer shifted right. CanUndoShiftLeft: .fill 1, 0
; A314164: Coordination sequence Gal.5.302.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,5,11,16,22,28,34,40,45,51,56,61,67,72,78,84,90,96,101,107,112,117,123,128,134,140,146,152,157,163,168,173,179,184,190,196,202,208,213,219,224,229,235,240,246,252,258,264,269,275 mov $4,$0 cal $0,313801 ; Coordination sequence Gal.5.291.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. mov $3,2 add $3,$0 mov $1,$3 mul $1,2 div $1,3 sub $1,1 mov $2,$4 mul $2,2 add $1,$2
#include "Platform.inc" #include "FarCalls.inc" #include "Lcd.inc" #include "TestFixture.inc" radix decimal extern lcdState udata global initialLcdState global expectedIsLcdIdle initialLcdState res 1 expectedIsLcdIdle res 1 IsLcdIdleTest code global testArrange testArrange: fcall initialiseLcd testAct: banksel initialLcdState movf initialLcdState, W banksel lcdState movwf lcdState fcall isLcdIdle testAssert: banksel expectedIsLcdIdle movf expectedIsLcdIdle btfss STATUS, Z goto assertLcdIsIdleForThisState assertLcdIsNotIdleForThisState: .assert "W == 0, 'Expected isLcdIdle() to return false.'" return assertLcdIsIdleForThisState: .assert "W != 0, 'Expected isLcdIdle() to return true.'" return end
; A256137: a(2) = 1; a(3) = 4; for n >= 4, a(n) = 2 + Sum_{i=4..n} d(i), where d(i) = i for even i, d(i) = i-3 for odd i. ; 1,4,6,8,14,18,26,32,42,50,62,72,86,98,114,128,146,162,182,200,222,242,266,288,314,338,366,392,422,450,482,512,546,578,614,648,686,722,762,800,842,882,926,968,1014,1058,1106,1152,1202,1250,1302,1352,1406,1458,1514,1568,1626,1682,1742,1800,1862,1922,1986,2048,2114,2178,2246,2312,2382,2450,2522,2592,2666,2738,2814,2888,2966,3042,3122,3200,3282,3362,3446,3528,3614,3698,3786,3872,3962,4050,4142,4232,4326,4418,4514,4608,4706,4802,4902,5000,5102,5202,5306,5408,5514,5618,5726,5832,5942,6050,6162,6272,6386,6498,6614,6728,6846,6962,7082,7200,7322,7442,7566,7688,7814,7938,8066,8192,8322,8450,8582,8712,8846,8978,9114,9248,9386,9522,9662,9800,9942,10082,10226,10368,10514,10658,10806,10952,11102,11250,11402,11552,11706,11858,12014,12168,12326,12482,12642,12800,12962,13122,13286,13448,13614,13778,13946,14112,14282,14450,14622,14792,14966,15138,15314,15488,15666,15842,16022,16200,16382,16562,16746,16928,17114,17298,17486,17672,17862,18050,18242,18432,18626,18818,19014,19208,19406,19602,19802,20000,20202,20402,20606,20808,21014,21218,21426,21632,21842,22050,22262,22472,22686,22898,23114,23328,23546,23762,23982,24200,24422,24642,24866,25088,25314,25538,25766,25992,26222,26450,26682,26912,27146,27378,27614,27848,28086,28322,28562,28800,29042,29282,29526,29768,30014,30258,30506,30752,31002,31250 mov $2,$0 add $2,1 mov $1,$2 lpb $2 add $1,$0 sub $0,2 trn $0,1 add $0,1 add $1,$0 mov $2,$0 lpe
.size 8000 .text@48 jp lstatint .text@100 jp lbegin .data@143 c0 .text@150 lbegin: ld a, 00 ldff(ff), a ld a, 30 ldff(00), a ld a, 01 ldff(4d), a stop, 00 ld a, ff ldff(45), a ld b, 91 call lwaitly_b ld hl, fe00 ld d, 10 ld a, d ld(hl++), a ld a, 08 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 0e ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 14 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 28 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 2e ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 34 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 48 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 4e ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 54 ld(hl++), a ld a, 40 ldff(41), a ld a, 02 ldff(ff), a xor a, a ldff(0f), a ei ld a, 01 ldff(45), a ld c, 41 ld a, 93 ldff(40), a ld a, 07 ldff(43), a .text@1000 lstatint: nop .text@1096 ldff a, (c) and a, 03 jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a pop af ld(9800), a ld bc, 7a00 ld hl, 8000 ld d, a0 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f
; A021359: Decimal expansion of 1/355. ; 0,0,2,8,1,6,9,0,1,4,0,8,4,5,0,7,0,4,2,2,5,3,5,2,1,1,2,6,7,6,0,5,6,3,3,8,0,2,8,1,6,9,0,1,4,0,8,4,5,0,7,0,4,2,2,5,3,5,2,1,1,2,6,7,6,0,5,6,3,3,8,0,2,8,1,6,9,0,1,4,0,8,4,5,0,7,0,4,2,2,5,3,5,2,1,1,2,6,7 seq $0,173833 ; 10^n - 3. div $0,355 mod $0,10
; A345488: Numbers that are the sum of eight squares in one or more ways. ; Submitted by Jon Maiga ; 8,11,14,16,17,19,20,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114 sub $1,$0 add $0,12 mov $2,$1 lpb $0 sub $2,5 add $2,$1 sub $0,$2 div $0,2 mov $2,$1 mul $2,2 lpe add $0,3
; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; Internal function, call an EXTROM subroutine ; ; ; $Id: msxextrom.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msxextrom LIB msxrompage defc EXTROM = $015f msxextrom: exx ex af,af' ; store all registers ld hl,EXTROM jp msxrompage
; A142069: Period length 9: repeat 3, 7, 2, 6, 1, 5, 0, 4, 8 . ; 3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5,0,4,8,3,7,2,6,1,5 mul $0,4 add $0,3 mod $0,9 mov $1,$0
TITLE 'bfp-021-multadd.asm: Test IEEE Multiply And Add' *********************************************************************** * *Testcase IEEE MULTIPLY AND ADD * Test case capability includes IEEE exceptions trappable and * otherwise. Test results, FPCR flags, the Condition code, and any * DXC are saved for all tests. * * This test program is focused on the four fused Multiply And Add * instructions. Standard Multiply and Multiply to longer precision * are tested in other programs. * *********************************************************************** SPACE 2 *********************************************************************** * * bfp-021-multadd.asm * * This assembly-language source file is part of the * Hercules Binary Floating Point Validation Package * by Stephen R. Orso * * Copyright 2016 by Stephen R Orso. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * DISCLAMER: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *********************************************************************** SPACE 2 *********************************************************************** * * Tests the following three conversion instructions * MULTIPLY AND ADD (short BFP, RRE) * MULTIPLY AND ADD (long BFP, RRE) * MULTIPLY AND ADD (short BFP, RXE) * MULTIPLY AND ADD (long BFP, RXE) * * * Test data is compiled into this program. The test script that runs * this program can provide alternative test data through Hercules R * commands. * * Test Case Order * 1) Short BFP basic tests, including traps and NaN propagation * 2) Short BFP finite number tests, including traps and scaling * 3) Short BFP FPC-controlled rounding mode exhaustive tests * 4) Long BFP basic tests, including traps and NaN propagation * 5) Long BFP finite number tests, including traps and scaling * 6) Long BFP FPC-controlled rounding mode exhaustive tests * * Three input test sets are provided each for short and long BFP * inputs. Test values are the same for each precision for most * tests. Overflow and underflow each require precision- * dependent test values. * * Review of Softfloat code for multiply and add shows that the * multiplication and addition are performed in precision-independent * format. Overflow, underflow, inexact, and incremented are detected * upon conversion from precision-independent format to the target * format. As a result, it should not matter whether overflow etc is * caused by the multiplication or the addition. We will include * a few test cases where this differs in the finite testing section, * but that's all. * * Also tests the following floating point support instructions * LOAD (Short) * LOAD (Long) * LFPC (Load Floating Point Control Register) * SRNMB (Set BFP Rounding Mode 3-bit) * STORE (Short) * STORE (Long) * STFPC (Store Floating Point Control Register) * *********************************************************************** SPACE 2 MACRO PADCSECT &ENDLABL .* .* Macro to pad the CSECT to include result data areas if this test .* program is not being assembled using asma. asma generates a core .* image that is loaded by the loadcore command, and because the .* core image is a binary stored in Github, it makes sense to make .* this small effort to keep the core image small. .* AIF (D'&ENDLABL).GOODPAD MNOTE 4,'Missing or invalid CSECT padding label ''&ENDLABL''' MNOTE *,'No CSECT padding performed' MEXIT .* .GOODPAD ANOP Label valid. See if we're on asma AIF ('&SYSASM' EQ 'A SMALL MAINFRAME ASSEMBLER').NOPAD ORG &ENDLABL-1 Not ASMA. Pad CSECT MEXIT .* .NOPAD ANOP MNOTE *,'asma detected; no CSECT padding performed' MEND * * Note: for compatibility with the z/CMS test rig, do not change * or use R11, R14, or R15. Everything else is fair game. * BFPMULA START 0 STRTLABL EQU * R0 EQU 0 Work register for cc extraction R1 EQU 1 R2 EQU 2 Holds count of test input values R3 EQU 3 Points to next test input value(s) R4 EQU 4 Rounding tests inner loop control R5 EQU 5 Rounding tests outer loop control R6 EQU 6 Rounding tests top of inner loop R7 EQU 7 Pointer to next result value(s) R8 EQU 8 Pointer to next FPCR result R9 EQU 9 Rounding tests top of outer loop R10 EQU 10 Pointer to test address list R11 EQU 11 **Reserved for z/CMS test rig R12 EQU 12 Holds number of test cases in set R13 EQU 13 Mainline return address R14 EQU 14 **Return address for z/CMS test rig R15 EQU 15 **Base register on z/CMS or Hyperion * * Floating Point Register equates to keep the cross reference clean * FPR0 EQU 0 FPR1 EQU 1 FPR2 EQU 2 FPR3 EQU 3 FPR4 EQU 4 FPR5 EQU 5 FPR6 EQU 6 FPR7 EQU 7 FPR8 EQU 8 FPR9 EQU 9 FPR10 EQU 10 FPR11 EQU 11 FPR12 EQU 12 FPR13 EQU 13 FPR14 EQU 14 FPR15 EQU 15 * USING *,R15 * * Above works on real iron (R15=0 after sysclear) * and in z/CMS (R15 points to start of load module) * SPACE 2 *********************************************************************** * * Low core definitions, Restart PSW, and Program Check Routine. * *********************************************************************** SPACE 2 ORG STRTLABL+X'8E' Program check interrution code PCINTCD DS H * PCOLDPSW EQU STRTLABL+X'150' z/Arch Program check old PSW * ORG STRTLABL+X'1A0' z/Arch Restart PSW DC X'0000000180000000',AD(START) * ORG STRTLABL+X'1D0' z/Arch Program check old PSW DC X'0000000000000000',AD(PROGCHK) * * Program check routine. If Data Exception, continue execution at * the instruction following the program check. Otherwise, hard wait. * No need to collect data. All interesting DXC stuff is captured * in the FPCR. * ORG STRTLABL+X'200' PROGCHK DS 0H Program check occured... CLI PCINTCD+1,X'07' Data Exception? JNE PCNOTDTA ..no, hardwait (not sure if R15 is ok) LPSWE PCOLDPSW ..yes, resume program execution PCNOTDTA DS 0H LTR R14,R14 Return address provided? BNZR R14 Yes, return to z/CMS test rig. LPSWE HARDWAIT Not data exception, enter disabled wait EJECT *********************************************************************** * * Main program. Enable Advanced Floating Point, process test cases. * *********************************************************************** SPACE 2 START DS 0H STCTL R0,R0,CTLR0 Store CR0 to enable AFP OI CTLR0+1,X'04' Turn on AFP bit LCTL R0,R0,CTLR0 Reload updated CR0 * LA R10,SHORTNF Point to short BFP non-finite inputs BAS R13,SBFPNF Multiply short BFP non-finites LA R10,SHORTF Point to short BFP finite inputs BAS R13,SBFPF Multiply short BFP finites LA R10,RMSHORTS Point to short BFP rounding mode tests BAS R13,SBFPRM Multiply short BFP for rounding tests * LA R10,LONGNF Point to long BFP non-finite inputs BAS R13,LBFPNF Multiply long BFP non-finites LA R10,LONGF Point to long BFP finite inputs BAS R13,LBFPF Multiply long BFP finites LA R10,RMLONGS Point to long BFP rounding mode tests BAS R13,LBFPRM Multiply long BFP for rounding tests * LTR R14,R14 Return address provided? BNZR R14 ..Yes, return to z/CMS test rig. LPSWE WAITPSW All done * DS 0D Ensure correct alignment for psw WAITPSW DC X'0002000000000000',AD(0) Normal end - disabled wait HARDWAIT DC X'0002000000000000',XL6'00',X'DEAD' Abnormal end * CTLR0 DS F FPCREGNT DC X'00000000' FPCR, trap all IEEE exceptions, zero flags FPCREGTR DC X'F8000000' FPCR, trap no IEEE exceptions, zero flags * * Input values parameter list, four fullwords for each test data set * 1) Count, * 2) Address of inputs, * 3) Address to place results, and * 4) Address to place DXC/Flags/cc values. * ORG STRTLABL+X'300' Enable run-time replacement SHORTNF DS 0F Input pairs for short BFP non-finite tests DC A(SBFPNFCT) DC A(SBFPNFIN) DC A(SBFPNFOT) DC A(SBFPNFFL) * SHORTF DS 0F Input pairs for short BFP finite tests DC A(SBFPCT) DC A(SBFPIN) DC A(SBFPOUT) DC A(SBFPFLGS) * RMSHORTS DS 0F Input pairs for short BFP rounding testing DC A(SBFPRMCT) DC A(SBFPINRM) DC A(SBFPRMO) DC A(SBFPRMOF) * LONGNF DS 0F Input pairs for long BFP non-finite testing DC A(LBFPNFCT) DC A(LBFPNFIN) DC A(LBFPNFOT) DC A(LBFPNFFL) * LONGF DS 0F Input pairs for long BFP finite testing DC A(LBFPCT) DC A(LBFPIN) DC A(LBFPOUT) DC A(LBFPFLGS) * RMLONGS DS 0F Input pairs for long BFP rounding testing DC A(LBFPRMCT) DC A(LBFPINRM) DC A(LBFPRMO) DC A(LBFPRMOF) * EJECT *********************************************************************** * * Perform Multiply And Add using provided short BFP inputs. This set * of tests checks NaN propagation, operations on values that are not * finite numbers, and other basic tests. This set generates results * that can be validated against Figure 19-24 on page 19-39 of * SA22-7832-10. * * Four results are generated for each input: one RRE with all * exceptions non-trappable, a second RRE with all exceptions trappable, * a third RXE with all exceptions non-trappable, a fourth RXE with all * exceptions trappable. * * Because this is a three-operand instruction, validation against * Figure 19-24, effectively an 8 x 8 x 8 table, will generate a * phenomonal set of results. Namely 512 results of 16 bytes each * plus 512 FPCR contents of 16 bytes each. * * The product and FPCR are stored for each result. * *********************************************************************** SPACE 2 SBFPNF DS 0H BFP Short non-finite values tests LM R2,R3,0(R10) Get count and addr of multiplicand values LM R8,R9,8(R10) Get address of result area and flag area. LTR R2,R2 Any test cases? BZR R13 ..No, return to caller * SBFPNFLP DS 0H Top of outer loop - Multiplicand LM R4,R5,0(R10) Get count and start of multiplier values * ..which are the same as the multiplicands BASR R12,0 Set top of middle loop * DS 0H Top of middle loop - multiplier LM R6,R7,0(R10) Get count and start of addend values * ..which are the same as the multiplicands BASR R1,0 Set top of inner loop - addend * * Multiply and Add: R1 = R3 x R2 + R1 * LE FPR4,0(,R3) Get short BFP multiplicand LE FPR1,0(,R5) Get short BFP multiplier * LFPC FPCREGNT Set exceptions non-trappable LE FPR8,0(,R7) Get short BFP addend MAEBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STE FPR8,0(,R8) Store short BFP product-sum STFPC 0(R9) Store resulting FPCR flags and DXC * LFPC FPCREGTR Set exceptions trappable LE FPR8,0(,R7) Get short BFP addend MAEBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STE FPR8,4(,R8) Store short BFP product-sum STFPC 4(R9) Store resulting FPCR flags and DXC * LFPC FPCREGNT Set exceptions non-trappable LE FPR8,0(,R7) Get short BFP addend MAEB FPR8,FPR4,0(,R5) Mult. FPR4 by multiplier, add FPR8 RXE STE FPR8,8(,R8) Store short BFP product-sum STFPC 8(R9) Store resulting FPCR flags and DXC * LFPC FPCREGTR Set exceptions trappable LE FPR8,0(,R7) Get short BFP addend MAEB FPR8,FPR4,0(,R5) Mult. FPR4 by multiplier, add FPR8 RXE STE FPR8,12(,R8) Store short BFP product-sum STFPC 12(R9) Store resulting FPCR flags and DXC * LA R8,4*4(,R8) Point to next product-sum result area LA R9,4*4(,R9) Point to next FPCR contents area LA R7,4(,R7) Point to next addend value BCTR R6,R1 Loop through addend values * LA R5,4(,R5) Point to next multiplier BCTR R4,R12 Loop through multiplier values * LA R3,4(,R3) Point to next multiplicand BCT R2,SBFPNFLP Loop through multiplicand values BR R13 All converted; return. EJECT *********************************************************************** * * Perform Multiply And Add using provided short BFP input triples. * This set of tests triggers IEEE exceptions Overflow, Underflow, and * Inexact and collects both trap and non-trap results. * * Four results are generated for each input: one RRE with all * exceptions non-trappable, a second RRE with all exceptions trappable, * a third RXE with all exceptions non-trappable, a fourth RXE with all * exceptions trappable, * * The product and FPCR are stored for each result. * *********************************************************************** SPACE 2 SBFPF LM R2,R3,0(R10) Get count and address of test input values LM R7,R8,8(R10) Get address of result area and flag area. LTR R2,R2 Any test cases? BZR R13 ..No, return to caller BASR R12,0 Set top of loop * LFPC FPCREGNT Set exceptions non-trappable LE FPR4,0(,R3) Get short BFP multiplicand LE FPR1,1*4(,R3) Get short BFP multiplier LE FPR8,2*4(,R3) Get short BFP addend MAEBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STE FPR8,0(,R7) Store short BFP product-sum STFPC 0(R8) Store resulting FPCR flags and DXC * LFPC FPCREGTR Set exceptions trappable LE FPR8,2*4(,R3) Reload short BFP addend * ..multiplier is still in FPR1, * ..multiplicand is still in FPR4 MAEBR FPR8,FPR4,FPR1 Multiply short FPR8 by FPR1 RRE STE FPR8,1*4(,R7) Store short BFP product-sum STFPC 4(R8) Store resulting FPCR flags and DXC * LFPC FPCREGNT Set exceptions non-trappable LE FPR8,2*4(,R3) Reload short BFP addend * ..multiplicand is still in FPR4 MAEB FPR8,FPR4,4(,R3) Mult. FPR4 by multiplier, add FPR8 RXE STE FPR8,2*4(,R7) Store short BFP product STFPC 8(R8) Store resulting FPCR flags and DXC * LFPC FPCREGTR Set exceptions trappable LE FPR8,2*4(,R3) Reload short BFP addend * ..multiplicand is still in FPR4 MAEB FPR8,FPR4,4(,R3) Mult. FPR4 by multiplier, add FPR8 RXE STE FPR8,3*4(,R7) Store short BFP product STFPC 12(R8) Store resulting FPCR flags and DXC * LA R3,3*4(,R3) Point to next input value trible LA R7,4*4(,R7) Point to next product result set LA R8,4*4(,R8) Point to next FPCR result set BCTR R2,R12 Convert next input value. BR R13 All converted; return. EJECT *********************************************************************** * * Perform Multiply And Add using provided short BFP input triples. * This set of tests exhaustively tests all rounding modes available for * Multiply And Add. The rounding mode can only be specified in the * FPC. * * All five FPC rounding modes are tested because the preceeding tests, * using rounding mode RNTE, do not often create results that require * rounding. * * Two results are generated for each input and rounding mode: one RRE * and one RXE. Traps are disabled for all rounding mode tests. * * The product and FPCR are stored for each test. * *********************************************************************** SPACE 2 SBFPRM LM R2,R3,0(R10) Get count and address of test input values LM R7,R8,8(R10) Get address of result area and flag area. LTR R2,R2 Any test cases? BZR R13 ..No, return to caller XR R1,R1 Zero register 1 for use in IC/STC/indexing BASR R12,0 Set top of test case loop LA R5,FPCMCT Get count of FPC modes to be tested BASR R9,0 Set top of rounding mode outer loop * IC R1,FPCMODES-L'FPCMODES(R5) Get next FPC mode * LFPC FPCREGNT Set exceptions non-trappable, clear flags SRNMB 0(R1) Set FPC Rounding Mode LE FPR4,0(,R3) Get short BFP multiplicand LE FPR1,4(,R3) Get short BFP multiplier LE FPR8,8(,R3) Get short BFP addend MAEBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STE FPR8,0(,R7) Store short BFP product-sum STFPC 0(R8) Store resulting FPCR flags and DXC * LFPC FPCREGNT Set exceptions non-trappable, clear flags SRNMB 0(R1) Set FPC Rounding Mode LE FPR8,8(,R3) Get short BFP addend * ..multiplicand is still in FPR4 MAEB FPR8,FPR4,4(,R3) Mult. FPR4 by multiplier, add FPR8 RXE STE FPR8,4(,R7) Store short BFP product-sum STFPC 4(R8) Store resulting FPCR flags and DXC * LA R7,2*4(,R7) Point to next product result set LA R8,2*4(,R8) Point to next FPCR result area * BCTR R5,R9 Iterate to next FPC mode for this input * * End of FPC modes to be tested. Advance to next test case. We will * skip eight bytes of result area so that each set of five result * value pairs starts at a memory address ending in zero for the * convenience of memory dump review. * LA R3,3*4(,R3) Point to next input value pair triple LA R7,8(,R7) Skip to start of next result set LA R8,8(,R8) Skip to start of next FPCR result set BCTR R2,R12 Advance to the next input pair * BR R13 All converted; return. EJECT *********************************************************************** * * Perform Multiply And Add using provided long BFP inputs. This set * of tests checks NaN propagation, operations on values that are not * finite numbers, and other basic tests. This set generates results * that can be validated against Figure 19-24 on page 19-39 of * SA22-7832-10. * * Four results are generated for each input: one RRE with all * exceptions non-trappable, a second RRE with all exceptions trappable, * a third RXE with all exceptions non-trappable, a fourth RXE with all * exceptions trappable. * * Because this is a three-operand instruction, validation against * Figure 19-24, effectively an 8 x 8 x 8 table, will generate a * phenomonal set of results. Namely 512 results of 16 bytes each * plus 512 FPCR contents of 16 bytes each. * * The product and FPCR are stored for each result. * *********************************************************************** SPACE 2 LBFPNF DS 0H BFP long non-finite values tests LM R2,R3,0(R10) Get count and addr of multiplicand values LM R8,R9,8(R10) Get address of result area and flag area. LTR R2,R2 Any test cases? BZR R13 ..No, return to caller * LBFPNFLP DS 0H Top of outer loop - Multiplicand LM R4,R5,0(R10) Get count and start of multiplier values * ..which are the same as the multiplicands BASR R12,0 Set top of middle loop * DS 0H Top of middle loop - multiplier LM R6,R7,0(R10) Get count and start of addend values * ..which are the same as the multiplicands BASR R1,0 Set top of inner loop - addend * * Multiply and Add: R1 = R3 x R2 + R1 * LE FPR4,0(,R3) Get long BFP multiplicand LE FPR1,0(,R5) Get long BFP multiplier * LFPC FPCREGNT Set exceptions non-trappable LD FPR8,0(,R7) Get long BFP addend MADBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STD FPR8,0(,R8) Store long BFP product-sum STFPC 0(R9) Store resulting FPCR flags and DXC * LFPC FPCREGTR Set exceptions trappable LE FPR8,0(,R7) Get long BFP addend MADBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STD FPR8,1*8(,R8) Store long BFP product-sum STFPC 1*4(R9) Store resulting FPCR flags and DXC * LFPC FPCREGNT Set exceptions non-trappable LE FPR8,0(,R7) Get long BFP addend MADB FPR8,FPR4,0(,R5) Mult. FPR4 by multiplier, add FPR8 RXE STD FPR8,2*8(,R8) Store long BFP product-sum STFPC 2*4(R9) Store resulting FPCR flags and DXC * LFPC FPCREGTR Set exceptions trappable LE FPR8,0(,R7) Get long BFP addend MADB FPR8,FPR4,0(,R5) Mult. FPR4 by multiplier, add FPR8 RXE STD FPR8,3*8(,R8) Store long BFP product-sum STFPC 3*4(R9) Store resulting FPCR flags and DXC * LA R8,4*8(,R8) Point to next product-sum result area LA R9,4*4(,R9) Point to next FPCR contents area LA R7,8(,R7) Point to next addend value BCTR R6,R1 Loop through addend values * LA R5,8(,R5) Point to next multiplier BCTR R4,R12 Loop through multiplier values * LA R3,8(,R3) Point to next multiplicand BCT R2,LBFPNFLP Loop through multiplicand values BR R13 All converted; return. EJECT *********************************************************************** * * Perform Multiply And Add using provided long BFP input triples. This * set of tests triggers IEEE exceptions Overflow, Underflow, and * Inexact and collects non-trap and trap results. * * Four results are generated for each input: one RRE with all * exceptions non-trappable, a second RRE with all exceptions trappable, * a third RXE with all exceptions non-trappable, a fourth RXE with all * exceptions trappable, * * The product and FPCR are stored for each result. * *********************************************************************** SPACE 2 LBFPF LM R2,R3,0(R10) Get count and address of test input values LM R7,R8,8(R10) Get address of result area and flag area. LTR R2,R2 Any test cases? BZR R13 ..No, return to caller BASR R12,0 Set top of loop * LFPC FPCREGNT Set exceptions non-trappable LD FPR4,0(,R3) Get long BFP multiplicand LD FPR1,8(,R3) Get long BFP multiplier LD FPR8,16(,R3) Get long BFP addend MADBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STD FPR8,0(,R7) Store long BFP product STFPC 0(R8) Store resulting FPCR flags and DXC * LFPC FPCREGTR Set exceptions trappable LD FPR8,16(,R3) Reload long BFP addend * ..multiplier is still in FPR1, * ..multiplicand is still in FFR4 MADBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STD FPR8,8(,R7) Store long BFP product-sum STFPC 1*4(R8) Store resulting FPCR flags and DXC * LFPC FPCREGNT Set exceptions non-trappable LD FPR8,16(,R3) Reload long BFP addend * ..multiplicand is still in FFR4 MADB FPR8,FPR4,8(,R3) Mult. FPR4 by multiplier, add FPR8 RXE STD FPR8,2*8(,R7) Store long BFP product-sum STFPC 2*4(R8) Store resulting FPCR flags and DXC * LFPC FPCREGTR Set exceptions trappable LD FPR8,16(,R3) Reload long BFP addend * ..multiplicand is still in FFR4 MADB FPR8,FPR4,8(,R3) Mult. FPR4 by multiplier, add FPR8 RXE STD FPR8,3*8(,R7) Store long BFP product-sum STFPC 3*4(R8) Store resulting FPCR flags and DXC * LA R3,3*8(,R3) Point to next input value triple LA R7,4*8(,R7) Point to next product-sum result set LA R8,4*4(,R8) Point to next FPCR result area BCTR R2,R12 Convert next input value. BR R13 All converted; return. EJECT *********************************************************************** * * Perform Multiply using provided long BFP input pairs. This set of * tests exhaustively tests all rounding modes available for Multiply. * The rounding mode can only be specified in the FPC. * * All five FPC rounding modes are tested because the preceeding tests, * using rounding mode RNTE, do not often create results that require * rounding. * * Two results are generated for each input and rounding mode: one RRE * and one RXE. Traps are disabled for all rounding mode tests. * * The product and FPCR are stored for each result. * *********************************************************************** SPACE 2 LBFPRM LM R2,R3,0(R10) Get count and address of test input values LM R7,R8,8(R10) Get address of result area and flag area. LTR R2,R2 Any test cases? BZR R13 ..No, return to caller XR R1,R1 Zero register 1 for use in IC/STC/indexing BASR R12,0 Set top of test case loop LA R5,FPCMCT Get count of FPC modes to be tested BASR R9,0 Set top of rounding mode loop * IC R1,FPCMODES-L'FPCMODES(R5) Get next FPC mode * LFPC FPCREGNT Set exceptions non-trappable, clear flags SRNMB 0(R1) Set FPC Rounding Mode LD FPR4,0(,R3) Get long BFP multiplicand LD FPR1,8(,R3) Get long BFP multiplier LD FPR8,16(,R3) Get long BFP addend MADBR FPR8,FPR4,FPR1 Multiply FPR4 by FPR1, add FPR8 RRE STD FPR8,0(,R7) Store long BFP product-sum STFPC 0(R8) Store resulting FPCR flags and DXC * LFPC FPCREGNT Set exceptions non-trappable, clear flags SRNMB 0(R1) Set FPC Rounding Mode LD FPR8,16(,R3) Reload long BFP addend MADB FPR8,FPR4,8(,R3) Multiply long FPR8 by multiplier RXE STD FPR8,8(,R7) Store long BFP product-sum STFPC 4(R8) Store resulting FPCR flags and DXC * LA R7,2*8(,R7) Point to next product result set LA R8,2*4(,R8) Point to next FPCR result area * BCTR R5,R9 Iterate to next FPC mode * * End of FPC modes to be tested. Advance to next test case. We will * skip eight bytes of FPCR result area so that each set of five result * FPCR contents pairs starts at a memory address ending in zero for the * convenience of memory dump review. * LA R3,3*8(,R3) Point to next input value triple LA R8,8(,R8) Skip to start of next FPCR result area BCTR R2,R12 Multiply next input value lots of times * BR R13 All converted; return. EJECT *********************************************************************** * * Table of FPC rounding modes to test product rounding modes. * * The Set BFP Rounding Mode does allow specification of the FPC * rounding mode as an address, so we shall index into a table of * BFP rounding modes without bothering with Execute. * *********************************************************************** SPACE 2 * * Rounding modes that may be set in the FPCR. The FPCR controls * rounding of the product. * * These are indexed directly by the loop counter, which counts down. * So the modes are listed in reverse order here. * FPCMODES DS 0C DC AL1(7) RFS, Round for shorter precision DC AL1(3) RM, Round to -infinity DC AL1(2) RP, Round to +infinity DC AL1(1) RZ, Round to zero DC AL1(0) RNTE, Round to Nearest, ties to even FPCMCT EQU *-FPCMODES Count of FPC Modes to be tested * EJECT *********************************************************************** * * Short BFP test data sets for Multiply And Add testing. * * The first test data set is used for tests of basic functionality, * NaN propagation, and results from operations involving other than * finite numbers. The same set of eight values is used as the * multiplicand, multiplier, and addend, resulting in 8 x 8 x 8 or * 512 test cases. * * The second test data set is used for testing boundary conditions * using two finite non-zero values. Each possible condition code * and type of result (normal, scaled, etc) is created by members of * this test data set. * * The third test data set is used for exhaustive testing of final * results across the five rounding modes available for the Multiply * instruction. * * The strategy for predictable rounding mode testing is to use a * multiplicand with some one-bits in the low-order byte and multiply * that by 1/16 (0.0625). In BFP, this will have the effect of shifting * the low-order byte out of the target precision representation and * into the high-order portion of the bits that control rounding. The * input low-order byte will be determined by the rounding desired. * *********************************************************************** SPACE 2 *********************************************************************** * * First input test data set, to test operations using non-finite or * zero inputs. Member values chosen to validate Figure 19-24 on page * 19-39 of SA22-7832-10. Each value in this table is used as the * multiplicand, multiplier, and addend. Eight entries menas 512 result * sets. * *********************************************************************** SPACE 2 SBFPNFIN DS 0F Inputs for short BFP non-finite tests DC X'FF800000' -inf DC X'C0000000' -2.0 DC X'80000000' -0 DC X'00000000' +0 DC X'40000000' +2.0 DC X'7F800000' +inf DC X'FFCB0000' -QNaN DC X'7F8A0000' +SNaN SBFPNFCT EQU (*-SBFPNFIN)/4 Count of short BFP in list SPACE 3 *********************************************************************** * * Second input test data set. These are finite triples intended to * trigger overflow, underflow, and inexact exceptions. Each triple is * added twice, once non-trappable and once trappable. Trappable * overflow or underflow yields a scaled result. Trappable inexact * will show whether the Incremented DXC code is returned. * * The following test cases are required: * 1. Overflow * 2. Underflow - normal inputs * 3. Underflow - subnormal inputs * 4. Normal - from subnormal inputs * 5. Inexact - incremented * 6. Inexact - truncated * *********************************************************************** SPACE 2 SBFPIN DS 0F Inputs for short BFP finite tests * * Overflow on multiplication two ways - once on the multiply, once * on the addition following the multiplication. * DC X'7F7FFFFF' +Nmax multiplicand DC X'FF7FFFFF' -Nmax multiplier DC X'7F7FFFFF' Big positive value, won't show up. * DC X'7F7FFFFF' +Nmax multiplicand DC X'3F800000' +1.0 multiplier DC X'7F7FFFFF' +Nmax addend, triggers overflow * * Underflow from product of normals. We will multiply a small normal * by 0.25 to generate a subnormal. We cannot add another normal * (positive or negative) and keep the result subnormal, so we will just * add a subnormal. * DC X'00FFFFFF' Very small normal number DC X'3E800000' 0.25, creates subnormal DC X'00000001' +Dmin, will appear in result * * Underflow from the product of a subnormal and a normal. * DC X'3F000000' +0.5 DC X'007FFFFF' +Dmax Subnormal DC X'00000001' +Dmin, will appear in result * * We cannot generate a normal result from product of subnormals * because the result will be smaller than both the multiplicand and the * multiplier. So we'll try multiplying +Dmax by 2. The result should * be +Nmin plus the addend. * DC X'007FFFFF' +Dmax DC X'40000000' +2.0 DC X'00400000' +Dmax * * Multiply a value from 1.0 such that the added digits are to the right * of the right-most bit in the stored significand. The result will be * inexact, and incremented will be determined by the value of the * bits in the multiplier. We will add 0.5 to this product because * that value will not cause renormalization. Renormalization would * shift the rounding bits one to the right, messing up the expected * rounding. * DC X'3F80000C' Multiplicand 1.000001430511474609375 DC X'3F880000' Multiplier 1.0625 (1 + 1/16) DC X'3F000000' Plus 0.5 *..nearest is away from zero, incremented. * DC X'3F800007' Multiplicand 1.00000083446502685546875 DC X'3F880000' Multiplier 1.0625 (1 + 1/16) DC X'3F000000' Plus 0.5 *..nearest is toward zero, truncated * SBFPCT EQU (*-SBFPIN)/4/3 Count of short BFP in list SPACE 3 *********************************************************************** * * Third input test data set. These are finite triples intended to * test all combinations of rounding mode for the product and the * remainder. Values are chosen to create a requirement to round * to the target precision after the computation and to generate * varying results depending on the rounding mode in the FPCR. * * The result set will have cases that represent each of the following * * 1. Positive, nearest magnitude is toward zero. * 2. Negative, nearest magnitude is toward zero. * 3. Positive, nearest magnitude is away from zero. * 4. Negative, nearest magnitude is away from zero. * 5. Positive, tie, nearest even has greater magnitude * 6. Negative, tie, nearest even has greater magnitude * 7. Positive, tie, nearest even has lower magnitude * 8. Negative, tie, nearest even has lower magnitude * * Round For Shorter precision correctness can be determined from the * above test cases. * *********************************************************************** SPACE 2 SBFPINRM DS 0F Inputs for short BFP rounding testing * * Multiply a value from 1.0 such that the added digits are to the right * of the right-most bit in the stored significand. The result will be * inexact, and incremented will be determined by the value of the * bits in the multiplier. * DC X'3F800007' Multiplicand +1.00000083446502685546875 DC X'3F880000' Multiplier 1.0625 (1/16) DC X'3F000000' Addend 0.5 DC X'BF800007' Multiplicand -1.00000083446502685546875 DC X'3F880000' Multiplier 1.0625 (1/16) DC X'BF000000' Addend -0.5 *..nearest is toward zero, truncated * DC X'3F80000C' Multiplicand +1.000001430511474609375 DC X'3F880000' Multiplier 1.0625 (1/16) DC X'3F000000' Addend 0.5 DC X'BF80000C' Multiplicand -1.000001430511474609375 DC X'3F880000' Multiplier 1.0625 (1/16) DC X'BF000000' Addend -0.5 *..nearest is away from zero, incremented. * DC X'3F800008' Multiplicand +1.000000476837158203125 DC X'3F880000' Multiplier 1.0625 (1/16) DC X'3F000000' Addend 0.5 DC X'BF800008' Multiplicand -1.000000476837158203125 DC X'3F880000' Multiplier 1.0625 (1/16) DC X'BF000000' Addend -0.5 *..nearest is a tie, nearest even has lower magnitude * DC X'3F800018' Multiplicand +1.000002384185791015625 DC X'3F880000' Multiplier 1.0625 (1/16) DC X'3F000000' Addend 0.5 DC X'BF800018' Multiplicand -1.000002384185791015625 DC X'3F880000' Multiplier 1.0625 (1/16) DC X'BF000000' Addend -0.5 *..nearest is a tie, nearest even has greater magnitude * SBFPRMCT EQU (*-SBFPINRM)/4/3 Count of short BFP rounding tests EJECT *********************************************************************** * * Long BFP test data sets for Multiply And Add testing. * * The first test data set is used for tests of basic functionality, * NaN propagation, and results from operations involving other than * finite numbers. * * The second test data set is used for testing boundary conditions * using two finite non-zero values. Each possible condition code * and type of result (normal, scaled, etc) is created by members of * this test data set. * * The third test data set is used for exhaustive testing of final * results across the five rounding modes available for the Add * instruction. * * See the Short BFP test cases header for a discussion of test case * selection for rounding mode test case values. * *********************************************************************** SPACE 2 *********************************************************************** * * First input test data set, to test operations using non-finite or * zero inputs. Member values chosen to validate Figure 19-24 on page * 19-39 of SA22-7832-10. Each value in this table is used as the * multiplicand, multiplier, and addend. Eight entries menas 512 result * sets. * *********************************************************************** SPACE 2 LBFPNFIN DS 0F Inputs for long BFP testing DC X'FFF0000000000000' -inf DC X'C000000000000000' -2.0 DC X'8000000000000000' -0 DC X'0000000000000000' +0 DC X'4000000000000000' +2.0 DC X'7FF0000000000000' +inf DC X'FFF8B00000000000' -QNaN DC X'7FF0A00000000000' +SNaN LBFPNFCT EQU (*-LBFPNFIN)/8 Count of long BFP in list SPACE 3 *********************************************************************** * * Second input test data set. These are finite triples intended to * trigger overflow, underflow, and inexact exceptions. Each triples is * added twice, once non-trappable and once trappable. Trappable * overflow or underflow yields a scaled result. Trappable inexact * will show whether the Incremented DXC code is returned. * * The following test cases are required: * 1. Overflow * 2. Underflow - normal inputs * 3. Underflow - subnormal inputs * 4. Normal - from subnormal inputs * 5. Inexact - incremented * 6. Inexact - truncated * *********************************************************************** SPACE 2 LBFPIN DS 0D Inputs for long BFP finite tests * * Overflow on multiplication two ways. Once on the muliplication step, * and then a second time on the addition step. * DC X'7FEFFFFFFFFFFFFF' +Nmax DC X'FFEFFFFFFFFFFFFF' -Nmax DC X'3FF0000000000000' +1.0 * DC X'7FEFFFFFFFFFFFFF' +Nmax DC X'3FF0000000000000' +1.0 DC X'7FEFFFFFFFFFFFFF' +Nmax * * Underflow from product of normals. We will multiply a small normal * by 0.25 to generate a subnormal. We cannot add another normal * (positive or negative) and keep the result subnormal, so we will just * add a subnormal. * DC X'001FFFFFFFFFFFFF' Very small normal number DC X'3FD0000000000000' 0.25, creates subnormal DC X'0000000000000001' +Dmin, will appear in result * * Underflow from the product of a subnormal and a normal. * DC X'3FE0000000000000' +0.5 DC X'000FFFFFFFFFFFFF' +Dmax subnormal DC X'0000000000000001' +Dmin, will appear in result * * We cannot generate a normal result from product of subnormals * because the result will be smaller than both the multiplicand and the * multiplier. So we'll try multiplying +Dmax by 2. The result should * be +Nmin * DC X'000FFFFFFFFFFFFF' +Dmax DC X'4000000000000000' +2.0, result should be normal DC X'0008000000000000' A large subnormal * * Multiply a value from 1.0 such that the added digits are to the right * of the right-most bit in the stored significand. The result will be * inexact, and incremented will be determined by the value of the * bits in the multiplier. * DC X'3FF000000000000C' Multiplicand +1, aka 1.0b0 DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'3FE0000000000000' +0.5 *..nearest is away from zero, incremented. * DC X'3FF0000000000007' Multiplicand +1, aka 1.0b0 DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'3FE0000000000000' +0.5 *..nearest is toward zero, truncated. * LBFPCT EQU (*-LBFPIN)/8/3 Count of long BFP triples in list SPACE 3 *********************************************************************** * * Third input test data set. These are finite triples intended to * test all combinations of rounding mode for the product and the * remainder. Values are chosen to create a requirement to round * to the target precision after the computation and to generate * varying results depending on the rounding mode in the FPCR. * * The result set will have cases that represent each of the following * * 1. Positive, nearest magnitude is toward zero. * 2. Negative, nearest magnitude is toward zero. * 3. Positive, nearest magnitude is away from zero. * 4. Negative, nearest magnitude is away from zero. * 5. Positive, tie, nearest even has greater magnitude * 6. Negative, tie, nearest even has greater magnitude * 7. Positive, tie, nearest even has lower magnitude * 8. Negative, tie, nearest even has lower magnitude * * Round For Shorter precision correctness can be determined from the * above test cases. * *********************************************************************** SPACE 2 LBFPINRM DS 0F * * Multiply a value from 1.0 such that the added digits are to the right * of the right-most bit in the stored significand. The result will be * inexact, and incremented will be determined by the value of the * bits in the multiplier. * DC X'3FF0000000000007' Multiplicand DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'3FE0000000000000' +0.5 DC X'BFF0000000000007' Multiplicand DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'BFE0000000000000' -0.5 *..nearest is toward zero, truncated. * DC X'3FF000000000000C' Multiplicand DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'3FE0000000000000' +0.5 DC X'BFF000000000000C' Multiplicand DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'BFE0000000000000' -0.5 *..nearest is away from zero, incremented. * DC X'3FF0000000000008' Multiplicand DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'3FE0000000000000' +0.5 DC X'BFF0000000000008' Multiplicand DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'BFE0000000000000' -0.5 *..nearest is a tie, nearest even has lower magnitude * DC X'3FF0000000000018' Multiplicand +1, aka +1.0b0 DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'3FE0000000000000' +0.5 DC X'BFF0000000000018' Multiplicand -1, aka -1.0b0 DC X'3FF1000000000000' Multiplier 1.0625 (1/16) DC X'BFE0000000000000' -0.5 *..nearest is a tie, nearest even has greater magnitude * LBFPRMCT EQU (*-LBFPINRM)/8/3 Count of long BFP rounding tests EJECT * * Locations for results * SBFPNFOT EQU STRTLABL+X'1000' Short non-finite BFP results * ..room for 512 tests, 512 used SBFPNFFL EQU STRTLABL+X'3000' FPCR flags and DXC from short BFP * ..room for 512 tests, 512 used * SBFPOUT EQU STRTLABL+X'5000' Short BFP finite results * ..room for 16 tests, 7 used SBFPFLGS EQU STRTLABL+X'5100' FPCR flags and DXC from short BFP * ..room for 16 tests, 7 used * SBFPRMO EQU STRTLABL+X'5200' Short BFP rounding mode test results * ..Room for 16, 8 used. SBFPRMOF EQU STRTLABL+X'5500' Short BFP rounding mode FPCR results * ..Room for 16, 8 used. * ..next location starts at X'5800' * LBFPNFOT EQU STRTLABL+X'6000' Long non-finite BFP results * ..room for 512 tests, 512 used LBFPNFFL EQU STRTLABL+X'A000' FPCR flags and DXC from long BFP * ..room for 512 tests, 512 used * LBFPOUT EQU STRTLABL+X'C000' Long BFP finite results * ..room for 16 tests, 7 used LBFPFLGS EQU STRTLABL+X'C200' FPCR flags and DXC from long BFP * ..room for 16 tests, 7 used * LBFPRMO EQU STRTLABL+X'C500' Long BFP rounding mode test results * ..Room for 16, 8 used. LBFPRMOF EQU STRTLABL+X'CA00' Long BFP rounding mode FPCR results * ..Room for 16, 8 used. * ..next location starts at X'CD00' * * ENDLABL EQU STRTLABL+X'C800' PADCSECT ENDLABL END
; A021191: Decimal expansion of 1/187. ; Submitted by Jon Maiga ; 0,0,5,3,4,7,5,9,3,5,8,2,8,8,7,7,0,0,5,3,4,7,5,9,3,5,8,2,8,8,7,7,0,0,5,3,4,7,5,9,3,5,8,2,8,8,7,7,0,0,5,3,4,7,5,9,3,5,8,2,8,8,7,7,0,0,5,3,4,7,5,9,3,5,8,2,8,8,7,7,0,0,5,3,4,7,5,9,3,5,8,2,8,8,7,7,0,0,5 seq $0,83812 ; 4n-1 is the digit reversal of n-1. div $0,374 mod $0,10
#include<cstdio> #include<algorithm> using namespace std; int s[1000000]; main() { int i,k,n; while(scanf("%d",&n)==1) { for(i=0;i<n;i++) scanf("%d",&s[i]); scanf("%d",&k); nth_element(s,s+k-1,s+n); printf("%d\n",s[k-1]); } }
################################################################## # The program performs insertion sort and statistical operations. # Only $s registers have been used. ################################################################## ####################### # Text Segment ####################### .text .globl main main: jal interact li $v0, 10 syscall interact: addi $sp, $sp, -8 sw $s0, 4($sp) sw $ra, ($sp) la $a0, display li $v0, 4 syscall la $a0, displaya li $v0, 4 syscall la $a0, displayb li $v0, 4 syscall la $a0, displayc li $v0, 4 syscall la $a0, displayd li $v0, 4 syscall li $v0, 5 syscall sw $v0, opcode lw $s0, opcode beq $s0, 1, readArray beq $s0, 2, insertionSort beq $s0, 3, medianMode beq $s0, 4, cont cont: addi, $sp, $sp, 8 jr $ra readArray: # Get number of array elements la $a0, introString li $v0, 4 syscall addi $sp, $sp, -24 sw $ra, ($sp) sw $s0, 4($sp) sw $s1, 8($sp) sw $s2, 12($sp) sw $s3, 16($sp) sw $s4, 20($sp) li $v0, 5 syscall move $s0, $v0 sw $s0, size sll $s3, $s0, 2 # Create dynamic array move $a0, $s3 li $v0, 9 syscall sw $v0, array la $s1, array # Get the elements li $s4, 100 for: li $v0, 5 syscall bgt $v0, $zero, go1 blt $v0, $zero, go3 beq $v0, $zero, go3 go1: blt $v0, $s4, go2 bgt $v0, $s4, go3 beq $v0, $s4, go3 go2: move $s2, $v0 sw $s2, ($s1) addi $s1, $s1, 4 addi $s0, $s0, -1 go3: bgt $s0, $zero, for lw $s1, size # length la $s2, array forPrint3: lw $a0, ($s2) li $v0, 1 syscall la $a0, tab li $v0, 4 syscall addi $s2, $s2, 4 addi $s1, $s1, -1 bgt $s1, $zero, forPrint3 la $a0, endLine li $v0, 4 syscall addi $sp, $sp, 24 j main insertionSort: addi $sp, $sp, -28 li $s0, 1 # i lw $s2, size # length la $s3, array la $s6, array while: move $s1, $s0 # j move $s3, $s6 move $t6, $s1 addi $s3, $s3, -4 for2: addi $s3, $s3, 4 addi $t6, $t6, -1 bgt $t6, 0, for2 lw $s4, ($s3) # load 0th index value lw $s5, 4($s3) # load 1st index value sw $s0, ($sp) sw $s1, 4($sp) sw $s2, 8($sp) sw $s3, 12($sp) sw $s4, 16($sp) sw $s5, 20($sp) sw $s6, 24($sp) blt $s1, 1, cont3 bgt $s1, 0, cont2 while2: move $a0, $s1 jal swap # Restore saved registers lw $s0, ($sp) lw $s1, 4($sp) lw $s2, 8($sp) lw $s3, 12($sp) lw $s4, 16($sp) lw $s5, 20($sp) lw $s6, 24($sp) addi $s1, $s1, -1 # decrement j addi $s3, $s3, -4 # get next index values lw $s4, ($s3) lw $s5, 4($s3) sw $s0, ($sp) sw $s1, 4($sp) sw $s2, 8($sp) sw $s3, 12($sp) sw $s4, 16($sp) sw $s5, 20($sp) sw $s6, 24($sp) blt $s1, 1, cont3 # j greater than 0 cont2: bgt $s4, $s5, while2 # prev value greater than next value cont3: addi $s0, $s0, 1 # increment i blt $s0, $s2, while # i less than length go to while lw $s2, size # length la $s3, array forPrint2: lw $a0, ($s3) li $v0, 1 syscall la $a0, tab li $v0, 4 syscall addi $s3, $s3, 4 addi $s2, $s2, -1 bgt $s2, $zero, forPrint2 la $a0, endLine li $v0, 4 syscall addi $sp, $sp, 28 j main swap: la $s2, array #swap li $s0, 0 li $s1, 0 li $s3, 0 addi $s3, $a0, -1 move $s0, $s3 move $s1, $a0 sll $s0, $s0, 2 # $t0= 4 * $t0 sll $s1, $s1, 2 # $t1= 4 * $t1 add $s0, $s0, $s2 # $t0 points to the array element at index1 add $s1, $s1, $s2 # $t1 points to the array element at index2 # Perform swap. lw $s4, 0($s0) lw $s5, 0($s1) sw $s4, 0($s1) sw $s5, 0($s0) jr $ra medianMode: # Median lw $s0, size la $s2, array # if size is odd then add li $s3, 2 div $s0, $s3 # $t0 / $t1 mflo $s4 mfhi $s0 # $t3 = $t0 mod $t1 beq $s0, 0, adder bne $s0, 0, cont4 adder: sll $s4, $s4, 2 li $s5, 0 addi $s5, $s4, -4 add $s4, $s4, $s2 add $s5, $s5, $s2 lw $s5, ($s5) lw $s4, ($s4) add $s5, $s5, $s4 li $s4, 2 div $s5, $s4 # $s5 / $t1 mflo $s5 # $t2 = floor($s5 / $t1) lw $s0, size move $a0, $s5 li $v0, 1 syscall j getGo cont4: lw $s0, size srl $s0, $s0, 1 sll $s0, $s0, 2 add $s0, $s0, $s2 lw $s1, ($s0) move $a0, $s1 li $v0, 1 syscall getGo: la $a0, endLine li $v0, 4 syscall # Mode lw $s0, size la $s2, array # reg for number of times repeated li $s3, 0 # reg for number repeated lw $s4, ($s2) # counter li $s7, 0 # Two values ahead forStat: lw $s5, ($s2) lw $s6, 4($s2) beq $s5, $s6, go bne $s5, $s6, forget go: addi $s7, $s7, 1 bgt $s7, $s3, check1 beq $s7, $s3, check2 j cont5 check1: move $s4, $s5 move $s3, $s7 j cont5 check2: blt $s5, $s4, check3 j cont5 check3: move $s4, $s5 j cont5 forget: li $s7, 0 cont5: addi $s2, $s2, 4 addi $s0, $s0, -1 bgt $s0, $zero, forStat move $a0, $s4 li $v0, 1 syscall la $a0, endLine li $v0, 4 syscall j main ####################### # Data Segment ####################### .data .align 2 array: .space 1024 size: .word 0 opcode: .word 0 endLine: .asciiz "\n" tab: .asciiz "\t" display: .asciiz "Choose an option:\n" displaya: .asciiz "1 - Read an array\n" displayb: .asciiz "2 - Insertion Sort\n" displayc: .asciiz "3 - Find Median and Mode\n" displayd: .asciiz "4 - Quit\n" introString: .asciiz "Enter array size (Max. 256 elements):\n" elementString: .asciiz "Enter array elements:\n"
; A047615: Numbers that are congruent to {0, 5} mod 8. ; 0,5,8,13,16,21,24,29,32,37,40,45,48,53,56,61,64,69,72,77,80,85,88,93,96,101,104,109,112,117,120,125,128,133,136,141,144,149,152,157,160,165,168,173,176,181,184,189,192,197,200,205,208,213,216,221,224,229,232,237,240,245,248,253,256,261,264,269,272,277,280,285,288,293,296,301,304,309,312,317,320,325,328,333,336,341,344,349,352,357,360,365,368,373,376,381,384,389,392,397,400,405,408,413,416,421,424,429,432,437,440,445,448,453,456,461,464,469,472,477,480,485,488,493,496,501,504,509,512,517,520,525,528,533,536,541,544,549,552,557,560,565,568,573,576,581,584,589,592,597,600,605,608,613,616,621,624,629,632,637,640,645,648,653,656,661,664,669,672,677,680,685,688,693,696,701,704,709,712,717,720,725,728,733,736,741,744,749,752,757,760,765,768,773,776,781,784,789,792,797,800,805,808,813,816,821,824,829,832,837,840,845,848,853,856,861,864,869,872,877,880,885,888,893,896,901,904,909,912,917,920,925,928,933,936,941,944,949,952,957,960,965,968,973,976,981,984,989,992,997 mov $1,$0 mod $0,2 mul $1,4 add $1,$0
; A142654: Primes congruent to 31 mod 56. ; Submitted by Jon Maiga ; 31,199,311,367,479,647,983,1039,1151,1319,1487,1543,1823,1879,2383,2551,2663,2719,2887,2999,3167,3391,3559,3671,3727,4007,4231,4567,4679,4903,5351,5407,5519,5743,6079,6247,6359,6863,7591,7703,7759,7927,8039,8263,8431,8543,8599,9103,9439,9551,9719,9887,10111,10223,10391,10559,11119,11287,11399,11903,11959,12071,12239,12743,12799,12911,12967,13751,13807,14087,14143,14423,14479,14591,14759,14983,15263,15319,15767,15823,15991,16103,16607,16831,16943,17167,17783,17839,18119,18287,18679,18959,19183 mov $2,$0 add $2,2 pow $2,2 lpb $2 add $1,30 mov $3,$1 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,26 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe mov $0,$1 add $0,31
#include <bits/stdc++.h> using namespace std; using ElementType = char; struct TNode { char data; struct TNode *left; struct TNode *right; }; struct TNode *BinTreeFromOderings(char PreOder[], char InOder[], int n) { if (n == 0) { return NULL; } struct TNode *BT = new (struct TNode); BT->data = PreOder[0]; BT->left = NULL; BT->right = NULL; int RootIndex = 0; for ( ; RootIndex <= n - 1; ++RootIndex) { if (InOder[RootIndex] == BT->data) { break; } } BT->left = BinTreeFromOderings(PreOder + 1, InOder, RootIndex); BT->right = BinTreeFromOderings(PreOder + RootIndex + 1, InOder + RootIndex + 1, n - RootIndex - 1); return BT; } int getHeight(struct TNode* BT) { if (BT == nullptr) { return 0; } else { return max(getHeight(BT->left) + 1, getHeight(BT->right) + 1); } } int main() { int n; cin >> n; char PreOder[n+1], InOrder[n+1]; cin >> PreOder >> InOrder; struct TNode *BT = BinTreeFromOderings(PreOder, InOrder, n); cout << getHeight(BT) << endl; return 0; }
_mkdir: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: bf 01 00 00 00 mov $0x1,%edi 16: 83 ec 08 sub $0x8,%esp 19: 8b 31 mov (%ecx),%esi 1b: 8b 59 04 mov 0x4(%ecx),%ebx 1e: 83 c3 04 add $0x4,%ebx int i; if(argc < 2){ 21: 83 fe 01 cmp $0x1,%esi 24: 7e 3e jle 64 <main+0x64> 26: 8d 76 00 lea 0x0(%esi),%esi 29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi printf(2, "Usage: mkdir files...\n"); exit(); } for(i = 1; i < argc; i++){ if(mkdir(argv[i]) < 0){ 30: 83 ec 0c sub $0xc,%esp 33: ff 33 pushl (%ebx) 35: e8 f0 02 00 00 call 32a <mkdir> 3a: 83 c4 10 add $0x10,%esp 3d: 85 c0 test %eax,%eax 3f: 78 0f js 50 <main+0x50> if(argc < 2){ printf(2, "Usage: mkdir files...\n"); exit(); } for(i = 1; i < argc; i++){ 41: 83 c7 01 add $0x1,%edi 44: 83 c3 04 add $0x4,%ebx 47: 39 fe cmp %edi,%esi 49: 75 e5 jne 30 <main+0x30> printf(2, "mkdir: %s failed to create\n", argv[i]); break; } } exit(); 4b: e8 72 02 00 00 call 2c2 <exit> exit(); } for(i = 1; i < argc; i++){ if(mkdir(argv[i]) < 0){ printf(2, "mkdir: %s failed to create\n", argv[i]); 50: 50 push %eax 51: ff 33 pushl (%ebx) 53: 68 57 07 00 00 push $0x757 58: 6a 02 push $0x2 5a: e8 c1 03 00 00 call 420 <printf> break; 5f: 83 c4 10 add $0x10,%esp 62: eb e7 jmp 4b <main+0x4b> main(int argc, char *argv[]) { int i; if(argc < 2){ printf(2, "Usage: mkdir files...\n"); 64: 52 push %edx 65: 52 push %edx 66: 68 40 07 00 00 push $0x740 6b: 6a 02 push $0x2 6d: e8 ae 03 00 00 call 420 <printf> exit(); 72: e8 4b 02 00 00 call 2c2 <exit> 77: 66 90 xchg %ax,%ax 79: 66 90 xchg %ax,%ax 7b: 66 90 xchg %ax,%ax 7d: 66 90 xchg %ax,%ax 7f: 90 nop 00000080 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 80: 55 push %ebp 81: 89 e5 mov %esp,%ebp 83: 53 push %ebx 84: 8b 45 08 mov 0x8(%ebp),%eax 87: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 8a: 89 c2 mov %eax,%edx 8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 90: 83 c1 01 add $0x1,%ecx 93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 97: 83 c2 01 add $0x1,%edx 9a: 84 db test %bl,%bl 9c: 88 5a ff mov %bl,-0x1(%edx) 9f: 75 ef jne 90 <strcpy+0x10> ; return os; } a1: 5b pop %ebx a2: 5d pop %ebp a3: c3 ret a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000000b0 <strcmp>: int strcmp(const char *p, const char *q) { b0: 55 push %ebp b1: 89 e5 mov %esp,%ebp b3: 56 push %esi b4: 53 push %ebx b5: 8b 55 08 mov 0x8(%ebp),%edx b8: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) bb: 0f b6 02 movzbl (%edx),%eax be: 0f b6 19 movzbl (%ecx),%ebx c1: 84 c0 test %al,%al c3: 75 1e jne e3 <strcmp+0x33> c5: eb 29 jmp f0 <strcmp+0x40> c7: 89 f6 mov %esi,%esi c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; d0: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d3: 0f b6 02 movzbl (%edx),%eax p++, q++; d6: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx dd: 84 c0 test %al,%al df: 74 0f je f0 <strcmp+0x40> e1: 89 f1 mov %esi,%ecx e3: 38 d8 cmp %bl,%al e5: 74 e9 je d0 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; e7: 29 d8 sub %ebx,%eax } e9: 5b pop %ebx ea: 5e pop %esi eb: 5d pop %ebp ec: c3 ret ed: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) f0: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; f2: 29 d8 sub %ebx,%eax } f4: 5b pop %ebx f5: 5e pop %esi f6: 5d pop %ebp f7: c3 ret f8: 90 nop f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000100 <strlen>: uint strlen(const char *s) { 100: 55 push %ebp 101: 89 e5 mov %esp,%ebp 103: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 106: 80 39 00 cmpb $0x0,(%ecx) 109: 74 12 je 11d <strlen+0x1d> 10b: 31 d2 xor %edx,%edx 10d: 8d 76 00 lea 0x0(%esi),%esi 110: 83 c2 01 add $0x1,%edx 113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 117: 89 d0 mov %edx,%eax 119: 75 f5 jne 110 <strlen+0x10> ; return n; } 11b: 5d pop %ebp 11c: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 11d: 31 c0 xor %eax,%eax ; return n; } 11f: 5d pop %ebp 120: c3 ret 121: eb 0d jmp 130 <memset> 123: 90 nop 124: 90 nop 125: 90 nop 126: 90 nop 127: 90 nop 128: 90 nop 129: 90 nop 12a: 90 nop 12b: 90 nop 12c: 90 nop 12d: 90 nop 12e: 90 nop 12f: 90 nop 00000130 <memset>: void* memset(void *dst, int c, uint n) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp 133: 57 push %edi 134: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 137: 8b 4d 10 mov 0x10(%ebp),%ecx 13a: 8b 45 0c mov 0xc(%ebp),%eax 13d: 89 d7 mov %edx,%edi 13f: fc cld 140: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 142: 89 d0 mov %edx,%eax 144: 5f pop %edi 145: 5d pop %ebp 146: c3 ret 147: 89 f6 mov %esi,%esi 149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000150 <strchr>: char* strchr(const char *s, char c) { 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 53 push %ebx 154: 8b 45 08 mov 0x8(%ebp),%eax 157: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 15a: 0f b6 10 movzbl (%eax),%edx 15d: 84 d2 test %dl,%dl 15f: 74 1d je 17e <strchr+0x2e> if(*s == c) 161: 38 d3 cmp %dl,%bl 163: 89 d9 mov %ebx,%ecx 165: 75 0d jne 174 <strchr+0x24> 167: eb 17 jmp 180 <strchr+0x30> 169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 170: 38 ca cmp %cl,%dl 172: 74 0c je 180 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 174: 83 c0 01 add $0x1,%eax 177: 0f b6 10 movzbl (%eax),%edx 17a: 84 d2 test %dl,%dl 17c: 75 f2 jne 170 <strchr+0x20> if(*s == c) return (char*)s; return 0; 17e: 31 c0 xor %eax,%eax } 180: 5b pop %ebx 181: 5d pop %ebp 182: c3 ret 183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000190 <gets>: char* gets(char *buf, int max) { 190: 55 push %ebp 191: 89 e5 mov %esp,%ebp 193: 57 push %edi 194: 56 push %esi 195: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 196: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 198: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 19b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 19e: eb 29 jmp 1c9 <gets+0x39> cc = read(0, &c, 1); 1a0: 83 ec 04 sub $0x4,%esp 1a3: 6a 01 push $0x1 1a5: 57 push %edi 1a6: 6a 00 push $0x0 1a8: e8 2d 01 00 00 call 2da <read> if(cc < 1) 1ad: 83 c4 10 add $0x10,%esp 1b0: 85 c0 test %eax,%eax 1b2: 7e 1d jle 1d1 <gets+0x41> break; buf[i++] = c; 1b4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 1b8: 8b 55 08 mov 0x8(%ebp),%edx 1bb: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 1bd: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 1bf: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 1c3: 74 1b je 1e0 <gets+0x50> 1c5: 3c 0d cmp $0xd,%al 1c7: 74 17 je 1e0 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1c9: 8d 5e 01 lea 0x1(%esi),%ebx 1cc: 3b 5d 0c cmp 0xc(%ebp),%ebx 1cf: 7c cf jl 1a0 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1d1: 8b 45 08 mov 0x8(%ebp),%eax 1d4: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1d8: 8d 65 f4 lea -0xc(%ebp),%esp 1db: 5b pop %ebx 1dc: 5e pop %esi 1dd: 5f pop %edi 1de: 5d pop %ebp 1df: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1e0: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1e3: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1e5: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1e9: 8d 65 f4 lea -0xc(%ebp),%esp 1ec: 5b pop %ebx 1ed: 5e pop %esi 1ee: 5f pop %edi 1ef: 5d pop %ebp 1f0: c3 ret 1f1: eb 0d jmp 200 <stat> 1f3: 90 nop 1f4: 90 nop 1f5: 90 nop 1f6: 90 nop 1f7: 90 nop 1f8: 90 nop 1f9: 90 nop 1fa: 90 nop 1fb: 90 nop 1fc: 90 nop 1fd: 90 nop 1fe: 90 nop 1ff: 90 nop 00000200 <stat>: int stat(const char *n, struct stat *st) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 56 push %esi 204: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 205: 83 ec 08 sub $0x8,%esp 208: 6a 00 push $0x0 20a: ff 75 08 pushl 0x8(%ebp) 20d: e8 f0 00 00 00 call 302 <open> if(fd < 0) 212: 83 c4 10 add $0x10,%esp 215: 85 c0 test %eax,%eax 217: 78 27 js 240 <stat+0x40> return -1; r = fstat(fd, st); 219: 83 ec 08 sub $0x8,%esp 21c: ff 75 0c pushl 0xc(%ebp) 21f: 89 c3 mov %eax,%ebx 221: 50 push %eax 222: e8 f3 00 00 00 call 31a <fstat> 227: 89 c6 mov %eax,%esi close(fd); 229: 89 1c 24 mov %ebx,(%esp) 22c: e8 b9 00 00 00 call 2ea <close> return r; 231: 83 c4 10 add $0x10,%esp 234: 89 f0 mov %esi,%eax } 236: 8d 65 f8 lea -0x8(%ebp),%esp 239: 5b pop %ebx 23a: 5e pop %esi 23b: 5d pop %ebp 23c: c3 ret 23d: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 240: b8 ff ff ff ff mov $0xffffffff,%eax 245: eb ef jmp 236 <stat+0x36> 247: 89 f6 mov %esi,%esi 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000250 <atoi>: return r; } int atoi(const char *s) { 250: 55 push %ebp 251: 89 e5 mov %esp,%ebp 253: 53 push %ebx 254: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 257: 0f be 11 movsbl (%ecx),%edx 25a: 8d 42 d0 lea -0x30(%edx),%eax 25d: 3c 09 cmp $0x9,%al 25f: b8 00 00 00 00 mov $0x0,%eax 264: 77 1f ja 285 <atoi+0x35> 266: 8d 76 00 lea 0x0(%esi),%esi 269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 270: 8d 04 80 lea (%eax,%eax,4),%eax 273: 83 c1 01 add $0x1,%ecx 276: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 27a: 0f be 11 movsbl (%ecx),%edx 27d: 8d 5a d0 lea -0x30(%edx),%ebx 280: 80 fb 09 cmp $0x9,%bl 283: 76 eb jbe 270 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 285: 5b pop %ebx 286: 5d pop %ebp 287: c3 ret 288: 90 nop 289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000290 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 290: 55 push %ebp 291: 89 e5 mov %esp,%ebp 293: 56 push %esi 294: 53 push %ebx 295: 8b 5d 10 mov 0x10(%ebp),%ebx 298: 8b 45 08 mov 0x8(%ebp),%eax 29b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 29e: 85 db test %ebx,%ebx 2a0: 7e 14 jle 2b6 <memmove+0x26> 2a2: 31 d2 xor %edx,%edx 2a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 2a8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 2ac: 88 0c 10 mov %cl,(%eax,%edx,1) 2af: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 2b2: 39 da cmp %ebx,%edx 2b4: 75 f2 jne 2a8 <memmove+0x18> *dst++ = *src++; return vdst; } 2b6: 5b pop %ebx 2b7: 5e pop %esi 2b8: 5d pop %ebp 2b9: c3 ret 000002ba <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 2ba: b8 01 00 00 00 mov $0x1,%eax 2bf: cd 40 int $0x40 2c1: c3 ret 000002c2 <exit>: SYSCALL(exit) 2c2: b8 02 00 00 00 mov $0x2,%eax 2c7: cd 40 int $0x40 2c9: c3 ret 000002ca <wait>: SYSCALL(wait) 2ca: b8 03 00 00 00 mov $0x3,%eax 2cf: cd 40 int $0x40 2d1: c3 ret 000002d2 <pipe>: SYSCALL(pipe) 2d2: b8 04 00 00 00 mov $0x4,%eax 2d7: cd 40 int $0x40 2d9: c3 ret 000002da <read>: SYSCALL(read) 2da: b8 05 00 00 00 mov $0x5,%eax 2df: cd 40 int $0x40 2e1: c3 ret 000002e2 <write>: SYSCALL(write) 2e2: b8 10 00 00 00 mov $0x10,%eax 2e7: cd 40 int $0x40 2e9: c3 ret 000002ea <close>: SYSCALL(close) 2ea: b8 15 00 00 00 mov $0x15,%eax 2ef: cd 40 int $0x40 2f1: c3 ret 000002f2 <kill>: SYSCALL(kill) 2f2: b8 06 00 00 00 mov $0x6,%eax 2f7: cd 40 int $0x40 2f9: c3 ret 000002fa <exec>: SYSCALL(exec) 2fa: b8 07 00 00 00 mov $0x7,%eax 2ff: cd 40 int $0x40 301: c3 ret 00000302 <open>: SYSCALL(open) 302: b8 0f 00 00 00 mov $0xf,%eax 307: cd 40 int $0x40 309: c3 ret 0000030a <mknod>: SYSCALL(mknod) 30a: b8 11 00 00 00 mov $0x11,%eax 30f: cd 40 int $0x40 311: c3 ret 00000312 <unlink>: SYSCALL(unlink) 312: b8 12 00 00 00 mov $0x12,%eax 317: cd 40 int $0x40 319: c3 ret 0000031a <fstat>: SYSCALL(fstat) 31a: b8 08 00 00 00 mov $0x8,%eax 31f: cd 40 int $0x40 321: c3 ret 00000322 <link>: SYSCALL(link) 322: b8 13 00 00 00 mov $0x13,%eax 327: cd 40 int $0x40 329: c3 ret 0000032a <mkdir>: SYSCALL(mkdir) 32a: b8 14 00 00 00 mov $0x14,%eax 32f: cd 40 int $0x40 331: c3 ret 00000332 <chdir>: SYSCALL(chdir) 332: b8 09 00 00 00 mov $0x9,%eax 337: cd 40 int $0x40 339: c3 ret 0000033a <dup>: SYSCALL(dup) 33a: b8 0a 00 00 00 mov $0xa,%eax 33f: cd 40 int $0x40 341: c3 ret 00000342 <getpid>: SYSCALL(getpid) 342: b8 0b 00 00 00 mov $0xb,%eax 347: cd 40 int $0x40 349: c3 ret 0000034a <sbrk>: SYSCALL(sbrk) 34a: b8 0c 00 00 00 mov $0xc,%eax 34f: cd 40 int $0x40 351: c3 ret 00000352 <sleep>: SYSCALL(sleep) 352: b8 0d 00 00 00 mov $0xd,%eax 357: cd 40 int $0x40 359: c3 ret 0000035a <waitx>: SYSCALL(waitx) 35a: b8 16 00 00 00 mov $0x16,%eax 35f: cd 40 int $0x40 361: c3 ret 00000362 <getpinfo>: SYSCALL(getpinfo) 362: b8 17 00 00 00 mov $0x17,%eax 367: cd 40 int $0x40 369: c3 ret 0000036a <cps>: SYSCALL(cps) 36a: b8 18 00 00 00 mov $0x18,%eax 36f: cd 40 int $0x40 371: c3 ret 00000372 <set_priority>: 372: b8 19 00 00 00 mov $0x19,%eax 377: cd 40 int $0x40 379: c3 ret 37a: 66 90 xchg %ax,%ax 37c: 66 90 xchg %ax,%ax 37e: 66 90 xchg %ax,%ax 00000380 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 380: 55 push %ebp 381: 89 e5 mov %esp,%ebp 383: 57 push %edi 384: 56 push %esi 385: 53 push %ebx 386: 89 c6 mov %eax,%esi 388: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 38b: 8b 5d 08 mov 0x8(%ebp),%ebx 38e: 85 db test %ebx,%ebx 390: 74 7e je 410 <printint+0x90> 392: 89 d0 mov %edx,%eax 394: c1 e8 1f shr $0x1f,%eax 397: 84 c0 test %al,%al 399: 74 75 je 410 <printint+0x90> neg = 1; x = -xx; 39b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 39d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 3a4: f7 d8 neg %eax 3a6: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 3a9: 31 ff xor %edi,%edi 3ab: 8d 5d d7 lea -0x29(%ebp),%ebx 3ae: 89 ce mov %ecx,%esi 3b0: eb 08 jmp 3ba <printint+0x3a> 3b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 3b8: 89 cf mov %ecx,%edi 3ba: 31 d2 xor %edx,%edx 3bc: 8d 4f 01 lea 0x1(%edi),%ecx 3bf: f7 f6 div %esi 3c1: 0f b6 92 7c 07 00 00 movzbl 0x77c(%edx),%edx }while((x /= base) != 0); 3c8: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 3ca: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 3cd: 75 e9 jne 3b8 <printint+0x38> if(neg) 3cf: 8b 45 c4 mov -0x3c(%ebp),%eax 3d2: 8b 75 c0 mov -0x40(%ebp),%esi 3d5: 85 c0 test %eax,%eax 3d7: 74 08 je 3e1 <printint+0x61> buf[i++] = '-'; 3d9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 3de: 8d 4f 02 lea 0x2(%edi),%ecx 3e1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 3e5: 8d 76 00 lea 0x0(%esi),%esi 3e8: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 3eb: 83 ec 04 sub $0x4,%esp 3ee: 83 ef 01 sub $0x1,%edi 3f1: 6a 01 push $0x1 3f3: 53 push %ebx 3f4: 56 push %esi 3f5: 88 45 d7 mov %al,-0x29(%ebp) 3f8: e8 e5 fe ff ff call 2e2 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 3fd: 83 c4 10 add $0x10,%esp 400: 39 df cmp %ebx,%edi 402: 75 e4 jne 3e8 <printint+0x68> putc(fd, buf[i]); } 404: 8d 65 f4 lea -0xc(%ebp),%esp 407: 5b pop %ebx 408: 5e pop %esi 409: 5f pop %edi 40a: 5d pop %ebp 40b: c3 ret 40c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 410: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 412: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 419: eb 8b jmp 3a6 <printint+0x26> 41b: 90 nop 41c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000420 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 420: 55 push %ebp 421: 89 e5 mov %esp,%ebp 423: 57 push %edi 424: 56 push %esi 425: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 426: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 429: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 42c: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 42f: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 432: 89 45 d0 mov %eax,-0x30(%ebp) 435: 0f b6 1e movzbl (%esi),%ebx 438: 83 c6 01 add $0x1,%esi 43b: 84 db test %bl,%bl 43d: 0f 84 b0 00 00 00 je 4f3 <printf+0xd3> 443: 31 d2 xor %edx,%edx 445: eb 39 jmp 480 <printf+0x60> 447: 89 f6 mov %esi,%esi 449: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 450: 83 f8 25 cmp $0x25,%eax 453: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 456: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 45b: 74 18 je 475 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 45d: 8d 45 e2 lea -0x1e(%ebp),%eax 460: 83 ec 04 sub $0x4,%esp 463: 88 5d e2 mov %bl,-0x1e(%ebp) 466: 6a 01 push $0x1 468: 50 push %eax 469: 57 push %edi 46a: e8 73 fe ff ff call 2e2 <write> 46f: 8b 55 d4 mov -0x2c(%ebp),%edx 472: 83 c4 10 add $0x10,%esp 475: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 478: 0f b6 5e ff movzbl -0x1(%esi),%ebx 47c: 84 db test %bl,%bl 47e: 74 73 je 4f3 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 480: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 482: 0f be cb movsbl %bl,%ecx 485: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 488: 74 c6 je 450 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 48a: 83 fa 25 cmp $0x25,%edx 48d: 75 e6 jne 475 <printf+0x55> if(c == 'd'){ 48f: 83 f8 64 cmp $0x64,%eax 492: 0f 84 f8 00 00 00 je 590 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 498: 81 e1 f7 00 00 00 and $0xf7,%ecx 49e: 83 f9 70 cmp $0x70,%ecx 4a1: 74 5d je 500 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 4a3: 83 f8 73 cmp $0x73,%eax 4a6: 0f 84 84 00 00 00 je 530 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 4ac: 83 f8 63 cmp $0x63,%eax 4af: 0f 84 ea 00 00 00 je 59f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 4b5: 83 f8 25 cmp $0x25,%eax 4b8: 0f 84 c2 00 00 00 je 580 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4be: 8d 45 e7 lea -0x19(%ebp),%eax 4c1: 83 ec 04 sub $0x4,%esp 4c4: c6 45 e7 25 movb $0x25,-0x19(%ebp) 4c8: 6a 01 push $0x1 4ca: 50 push %eax 4cb: 57 push %edi 4cc: e8 11 fe ff ff call 2e2 <write> 4d1: 83 c4 0c add $0xc,%esp 4d4: 8d 45 e6 lea -0x1a(%ebp),%eax 4d7: 88 5d e6 mov %bl,-0x1a(%ebp) 4da: 6a 01 push $0x1 4dc: 50 push %eax 4dd: 57 push %edi 4de: 83 c6 01 add $0x1,%esi 4e1: e8 fc fd ff ff call 2e2 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4e6: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4ea: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 4ed: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4ef: 84 db test %bl,%bl 4f1: 75 8d jne 480 <printf+0x60> putc(fd, c); } state = 0; } } } 4f3: 8d 65 f4 lea -0xc(%ebp),%esp 4f6: 5b pop %ebx 4f7: 5e pop %esi 4f8: 5f pop %edi 4f9: 5d pop %ebp 4fa: c3 ret 4fb: 90 nop 4fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 500: 83 ec 0c sub $0xc,%esp 503: b9 10 00 00 00 mov $0x10,%ecx 508: 6a 00 push $0x0 50a: 8b 5d d0 mov -0x30(%ebp),%ebx 50d: 89 f8 mov %edi,%eax 50f: 8b 13 mov (%ebx),%edx 511: e8 6a fe ff ff call 380 <printint> ap++; 516: 89 d8 mov %ebx,%eax 518: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 51b: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 51d: 83 c0 04 add $0x4,%eax 520: 89 45 d0 mov %eax,-0x30(%ebp) 523: e9 4d ff ff ff jmp 475 <printf+0x55> 528: 90 nop 529: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 530: 8b 45 d0 mov -0x30(%ebp),%eax 533: 8b 18 mov (%eax),%ebx ap++; 535: 83 c0 04 add $0x4,%eax 538: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 53b: b8 73 07 00 00 mov $0x773,%eax 540: 85 db test %ebx,%ebx 542: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 545: 0f b6 03 movzbl (%ebx),%eax 548: 84 c0 test %al,%al 54a: 74 23 je 56f <printf+0x14f> 54c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 550: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 553: 8d 45 e3 lea -0x1d(%ebp),%eax 556: 83 ec 04 sub $0x4,%esp 559: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 55b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 55e: 50 push %eax 55f: 57 push %edi 560: e8 7d fd ff ff call 2e2 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 565: 0f b6 03 movzbl (%ebx),%eax 568: 83 c4 10 add $0x10,%esp 56b: 84 c0 test %al,%al 56d: 75 e1 jne 550 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 56f: 31 d2 xor %edx,%edx 571: e9 ff fe ff ff jmp 475 <printf+0x55> 576: 8d 76 00 lea 0x0(%esi),%esi 579: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 580: 83 ec 04 sub $0x4,%esp 583: 88 5d e5 mov %bl,-0x1b(%ebp) 586: 8d 45 e5 lea -0x1b(%ebp),%eax 589: 6a 01 push $0x1 58b: e9 4c ff ff ff jmp 4dc <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 590: 83 ec 0c sub $0xc,%esp 593: b9 0a 00 00 00 mov $0xa,%ecx 598: 6a 01 push $0x1 59a: e9 6b ff ff ff jmp 50a <printf+0xea> 59f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5a2: 83 ec 04 sub $0x4,%esp 5a5: 8b 03 mov (%ebx),%eax 5a7: 6a 01 push $0x1 5a9: 88 45 e4 mov %al,-0x1c(%ebp) 5ac: 8d 45 e4 lea -0x1c(%ebp),%eax 5af: 50 push %eax 5b0: 57 push %edi 5b1: e8 2c fd ff ff call 2e2 <write> 5b6: e9 5b ff ff ff jmp 516 <printf+0xf6> 5bb: 66 90 xchg %ax,%ax 5bd: 66 90 xchg %ax,%ax 5bf: 90 nop 000005c0 <free>: static Header base; static Header *freep; void free(void *ap) { 5c0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5c1: a1 20 0a 00 00 mov 0xa20,%eax static Header base; static Header *freep; void free(void *ap) { 5c6: 89 e5 mov %esp,%ebp 5c8: 57 push %edi 5c9: 56 push %esi 5ca: 53 push %ebx 5cb: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5ce: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 5d0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5d3: 39 c8 cmp %ecx,%eax 5d5: 73 19 jae 5f0 <free+0x30> 5d7: 89 f6 mov %esi,%esi 5d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 5e0: 39 d1 cmp %edx,%ecx 5e2: 72 1c jb 600 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5e4: 39 d0 cmp %edx,%eax 5e6: 73 18 jae 600 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 5e8: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5ea: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5ec: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5ee: 72 f0 jb 5e0 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5f0: 39 d0 cmp %edx,%eax 5f2: 72 f4 jb 5e8 <free+0x28> 5f4: 39 d1 cmp %edx,%ecx 5f6: 73 f0 jae 5e8 <free+0x28> 5f8: 90 nop 5f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 600: 8b 73 fc mov -0x4(%ebx),%esi 603: 8d 3c f1 lea (%ecx,%esi,8),%edi 606: 39 d7 cmp %edx,%edi 608: 74 19 je 623 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 60a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 60d: 8b 50 04 mov 0x4(%eax),%edx 610: 8d 34 d0 lea (%eax,%edx,8),%esi 613: 39 f1 cmp %esi,%ecx 615: 74 23 je 63a <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 617: 89 08 mov %ecx,(%eax) freep = p; 619: a3 20 0a 00 00 mov %eax,0xa20 } 61e: 5b pop %ebx 61f: 5e pop %esi 620: 5f pop %edi 621: 5d pop %ebp 622: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 623: 03 72 04 add 0x4(%edx),%esi 626: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 629: 8b 10 mov (%eax),%edx 62b: 8b 12 mov (%edx),%edx 62d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 630: 8b 50 04 mov 0x4(%eax),%edx 633: 8d 34 d0 lea (%eax,%edx,8),%esi 636: 39 f1 cmp %esi,%ecx 638: 75 dd jne 617 <free+0x57> p->s.size += bp->s.size; 63a: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 63d: a3 20 0a 00 00 mov %eax,0xa20 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 642: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 645: 8b 53 f8 mov -0x8(%ebx),%edx 648: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 64a: 5b pop %ebx 64b: 5e pop %esi 64c: 5f pop %edi 64d: 5d pop %ebp 64e: c3 ret 64f: 90 nop 00000650 <malloc>: return freep; } void* malloc(uint nbytes) { 650: 55 push %ebp 651: 89 e5 mov %esp,%ebp 653: 57 push %edi 654: 56 push %esi 655: 53 push %ebx 656: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 659: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 65c: 8b 15 20 0a 00 00 mov 0xa20,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 662: 8d 78 07 lea 0x7(%eax),%edi 665: c1 ef 03 shr $0x3,%edi 668: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 66b: 85 d2 test %edx,%edx 66d: 0f 84 a3 00 00 00 je 716 <malloc+0xc6> 673: 8b 02 mov (%edx),%eax 675: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 678: 39 cf cmp %ecx,%edi 67a: 76 74 jbe 6f0 <malloc+0xa0> 67c: 81 ff 00 10 00 00 cmp $0x1000,%edi 682: be 00 10 00 00 mov $0x1000,%esi 687: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 68e: 0f 43 f7 cmovae %edi,%esi 691: ba 00 80 00 00 mov $0x8000,%edx 696: 81 ff ff 0f 00 00 cmp $0xfff,%edi 69c: 0f 46 da cmovbe %edx,%ebx 69f: eb 10 jmp 6b1 <malloc+0x61> 6a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 6a8: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 6aa: 8b 48 04 mov 0x4(%eax),%ecx 6ad: 39 cf cmp %ecx,%edi 6af: 76 3f jbe 6f0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 6b1: 39 05 20 0a 00 00 cmp %eax,0xa20 6b7: 89 c2 mov %eax,%edx 6b9: 75 ed jne 6a8 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 6bb: 83 ec 0c sub $0xc,%esp 6be: 53 push %ebx 6bf: e8 86 fc ff ff call 34a <sbrk> if(p == (char*)-1) 6c4: 83 c4 10 add $0x10,%esp 6c7: 83 f8 ff cmp $0xffffffff,%eax 6ca: 74 1c je 6e8 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 6cc: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 6cf: 83 ec 0c sub $0xc,%esp 6d2: 83 c0 08 add $0x8,%eax 6d5: 50 push %eax 6d6: e8 e5 fe ff ff call 5c0 <free> return freep; 6db: 8b 15 20 0a 00 00 mov 0xa20,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 6e1: 83 c4 10 add $0x10,%esp 6e4: 85 d2 test %edx,%edx 6e6: 75 c0 jne 6a8 <malloc+0x58> return 0; 6e8: 31 c0 xor %eax,%eax 6ea: eb 1c jmp 708 <malloc+0xb8> 6ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 6f0: 39 cf cmp %ecx,%edi 6f2: 74 1c je 710 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 6f4: 29 f9 sub %edi,%ecx 6f6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 6f9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 6fc: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 6ff: 89 15 20 0a 00 00 mov %edx,0xa20 return (void*)(p + 1); 705: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 708: 8d 65 f4 lea -0xc(%ebp),%esp 70b: 5b pop %ebx 70c: 5e pop %esi 70d: 5f pop %edi 70e: 5d pop %ebp 70f: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 710: 8b 08 mov (%eax),%ecx 712: 89 0a mov %ecx,(%edx) 714: eb e9 jmp 6ff <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 716: c7 05 20 0a 00 00 24 movl $0xa24,0xa20 71d: 0a 00 00 720: c7 05 24 0a 00 00 24 movl $0xa24,0xa24 727: 0a 00 00 base.s.size = 0; 72a: b8 24 0a 00 00 mov $0xa24,%eax 72f: c7 05 28 0a 00 00 00 movl $0x0,0xa28 736: 00 00 00 739: e9 3e ff ff ff jmp 67c <malloc+0x2c>
#include "controller.h" //--------------------------------------------------------------------- t_eq2_controller::t_eq2_controller(t_eq2_model* eq2_model, t_eq2_view* eq2_view) { this->eq2_model = eq2_model; this->eq2_view = eq2_view; } //--------------------------------------------------------------------- void t_eq2_controller::read_eq2_coeficients(void) { eq2_model->set_a(eq2_view->read_a()); eq2_model->set_b(eq2_view->read_b()); eq2_model->set_c(eq2_view->read_c()); } //--------------------------------------------------------------------- void t_eq2_controller::solve(void) { eq2_model->solve(); } //--------------------------------------------------------------------- void t_eq2_controller::print_solutions(void) { eq2_view->print_solutions(eq2_model->get_x1_re(), eq2_model->get_x1_im(), eq2_model->get_x2_re(), eq2_model->get_x2_im()); } //---------------------------------------------------------------------
//===- ThreadSafetyCommon.cpp -----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // Implementation of the interfaces declared in ThreadSafetyCommon.h // //===----------------------------------------------------------------------===// #include "clang/Analysis/Analyses/ThreadSafetyCommon.h" #include "clang/AST/Attr.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/StmtCXX.h" #include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/Analyses/ThreadSafetyTIL.h" #include "clang/Analysis/Analyses/ThreadSafetyTraverse.h" #include "clang/Analysis/AnalysisContext.h" #include "clang/Analysis/CFG.h" #include "clang/Basic/OperatorKinds.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include <algorithm> #include <climits> #include <vector> using namespace clang; using namespace threadSafety; // From ThreadSafetyUtil.h std::string threadSafety::getSourceLiteralString(const clang::Expr *CE) { switch (CE->getStmtClass()) { case Stmt::IntegerLiteralClass: return cast<IntegerLiteral>(CE)->getValue().toString(10, true); case Stmt::StringLiteralClass: { std::string ret("\""); ret += cast<StringLiteral>(CE)->getString(); ret += "\""; return ret; } case Stmt::CharacterLiteralClass: case Stmt::CXXNullPtrLiteralExprClass: case Stmt::GNUNullExprClass: case Stmt::CXXBoolLiteralExprClass: case Stmt::FloatingLiteralClass: case Stmt::ImaginaryLiteralClass: case Stmt::ObjCStringLiteralClass: default: return "#lit"; } } // Return true if E is a variable that points to an incomplete Phi node. static bool isIncompletePhi(const til::SExpr *E) { if (const auto *Ph = dyn_cast<til::Phi>(E)) return Ph->status() == til::Phi::PH_Incomplete; return false; } typedef SExprBuilder::CallingContext CallingContext; til::SExpr *SExprBuilder::lookupStmt(const Stmt *S) { auto It = SMap.find(S); if (It != SMap.end()) return It->second; return nullptr; } til::SCFG *SExprBuilder::buildCFG(CFGWalker &Walker) { Walker.walk(*this); return Scfg; } static bool isCalleeArrow(const Expr *E) { const MemberExpr *ME = dyn_cast<MemberExpr>(E->IgnoreParenCasts()); return ME ? ME->isArrow() : false; } /// \brief Translate a clang expression in an attribute to a til::SExpr. /// Constructs the context from D, DeclExp, and SelfDecl. /// /// \param AttrExp The expression to translate. /// \param D The declaration to which the attribute is attached. /// \param DeclExp An expression involving the Decl to which the attribute /// is attached. E.g. the call to a function. CapabilityExpr SExprBuilder::translateAttrExpr(const Expr *AttrExp, const NamedDecl *D, const Expr *DeclExp, VarDecl *SelfDecl) { // If we are processing a raw attribute expression, with no substitutions. if (!DeclExp) return translateAttrExpr(AttrExp, nullptr); CallingContext Ctx(nullptr, D); // Examine DeclExp to find SelfArg and FunArgs, which are used to substitute // for formal parameters when we call buildMutexID later. if (const MemberExpr *ME = dyn_cast<MemberExpr>(DeclExp)) { Ctx.SelfArg = ME->getBase(); Ctx.SelfArrow = ME->isArrow(); } else if (const CXXMemberCallExpr *CE = dyn_cast<CXXMemberCallExpr>(DeclExp)) { Ctx.SelfArg = CE->getImplicitObjectArgument(); Ctx.SelfArrow = isCalleeArrow(CE->getCallee()); Ctx.NumArgs = CE->getNumArgs(); Ctx.FunArgs = CE->getArgs(); } else if (const CallExpr *CE = dyn_cast<CallExpr>(DeclExp)) { Ctx.NumArgs = CE->getNumArgs(); Ctx.FunArgs = CE->getArgs(); } else if (const CXXConstructExpr *CE = dyn_cast<CXXConstructExpr>(DeclExp)) { Ctx.SelfArg = nullptr; // Will be set below Ctx.NumArgs = CE->getNumArgs(); Ctx.FunArgs = CE->getArgs(); } else if (D && isa<CXXDestructorDecl>(D)) { // There's no such thing as a "destructor call" in the AST. Ctx.SelfArg = DeclExp; } // Hack to handle constructors, where self cannot be recovered from // the expression. if (SelfDecl && !Ctx.SelfArg) { DeclRefExpr SelfDRE(SelfDecl, false, SelfDecl->getType(), VK_LValue, SelfDecl->getLocation()); Ctx.SelfArg = &SelfDRE; // If the attribute has no arguments, then assume the argument is "this". if (!AttrExp) return translateAttrExpr(Ctx.SelfArg, nullptr); else // For most attributes. return translateAttrExpr(AttrExp, &Ctx); } // If the attribute has no arguments, then assume the argument is "this". if (!AttrExp) return translateAttrExpr(Ctx.SelfArg, nullptr); else // For most attributes. return translateAttrExpr(AttrExp, &Ctx); } /// \brief Translate a clang expression in an attribute to a til::SExpr. // This assumes a CallingContext has already been created. CapabilityExpr SExprBuilder::translateAttrExpr(const Expr *AttrExp, CallingContext *Ctx) { if (!AttrExp) return CapabilityExpr(nullptr, false); if (auto* SLit = dyn_cast<StringLiteral>(AttrExp)) { if (SLit->getString() == StringRef("*")) // The "*" expr is a universal lock, which essentially turns off // checks until it is removed from the lockset. return CapabilityExpr(new (Arena) til::Wildcard(), false); else // Ignore other string literals for now. return CapabilityExpr(nullptr, false); } bool Neg = false; if (auto *OE = dyn_cast<CXXOperatorCallExpr>(AttrExp)) { if (OE->getOperator() == OO_Exclaim) { Neg = true; AttrExp = OE->getArg(0); } } else if (auto *UO = dyn_cast<UnaryOperator>(AttrExp)) { if (UO->getOpcode() == UO_LNot) { Neg = true; AttrExp = UO->getSubExpr(); } } til::SExpr *E = translate(AttrExp, Ctx); // Trap mutex expressions like nullptr, or 0. // Any literal value is nonsense. if (!E || isa<til::Literal>(E)) return CapabilityExpr(nullptr, false); // Hack to deal with smart pointers -- strip off top-level pointer casts. if (auto *CE = dyn_cast_or_null<til::Cast>(E)) { if (CE->castOpcode() == til::CAST_objToPtr) return CapabilityExpr(CE->expr(), Neg); } return CapabilityExpr(E, Neg); } // Translate a clang statement or expression to a TIL expression. // Also performs substitution of variables; Ctx provides the context. // Dispatches on the type of S. til::SExpr *SExprBuilder::translate(const Stmt *S, CallingContext *Ctx) { if (!S) return nullptr; // Check if S has already been translated and cached. // This handles the lookup of SSA names for DeclRefExprs here. if (til::SExpr *E = lookupStmt(S)) return E; switch (S->getStmtClass()) { case Stmt::DeclRefExprClass: return translateDeclRefExpr(cast<DeclRefExpr>(S), Ctx); case Stmt::CXXThisExprClass: return translateCXXThisExpr(cast<CXXThisExpr>(S), Ctx); case Stmt::MemberExprClass: return translateMemberExpr(cast<MemberExpr>(S), Ctx); case Stmt::CallExprClass: return translateCallExpr(cast<CallExpr>(S), Ctx); case Stmt::CXXMemberCallExprClass: return translateCXXMemberCallExpr(cast<CXXMemberCallExpr>(S), Ctx); case Stmt::CXXOperatorCallExprClass: return translateCXXOperatorCallExpr(cast<CXXOperatorCallExpr>(S), Ctx); case Stmt::UnaryOperatorClass: return translateUnaryOperator(cast<UnaryOperator>(S), Ctx); case Stmt::BinaryOperatorClass: case Stmt::CompoundAssignOperatorClass: return translateBinaryOperator(cast<BinaryOperator>(S), Ctx); case Stmt::ArraySubscriptExprClass: return translateArraySubscriptExpr(cast<ArraySubscriptExpr>(S), Ctx); case Stmt::ConditionalOperatorClass: return translateAbstractConditionalOperator( cast<ConditionalOperator>(S), Ctx); case Stmt::BinaryConditionalOperatorClass: return translateAbstractConditionalOperator( cast<BinaryConditionalOperator>(S), Ctx); // We treat these as no-ops case Stmt::ParenExprClass: return translate(cast<ParenExpr>(S)->getSubExpr(), Ctx); case Stmt::ExprWithCleanupsClass: return translate(cast<ExprWithCleanups>(S)->getSubExpr(), Ctx); case Stmt::CXXBindTemporaryExprClass: return translate(cast<CXXBindTemporaryExpr>(S)->getSubExpr(), Ctx); // Collect all literals case Stmt::CharacterLiteralClass: case Stmt::CXXNullPtrLiteralExprClass: case Stmt::GNUNullExprClass: case Stmt::CXXBoolLiteralExprClass: case Stmt::FloatingLiteralClass: case Stmt::ImaginaryLiteralClass: case Stmt::IntegerLiteralClass: case Stmt::StringLiteralClass: case Stmt::ObjCStringLiteralClass: return new (Arena) til::Literal(cast<Expr>(S)); case Stmt::DeclStmtClass: return translateDeclStmt(cast<DeclStmt>(S), Ctx); default: break; } if (const CastExpr *CE = dyn_cast<CastExpr>(S)) return translateCastExpr(CE, Ctx); return new (Arena) til::Undefined(S); } til::SExpr *SExprBuilder::translateDeclRefExpr(const DeclRefExpr *DRE, CallingContext *Ctx) { const ValueDecl *VD = cast<ValueDecl>(DRE->getDecl()->getCanonicalDecl()); // Function parameters require substitution and/or renaming. if (const ParmVarDecl *PV = dyn_cast_or_null<ParmVarDecl>(VD)) { const FunctionDecl *FD = cast<FunctionDecl>(PV->getDeclContext())->getCanonicalDecl(); unsigned I = PV->getFunctionScopeIndex(); if (Ctx && Ctx->FunArgs && FD == Ctx->AttrDecl->getCanonicalDecl()) { // Substitute call arguments for references to function parameters assert(I < Ctx->NumArgs); return translate(Ctx->FunArgs[I], Ctx->Prev); } // Map the param back to the param of the original function declaration // for consistent comparisons. VD = FD->getParamDecl(I); } // For non-local variables, treat it as a reference to a named object. return new (Arena) til::LiteralPtr(VD); } til::SExpr *SExprBuilder::translateCXXThisExpr(const CXXThisExpr *TE, CallingContext *Ctx) { // Substitute for 'this' if (Ctx && Ctx->SelfArg) return translate(Ctx->SelfArg, Ctx->Prev); assert(SelfVar && "We have no variable for 'this'!"); return SelfVar; } static const ValueDecl *getValueDeclFromSExpr(const til::SExpr *E) { if (auto *V = dyn_cast<til::Variable>(E)) return V->clangDecl(); if (auto *Ph = dyn_cast<til::Phi>(E)) return Ph->clangDecl(); if (auto *P = dyn_cast<til::Project>(E)) return P->clangDecl(); if (auto *L = dyn_cast<til::LiteralPtr>(E)) return L->clangDecl(); return nullptr; } static bool hasCppPointerType(const til::SExpr *E) { auto *VD = getValueDeclFromSExpr(E); if (VD && VD->getType()->isPointerType()) return true; if (auto *C = dyn_cast<til::Cast>(E)) return C->castOpcode() == til::CAST_objToPtr; return false; } // Grab the very first declaration of virtual method D static const CXXMethodDecl *getFirstVirtualDecl(const CXXMethodDecl *D) { while (true) { D = D->getCanonicalDecl(); CXXMethodDecl::method_iterator I = D->begin_overridden_methods(), E = D->end_overridden_methods(); if (I == E) return D; // Method does not override anything D = *I; // FIXME: this does not work with multiple inheritance. } return nullptr; } til::SExpr *SExprBuilder::translateMemberExpr(const MemberExpr *ME, CallingContext *Ctx) { til::SExpr *BE = translate(ME->getBase(), Ctx); til::SExpr *E = new (Arena) til::SApply(BE); const ValueDecl *D = cast<ValueDecl>(ME->getMemberDecl()->getCanonicalDecl()); if (auto *VD = dyn_cast<CXXMethodDecl>(D)) D = getFirstVirtualDecl(VD); til::Project *P = new (Arena) til::Project(E, D); if (hasCppPointerType(BE)) P->setArrow(true); return P; } til::SExpr *SExprBuilder::translateCallExpr(const CallExpr *CE, CallingContext *Ctx, const Expr *SelfE) { if (CapabilityExprMode) { // Handle LOCK_RETURNED const FunctionDecl *FD = CE->getDirectCallee()->getMostRecentDecl(); if (LockReturnedAttr* At = FD->getAttr<LockReturnedAttr>()) { CallingContext LRCallCtx(Ctx); LRCallCtx.AttrDecl = CE->getDirectCallee(); LRCallCtx.SelfArg = SelfE; LRCallCtx.NumArgs = CE->getNumArgs(); LRCallCtx.FunArgs = CE->getArgs(); return const_cast<til::SExpr*>( translateAttrExpr(At->getArg(), &LRCallCtx).sexpr()); } } til::SExpr *E = translate(CE->getCallee(), Ctx); for (const auto *Arg : CE->arguments()) { til::SExpr *A = translate(Arg, Ctx); E = new (Arena) til::Apply(E, A); } return new (Arena) til::Call(E, CE); } til::SExpr *SExprBuilder::translateCXXMemberCallExpr( const CXXMemberCallExpr *ME, CallingContext *Ctx) { if (CapabilityExprMode) { // Ignore calls to get() on smart pointers. if (ME->getMethodDecl()->getNameAsString() == "get" && ME->getNumArgs() == 0) { auto *E = translate(ME->getImplicitObjectArgument(), Ctx); return new (Arena) til::Cast(til::CAST_objToPtr, E); // return E; } } return translateCallExpr(cast<CallExpr>(ME), Ctx, ME->getImplicitObjectArgument()); } til::SExpr *SExprBuilder::translateCXXOperatorCallExpr( const CXXOperatorCallExpr *OCE, CallingContext *Ctx) { if (CapabilityExprMode) { // Ignore operator * and operator -> on smart pointers. OverloadedOperatorKind k = OCE->getOperator(); if (k == OO_Star || k == OO_Arrow) { auto *E = translate(OCE->getArg(0), Ctx); return new (Arena) til::Cast(til::CAST_objToPtr, E); // return E; } } return translateCallExpr(cast<CallExpr>(OCE), Ctx); } til::SExpr *SExprBuilder::translateUnaryOperator(const UnaryOperator *UO, CallingContext *Ctx) { switch (UO->getOpcode()) { case UO_PostInc: case UO_PostDec: case UO_PreInc: case UO_PreDec: return new (Arena) til::Undefined(UO); case UO_AddrOf: { if (CapabilityExprMode) { // interpret &Graph::mu_ as an existential. if (DeclRefExpr* DRE = dyn_cast<DeclRefExpr>(UO->getSubExpr())) { if (DRE->getDecl()->isCXXInstanceMember()) { // This is a pointer-to-member expression, e.g. &MyClass::mu_. // We interpret this syntax specially, as a wildcard. auto *W = new (Arena) til::Wildcard(); return new (Arena) til::Project(W, DRE->getDecl()); } } } // otherwise, & is a no-op return translate(UO->getSubExpr(), Ctx); } // We treat these as no-ops case UO_Deref: case UO_Plus: return translate(UO->getSubExpr(), Ctx); case UO_Minus: return new (Arena) til::UnaryOp(til::UOP_Minus, translate(UO->getSubExpr(), Ctx)); case UO_Not: return new (Arena) til::UnaryOp(til::UOP_BitNot, translate(UO->getSubExpr(), Ctx)); case UO_LNot: return new (Arena) til::UnaryOp(til::UOP_LogicNot, translate(UO->getSubExpr(), Ctx)); // Currently unsupported case UO_Real: case UO_Imag: case UO_Extension: case UO_Coawait: return new (Arena) til::Undefined(UO); } return new (Arena) til::Undefined(UO); } til::SExpr *SExprBuilder::translateBinOp(til::TIL_BinaryOpcode Op, const BinaryOperator *BO, CallingContext *Ctx, bool Reverse) { til::SExpr *E0 = translate(BO->getLHS(), Ctx); til::SExpr *E1 = translate(BO->getRHS(), Ctx); if (Reverse) return new (Arena) til::BinaryOp(Op, E1, E0); else return new (Arena) til::BinaryOp(Op, E0, E1); } til::SExpr *SExprBuilder::translateBinAssign(til::TIL_BinaryOpcode Op, const BinaryOperator *BO, CallingContext *Ctx, bool Assign) { const Expr *LHS = BO->getLHS(); const Expr *RHS = BO->getRHS(); til::SExpr *E0 = translate(LHS, Ctx); til::SExpr *E1 = translate(RHS, Ctx); const ValueDecl *VD = nullptr; til::SExpr *CV = nullptr; if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(LHS)) { VD = DRE->getDecl(); CV = lookupVarDecl(VD); } if (!Assign) { til::SExpr *Arg = CV ? CV : new (Arena) til::Load(E0); E1 = new (Arena) til::BinaryOp(Op, Arg, E1); E1 = addStatement(E1, nullptr, VD); } if (VD && CV) return updateVarDecl(VD, E1); return new (Arena) til::Store(E0, E1); } til::SExpr *SExprBuilder::translateBinaryOperator(const BinaryOperator *BO, CallingContext *Ctx) { switch (BO->getOpcode()) { case BO_PtrMemD: case BO_PtrMemI: return new (Arena) til::Undefined(BO); case BO_Mul: return translateBinOp(til::BOP_Mul, BO, Ctx); case BO_Div: return translateBinOp(til::BOP_Div, BO, Ctx); case BO_Rem: return translateBinOp(til::BOP_Rem, BO, Ctx); case BO_Add: return translateBinOp(til::BOP_Add, BO, Ctx); case BO_Sub: return translateBinOp(til::BOP_Sub, BO, Ctx); case BO_Shl: return translateBinOp(til::BOP_Shl, BO, Ctx); case BO_Shr: return translateBinOp(til::BOP_Shr, BO, Ctx); case BO_LT: return translateBinOp(til::BOP_Lt, BO, Ctx); case BO_GT: return translateBinOp(til::BOP_Lt, BO, Ctx, true); case BO_LE: return translateBinOp(til::BOP_Leq, BO, Ctx); case BO_GE: return translateBinOp(til::BOP_Leq, BO, Ctx, true); case BO_EQ: return translateBinOp(til::BOP_Eq, BO, Ctx); case BO_NE: return translateBinOp(til::BOP_Neq, BO, Ctx); case BO_And: return translateBinOp(til::BOP_BitAnd, BO, Ctx); case BO_Xor: return translateBinOp(til::BOP_BitXor, BO, Ctx); case BO_Or: return translateBinOp(til::BOP_BitOr, BO, Ctx); case BO_LAnd: return translateBinOp(til::BOP_LogicAnd, BO, Ctx); case BO_LOr: return translateBinOp(til::BOP_LogicOr, BO, Ctx); case BO_Assign: return translateBinAssign(til::BOP_Eq, BO, Ctx, true); case BO_MulAssign: return translateBinAssign(til::BOP_Mul, BO, Ctx); case BO_DivAssign: return translateBinAssign(til::BOP_Div, BO, Ctx); case BO_RemAssign: return translateBinAssign(til::BOP_Rem, BO, Ctx); case BO_AddAssign: return translateBinAssign(til::BOP_Add, BO, Ctx); case BO_SubAssign: return translateBinAssign(til::BOP_Sub, BO, Ctx); case BO_ShlAssign: return translateBinAssign(til::BOP_Shl, BO, Ctx); case BO_ShrAssign: return translateBinAssign(til::BOP_Shr, BO, Ctx); case BO_AndAssign: return translateBinAssign(til::BOP_BitAnd, BO, Ctx); case BO_XorAssign: return translateBinAssign(til::BOP_BitXor, BO, Ctx); case BO_OrAssign: return translateBinAssign(til::BOP_BitOr, BO, Ctx); case BO_Comma: // The clang CFG should have already processed both sides. return translate(BO->getRHS(), Ctx); } return new (Arena) til::Undefined(BO); } til::SExpr *SExprBuilder::translateCastExpr(const CastExpr *CE, CallingContext *Ctx) { clang::CastKind K = CE->getCastKind(); switch (K) { case CK_LValueToRValue: { if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CE->getSubExpr())) { til::SExpr *E0 = lookupVarDecl(DRE->getDecl()); if (E0) return E0; } til::SExpr *E0 = translate(CE->getSubExpr(), Ctx); return E0; // FIXME!! -- get Load working properly // return new (Arena) til::Load(E0); } case CK_NoOp: case CK_DerivedToBase: case CK_UncheckedDerivedToBase: case CK_ArrayToPointerDecay: case CK_FunctionToPointerDecay: { til::SExpr *E0 = translate(CE->getSubExpr(), Ctx); return E0; } default: { // FIXME: handle different kinds of casts. til::SExpr *E0 = translate(CE->getSubExpr(), Ctx); if (CapabilityExprMode) return E0; return new (Arena) til::Cast(til::CAST_none, E0); } } } til::SExpr * SExprBuilder::translateArraySubscriptExpr(const ArraySubscriptExpr *E, CallingContext *Ctx) { til::SExpr *E0 = translate(E->getBase(), Ctx); til::SExpr *E1 = translate(E->getIdx(), Ctx); return new (Arena) til::ArrayIndex(E0, E1); } til::SExpr * SExprBuilder::translateAbstractConditionalOperator( const AbstractConditionalOperator *CO, CallingContext *Ctx) { auto *C = translate(CO->getCond(), Ctx); auto *T = translate(CO->getTrueExpr(), Ctx); auto *E = translate(CO->getFalseExpr(), Ctx); return new (Arena) til::IfThenElse(C, T, E); } til::SExpr * SExprBuilder::translateDeclStmt(const DeclStmt *S, CallingContext *Ctx) { DeclGroupRef DGrp = S->getDeclGroup(); for (DeclGroupRef::iterator I = DGrp.begin(), E = DGrp.end(); I != E; ++I) { if (VarDecl *VD = dyn_cast_or_null<VarDecl>(*I)) { Expr *E = VD->getInit(); til::SExpr* SE = translate(E, Ctx); // Add local variables with trivial type to the variable map QualType T = VD->getType(); if (T.isTrivialType(VD->getASTContext())) { return addVarDecl(VD, SE); } else { // TODO: add alloca } } } return nullptr; } // If (E) is non-trivial, then add it to the current basic block, and // update the statement map so that S refers to E. Returns a new variable // that refers to E. // If E is trivial returns E. til::SExpr *SExprBuilder::addStatement(til::SExpr* E, const Stmt *S, const ValueDecl *VD) { if (!E || !CurrentBB || E->block() || til::ThreadSafetyTIL::isTrivial(E)) return E; if (VD) E = new (Arena) til::Variable(E, VD); CurrentInstructions.push_back(E); if (S) insertStmt(S, E); return E; } // Returns the current value of VD, if known, and nullptr otherwise. til::SExpr *SExprBuilder::lookupVarDecl(const ValueDecl *VD) { auto It = LVarIdxMap.find(VD); if (It != LVarIdxMap.end()) { assert(CurrentLVarMap[It->second].first == VD); return CurrentLVarMap[It->second].second; } return nullptr; } // if E is a til::Variable, update its clangDecl. static void maybeUpdateVD(til::SExpr *E, const ValueDecl *VD) { if (!E) return; if (til::Variable *V = dyn_cast<til::Variable>(E)) { if (!V->clangDecl()) V->setClangDecl(VD); } } // Adds a new variable declaration. til::SExpr *SExprBuilder::addVarDecl(const ValueDecl *VD, til::SExpr *E) { maybeUpdateVD(E, VD); LVarIdxMap.insert(std::make_pair(VD, CurrentLVarMap.size())); CurrentLVarMap.makeWritable(); CurrentLVarMap.push_back(std::make_pair(VD, E)); return E; } // Updates a current variable declaration. (E.g. by assignment) til::SExpr *SExprBuilder::updateVarDecl(const ValueDecl *VD, til::SExpr *E) { maybeUpdateVD(E, VD); auto It = LVarIdxMap.find(VD); if (It == LVarIdxMap.end()) { til::SExpr *Ptr = new (Arena) til::LiteralPtr(VD); til::SExpr *St = new (Arena) til::Store(Ptr, E); return St; } CurrentLVarMap.makeWritable(); CurrentLVarMap.elem(It->second).second = E; return E; } // Make a Phi node in the current block for the i^th variable in CurrentVarMap. // If E != null, sets Phi[CurrentBlockInfo->ArgIndex] = E. // If E == null, this is a backedge and will be set later. void SExprBuilder::makePhiNodeVar(unsigned i, unsigned NPreds, til::SExpr *E) { unsigned ArgIndex = CurrentBlockInfo->ProcessedPredecessors; assert(ArgIndex > 0 && ArgIndex < NPreds); til::SExpr *CurrE = CurrentLVarMap[i].second; if (CurrE->block() == CurrentBB) { // We already have a Phi node in the current block, // so just add the new variable to the Phi node. til::Phi *Ph = dyn_cast<til::Phi>(CurrE); assert(Ph && "Expecting Phi node."); if (E) Ph->values()[ArgIndex] = E; return; } // Make a new phi node: phi(..., E) // All phi args up to the current index are set to the current value. til::Phi *Ph = new (Arena) til::Phi(Arena, NPreds); Ph->values().setValues(NPreds, nullptr); for (unsigned PIdx = 0; PIdx < ArgIndex; ++PIdx) Ph->values()[PIdx] = CurrE; if (E) Ph->values()[ArgIndex] = E; Ph->setClangDecl(CurrentLVarMap[i].first); // If E is from a back-edge, or either E or CurrE are incomplete, then // mark this node as incomplete; we may need to remove it later. if (!E || isIncompletePhi(E) || isIncompletePhi(CurrE)) { Ph->setStatus(til::Phi::PH_Incomplete); } // Add Phi node to current block, and update CurrentLVarMap[i] CurrentArguments.push_back(Ph); if (Ph->status() == til::Phi::PH_Incomplete) IncompleteArgs.push_back(Ph); CurrentLVarMap.makeWritable(); CurrentLVarMap.elem(i).second = Ph; } // Merge values from Map into the current variable map. // This will construct Phi nodes in the current basic block as necessary. void SExprBuilder::mergeEntryMap(LVarDefinitionMap Map) { assert(CurrentBlockInfo && "Not processing a block!"); if (!CurrentLVarMap.valid()) { // Steal Map, using copy-on-write. CurrentLVarMap = std::move(Map); return; } if (CurrentLVarMap.sameAs(Map)) return; // Easy merge: maps from different predecessors are unchanged. unsigned NPreds = CurrentBB->numPredecessors(); unsigned ESz = CurrentLVarMap.size(); unsigned MSz = Map.size(); unsigned Sz = std::min(ESz, MSz); for (unsigned i=0; i<Sz; ++i) { if (CurrentLVarMap[i].first != Map[i].first) { // We've reached the end of variables in common. CurrentLVarMap.makeWritable(); CurrentLVarMap.downsize(i); break; } if (CurrentLVarMap[i].second != Map[i].second) makePhiNodeVar(i, NPreds, Map[i].second); } if (ESz > MSz) { CurrentLVarMap.makeWritable(); CurrentLVarMap.downsize(Map.size()); } } // Merge a back edge into the current variable map. // This will create phi nodes for all variables in the variable map. void SExprBuilder::mergeEntryMapBackEdge() { // We don't have definitions for variables on the backedge, because we // haven't gotten that far in the CFG. Thus, when encountering a back edge, // we conservatively create Phi nodes for all variables. Unnecessary Phi // nodes will be marked as incomplete, and stripped out at the end. // // An Phi node is unnecessary if it only refers to itself and one other // variable, e.g. x = Phi(y, y, x) can be reduced to x = y. assert(CurrentBlockInfo && "Not processing a block!"); if (CurrentBlockInfo->HasBackEdges) return; CurrentBlockInfo->HasBackEdges = true; CurrentLVarMap.makeWritable(); unsigned Sz = CurrentLVarMap.size(); unsigned NPreds = CurrentBB->numPredecessors(); for (unsigned i=0; i < Sz; ++i) { makePhiNodeVar(i, NPreds, nullptr); } } // Update the phi nodes that were initially created for a back edge // once the variable definitions have been computed. // I.e., merge the current variable map into the phi nodes for Blk. void SExprBuilder::mergePhiNodesBackEdge(const CFGBlock *Blk) { til::BasicBlock *BB = lookupBlock(Blk); unsigned ArgIndex = BBInfo[Blk->getBlockID()].ProcessedPredecessors; assert(ArgIndex > 0 && ArgIndex < BB->numPredecessors()); for (til::SExpr *PE : BB->arguments()) { til::Phi *Ph = dyn_cast_or_null<til::Phi>(PE); assert(Ph && "Expecting Phi Node."); assert(Ph->values()[ArgIndex] == nullptr && "Wrong index for back edge."); til::SExpr *E = lookupVarDecl(Ph->clangDecl()); assert(E && "Couldn't find local variable for Phi node."); Ph->values()[ArgIndex] = E; } } void SExprBuilder::enterCFG(CFG *Cfg, const NamedDecl *D, const CFGBlock *First) { // Perform initial setup operations. unsigned NBlocks = Cfg->getNumBlockIDs(); Scfg = new (Arena) til::SCFG(Arena, NBlocks); // allocate all basic blocks immediately, to handle forward references. BBInfo.resize(NBlocks); BlockMap.resize(NBlocks, nullptr); // create map from clang blockID to til::BasicBlocks for (auto *B : *Cfg) { auto *BB = new (Arena) til::BasicBlock(Arena); BB->reserveInstructions(B->size()); BlockMap[B->getBlockID()] = BB; } CurrentBB = lookupBlock(&Cfg->getEntry()); auto Parms = isa<ObjCMethodDecl>(D) ? cast<ObjCMethodDecl>(D)->parameters() : cast<FunctionDecl>(D)->parameters(); for (auto *Pm : Parms) { QualType T = Pm->getType(); if (!T.isTrivialType(Pm->getASTContext())) continue; // Add parameters to local variable map. // FIXME: right now we emulate params with loads; that should be fixed. til::SExpr *Lp = new (Arena) til::LiteralPtr(Pm); til::SExpr *Ld = new (Arena) til::Load(Lp); til::SExpr *V = addStatement(Ld, nullptr, Pm); addVarDecl(Pm, V); } } void SExprBuilder::enterCFGBlock(const CFGBlock *B) { // Intialize TIL basic block and add it to the CFG. CurrentBB = lookupBlock(B); CurrentBB->reservePredecessors(B->pred_size()); Scfg->add(CurrentBB); CurrentBlockInfo = &BBInfo[B->getBlockID()]; // CurrentLVarMap is moved to ExitMap on block exit. // FIXME: the entry block will hold function parameters. // assert(!CurrentLVarMap.valid() && "CurrentLVarMap already initialized."); } void SExprBuilder::handlePredecessor(const CFGBlock *Pred) { // Compute CurrentLVarMap on entry from ExitMaps of predecessors CurrentBB->addPredecessor(BlockMap[Pred->getBlockID()]); BlockInfo *PredInfo = &BBInfo[Pred->getBlockID()]; assert(PredInfo->UnprocessedSuccessors > 0); if (--PredInfo->UnprocessedSuccessors == 0) mergeEntryMap(std::move(PredInfo->ExitMap)); else mergeEntryMap(PredInfo->ExitMap.clone()); ++CurrentBlockInfo->ProcessedPredecessors; } void SExprBuilder::handlePredecessorBackEdge(const CFGBlock *Pred) { mergeEntryMapBackEdge(); } void SExprBuilder::enterCFGBlockBody(const CFGBlock *B) { // The merge*() methods have created arguments. // Push those arguments onto the basic block. CurrentBB->arguments().reserve( static_cast<unsigned>(CurrentArguments.size()), Arena); for (auto *A : CurrentArguments) CurrentBB->addArgument(A); } void SExprBuilder::handleStatement(const Stmt *S) { til::SExpr *E = translate(S, nullptr); addStatement(E, S); } void SExprBuilder::handleDestructorCall(const VarDecl *VD, const CXXDestructorDecl *DD) { til::SExpr *Sf = new (Arena) til::LiteralPtr(VD); til::SExpr *Dr = new (Arena) til::LiteralPtr(DD); til::SExpr *Ap = new (Arena) til::Apply(Dr, Sf); til::SExpr *E = new (Arena) til::Call(Ap); addStatement(E, nullptr); } void SExprBuilder::exitCFGBlockBody(const CFGBlock *B) { CurrentBB->instructions().reserve( static_cast<unsigned>(CurrentInstructions.size()), Arena); for (auto *V : CurrentInstructions) CurrentBB->addInstruction(V); // Create an appropriate terminator unsigned N = B->succ_size(); auto It = B->succ_begin(); if (N == 1) { til::BasicBlock *BB = *It ? lookupBlock(*It) : nullptr; // TODO: set index unsigned Idx = BB ? BB->findPredecessorIndex(CurrentBB) : 0; auto *Tm = new (Arena) til::Goto(BB, Idx); CurrentBB->setTerminator(Tm); } else if (N == 2) { til::SExpr *C = translate(B->getTerminatorCondition(true), nullptr); til::BasicBlock *BB1 = *It ? lookupBlock(*It) : nullptr; ++It; til::BasicBlock *BB2 = *It ? lookupBlock(*It) : nullptr; // FIXME: make sure these arent' critical edges. auto *Tm = new (Arena) til::Branch(C, BB1, BB2); CurrentBB->setTerminator(Tm); } } void SExprBuilder::handleSuccessor(const CFGBlock *Succ) { ++CurrentBlockInfo->UnprocessedSuccessors; } void SExprBuilder::handleSuccessorBackEdge(const CFGBlock *Succ) { mergePhiNodesBackEdge(Succ); ++BBInfo[Succ->getBlockID()].ProcessedPredecessors; } void SExprBuilder::exitCFGBlock(const CFGBlock *B) { CurrentArguments.clear(); CurrentInstructions.clear(); CurrentBlockInfo->ExitMap = std::move(CurrentLVarMap); CurrentBB = nullptr; CurrentBlockInfo = nullptr; } void SExprBuilder::exitCFG(const CFGBlock *Last) { for (auto *Ph : IncompleteArgs) { if (Ph->status() == til::Phi::PH_Incomplete) simplifyIncompleteArg(Ph); } CurrentArguments.clear(); CurrentInstructions.clear(); IncompleteArgs.clear(); } /* void printSCFG(CFGWalker &Walker) { llvm::BumpPtrAllocator Bpa; til::MemRegionRef Arena(&Bpa); SExprBuilder SxBuilder(Arena); til::SCFG *Scfg = SxBuilder.buildCFG(Walker); TILPrinter::print(Scfg, llvm::errs()); } */
; A267921: Decimal representation of the n-th iteration of the "Rule 243" elementary cellular automaton starting with a single ON (black) cell. ; 1,5,29,125,509,2045,8189,32765,131069,524285,2097149,8388605,33554429,134217725,536870909,2147483645,8589934589,34359738365,137438953469,549755813885,2199023255549,8796093022205,35184372088829,140737488355325,562949953421309,2251799813685245,9007199254740989 mov $1,4 pow $1,$0 trn $1,2 mul $1,2 add $1,1
; A047281: Numbers that are congruent to {0, 3, 6} mod 7. ; 0,3,6,7,10,13,14,17,20,21,24,27,28,31,34,35,38,41,42,45,48,49,52,55,56,59,62,63,66,69,70,73,76,77,80,83,84,87,90,91,94,97,98,101,104,105,108,111,112,115,118,119,122,125,126,129,132,133,136,139,140,143,146,147,150,153,154,157,160,161,164,167,168,171,174,175,178,181,182,185,188,189,192,195,196,199,202,203,206,209,210,213,216,217,220,223,224,227,230,231,234,237,238,241,244,245,248,251,252,255,258,259,262,265,266,269,272,273,276,279,280,283,286,287,290,293,294,297,300,301,304,307,308,311,314,315,318,321,322,325,328,329,332,335,336,339,342,343,346,349,350,353,356,357,360,363,364,367,370,371,374,377,378,381,384,385,388,391,392,395,398,399,402,405,406,409,412,413,416,419,420,423,426,427,430,433,434,437,440,441,444,447,448,451,454,455,458,461,462,465,468,469,472,475,476,479,482,483,486,489,490,493,496,497,500,503,504,507,510,511,514,517,518,521,524,525,528,531,532,535,538,539,542,545,546,549,552,553,556,559,560,563,566,567,570,573,574,577,580,581 mov $2,7 mul $2,$0 mod $0,3 mov $1,$0 add $1,$0 add $1,$2 div $1,3
RocketHideoutB1F_Script: call RocketHideout1Script_44be0 call EnableAutoTextBoxDrawing ld hl, RocketHideout1TrainerHeader0 ld de, RocketHideoutB1F_ScriptPointers ld a, [wRocketHideoutB1FCurScript] call ExecuteCurMapScriptInTable ld [wRocketHideoutB1FCurScript], a ret RocketHideout1Script_44be0: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_677 jr nz, .asm_44c01 CheckEventReuseA EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_4 jr nz, .asm_44bf7 ld a, $54 jr .asm_44c03 .asm_44bf7 ld a, SFX_GO_INSIDE call PlaySound CheckEventHL EVENT_677 .asm_44c01 ld a, $e .asm_44c03 ld [wNewTileBlockID], a lb bc, 8, 12 predef_jump ReplaceTileBlock RocketHideoutB1F_ScriptPointers: dw CheckFightingMapTrainers dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle RocketHideoutB1F_TextPointers: dw RocketHideout1Text1 dw RocketHideout1Text2 dw RocketHideout1Text3 dw RocketHideout1Text4 dw RocketHideout1Text5 dw PickUpItemText dw PickUpItemText RocketHideout1TrainerHeader0: dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_0 db ($3 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_0 dw RocketHideout1BattleText2 ; TextBeforeBattle dw RocketHideout1AfterBattleTxt2 ; TextAfterBattle dw RocketHideout1EndBattleText2 ; TextEndBattle dw RocketHideout1EndBattleText2 ; TextEndBattle RocketHideout1TrainerHeader1: dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_1 db ($2 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_1 dw RocketHideout1BattleText3 ; TextBeforeBattle dw RocketHideout1AfterBattleTxt3 ; TextAfterBattle dw RocketHideout1EndBattleText3 ; TextEndBattle dw RocketHideout1EndBattleText3 ; TextEndBattle RocketHideout1TrainerHeader2: dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_2 db ($2 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_2 dw RocketHideout1BattleText4 ; TextBeforeBattle dw RocketHideout1AfterBattleTxt4 ; TextAfterBattle dw RocketHideout1EndBattleText4 ; TextEndBattle dw RocketHideout1EndBattleText4 ; TextEndBattle RocketHideout1TrainerHeader3: dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_3 db ($3 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_3 dw RocketHideout1BattleText5 ; TextBeforeBattle dw RocketHideout1AfterBattleTxt5 ; TextAfterBattle dw RocketHideout1EndBattleText5 ; TextEndBattle dw RocketHideout1EndBattleText5 ; TextEndBattle RocketHideout1TrainerHeader4: dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_4 db ($3 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_4 dw RocketHideout1BattleText6 ; TextBeforeBattle dw RocketHideout1AfterBattleTxt6 ; TextAfterBattle dw RocketHideout1EndBattleText6 ; TextEndBattle dw RocketHideout1EndBattleText6 ; TextEndBattle db $ff RocketHideout1Text1: TX_ASM ld hl, RocketHideout1TrainerHeader0 call TalkToTrainer jp TextScriptEnd RocketHideout1Text2: TX_ASM ld hl, RocketHideout1TrainerHeader1 call TalkToTrainer jp TextScriptEnd RocketHideout1Text3: TX_ASM ld hl, RocketHideout1TrainerHeader2 call TalkToTrainer jp TextScriptEnd RocketHideout1Text4: TX_ASM ld hl, RocketHideout1TrainerHeader3 call TalkToTrainer jp TextScriptEnd RocketHideout1Text5: TX_ASM ld hl, RocketHideout1TrainerHeader4 call TalkToTrainer jp TextScriptEnd RocketHideout1EndBattleText6: TX_FAR _RocketHideout1EndBattleText6 TX_ASM SetEvent EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_4 ld hl, RocketHideout1Text_44c9f ret RocketHideout1Text_44c9f: TX_BLINK db "@" RocketHideout1BattleText2: TX_FAR _RocketHideout1BattleText2 db "@" RocketHideout1EndBattleText2: TX_FAR _RocketHideout1EndBattleText2 db "@" RocketHideout1AfterBattleTxt2: TX_FAR _RocketHideout1AfterBattleTxt2 db "@" RocketHideout1BattleText3: TX_FAR _RocketHideout1BattleText3 db "@" RocketHideout1EndBattleText3: TX_FAR _RocketHideout1EndBattleText3 db "@" RocketHideout1AfterBattleTxt3: TX_FAR _RocketHideout1AfterBattleTxt3 db "@" RocketHideout1BattleText4: TX_FAR _RocketHideout1BattleText4 db "@" RocketHideout1EndBattleText4: TX_FAR _RocketHideout1EndBattleText4 db "@" RocketHideout1AfterBattleTxt4: TX_FAR _RocketHideout1AfterBattleTxt4 db "@" RocketHideout1BattleText5: TX_FAR _RocketHideout1BattleText5 db "@" RocketHideout1EndBattleText5: TX_FAR _RocketHideout1EndBattleText5 db "@" RocketHideout1AfterBattleTxt5: TX_FAR _RocketHideout1AfterBattleTxt5 db "@" RocketHideout1BattleText6: TX_FAR _RocketHideout1BattleText6 db "@" RocketHideout1AfterBattleTxt6: TX_FAR _RocketHideout1AfterBattleTxt6 db "@"
%ifdef CONFIG { "RegData": { "RAX": "0x3335785C36350000", "RBX": "0x3465785C33350000", "RCX": "0x6663785C34650332", "RDX": "0x3234785C66630F0B", "RDI": "0x3234785C32340000", "RSI": "0x3035785C32340000", "RSP": "0x3564785C30350000", "R8": "0x6532785C35640785", "R9": "0x6435785C65320000", "R10": "0x3262785C64350000", "R11": "0x6638785C32621E17", "R12": "0x3831785C66380000", "R13": "0x3434785C38310000", "R14": "0x6632785C34340000", "R15": "0x3162785C66320000" }, "MemoryRegions": { "0x100000000": "4096" } } %endif lea r15, [rel .data] mov rax, [r15 + 0] mov cl, [r15 + 2] sar ax, cl mov rbx, [r15 + 4] mov cl, [r15 + 6] sar bx, cl mov rcx, [r15 + 8] mov cl, [r15 + 10] sar cx, cl mov rdx, [r15 + 12] mov cl, [r15 + 14] sar dx, cl mov rdi, [r15 + 16] mov cl, [r15 + 18] sar di, cl mov rsi, [r15 + 20] mov cl, [r15 + 22] sar si, cl mov rsp, [r15 + 24] mov cl, [r15 + 26] sar sp, cl mov r8, [r15 + 28] mov cl, [r15 + 30] sar r8w, cl mov r9, [r15 + 32] mov cl, [r15 + 34] sar r9w, cl mov r10, [r15 + 36] mov cl, [r15 + 38] sar r10w, cl mov r11, [r15 + 40] mov cl, [r15 + 42] sar r11w, cl mov r12, [r15 + 44] mov cl, [r15 + 46] sar r12w, cl mov r13, [r15 + 48] mov cl, [r15 + 50] sar r13w, cl mov r14, [r15 + 52] mov cl, [r15 + 54] sar r14w, cl mov cl, [r15 + 58] mov r15, [r15 + 56] sar r15w, cl hlt .data: db '\x56\x53\xe4\xcf\x42\x42\x50\xd5\x2e\x5d\xb2\x8f\x18\x44\x2f\xb1' db '\xad\x88\x64\x7e\x20\x99\xb4\xf8\xa4\x34\xc7\x65\xd7\x01\x19\xc3' db '\x8c\xce\x28\x7c\x64\x65\x50\x65\xb7\xda\xaf\x08\xc0\x1f\x31\xbf' db '\x7f\xeb\xf0\x0b\xf0\x46\x4e\x72\x2c\xf8\xb4\x4b\xa9\x8d\xc9\x33'
############################################################################### # File : sllv.asm # Project : MIPS32 MUX # Author: : Grant Ayers (ayers@cs.stanford.edu) # # Standards/Formatting: # MIPS gas, soft tab, 80 column # # Description: # Test the functionality of the 'sllv' instruction. # ############################################################################### .section .test, "x" .balign 4 .set noreorder .global test .ent test test: lui $s0, 0xbfff # Load the base address 0xbffffff0 ori $s0, 0xfff0 ori $s1, $0, 1 # Prepare the 'done' status #### Test code start #### lui $t0, 0xdeaf # A = 0xdeafbeef ori $t0, 0xbeef ori $t1, $0, 12 sllv $t2, $t0, $t1 # B = 0xdeafbeef << 12 = 0xfbeef000 lui $t3, 0xfbee ori $t3, 0xf000 subu $t4, $t2, $t3 sltiu $v0, $t4, 1 #### Test code end #### sw $v0, 8($s0) # Set the test result sw $s1, 4($s0) # Set 'done' $done: jr $ra nop .end test
; A101102: Fifth partial sums of cubes (A000578). ; 1,13,82,354,1200,3432,8646,19734,41613,82225,153868,274924,472056,782952,1259700,1972884,3016497,4513773,6624046,9550750,13550680,18944640,26129610,35592570,47926125,63846081,84211128,110044792,142559824,183185200,233595912,295745736,371903169,464690733,577127850,712677498,875296864,1069492216,1300378222,1573741950,1896111789,2274831537,2718139908,3235255716,3836469000,4533238360,5338294780,6265752220,7331225265,8551954125,9946937286,11537072118,13345303752,15396782544,17719030450,20342116642,23298842701,26624937729,30359263728,34544031600,39225028128,44451854304,50278175376,56761982992,63965869825,71957317069,80808995202,90599078418,101411573136,113336661000,126471056790,140918381670,156789552205,174203185585,193286021500,214173361116,237009523608,261948320712,289153549764,318799505700,351071512497,386166474541,424293448414,465674235598,510543996600,559151887008,611761715994,668652627786,730119806637,796475205825,868048301224,945186869992,1028257794928,1117647895056,1213764783000,1317037749720,1427918677185,1546882979565,1674430573530,1811086878250,1957403845696,2113961021848,2281366639422,2460258742734,2651306345325,2855210620977,3072706128756,3304562072724,3551583596968,3814613116600,4094531685388,4392260400684,4708761846321,5045041574157,5402149624950,5781182089254,6183282709032,6609644520688,7061511540226,7540180491250,8047002576525,8583385293825,9150794296800,9750755301600,10384856040000,11054748259776,11762149773088,12508846553632,13296694883329,14127623549325,15003636092082,15926813105346,16899314588784,17923382354088,19001342485350,20135607854518,21328680692749,22583155218481,23901720323052,25287162314700,26742367721784,28270326156072,29874133236948,31556993577396,33322223832625,35173255812205,37113639656590,39147047078910,41277274672920,43508247288000,45844021472106,48288788983578,50846880372717,53522768634049,56321072930200,59246562388312,62304159969936,65498946415344,68836164263208,72321221946600,75959697966273,79757345142189,83720094944266,87854061903322,92165548103200,96661047755064,101347251854862,106231052924958,111319549840941,116620052744625,122140088044260,127887403502980,133869973416520,140096003881240,146573938153500,153312462101436,160320509750193,167607268921677,175182186969894,183054976612950,191235621862792,199734384053776,208561807971154,217728728080578,227246274859725,237125881233153,247379289111504,258018556036176,269056061930592,280504515959200,292376963495344,304686793199152,317447744206593,330673913430861,344379762977250,358580127672690,373290222711120,388525651415880,404302413120310,420636911167750,437545961032141,455046798560433,473157088338012,491894932178364,511278877738200,531327927259272,552061546438116,573499673424964,595662727953073,618571620599725,642247762180158,666713073275694,691989993897336,718101493286112,745071079851450,772922811248874,801681304598317,831371746844353,862019905259656,893652138093000,926295405363120,959977279799760,994725957933240,1030570271333880,1067539698002625,1105664373914221,1144975104714298,1185503377571722,1227281373187584,1270341977962200,1314718796321502,1360446163204206,1407559156711149,1456093610918193,1506086128854100,1557574095644788,1610595691825384,1665189906821496,1721396552601132,1779256277498700,1838810580212529,1900101823977357,1963173250913238,2028068996552326,2094834104545000,2163514541546800,2234157212287650,2306809974824850,2381521655981325,2458342066970625 lpb $0 mov $2,$0 cal $2,101097 ; a(n) = n*(n+1)*(n+2)*(n+3)*(n+4)*(2 + 4*n + n^2)/840. sub $0,1 add $1,$2 lpe add $1,1
; A007925: a(n) = n^(n+1) - (n+1)^n. ; -1,-1,-1,17,399,7849,162287,3667649,91171007,2486784401,74062575399,2395420006033,83695120256591,3143661612445145,126375169532421599,5415486851106043649,246486713303685957375,11877172892329028459041,604107995057426434824791,32347093457545958193355601,1818933570553048451362803599,107174878415004743976428761769,6603566867236834087319487357519,424678439961073471604787362241217,28456944965606318057422334010359999,1983672219242345491970468171243171249,143635905817125431934482063697696042887 mov $1,$0 add $1,1 mov $2,$0 pow $0,$1 pow $1,$2 sub $0,$1
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x14bfe, %rsi lea addresses_WC_ht+0x7a7e, %rdi nop xor %r15, %r15 mov $45, %rcx rep movsl nop nop nop nop add %r9, %r9 lea addresses_UC_ht+0x56fe, %rdx nop cmp %r14, %r14 movb $0x61, (%rdx) nop nop nop nop nop sub $10425, %r9 lea addresses_A_ht+0x133fe, %rdi sub %r15, %r15 movb $0x61, (%rdi) nop inc %rdx lea addresses_WT_ht+0x5bc4, %r15 nop nop nop nop sub $37113, %rdx mov $0x6162636465666768, %rcx movq %rcx, %xmm7 movups %xmm7, (%r15) nop nop and $61552, %rdi lea addresses_normal_ht+0xf3fe, %rsi lea addresses_WC_ht+0x14afe, %rdi nop add %rbx, %rbx mov $40, %rcx rep movsq nop nop dec %rbx lea addresses_A_ht+0x97fe, %rsi lea addresses_normal_ht+0x1667e, %rdi clflush (%rsi) nop nop nop xor %r9, %r9 mov $35, %rcx rep movsb nop nop nop nop xor $60035, %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r9 push %rbx push %rcx push %rdi push %rsi // Faulty Load lea addresses_WT+0x47fe, %rsi nop nop nop nop nop add %rbx, %rbx mov (%rsi), %r9 lea oracles, %rcx and $0xff, %r9 shlq $12, %r9 mov (%rcx,%r9,1), %r9 pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
title "Interlocked Support" ;++ ; ; Copyright (c) 1989 Microsoft Corporation ; ; Module Name: ; ; intrlfst.asm ; ; Abstract: ; ; This module implements functions to support interlocked operations. ; Interlocked operations can only operate on nonpaged data. ; ; This module implements the fast call version of the interlocked ; fuctions. ; ; Author: ; ; Ken Reneris (kenr) 5-May-1994 ; ; Environment: ; ; Any mode. ; ; Revision History: ; ;-- .386p .xlist include ks386.inc include callconv.inc ; calling convention macros include mac386.inc .list extrn _Ki486CompatibilityLock:DWORD _TEXT$00 SEGMENT DWORD PUBLIC 'CODE' ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING ;++ ; ; General Notes on Interlocked Procedures: ; ; These procedures assume that neither their code, nor any of ; the data they touch, will cause a page fault. ; ; They use spinlocks to achieve MP atomicity, iff it's an MP machine. ; (The spinlock macros generate zilch if NT_UP = 1, and ; we if out some aux code here as well.) ; ; They turn off interrupts so that they can be used for synchronization ; between ISRs and driver code. Flags are preserved so they can ; be called in special code (Like IPC interrupt handlers) that ; may have interrupts off. ; ;-- ;; align 512 page ,132 subttl "ExInterlockedAddLargeStatistic" ;++ ; ; VOID ; FASTCALL ; ExInterlockedAddLargeStatistic ( ; IN PLARGE_INTEGER Addend, ; IN ULONG Increment ; ) ; ; Routine Description: ; ; This function performs an interlocked add of an increment value to an ; addend variable of type unsigned large integer. ; ; Arguments: ; ; (ecx) Addend - Supplies a pointer to the variable whose value is ; adjusted by the increment value. ; ; (edx) Increment - Supplies the increment value that is added to the ; addend variable. ; ; Return Value: ; ; None. ; ;-- cPublicFastCall ExInterlockedAddLargeStatistic, 2 cPublicFpo 0,0 ifdef NT_UP add dword ptr [ecx], edx ; add low part of large statistic adc dword ptr [ecx+4], 0 ; add carry to high part else lock add dword ptr [ecx], edx ; add low part of large statistic jc short Eils10 ; if c, add generated a carry fstRET ExInterlockedAddLargeStatistic ; return Eils10: lock adc dword ptr [ecx+4], 0 ; add carry to high part endif fstRET ExInterlockedAddLargeStatistic ; return fstENDP ExInterlockedAddLargeStatistic page , 132 subttl "Interlocked Add Unsigned Long" ;++ ; ; ULONG ; FASTCALL ; ExfInterlockedAddUlong ( ; IN PULONG Addend, ; IN ULONG Increment, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function performs an interlocked add of an increment value to an ; addend variable of type unsinged long. The initial value of the addend ; variable is returned as the function value. ; ; It is NOT possible to mix ExInterlockedDecrementLong and ; ExInterlockedIncrementong with ExInterlockedAddUlong. ; ; ; Arguments: ; ; (ecx) Addend - Supplies a pointer to a variable whose value is to be ; adjusted by the increment value. ; ; (edx) Increment - Supplies the increment value to be added to the ; addend variable. ; ; (esp+4) Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the addend variable. ; ; Return Value: ; ; The initial value of the addend variable. ; ;-- cPublicFastCall ExfInterlockedAddUlong, 3 cPublicFpo 1, 1 ifdef NT_UP ; ; UP version of ExInterlockedAddUlong ; pushfd cli ; disable interrupts mov eax, [ecx] ; (eax)= initial addend value add [ecx], edx ; [ecx]=adjusted value popfd ; restore flags including ints fstRET ExfInterlockedAddUlong else ; ; MP version of ExInterlockedAddUlong ; pushfd mov eax, [esp+8] ; (eax) = SpinLock Eial10: cli ; disable interrupts ACQUIRE_SPINLOCK eax, <short Eial20> mov eax, [ecx] ; (eax)=initial addend value add [ecx], edx ; [ecx]=adjusted value mov edx, [esp+8] ; (edx) = SpinLock RELEASE_SPINLOCK edx popfd fstRET ExfInterlockedAddUlong Eial20: popfd pushfd SPIN_ON_SPINLOCK eax, <short Eial10> endif fstENDP ExfInterlockedAddUlong page , 132 subttl "Interlocked Insert Head List" ;++ ; ; PLIST_ENTRY ; ExfInterlockedInsertHeadList ( ; IN PLIST_ENTRY ListHead, ; IN PLIST_ENTRY ListEntry, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function inserts an entry at the head of a doubly linked list ; so that access to the list is synchronized in a multiprocessor system. ; ; N.B. The pages of data which this routine operates on MUST be ; present. No page fault is allowed in this routine. ; ; Arguments: ; ; (ecx) = ListHead - Supplies a pointer to the head of the doubly linked ; list into which an entry is to be inserted. ; ; (edx) = ListEntry - Supplies a pointer to the entry to be inserted at the ; head of the list. ; ; (esp+4) Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; Pointer to entry that was at the head of the list or NULL if the list ; was empty. ; ;-- cPublicFastCall ExfInterlockedInsertHeadList , 3 cPublicFpo 1, 1 ifndef NT_UP cPublicFpo 1, 2 push esi mov esi, [esp+8] ; Address of spinlock endif pushfd Eiih10: cli ACQUIRE_SPINLOCK esi,<short Eiih20> mov eax, LsFlink[ecx] ; (eax)->next entry in the list mov [edx]+LsFlink, eax ; store next link in entry mov [edx]+LsBlink, ecx ; store previous link in entry mov [ecx]+LsFlink, edx ; store next link in head mov [eax]+LsBlink, edx ; store previous link in next RELEASE_SPINLOCK esi popfd ifndef NT_UP pop esi endif xor eax, ecx ; return null if list was empty jz short Eiih15 xor eax, ecx Eiih15: fstRET ExfInterlockedInsertHeadList ifndef NT_UP Eiih20: popfd pushfd SPIN_ON_SPINLOCK esi, <short Eiih10> endif fstENDP ExfInterlockedInsertHeadList page , 132 subttl "Interlocked Insert Tail List" ;++ ; ; PLIST_ENTRY ; FASTCALL ; ExfInterlockedInsertTailList ( ; IN PLIST_ENTRY ListHead, ; IN PLIST_ENTRY ListEntry, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function inserts an entry at the tail of a doubly linked list ; so that access to the list is synchronized in a multiprocessor system. ; ; N.B. The pages of data which this routine operates on MUST be ; present. No page fault is allowed in this routine. ; ; Arguments: ; ; (ecx) = ListHead - Supplies a pointer to the head of the doubly linked ; list into which an entry is to be inserted. ; ; (edx) = ListEntry - Supplies a pointer to the entry to be inserted at the ; tail of the list. ; ; (esp+4) Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; Pointer to entry that was at the tail of the list or NULL if the list ; was empty. ; ;-- cPublicFastCall ExfInterlockedInsertTailList, 3 cPublicFpo 1, 1 ifndef NT_UP cPublicFpo 1, 2 push esi mov esi, [esp+8] ; Address of spinlock endif pushfd Eiit10: cli ACQUIRE_SPINLOCK esi,<short Eiit20> mov eax, LsBlink[ecx] ; (eax)->prev entry in the list mov [edx]+LsFlink, ecx ; store next link in entry mov [edx]+LsBlink, eax ; store previous link in entry mov [ecx]+LsBlink, edx ; store next link in head mov [eax]+LsFlink, edx ; store previous link in next RELEASE_SPINLOCK esi popfd ifndef NT_UP pop esi endif xor eax, ecx ; return null if list was empty jz short Eiit15 xor eax, ecx Eiit15: fstRET ExfInterlockedInsertTailList ifndef NT_UP Eiit20: popfd pushfd SPIN_ON_SPINLOCK esi, <short Eiit10> endif fstENDP ExfInterlockedInsertTailList page , 132 subttl "Interlocked Remove Head List" ;++ ; ; PLIST_ENTRY ; FASTCALL ; ExfInterlockedRemoveHeadList ( ; IN PLIST_ENTRY ListHead, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function removes an entry from the head of a doubly linked list ; so that access to the list is synchronized in a multiprocessor system. ; If there are no entries in the list, then a value of NULL is returned. ; Otherwise, the address of the entry that is removed is returned as the ; function value. ; ; N.B. The pages of data which this routine operates on MUST be ; present. No page fault is allowed in this routine. ; ; Arguments: ; ; (ecx) ListHead - Supplies a pointer to the head of the doubly linked ; list from which an entry is to be removed. ; ; (edx) Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; The address of the entry removed from the list, or NULL if the list is ; empty. ; ;-- cPublicFastCall ExfInterlockedRemoveHeadList , 2 cPublicFpo 0, 1 ifdef NT_UP ; ; UP version ; pushfd cli mov eax, [ecx]+LsFlink ; (eax)-> next entry cmp eax, ecx ; Is list empty? je short Eirh20 ; if e, list is empty, go Eirh20 mov edx, [eax]+LsFlink ; (ecx)-> next entry(after deletion) mov [ecx]+LsFlink, edx ; store address of next in head mov [edx]+LsBlink, ecx ; store address of previous in next if DBG mov [eax]+LsFlink, 0baddd0ffh mov [eax]+LsBlink, 0baddd0ffh endif popfd ; restore flags including interrupts fstRET ExfInterlockedRemoveHeadList Eirh20: popfd xor eax,eax ; (eax) = null for empty list fstRET ExfInterlockedRemoveHeadList else ; ; MP version ; Eirh40: pushfd cli ACQUIRE_SPINLOCK edx, <short Eirh60> mov eax, [ecx]+LsFlink ; (eax)-> next entry cmp eax, ecx ; Is list empty? je short Eirh50 ; if e, list is empty, go Eirh50 cPublicFpo 0,2 push ebx mov ebx, [eax]+LsFlink ; (ecx)-> next entry(after deletion) mov [ecx]+LsFlink, ebx ; store address of next in head mov [ebx]+LsBlink, ecx ; store address of previous in next if DBG mov ebx, 0badd0ffh mov [eax]+LsFlink, ebx mov [eax]+LsBlink, ebx endif RELEASE_SPINLOCK edx cPublicFpo 0, 0 pop ebx popfd ; restore flags including interrupts fstRET ExfInterlockedRemoveHeadList Eirh50: RELEASE_SPINLOCK edx popfd xor eax,eax ; (eax) = null for empty list fstRET ExfInterlockedRemoveHeadList cPublicFpo 0, 0 Eirh60: popfd SPIN_ON_SPINLOCK edx, <Eirh40> fstRET ExfInterlockedRemoveHeadList endif ; nt_up fstENDP ExfInterlockedRemoveHeadList page , 132 subttl "Interlocked Pop Entry List" ;++ ; ; PSINGLE_LIST_ENTRY ; FASTCALL ; ExfInterlockedPopEntryList ( ; IN PSINGLE_LIST_ENTRY ListHead, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function removes an entry from the front of a singly linked list ; so that access to the list is synchronized in a multiprocessor system. ; If there are no entries in the list, then a value of NULL is returned. ; Otherwise, the address of the entry that is removed is returned as the ; function value. ; ; Arguments: ; ; (ecx) = ListHead - Supplies a pointer to the head of the singly linked ; list from which an entry is to be removed. ; ; (edx) = Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; The address of the entry removed from the list, or NULL if the list is ; empty. ; ;-- cPublicFastCall ExfInterlockedPopEntryList , 2 ifdef NT_UP ; ; UP version ; cPublicFpo 0,1 pushfd cli ; disable interrupts mov eax, [ecx] ; (eax)-> next entry or eax, eax ; Is it empty? je short Eipe05 ; if e, empty list, go Eipe05 mov edx, [eax] ; (edx)->next entry (after deletion) mov [ecx], edx ; store address of next in head if DBG mov [eax], 0baddd0ffh endif cPublicFpo 0,0 popfd ; restore flags including interrupts fstRET ExfInterlockedPopEntryList ; cReturn (eax)->removed entry Eipe05: popfd xor eax,eax fstRET ExfInterlockedPopEntryList ; cReturn (eax)=NULL else ; nt_up ; ; MP Version ; cPublicFpo 0,1 Eipe10: pushfd cli ; disable interrupts ACQUIRE_SPINLOCK edx, <short Eipe30> mov eax, [ecx] ; (eax)-> next entry or eax, eax ; Is it empty? je short Eipe20 ; if e, empty list, go Eipe20 cPublicFpo 0,2 push edx ; Save SpinLock address mov edx, [eax] ; (edx)->next entry (after deletion) mov [ecx], edx ; store address of next in head pop edx ; Restore SpinLock address if DBG mov [eax], 0baddd0ffh endif RELEASE_SPINLOCK edx cPublicFpo 0,0 popfd ; restore flags including interrupts fstRET ExfInterlockedPopEntryList Eipe20: RELEASE_SPINLOCK edx popfd xor eax,eax fstRET ExfInterlockedPopEntryList Eipe30: popfd SPIN_ON_SPINLOCK edx, Eipe10 endif ; nt_up fstENDP ExfInterlockedPopEntryList page , 132 subttl "Interlocked Push Entry List" ;++ ; ; PSINGLE_LIST_ENTRY ; FASTCALL ; ExInterlockedPushEntryList ( ; IN PSINGLE_LIST_ENTRY ListHead, ; IN PSINGLE_LIST_ENTRY ListEntry, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function inserts an entry at the head of a singly linked list ; so that access to the list is synchronized in a multiprocessor system. ; ; Arguments: ; ; (ecx) ListHead - Supplies a pointer to the head of the singly linked ; list into which an entry is to be inserted. ; ; (edx) ListEntry - Supplies a pointer to the entry to be inserted at the ; head of the list. ; ; (esp+4) Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; Previous contents of ListHead. NULL implies list went from empty ; to not empty. ; ;-- cPublicFastCall ExfInterlockedPushEntryList , 3 ifdef NT_UP ; ; UP Version ; cPublicFpo 0,1 pushfd cli mov eax, [ecx] ; (eax)-> next entry (return value also) mov [edx], eax ; store address of next in new entry mov [ecx], edx ; set address of next in head cPublicFpo 0,0 popfd ; restore flags including interrupts fstRET ExfInterlockedPushEntryList else ; ; MP Version ; cPublicFpo 1,1 pushfd push edx mov edx, [esp+12] ; (edx) = SpinLock Eipl10: cli ACQUIRE_SPINLOCK edx, <short Eipl20> pop edx ; (edx)-> Entry to be pushed mov eax, [ecx] ; (eax)-> next entry (return value also) mov [edx], eax ; store address of next in new entry mov [ecx], edx ; set address of next in head mov edx, [esp+8] ; (edx) = SpinLock RELEASE_SPINLOCK edx cPublicFpo 0,0 popfd ; restore flags including interrupts fstRET ExfInterlockedPushEntryList cPublicFpo 1,2 Eipl20: pop edx popfd ; Restore interrupt state pushfd push edx mov edx, [esp+12] SPIN_ON_SPINLOCK edx, <short Eipl10> endif fstENDP ExfInterlockedPushEntryList page , 132 subttl "Interlocked Pop Entry Sequenced List" ;++ ; ; PSINGLE_LIST_ENTRY ; FASTCALL ; ExInterlockedPopEntrySList ( ; IN PSINGLE_LIST_ENTRY ListHead, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function removes an entry from the front of a sequenced singly ; linked list so that access to the list is synchronized in an MP system. ; If there are no entries in the list, then a value of NULL is returned. ; Otherwise, the address of the entry that is removed is returned as the ; function value. ; ; N.B. The cmpxchg8b instruction is only supported on some processors. ; If the host processor does not support this instruction, then ; then following code is patched to contain a jump to the normal ; pop entry code which has a compatible calling sequence and data ; structure. ; ; Arguments: ; ; (ecx) = ListHead - Supplies a pointer to the sequenced listhead from ; which an entry is to be removed. ; ; (edx) = Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; The address of the entry removed from the list, or NULL if the list is ; empty. ; ;-- cPublicFastCall ExInterlockedPopEntrySList, 2 cPublicFpo 0,2 ; ; Save nonvolatile registers and read the listhead sequence number followed ; by the listhead next link. ; ; N.B. These two dwords MUST be read exactly in this order. ; push ebx ; save nonvolatile registers push ebp ; mov ebp, ecx ; save listhead address ; ; N.B. The following code is the continuation address should a fault ; occur in the rare case described below. ; public ExpInterlockedPopEntrySListResume ExpInterlockedPopEntrySListResume: ; mov edx, [ebp] + 4 ; get current sequence number mov eax, [ebp] + 0 ; get current next link ; ; If the list is empty, then there is nothing that can be removed. ; Epop10: or eax, eax ; check if list is empty jz short Epop20 ; if z set, list is empty mov ecx, edx ; copy sequence number and depth add ecx, 0FFFFH ; adjust sequence number and depth ; ; N.B. It is possible for the following instruction to fault in the rare ; case where the first entry in the list is allocated on another ; processor and freed between the time the free pointer is read above ; and the following instruction. When this happens, the access fault ; code continues execution above at the resumption address and the ; entire operation is retried. ; public ExpInterlockedPopEntrySListFault ExpInterlockedPopEntrySListFault: ; mov ebx, [eax] ; get address of successor entry .586 ifndef NT_UP lock cmpxchg8b qword ptr [ebp] ; compare and exchange else cmpxchg8b qword ptr [ebp] ; compare and exchange endif .386 jnz short Epop10 ; if z clear, exchange failed ; ; Restore nonvolatile registers and return result. ; cPublicFpo 0,0 Epop20: pop ebp ; restore nonvolatile registers pop ebx ; fstRET ExInterlockedPopEntrySList fstENDP ExInterlockedPopEntrySList page , 132 subttl "Interlocked Push Entry Sequenced List" ;++ ; ; PSINGLE_LIST_ENTRY ; FASTCALL ; ExInterlockedPushEntrySList ( ; IN PSINGLE_LIST_ENTRY ListHead, ; IN PSINGLE_LIST_ENTRY ListEntry, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function inserts an entry at the head of a sequenced singly linked ; list so that access to the list is synchronized in an MP system. ; ; N.B. The cmpxchg8b instruction is only supported on some processors. ; If the host processor does not support this instruction, then ; then following code is patched to contain a jump to the normal ; push entry code which has a compatible calling sequence and data ; structure. ; ; Arguments: ; ; (ecx) ListHead - Supplies a pointer to the sequenced listhead into which ; an entry is to be inserted. ; ; (edx) ListEntry - Supplies a pointer to the entry to be inserted at the ; head of the list. ; ; (esp+4) Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; Previous contents of ListHead. NULL implies list went from empty ; to not empty. ; ;-- cPublicFastCall ExInterlockedPushEntrySList, 3 cPublicFpo 0,2 ; ; Save nonvolatile registers and read the listhead sequence number followed ; by the listhead next link. ; ; N.B. These two dwords MUST be read exactly in this order. ; push ebx ; save nonvolatile registers push ebp ; mov ebp, ecx ; save listhead address mov ebx, edx ; save list entry address mov edx, [ebp] + 4 ; get current sequence number mov eax, [ebp] + 0 ; get current next link Epsh10: mov [ebx], eax ; set next link in new first entry mov ecx, edx ; copy sequence number add ecx, 010001H ; increment sequence number and depth .586 ifndef NT_UP lock cmpxchg8b qword ptr [ebp] ; compare and exchange else cmpxchg8b qword ptr[ebp] ; compare and exchange endif .386 jnz short Epsh10 ; if z clear, exchange failed ; ; Restore nonvolatile registers and return result. ; cPublicFpo 0,0 pop ebp ; restore nonvolatile registers pop ebx ; fstRET ExInterlockedPushEntrySList fstENDP ExInterlockedPushEntrySList page , 132 subttl "Interlocked Flush Sequenced List" ;++ ; ; PSINGLE_LIST_ENTRY ; FASTCALL ; ExInterlockedFlushSList ( ; IN PSINGLE_LIST_ENTRY ListHead ; ) ; ; Routine Description: ; ; This function removes the entire list from a sequenced singly ; linked list so that access to the list is synchronized in an MP system. ; If there are no entries in the list, then a value of NULL is returned. ; Otherwise, the address of the entry at the top of the list is removed ; and returned as the function value and the list header is set to point ; to NULL. ; ; N.B. The cmpxchg8b instruction is only supported on some processors. ; If the host processor does not support this instruction, then ; then following code is patched to contain a jump to the normal ; pop entry code which has a compatible calling sequence and data ; structure. ; ; Arguments: ; ; (ecx) = ListHead - Supplies a pointer to the sequenced listhead from ; which the list is to be flushed. ; ; Return Value: ; ; The address of the entire current list, or NULL if the list is ; empty. ; ;-- cPublicFastCall ExInterlockedFlushSList, 1 cPublicFpo 0,1 ; ; Save nonvolatile registers and read the listhead sequence number followed ; by the listhead next link. ; ; N.B. These two dwords MUST be read exactly in this order. ; push ebx ; save nonvolatile registers push ebp ; mov ebp, ecx ; save listhead address mov edx, [ebp] + 4 ; get current sequence number mov eax, [ebp] + 0 ; get current next link ; ; N.B. The following code is the retry code should the compare ; part of the compare exchange operation fail ; ; If the list is empty, then there is nothing that can be removed. ; Efls10: or eax, eax ; check if list is empty jz short Efls20 ; if z set, list is empty mov ecx, 0 ; clear sequence number and depth mov ebx, 0 ; clear successor entry pointer .586 ifndef NT_UP lock cmpxchg8b qword ptr [ebp] ; compare and exchange else cmpxchg8b qword ptr [ebp] ; compare and exchange endif .386 jnz short Efls10 ; if z clear, exchange failed ; ; Restore nonvolatile registers and return result. ; cPublicFpo 0,0 Efls20: pop ebp ; restore nonvolatile registers pop ebx ; fstRET ExInterlockedFlushSList fstENDP ExInterlockedFlushSList page , 132 subttl "Interlocked Pop Entry SList - Alternate" ;++ ; ; PSINGLE_LIST_ENTRY ; FASTCALL ; ExfInterlockedPopEntrySList ( ; IN PSINGLE_LIST_ENTRY ListHead, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function removes an entry from the front of a sequenced singly ; linked list so that access to the list is synchronized in an MP system. ; If there are no entries in the list, then a value of NULL is returned. ; Otherwise, the address of the entry that is removed is returned as the ; function value. ; ; N.B. The cmpxchg8b instruction is only supported on some processors. ; If the host processor does not support this instruction, then ; this function is used inplace of ExInterlockedPopEntrySList. ; ; Arguments: ; ; (ecx) = ListHead - Supplies a pointer to the sequenced listhead from ; which an entry is to be removed. ; ; (edx) = Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; The address of the entry removed from the list, or NULL if the list is ; empty. ; ; ;-- cPublicFastCall ExfInterlockedPopEntrySList, 2 cPublicFpo 0,1 Efpo10: pushfd ; save flags cli ; disable interrupts ifndef NT_UP ACQUIRE_SPINLOCK edx, <short Efpo30> ; acquire spinlock endif mov eax, [ecx] ; get current next link or eax, eax ; check if list is empty jz short Efpo20 ; if z set, list is empty push [eax] ; get address of successor list pop [ecx] ; store address of next in head dec dword ptr [ecx] + 4 ; decrement list depth Efpo20: ; ifndef NT_UP RELEASE_SPINLOCK edx ; release spinlock endif cPublicFpo 0,0 popfd ; restore flags fstRET ExfInterlockedPopEntrySList ifndef NT_UP cPublicFpo 0,0 Efpo30: popfd ; restore flags SPIN_ON_SPINLOCK edx, Efpo10 ; spin until lock is free endif fstENDP ExfInterlockedPopEntrySList page , 132 subttl "Interlocked Push Entry SList - Alternate" ;++ ; ; PSINGLE_LIST_ENTRY ; FASTCALL ; ExInterlockedPushEntrySList ( ; IN PSINGLE_LIST_ENTRY ListHead, ; IN PSINGLE_LIST_ENTRY ListEntry, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function inserts an entry at the head of a sequenced singly linked ; list so that access to the list is synchronized in an MP system. ; ; N.B. The cmpxchg8b instruction is only supported on some processors. ; If the host processor does not support this instruction, then ; this function is used inplace of ExInterlockedPushEntrySList. ; ; Arguments: ; ; (ecx) ListHead - Supplies a pointer to the sequenced listhead into which ; an entry is to be inserted. ; ; (edx) ListEntry - Supplies a pointer to the entry to be inserted at the ; head of the list. ; ; (esp+4) Lock - Supplies a pointer to a spin lock to be used to synchronize ; access to the list. ; ; Return Value: ; ; Previous contents of ListHead. NULL implies list went from empty ; to not empty. ;-- cPublicFastCall ExfInterlockedPushEntrySList, 3 cPublicFpo 0,1 Efph10: pushfd ; save flags cli ; disable interrupts ifndef NT_UP mov eax, [esp] + 8 ; get spinlock address ACQUIRE_SPINLOCK eax, <short Efph20> ; acquire spinlock endif push [ecx] ; get current next link pop [edx] ; store address of next in new entry mov [ecx], edx ; set address of next in head inc dword ptr [ecx] + 4 ; increment list depth ifndef NT_UP RELEASE_SPINLOCK eax ; release spinlock endif cPublicFpo 0,0 popfd ; restore flags fstRET ExfInterlockedPushEntrySList ifndef NT_UP cPublicFpo 0,0 Efph20: popfd ; restore flags SPIN_ON_SPINLOCK eax, <short Efph10> ; spin until lock is free endif fstENDP ExfInterlockedPushEntrySList page , 132 subttl "Interlocked Flush SList - Alternate" ;++ ; ; PSINGLE_LIST_ENTRY ; FASTCALL ; ExfInterlockedFlushSList ( ; IN PSINGLE_LIST_ENTRY ListHead ; ) ; ; Routine Description: ; ; This function returns a pointer to the entire SLIST on the specified list. ; Access to the list is synchronized in an MP system. ; If there are no entries in the list, then a value of NULL is returned. ; Otherwise, the address of the entry at the beginning of the list is returned ; and the entire list is removed from the slist. ; ; N.B. The cmpxchg8b instruction is only supported on some processors. ; If the host processor does not support this instruction, then ; this function is used inplace of ExInterlockedFlushSList. ; ; Arguments: ; ; (ecx) = ListHead - Supplies a pointer to the sequenced listhead from ; which an entry is to be removed. ; ; Return Value: ; ; The address of the entries removed from the list, or NULL if the list is ; empty. ; ; ;-- cPublicFastCall ExfInterlockedFlushSList, 1 cPublicFpo 0,1 ifndef NT_UP lea edx, _Ki486CompatibilityLock ; get 486 compatiblity lock address endif Effl10: pushfd ; save flags cli ; disable interrupts ifndef NT_UP ACQUIRE_SPINLOCK edx, <short Effl30> ; acquire spinlock endif mov eax, [ecx] ; get current next link or eax, eax ; check if list is empty jz short Effl20 ; if z set, list is empty mov dword ptr [ecx], 0 ; clear the list pointer (empty list) mov dword ptr [ecx] + 4, 0 ; clear the list depth (empty list) Effl20: ; ifndef NT_UP RELEASE_SPINLOCK edx ; release spinlock endif cPublicFpo 0,0 popfd ; restore flags fstRET ExfInterlockedFlushSList ifndef NT_UP cPublicFpo 0,0 Effl30: popfd ; restore flags SPIN_ON_SPINLOCK edx, Effl10 ; spin until lock is free endif fstENDP ExfInterlockedFlushSList page , 132 subttl "Interlocked i386 Increment Long" ;++ ; ; INTERLOCKED_RESULT ; FASTCALL ; Exfi386InterlockedIncrementLong ( ; IN PLONG Addend ; ) ; ; Routine Description: ; ; This function atomically increments Addend, returning an ennumerated ; type which indicates what interesting transitions in the value of ; Addend occurred due the operation. ; ; See ExInterlockedIncrementLong. This function is the i386 ; architectural specific version of ExInterlockedIncrementLong. ; No source directly calls this function, instead ; ExInterlockedIncrementLong is called and when built on x86 these ; calls are macroed to the i386 optimized version. ; ; Arguments: ; ; (ecx) Addend - Pointer to variable to increment. ; ; Return Value: ; ; An ennumerated type: ; ; ResultNegative if Addend is < 0 after increment. ; ResultZero if Addend is = 0 after increment. ; ResultPositive if Addend is > 0 after increment. ; ;-- cPublicFastCall Exfi386InterlockedIncrementLong, 1 cPublicFpo 0, 0 ifdef NT_UP add dword ptr [ecx],1 else lock add dword ptr [ecx],1 endif lahf ; (ah) = flags and eax,EFLAG_SELECT ; clear all but sign and zero flags fstRET Exfi386InterlockedIncrementLong fstENDP Exfi386InterlockedIncrementLong page , 132 subttl "Interlocked i386 Decrement Long" ;++ ; ; INTERLOCKED_RESULT ; FASTCALL ; Exfi386InterlockedDecrementLong ( ; IN PLONG Addend, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function atomically decrements Addend, returning an ennumerated ; type which indicates what interesting transitions in the value of ; Addend occurred due the operation. ; ; See Exi386InterlockedDecrementLong. This function is the i386 ; architectural specific version of ExInterlockedDecrementLong. ; No source directly calls this function, instead ; ExInterlockedDecrementLong is called and when built on x86 these ; calls are macroed to the i386 optimized version. ; ; Arguments: ; ; Addend (esp+4) - Pointer to variable to decrement. ; ; Lock (esp+8) - Spinlock used to implement atomicity. ; (not actually used on x86) ; ; Return Value: ; ; An ennumerated type: ; ; ResultNegative if Addend is < 0 after decrement. ; ResultZero if Addend is = 0 after decrement. ; ResultPositive if Addend is > 0 after decrement. ; ;-- cPublicFastCall Exfi386InterlockedDecrementLong , 1 cPublicFpo 0, 0 ifdef NT_UP sub dword ptr [ecx], 1 else lock sub dword ptr [ecx], 1 endif lahf ; (ah) = flags and eax, EFLAG_SELECT ; clear all but sign and zero flags fstRET Exfi386InterlockedDecrementLong fstENDP Exfi386InterlockedDecrementLong page , 132 subttl "Interlocked i386 Exchange Ulong" ;++ ; ; ULONG ; FASTCALL ; Exfi386InterlockedExchangeUlong ( ; IN PULONG Target, ; IN ULONG Value ; ) ; ; Routine Description: ; ; This function atomically exchanges the Target and Value, returning ; the prior contents of Target ; ; See Exi386InterlockedExchangeUlong. This function is the i386 ; architectural specific version of ExInterlockedDecrementLong. ; No source directly calls this function, instead ; ExInterlockedDecrementLong is called and when built on x86 these ; calls are macroed to the i386 optimized version. ; ; Arguments: ; ; (ecx) = Source - Address of ULONG to exchange ; (edx) = Value - New value of ULONG ; ; Return Value: ; ; The prior value of Source ;-- cPublicFastCall Exfi386InterlockedExchangeUlong, 2 cPublicFpo 0,0 cPublicFastCall InterlockedExchange, 2 .486 ifndef NT_UP xchg [ecx], edx ; make the exchange mov eax, edx else mov eax, [ecx] ; get comperand value Ixchg: cmpxchg [ecx], edx ; compare and swap jnz Ixchg ; if nz, exchange failed endif .386 fstRET Exfi386InterlockedExchangeUlong fstENDP InterlockedExchange fstENDP Exfi386InterlockedExchangeUlong ;++ ; ; LONG ; InterlockedIncrement( ; IN PLONG Addend ; ) ; ; Routine Description: ; ; This function performs an interlocked add of one to the addend variable. ; ; No checking is done for overflow. ; ; Arguments: ; ; Addend (ecx) - Supplies a pointer to a variable whose value is to be ; incremented by one. ; ; Return Value: ; ; (eax) - The incremented value. ; ;-- cPublicFastCall InterlockedIncrement,1 cPublicFpo 0,0 mov eax, 1 ; set increment value .486 ifndef NT_UP lock xadd [ecx], eax ; interlocked increment else xadd [ecx], eax ; interlocked increment endif .386p inc eax ; adjust return value fstRET InterlockedIncrement fstENDP InterlockedIncrement page , 132 subttl "InterlockedDecrment" ;++ ; ; LONG ; InterlockedDecrement( ; IN PLONG Addend ; ) ; ; Routine Description: ; ; This function performs an interlocked add of -1 to the addend variable. ; ; No checking is done for overflow ; ; Arguments: ; ; Addend (ecx) - Supplies a pointer to a variable whose value is to be ; decremented by one. ; ; Return Value: ; ; (eax) - The decremented value. ; ;-- cPublicFastCall InterlockedDecrement,1 cPublicFpo 0,0 mov eax, -1 ; set decrment value .486 ifndef NT_UP lock xadd [ecx], eax ; interlocked decrement else xadd [ecx], eax ; interlocked decrement endif .386 dec eax ; adjust return value fstRET InterlockedDecrement fstENDP InterlockedDecrement page , 132 subttl "Interlocked Compare Exchange" ;++ ; ; PVOID ; FASTCALL ; InterlockedCompareExchange ( ; IN OUT PVOID *Destination, ; IN PVOID Exchange, ; IN PVOID Comperand ; ) ; ; Routine Description: ; ; This function performs an interlocked compare of the destination ; value with the comperand value. If the destination value is equal ; to the comperand value, then the exchange value is stored in the ; destination. Otherwise, no operation is performed. ; ; Arguments: ; ; (ecx) Destination - Supplies a pointer to destination value. ; ; (edx) Exchange - Supplies the exchange value. ; ; [esp + 4] Comperand - Supplies the comperand value. ; ; Return Value: ; ; The initial destination value is returned as the function value. ; ;-- cPublicFastCall InterlockedCompareExchange, 3 cPublicFpo 0,0 mov eax, [esp + 4] ; set comperand value .486 ifndef NT_UP lock cmpxchg [ecx], edx ; compare and exchange else cmpxchg [ecx], edx ; compare and exchange endif .386 fstRET InterlockedCompareExchange fstENDP InterlockedCompareExchange page , 132 subttl "Interlocked Compare Exchange 64-bits" ;++ ; ; LONGLONG ; FASTCALL ; ExInterlockedCompareExchange64 ( ; IN PLONGLONG Destination, ; IN PLONGLONG Exchange, ; IN PLONGLONG Comperand, ; IN PKSPIN_LOCK Lock ; ) ; ; Routine Description: ; ; This function performs a compare and exchange of 64-bits. ; ; N.B. The cmpxchg8b instruction is only supported on some processors. ; If the host processor does not support this instruction, then ; then following code is patched to contain a jump to the normal ; compare exchange 64-bit code which has a compatible calling ; sequence and data structure. ; ; Arguments: ; ; (ecx) Destination - Supplies a pointer to the destination variable. ; ; (edx) Exchange - Supplies a pointer to the exchange value. ; ; (esp+4) Comperand - Supplies a pointer to the comperand value. ; ; (esp+4) Lock - Supplies a pointer to a spin lock to use if the cmpxchg8b ; instruction is not available on the host system. ; ; Return Value: ; ; The current destination value is returned as the function value. ; ;-- cPublicFastCall ExInterlockedCompareExchange64, 4 cPublicFpo 0,2 ; ; Save nonvolatile registers and read the exchange and comperand values. ; push ebx ; save nonvolatile registers push ebp ; mov ebp, ecx ; set destination address mov ebx, [edx] ; get exchange value mov ecx, [edx] + 4 ; mov edx, [esp] + 12 ; get comperand address mov eax, [edx] ; get comperand value mov edx, [edx] + 4 ; .586 ifndef NT_UP lock cmpxchg8b qword ptr [ebp] ; compare and exchange else cmpxchg8b qword ptr[ebp] ; compare and exchange endif .386 ; ; Restore nonvolatile registers and return result in edx:eax. ; cPublicFpo 0,0 pop ebp ; restore nonvolatile registers pop ebx ; fstRET ExInterlockedCompareExchange64 fstENDP ExInterlockedCompareExchange64 ; ; The following version of the compare exchange 64-bits function is used ; when the host processor does not support the cmpxchg8 instruction. ; cPublicFastCall ExpInterlockedCompareExchange64, 4 cPublicFpo 0,2 ; ; Save nonvolatile registers and read the exchange and comperand values. ; push ebx ; save nonvolatile registers push ebp ; mov ebp, ecx ; set destination address mov ebx, [edx] ; get exchange value mov ecx, [edx] + 4 ; mov edx, [esp] + 12 ; get comperand address mov eax, [edx] ; get comperand value mov edx, [edx] + 4 ; ifndef NT_UP cPublicFpo 0,4 push esi ; save register pushfd ; save flags mov esi, [esp] + 24 ; get address of lock Eicx10: cli ; disable interrupts ACQUIRE_SPINLOCK esi, <short Eicx40> ; acquire spinlock else cPublicFpo 0,3 pushfd ; save flags cli ; disable interrupts endif cmp eax, [ebp] ; compare current with comperand jne short Eicx30 ; if ne, low part mismatch cmp edx, [ebp] + 4 ; compare current with comperand jne short Eicx30 ; if ne, high part mismatch mov [ebp], ebx ; store exchange value mov [ebp] + 4, ecx ; ; ; Restore nonvolatile registers and return result in edx:eax. ; cPublicFpo 0,0 ifndef NT_UP Eicx20: RELEASE_SPINLOCK esi ; release spin lock popfd ; restore flags pop esi ; restore register else Eicx20: popfd ; restore flags endif pop ebp ; restore nonvolatile registers pop ebx ; fstRET ExpInterlockedCompareExchange64 ; ; The current and comperand values mismatch. Return the current destination ; value. ; Eicx30: mov eax, [ebp] ; get current destination value mov edx, [ebp] + 4 ; jmp short Eicx20 ; ; ; The spinlock is currently owned. ; ifndef NT_UP Eicx40: popfd ; restore flags pushfd ; save flags SPIN_ON_SPINLOCK esi, <short Eicx10> ; spin until lock free endif fstENDP ExpInterlockedCompareExchange64 page , 132 subttl "Interlocked Exchange Add" ;++ ; ; LONG ; FASTCALL ; InterlockedExchangeAdd ( ; IN OUT PLONG Addend, ; IN LONG Increment ; ) ; ; Routine Description: ; ; This function performs an interlocked add of an increment value to an ; addend variable of type unsinged long. The initial value of the addend ; variable is returned as the function value. ; ; It is NOT possible to mix ExInterlockedDecrementLong and ; ExInterlockedIncrementong with ExInterlockedAddUlong. ; ; ; Arguments: ; ; (ecx) Addend - Supplies a pointer to a variable whose value is to be ; adjusted by the increment value. ; ; (edx) Increment - Supplies the increment value to be added to the ; addend variable. ; ; Return Value: ; ; The initial value of the addend variable. ; ;-- cPublicFastCall InterlockedExchangeAdd, 2 cPublicFpo 0,0 .486 ifndef NT_UP lock xadd [ecx], edx ; exchange add else xadd [ecx], edx ; exchange add endif .386 mov eax, edx ; set initial value fstRET InterlockedExchangeAdd fstENDP InterlockedExchangeAdd _TEXT$00 ends end 
; A118304: Start with 25 and repeatedly reverse the digits and add 1 to get the next term. ; 25,53,36,64,47,75,58,86,69,97,80,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2 mov $2,$0 mov $0,25 lpb $2 seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences). add $0,1 sub $2,1 lpe
; void outp_callee(uint port, uchar byte) ; 09.2005 aralbrec SECTION code_clib PUBLIC outp_callee PUBLIC _outp_callee PUBLIC ASMDISP_OUTP_CALLEE .outp_callee ._outp_callee pop af pop de pop bc push af .asmentry ; bc = port ; e = byte IF __CPU_R2K__|__CPU_R3K__ ld h,b ld l,c ld a,e defb 0d3h ; ioi ld (hl),a ELSE out (c),e ENDIF ret DEFC ASMDISP_OUTP_CALLEE = asmentry - outp_callee
; ; file: sub1.asm ; Subprogram example program ; ; To create executable: ; Using djgpp: ; nasm -f coff sub1.asm ; gcc -o sub1 sub1.o driver.c asm_io.o ; %include "asm_io.inc" segment .data prompt1 db "Enter a number: ", 0 ; don't forget nul terminator prompt2 db "Enter another number: ", 0 outmsg1 db "You entered ", 0 outmsg2 db " and ", 0 outmsg3 db ", the sum of these is ", 0 segment .bss ; ; These labels refer to double words used to store the inputs ; input1 resd 1 input2 resd 1 segment .text global asm_main asm_main: enter 0,0 ; setup routine pusha mov eax, prompt1 ; print out prompt call print_string mov ebx, input1 ; store address of input1 into ebx mov ecx, ret1 ; store return address into ecx jmp short get_int ; read integer ret1: mov eax, prompt2 ; print out prompt call print_string mov ebx, input2 mov ecx, $ + 7 ; ecx = this address + 7 jmp short get_int mov eax, [input1] ; eax = dword at input1 add eax, [input2] ; eax += dword at input2 mov ebx, eax ; ebx = eax ; ; next print out result message as series of steps ; mov eax, outmsg1 call print_string ; print out first message mov eax, [input1] call print_int ; print out input1 mov eax, outmsg2 call print_string ; print out second message mov eax, [input2] call print_int ; print out input2 mov eax, outmsg3 call print_string ; print out third message mov eax, ebx call print_int ; print out sum (ebx) call print_nl ; print new-line popa mov eax, 0 ; return back to C leave ret ; ; subprogram get_int ; Parameters: ; ebx - address of dword to store integer into ; ecx - address of instruction to return to ; Notes: ; value of eax is destroyed get_int: call read_int mov [ebx], eax ; store input into memory jmp ecx ; jump back to caller
; sprite ids ; OverworldSprites indexes (see data/sprites/sprites.asm) const_def const SPRITE_NONE ; 00 const SPRITE_LUCAS ; 01 const SPRITE_LUCAS_BIKE ; 02 const SPRITE_GAMEBOY_KID ; 03 const SPRITE_RIVAL ; 04 const SPRITE_OAK ; 05 const SPRITE_RED ; 06 const SPRITE_BLUE ; 07 const SPRITE_BILL ; 08 const SPRITE_ELDER ; 09 const SPRITE_JANINE ; 0a const SPRITE_KURT ; 0b const SPRITE_MOM ; 0c const SPRITE_BLAINE ; 0d const SPRITE_REDS_MOM ; 0e const SPRITE_DAISY ; 0f const SPRITE_ROWAN ; 10 const SPRITE_WILL ; 11 const SPRITE_ROARK ; 12 const SPRITE_WHITNEY ; 13 const SPRITE_GARDENIA ; 14 const SPRITE_MORTY ; 15 const SPRITE_CHUCK ; 16 const SPRITE_JASMINE ; 17 const SPRITE_PRYCE ; 18 const SPRITE_VOLKNER ; 19 const SPRITE_WORKER ; 1a const SPRITE_KAREN ; 1b const SPRITE_BRUNO ; 1c const SPRITE_VETERAN ; 1d const SPRITE_CYNTHIA ; 1e const SPRITE_SURGE ; 1f const SPRITE_ERIKA ; 20 const SPRITE_KOGA ; 21 const SPRITE_SABRINA ; 22 const SPRITE_COOLTRAINER_M ; 23 const SPRITE_COOLTRAINER_F ; 24 const SPRITE_BUG_CATCHER ; 25 const SPRITE_TWIN ; 26 const SPRITE_YOUNGSTER ; 27 const SPRITE_LASS ; 28 const SPRITE_TEACHER ; 29 const SPRITE_BUENA ; 2a const SPRITE_SUPER_NERD ; 2b const SPRITE_ROCKER ; 2c const SPRITE_POKEFAN_M ; 2d const SPRITE_POKEFAN_F ; 2e const SPRITE_GRAMPS ; 2f const SPRITE_GRANNY ; 30 const SPRITE_SWIMMER_GUY ; 31 const SPRITE_SWIMMER_GIRL ; 32 const SPRITE_BIG_SNORLAX ; 33 const SPRITE_SURFING_PIKACHU ; 34 const SPRITE_GALACTIC_M ; 35 const SPRITE_ROCKET_GIRL ; 36 const SPRITE_NURSE ; 37 const SPRITE_LINK_RECEPTIONIST ; 38 const SPRITE_CLERK ; 39 const SPRITE_FISHER ; 3a const SPRITE_FISHING_GURU ; 3b const SPRITE_SCIENTIST ; 3c const SPRITE_CYRUS ; 3d const SPRITE_SAGE ; 3e const SPRITE_UNUSED_GUY ; 3f const SPRITE_GENTLEMAN ; 40 const SPRITE_BLACK_BELT ; 41 const SPRITE_RECEPTIONIST ; 42 const SPRITE_OFFICER ; 43 const SPRITE_CAL ; 44 const SPRITE_SLOWPOKE ; 45 const SPRITE_CAPTAIN ; 46 const SPRITE_BIG_LAPRAS ; 47 const SPRITE_GYM_GUY ; 48 const SPRITE_SAILOR ; 49 const SPRITE_BIKER ; 4a const SPRITE_CLOWN ; 4b const SPRITE_MONSTER ; 4c const SPRITE_FAIRY ; 4d const SPRITE_BIRD ; 4e const SPRITE_DRAGON ; 4f const SPRITE_BIG_ONIX ; 50 const SPRITE_N64 ; 51 const SPRITE_SUDOWOODO ; 52 const SPRITE_SURF ; 53 const SPRITE_POKE_BALL ; 54 const SPRITE_POKEDEX ; 55 const SPRITE_PAPER ; 56 const SPRITE_VIRTUAL_BOY ; 57 const SPRITE_OLD_LINK_RECEPTIONIST ; 58 const SPRITE_ROCK ; 59 const SPRITE_BOULDER ; 5a const SPRITE_SNES ; 5b const SPRITE_BRIEFCASE ; 5c const SPRITE_FRUIT_TREE ; 5d const SPRITE_GOLD_TROPHY ; 5e const SPRITE_SILVER_TROPHY ; 5f const SPRITE_DAWN ; 60 const SPRITE_DAWN_BIKE ; 61 const SPRITE_KURT_OUTSIDE ; 62 const SPRITE_SUICUNE ; 63 const SPRITE_ENTEI ; 64 const SPRITE_RAIKOU ; 65 const SPRITE_STANDING_YOUNGSTER ; 66 const SPRITE_SCIENTIST_F ; 67 const SPRITE_2X2_ANIM_LOW ; 68 const SPRITE_2X2_ANIM_HIGH ; 69 ; SpriteMons indexes (see data/sprites/sprite_mons.asm) const_def $80 SPRITE_POKEMON EQU const_value const SPRITE_UNOWN ; 80 const SPRITE_GEODUDE ; 81 const SPRITE_GROWLITHE ; 82 const SPRITE_WEEDLE ; 83 const SPRITE_SHELLDER ; 84 const SPRITE_ODDISH ; 85 const SPRITE_GENGAR ; 86 const SPRITE_ZUBAT ; 87 const SPRITE_MAGIKARP ; 88 const SPRITE_SQUIRTLE ; 89 const SPRITE_TOGEPI ; 8a const SPRITE_BUTTERFREE ; 8b const SPRITE_DIGLETT ; 8c const SPRITE_POLIWAG ; 8d const SPRITE_PIKACHU ; 8e const SPRITE_CLEFAIRY ; 8f const SPRITE_CHARMANDER ; 90 const SPRITE_JYNX ; 91 const SPRITE_STARMIE ; 92 const SPRITE_BULBASAUR ; 93 const SPRITE_JIGGLYPUFF ; 94 const SPRITE_GRIMER ; 95 const SPRITE_EKANS ; 96 const SPRITE_PARAS ; 97 const SPRITE_TENTACOOL ; 98 const SPRITE_TAUROS ; 99 const SPRITE_MACHOP ; 9a const SPRITE_VOLTORB ; 9b const SPRITE_LAPRAS ; 9c const SPRITE_RHYDON ; 9d const SPRITE_MOLTRES ; 9e const SPRITE_SNORLAX ; 9f const SPRITE_GYARADOS ; a0 const SPRITE_LUGIA ; a1 const SPRITE_HO_OH ; a2 ; special GetMonSprite values (see engine/overworld/overworld.asm) const_def $e0 const SPRITE_DAY_CARE_MON_1 ; e0 const SPRITE_DAY_CARE_MON_2 ; e1 ; wVariableSprites indexes (see wram.asm) const_def $f0 SPRITE_VARS EQU const_value const SPRITE_CONSOLE ; f0 const SPRITE_DOLL_1 ; f1 const SPRITE_DOLL_2 ; f2 const SPRITE_BIG_DOLL ; f3 const SPRITE_DAWN_LUCAS ; f4 const SPRITE_DAWN_LUCAS2 ; f5 const SPRITE_CLOWN_GALACTIC ; f6 const SPRITE_CLOWN_ROWAN ; f7
// Copyright (c) 2011-2015 The Bitcoin Core developers // Copyright (c) 2014-2017 The Dash Core developers // Copyright (c) 2017-2018 The GoByte Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "coincontroldialog.h" #include "ui_coincontroldialog.h" #include "addresstablemodel.h" #include "bitcoinunits.h" #include "guiutil.h" #include "optionsmodel.h" #include "platformstyle.h" #include "txmempool.h" #include "walletmodel.h" #include "wallet/coincontrol.h" #include "init.h" #include "policy/policy.h" #include "validation.h" // For mempool #include "wallet/wallet.h" #include "instantx.h" #include "privatesend-client.h" #include <boost/assign/list_of.hpp> // for 'map_list_of()' #include <QApplication> #include <QCheckBox> #include <QCursor> #include <QDialogButtonBox> #include <QFlags> #include <QIcon> #include <QSettings> #include <QString> #include <QTreeWidget> #include <QTreeWidgetItem> QList<CAmount> CoinControlDialog::payAmounts; CCoinControl* CoinControlDialog::coinControl = new CCoinControl(); bool CoinControlDialog::fSubtractFeeFromAmount = false; bool CCoinControlWidgetItem::operator<(const QTreeWidgetItem &other) const { int column = treeWidget()->sortColumn(); if (column == CoinControlDialog::COLUMN_AMOUNT || column == CoinControlDialog::COLUMN_DATE || column == CoinControlDialog::COLUMN_CONFIRMATIONS || column == CoinControlDialog::COLUMN_PRIVATESEND_ROUNDS) return data(column, Qt::UserRole).toLongLong() < other.data(column, Qt::UserRole).toLongLong(); return QTreeWidgetItem::operator<(other); } CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent), ui(new Ui::CoinControlDialog), model(0), platformStyle(_platformStyle) { ui->setupUi(this); /* Open CSS when configured */ this->setStyleSheet(GUIUtil::loadStyleSheet()); // context menu actions QAction *copyAddressAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); copyTransactionHashAction = new QAction(tr("Copy transaction ID"), this); // we need to enable/disable this lockAction = new QAction(tr("Lock unspent"), this); // we need to enable/disable this unlockAction = new QAction(tr("Unlock unspent"), this); // we need to enable/disable this // context menu contextMenu = new QMenu(this); contextMenu->addAction(copyAddressAction); contextMenu->addAction(copyLabelAction); contextMenu->addAction(copyAmountAction); contextMenu->addAction(copyTransactionHashAction); contextMenu->addSeparator(); contextMenu->addAction(lockAction); contextMenu->addAction(unlockAction); // context menu signals connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash())); connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin())); connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin())); // clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this); QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this); QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this); QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity())); connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount())); connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee())); connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee())); connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes())); connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput())); connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange())); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); ui->labelCoinControlAmount->addAction(clipboardAmountAction); ui->labelCoinControlFee->addAction(clipboardFeeAction); ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction); ui->labelCoinControlBytes->addAction(clipboardBytesAction); ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction); ui->labelCoinControlChange->addAction(clipboardChangeAction); // toggle tree/list mode connect(ui->radioTreeMode, SIGNAL(toggled(bool)), this, SLOT(radioTreeMode(bool))); connect(ui->radioListMode, SIGNAL(toggled(bool)), this, SLOT(radioListMode(bool))); // click on checkbox connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(viewItemChanged(QTreeWidgetItem*, int))); // click on header #if QT_VERSION < 0x050000 ui->treeWidget->header()->setClickable(true); #else ui->treeWidget->header()->setSectionsClickable(true); #endif connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); // ok button connect(ui->buttonBox, SIGNAL(clicked( QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*))); // (un)select all connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); // Toggle lock state connect(ui->pushButtonToggleLock, SIGNAL(clicked()), this, SLOT(buttonToggleLockClicked())); // change coin control first column label due Qt4 bug. // see https://github.com/bitcoin/bitcoin/issues/5716 ui->treeWidget->headerItem()->setText(COLUMN_CHECKBOX, QString()); ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 84); ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 100); ui->treeWidget->setColumnWidth(COLUMN_LABEL, 170); ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 190); ui->treeWidget->setColumnWidth(COLUMN_PRIVATESEND_ROUNDS, 88); ui->treeWidget->setColumnWidth(COLUMN_DATE, 80); ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 100); ui->treeWidget->setColumnHidden(COLUMN_TXHASH, true); // store transaction hash in this column, but don't show it ui->treeWidget->setColumnHidden(COLUMN_VOUT_INDEX, true); // store vout index in this column, but don't show it // default view is sorted by amount desc sortView(COLUMN_AMOUNT, Qt::DescendingOrder); // restore list mode and sortorder as a convenience feature QSettings settings; if (settings.contains("nCoinControlMode") && !settings.value("nCoinControlMode").toBool()) ui->radioTreeMode->click(); if (settings.contains("nCoinControlSortColumn") && settings.contains("nCoinControlSortOrder")) sortView(settings.value("nCoinControlSortColumn").toInt(), ((Qt::SortOrder)settings.value("nCoinControlSortOrder").toInt())); } CoinControlDialog::~CoinControlDialog() { QSettings settings; settings.setValue("nCoinControlMode", ui->radioListMode->isChecked()); settings.setValue("nCoinControlSortColumn", sortColumn); settings.setValue("nCoinControlSortOrder", (int)sortOrder); delete ui; } void CoinControlDialog::setModel(WalletModel *_model) { this->model = _model; if(_model && _model->getOptionsModel() && _model->getAddressTableModel()) { updateView(); updateLabelLocked(); CoinControlDialog::updateLabels(_model, this); } } // ok button void CoinControlDialog::buttonBoxClicked(QAbstractButton* button) { if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) done(QDialog::Accepted); // closes the dialog } // (un)select all void CoinControlDialog::buttonSelectAllClicked() { Qt::CheckState state = Qt::Checked; for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) { if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != Qt::Unchecked) { state = Qt::Unchecked; break; } } ui->treeWidget->setEnabled(false); for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state) ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state); ui->treeWidget->setEnabled(true); if (state == Qt::Unchecked) coinControl->UnSelectAll(); // just to be sure CoinControlDialog::updateLabels(model, this); } // Toggle lock state void CoinControlDialog::buttonToggleLockClicked() { QTreeWidgetItem *item; QString theme = GUIUtil::getThemeName(); // Works in list-mode only if(ui->radioListMode->isChecked()){ ui->treeWidget->setEnabled(false); for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++){ item = ui->treeWidget->topLevelItem(i); COutPoint outpt(uint256S(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt()); if (model->isLockedCoin(uint256S(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt())){ model->unlockCoin(outpt); item->setDisabled(false); item->setIcon(COLUMN_CHECKBOX, QIcon()); } else{ model->lockCoin(outpt); item->setDisabled(true); item->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/" + theme + "/lock_closed")); } updateLabelLocked(); } ui->treeWidget->setEnabled(true); CoinControlDialog::updateLabels(model, this); } else{ QMessageBox msgBox; msgBox.setObjectName("lockMessageBox"); msgBox.setStyleSheet(GUIUtil::loadStyleSheet()); msgBox.setText(tr("Please switch to \"List mode\" to use this function.")); msgBox.exec(); } } // context menu void CoinControlDialog::showMenu(const QPoint &point) { QTreeWidgetItem *item = ui->treeWidget->itemAt(point); if(item) { contextMenuItem = item; // disable some items (like Copy Transaction ID, lock, unlock) for tree roots in context menu if (item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode) { copyTransactionHashAction->setEnabled(true); if (model->isLockedCoin(uint256S(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt())) { lockAction->setEnabled(false); unlockAction->setEnabled(true); } else { lockAction->setEnabled(true); unlockAction->setEnabled(false); } } else // this means click on parent node in tree mode -> disable all { copyTransactionHashAction->setEnabled(false); lockAction->setEnabled(false); unlockAction->setEnabled(false); } // show context menu contextMenu->exec(QCursor::pos()); } } // context menu action: copy amount void CoinControlDialog::copyAmount() { GUIUtil::setClipboard(BitcoinUnits::removeSpaces(contextMenuItem->text(COLUMN_AMOUNT))); } // context menu action: copy label void CoinControlDialog::copyLabel() { if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_LABEL).length() == 0 && contextMenuItem->parent()) GUIUtil::setClipboard(contextMenuItem->parent()->text(COLUMN_LABEL)); else GUIUtil::setClipboard(contextMenuItem->text(COLUMN_LABEL)); } // context menu action: copy address void CoinControlDialog::copyAddress() { if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_ADDRESS).length() == 0 && contextMenuItem->parent()) GUIUtil::setClipboard(contextMenuItem->parent()->text(COLUMN_ADDRESS)); else GUIUtil::setClipboard(contextMenuItem->text(COLUMN_ADDRESS)); } // context menu action: copy transaction id void CoinControlDialog::copyTransactionHash() { GUIUtil::setClipboard(contextMenuItem->text(COLUMN_TXHASH)); } // context menu action: lock coin void CoinControlDialog::lockCoin() { QString theme = GUIUtil::getThemeName(); if (contextMenuItem->checkState(COLUMN_CHECKBOX) == Qt::Checked) contextMenuItem->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); COutPoint outpt(uint256S(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt()); model->lockCoin(outpt); contextMenuItem->setDisabled(true); contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/" + theme + "/lock_closed")); updateLabelLocked(); } // context menu action: unlock coin void CoinControlDialog::unlockCoin() { COutPoint outpt(uint256S(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt()); model->unlockCoin(outpt); contextMenuItem->setDisabled(false); contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon()); updateLabelLocked(); } // copy label "Quantity" to clipboard void CoinControlDialog::clipboardQuantity() { GUIUtil::setClipboard(ui->labelCoinControlQuantity->text()); } // copy label "Amount" to clipboard void CoinControlDialog::clipboardAmount() { GUIUtil::setClipboard(ui->labelCoinControlAmount->text().left(ui->labelCoinControlAmount->text().indexOf(" "))); } // copy label "Fee" to clipboard void CoinControlDialog::clipboardFee() { GUIUtil::setClipboard(ui->labelCoinControlFee->text().left(ui->labelCoinControlFee->text().indexOf(" ")).replace(ASYMP_UTF8, "")); } // copy label "After fee" to clipboard void CoinControlDialog::clipboardAfterFee() { GUIUtil::setClipboard(ui->labelCoinControlAfterFee->text().left(ui->labelCoinControlAfterFee->text().indexOf(" ")).replace(ASYMP_UTF8, "")); } // copy label "Bytes" to clipboard void CoinControlDialog::clipboardBytes() { GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace(ASYMP_UTF8, "")); } // copy label "Dust" to clipboard void CoinControlDialog::clipboardLowOutput() { GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text()); } // copy label "Change" to clipboard void CoinControlDialog::clipboardChange() { GUIUtil::setClipboard(ui->labelCoinControlChange->text().left(ui->labelCoinControlChange->text().indexOf(" ")).replace(ASYMP_UTF8, "")); } // treeview: sort void CoinControlDialog::sortView(int column, Qt::SortOrder order) { sortColumn = column; sortOrder = order; ui->treeWidget->sortItems(column, order); ui->treeWidget->header()->setSortIndicator(sortColumn, sortOrder); } // treeview: clicked on header void CoinControlDialog::headerSectionClicked(int logicalIndex) { if (logicalIndex == COLUMN_CHECKBOX) // click on most left column -> do nothing { ui->treeWidget->header()->setSortIndicator(sortColumn, sortOrder); } else { if (sortColumn == logicalIndex) sortOrder = ((sortOrder == Qt::AscendingOrder) ? Qt::DescendingOrder : Qt::AscendingOrder); else { sortColumn = logicalIndex; sortOrder = ((sortColumn == COLUMN_LABEL || sortColumn == COLUMN_ADDRESS) ? Qt::AscendingOrder : Qt::DescendingOrder); // if label or address then default => asc, else default => desc } sortView(sortColumn, sortOrder); } } // toggle tree mode void CoinControlDialog::radioTreeMode(bool checked) { if (checked && model) updateView(); } // toggle list mode void CoinControlDialog::radioListMode(bool checked) { if (checked && model) updateView(); } // checkbox clicked by user void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column) { if (column == COLUMN_CHECKBOX && item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode) { COutPoint outpt(uint256S(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt()); if (item->checkState(COLUMN_CHECKBOX) == Qt::Unchecked) coinControl->UnSelect(outpt); else if (item->isDisabled()) // locked (this happens if "check all" through parent node) item->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); else { coinControl->Select(outpt); int nRounds = pwalletMain->GetOutpointPrivateSendRounds(outpt); if (coinControl->fUsePrivateSend && nRounds < privateSendClient.nPrivateSendRounds) { QMessageBox::warning(this, windowTitle(), tr("Non-anonymized input selected. <b>PrivateSend will be disabled.</b><br><br>If you still want to use PrivateSend, please deselect all non-nonymized inputs first and then check PrivateSend checkbox again."), QMessageBox::Ok, QMessageBox::Ok); coinControl->fUsePrivateSend = false; } } // selection changed -> update labels if (ui->treeWidget->isEnabled()) // do not update on every click for (un)select all CoinControlDialog::updateLabels(model, this); } // TODO: Remove this temporary qt5 fix after Qt5.3 and Qt5.4 are no longer used. // Fixed in Qt5.5 and above: https://bugreports.qt.io/browse/QTBUG-43473 #if QT_VERSION >= 0x050000 else if (column == COLUMN_CHECKBOX && item->childCount() > 0) { if (item->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked && item->child(0)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked) item->setCheckState(COLUMN_CHECKBOX, Qt::Checked); } #endif } // shows count of locked unspent outputs void CoinControlDialog::updateLabelLocked() { std::vector<COutPoint> vOutpts; model->listLockedCoins(vOutpts); if (vOutpts.size() > 0) { ui->labelLocked->setText(tr("(%1 locked)").arg(vOutpts.size())); ui->labelLocked->setVisible(true); } else ui->labelLocked->setVisible(false); } void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) { if (!model) return; // nPayAmount CAmount nPayAmount = 0; bool fDust = false; CMutableTransaction txDummy; Q_FOREACH(const CAmount &amount, CoinControlDialog::payAmounts) { nPayAmount += amount; if (amount > 0) { CTxOut txout(amount, (CScript)std::vector<unsigned char>(24, 0)); txDummy.vout.push_back(txout); if (txout.IsDust(dustRelayFee)) fDust = true; } } CAmount nAmount = 0; CAmount nPayFee = 0; CAmount nAfterFee = 0; CAmount nChange = 0; unsigned int nBytes = 0; unsigned int nBytesInputs = 0; double dPriority = 0; double dPriorityInputs = 0; unsigned int nQuantity = 0; int nQuantityUncompressed = 0; bool fAllowFree = false; std::vector<COutPoint> vCoinControl; std::vector<COutput> vOutputs; coinControl->ListSelected(vCoinControl); model->getOutputs(vCoinControl, vOutputs); BOOST_FOREACH(const COutput& out, vOutputs) { // unselect already spent, very unlikely scenario, this could happen // when selected are spent elsewhere, like rpc or another computer uint256 txhash = out.tx->GetHash(); COutPoint outpt(txhash, out.i); if (model->isSpent(outpt)) { coinControl->UnSelect(outpt); continue; } // Quantity nQuantity++; // Amount nAmount += out.tx->tx->vout[out.i].nValue; // Priority dPriorityInputs += (double)out.tx->tx->vout[out.i].nValue * (out.nDepth+1); // Bytes CTxDestination address; if(ExtractDestination(out.tx->tx->vout[out.i].scriptPubKey, address)) { CPubKey pubkey; CKeyID *keyid = boost::get<CKeyID>(&address); if (keyid && model->getPubKey(*keyid, pubkey)) { nBytesInputs += (pubkey.IsCompressed() ? 148 : 180); if (!pubkey.IsCompressed()) nQuantityUncompressed++; } else nBytesInputs += 148; // in all error cases, simply assume 148 here } else nBytesInputs += 148; // Add inputs to calculate InstantSend Fee later if(coinControl->fUseInstantSend) txDummy.vin.push_back(CTxIn()); } // calculation if (nQuantity > 0) { // Bytes nBytes = nBytesInputs + ((CoinControlDialog::payAmounts.size() > 0 ? CoinControlDialog::payAmounts.size() + 1 : 2) * 34) + 10; // always assume +1 output for change here // in the subtract fee from amount case, we can tell if zero change already and subtract the bytes, so that fee calculation afterwards is accurate if (CoinControlDialog::fSubtractFeeFromAmount) if (nAmount - nPayAmount == 0) nBytes -= 34; // Fee nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool); if (nPayFee > 0 && coinControl->nMinimumTotalFee > nPayFee) nPayFee = coinControl->nMinimumTotalFee; // InstantSend Fee if (coinControl->fUseInstantSend) nPayFee = std::max(nPayFee, CTxLockRequest(txDummy).GetMinFee()); // Allow free? (require at least hard-coded threshold and default to that if no estimate) double mempoolEstimatePriority = mempool.estimateSmartPriority(nTxConfirmTarget); dPriority = dPriorityInputs / (nBytes - nBytesInputs + (nQuantityUncompressed * 29)); // 29 = 180 - 151 (uncompressed public keys are over the limit. max 151 bytes of the input are ignored for priority) double dPriorityNeeded = std::max(mempoolEstimatePriority, AllowFreeThreshold()); fAllowFree = (dPriority >= dPriorityNeeded); if (fSendFreeTransactions) if (fAllowFree && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE) nPayFee = 0; if (nPayAmount > 0) { nChange = nAmount - nPayAmount; if (!CoinControlDialog::fSubtractFeeFromAmount) nChange -= nPayFee; // PrivateSend Fee = overpay if(coinControl->fUsePrivateSend && nChange > 0) { nPayFee += nChange; nChange = 0; } // Never create dust outputs; if we would, just add the dust to the fee. if (nChange > 0 && nChange < MIN_CHANGE) { CTxOut txout(nChange, (CScript)std::vector<unsigned char>(24, 0)); if (txout.IsDust(dustRelayFee)) { if (CoinControlDialog::fSubtractFeeFromAmount) // dust-change will be raised until no dust nChange = txout.GetDustThreshold(dustRelayFee); else { nPayFee += nChange; nChange = 0; } } } if (nChange == 0 && !CoinControlDialog::fSubtractFeeFromAmount) nBytes -= 34; } // after fee nAfterFee = std::max<CAmount>(nAmount - nPayFee, 0); } // actually update labels int nDisplayUnit = BitcoinUnits::GBX; if (model && model->getOptionsModel()) nDisplayUnit = model->getOptionsModel()->getDisplayUnit(); QLabel *l1 = dialog->findChild<QLabel *>("labelCoinControlQuantity"); QLabel *l2 = dialog->findChild<QLabel *>("labelCoinControlAmount"); QLabel *l3 = dialog->findChild<QLabel *>("labelCoinControlFee"); QLabel *l4 = dialog->findChild<QLabel *>("labelCoinControlAfterFee"); QLabel *l5 = dialog->findChild<QLabel *>("labelCoinControlBytes"); QLabel *l7 = dialog->findChild<QLabel *>("labelCoinControlLowOutput"); QLabel *l8 = dialog->findChild<QLabel *>("labelCoinControlChange"); // enable/disable "dust" and "change" dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setEnabled(nPayAmount > 0); dialog->findChild<QLabel *>("labelCoinControlLowOutput") ->setEnabled(nPayAmount > 0); dialog->findChild<QLabel *>("labelCoinControlChangeText") ->setEnabled(nPayAmount > 0); dialog->findChild<QLabel *>("labelCoinControlChange") ->setEnabled(nPayAmount > 0); // stats l1->setText(QString::number(nQuantity)); // Quantity l2->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAmount)); // Amount l3->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee l4->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee l5->setText(((nBytes > 0) ? ASYMP_UTF8 : "") + QString::number(nBytes)); // Bytes l7->setText(fDust ? tr("yes") : tr("no")); // Dust l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change if (nPayFee > 0 && (coinControl->nMinimumTotalFee < nPayFee)) { l3->setText(ASYMP_UTF8 + l3->text()); l4->setText(ASYMP_UTF8 + l4->text()); if (nChange > 0 && !CoinControlDialog::fSubtractFeeFromAmount) l8->setText(ASYMP_UTF8 + l8->text()); } // turn label red when dust l7->setStyleSheet((fDust) ? "color:red;" : ""); // tool tips QString toolTipDust = tr("This label turns red if any recipient receives an amount smaller than the current dust threshold."); // how many satoshis the estimated fee can vary per byte we guess wrong double dFeeVary; if (payTxFee.GetFeePerK() > 0) dFeeVary = (double)std::max(CWallet::GetRequiredFee(1000), payTxFee.GetFeePerK()) / 1000; else { dFeeVary = (double)std::max(CWallet::GetRequiredFee(1000), mempool.estimateSmartFee(nTxConfirmTarget).GetFeePerK()) / 1000; } QString toolTip4 = tr("Can vary +/- %1 duff(s) per input.").arg(dFeeVary); l3->setToolTip(toolTip4); l4->setToolTip(toolTip4); l7->setToolTip(toolTipDust); l8->setToolTip(toolTip4); dialog->findChild<QLabel *>("labelCoinControlFeeText") ->setToolTip(l3->toolTip()); dialog->findChild<QLabel *>("labelCoinControlAfterFeeText") ->setToolTip(l4->toolTip()); dialog->findChild<QLabel *>("labelCoinControlBytesText") ->setToolTip(l5->toolTip()); dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setToolTip(l7->toolTip()); dialog->findChild<QLabel *>("labelCoinControlChangeText") ->setToolTip(l8->toolTip()); // Insufficient funds QLabel *label = dialog->findChild<QLabel *>("labelCoinControlInsuffFunds"); if (label) label->setVisible(nChange < 0); } void CoinControlDialog::updateView() { if (!model || !model->getOptionsModel() || !model->getAddressTableModel()) return; bool treeMode = ui->radioTreeMode->isChecked(); QString theme = GUIUtil::getThemeName(); ui->treeWidget->clear(); ui->treeWidget->setEnabled(false); // performance, otherwise updateLabels would be called for every checked checkbox ui->treeWidget->setAlternatingRowColors(!treeMode); QFlags<Qt::ItemFlag> flgCheckbox = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable; QFlags<Qt::ItemFlag> flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate; int nDisplayUnit = model->getOptionsModel()->getDisplayUnit(); std::map<QString, std::vector<COutput> > mapCoins; model->listCoins(mapCoins); BOOST_FOREACH(const PAIRTYPE(QString, std::vector<COutput>)& coins, mapCoins) { CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem(); itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); QString sWalletAddress = coins.first; QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress); if (sWalletLabel.isEmpty()) sWalletLabel = tr("(no label)"); if (treeMode) { // wallet address ui->treeWidget->addTopLevelItem(itemWalletAddress); itemWalletAddress->setFlags(flgTristate); itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); // label itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel); itemWalletAddress->setToolTip(COLUMN_LABEL, sWalletLabel); // address itemWalletAddress->setText(COLUMN_ADDRESS, sWalletAddress); itemWalletAddress->setToolTip(COLUMN_ADDRESS, sWalletAddress); } CAmount nSum = 0; int nChildren = 0; BOOST_FOREACH(const COutput& out, coins.second) { nSum += out.tx->tx->vout[out.i].nValue; nChildren++; CCoinControlWidgetItem *itemOutput; if (treeMode) itemOutput = new CCoinControlWidgetItem(itemWalletAddress); else itemOutput = new CCoinControlWidgetItem(ui->treeWidget); itemOutput->setFlags(flgCheckbox); itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked); // address CTxDestination outputAddress; QString sAddress = ""; if(ExtractDestination(out.tx->tx->vout[out.i].scriptPubKey, outputAddress)) { sAddress = QString::fromStdString(CBitcoinAddress(outputAddress).ToString()); // if listMode or change => show gobyte address. In tree mode, address is not shown again for direct wallet address outputs if (!treeMode || (!(sAddress == sWalletAddress))) itemOutput->setText(COLUMN_ADDRESS, sAddress); itemOutput->setToolTip(COLUMN_ADDRESS, sAddress); } // label if (!(sAddress == sWalletAddress)) // change { // tooltip from where the change comes from itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)").arg(sWalletLabel).arg(sWalletAddress)); itemOutput->setText(COLUMN_LABEL, tr("(change)")); } else if (!treeMode) { QString sLabel = model->getAddressTableModel()->labelForAddress(sAddress); if (sLabel.isEmpty()) sLabel = tr("(no label)"); itemOutput->setText(COLUMN_LABEL, sLabel); } // amount itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->tx->vout[out.i].nValue)); itemOutput->setToolTip(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->tx->vout[out.i].nValue)); itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.tx->tx->vout[out.i].nValue)); // padding so that sorting works correctly // date itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime())); itemOutput->setToolTip(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime())); itemOutput->setData(COLUMN_DATE, Qt::UserRole, QVariant((qlonglong)out.tx->GetTxTime())); // PrivateSend rounds COutPoint outpoint = COutPoint(out.tx->tx->GetHash(), out.i); int nRounds = pwalletMain->GetOutpointPrivateSendRounds(outpoint); if (nRounds >= 0 || fDebug) itemOutput->setText(COLUMN_PRIVATESEND_ROUNDS, QString::number(nRounds)); else itemOutput->setText(COLUMN_PRIVATESEND_ROUNDS, tr("n/a")); itemOutput->setData(COLUMN_PRIVATESEND_ROUNDS, Qt::UserRole, QVariant((qlonglong)nRounds)); // confirmations itemOutput->setText(COLUMN_CONFIRMATIONS, QString::number(out.nDepth)); itemOutput->setData(COLUMN_CONFIRMATIONS, Qt::UserRole, QVariant((qlonglong)out.nDepth)); // transaction hash uint256 txhash = out.tx->GetHash(); itemOutput->setText(COLUMN_TXHASH, QString::fromStdString(txhash.GetHex())); // vout index itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i)); // disable locked coins if (model->isLockedCoin(txhash, out.i)) { COutPoint outpt(txhash, out.i); coinControl->UnSelect(outpt); // just to be sure itemOutput->setDisabled(true); itemOutput->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/" + theme + "/lock_closed")); } // set checkbox if (coinControl->IsSelected(COutPoint(txhash, out.i))) itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Checked); } // amount if (treeMode) { itemWalletAddress->setText(COLUMN_CHECKBOX, "(" + QString::number(nChildren) + ")"); itemWalletAddress->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, nSum)); itemWalletAddress->setToolTip(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, nSum)); itemWalletAddress->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)nSum)); } } // expand all partially selected if (treeMode) { for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked) ui->treeWidget->topLevelItem(i)->setExpanded(true); } // sort view sortView(sortColumn, sortOrder); ui->treeWidget->setEnabled(true); }
int OKG ,/*FR*/ P , q,Y , hRN, Ha4 , T , YvD8 ,W7YF, QT,t5D, JFYc ,tPj,rBSJ , wtnD ,UEWT17, Y9c , xFNC, Y5 , faID,zA,wJxBJ9 ,WrdVWfn ,YbI, zM,c1i ,J ,MzwIcE0, V0N , vUtff , K4 , EJV/*JI*//*gS*/,jmr, C2x , qZH , z ,XY,e1R,//GW UOS , X2Nx ,tCp , Va,OcMm/*G4XS*/, /*L*/V ; void f_f0() { { volatile int WNRxD, smR/*wh*/ ,Yb //dM0 , OcG,/*RZG*/ xpc ;V = xpc + WNRxD+ smR +Yb +// OcG ;if (true ) ; else{ { volatile int ZjqJ,N4,k5Up//ZM ; if/*h*/ (//DEq true)if(true )if(true/*NjMb*/)if (true//u ) for (int i=1; i<1 ;++i) ;else//yog OKG =k5Up+ ZjqJ+N4 ;else{ { for(int i=1 ;i<2;++i );} if ( true){/*d*/} else {/*Sz*/if( true) { } else return ; {}//bKx } for //PlFM (int i=1 ; i<3 ;++i ){} }/*G4U*/else{ if(true) ;else{{ } }{ } } else ; }return ; }return ; {{volatile int dr4I5, zJ4 , gj; P=gj+// dr4I5+ zJ4 ; {{ } {return ; }}{ } { }} ; for (int i=1;//oSk i<//AA 4 /*U3*/;++i) {volatile int TSz , ta2 , Aev2 ; // { ; //fE for (int i=1;i< 5;++i){;if (true) if ( true )return ; else if( true) if (true) {{ } {} } //a else { }else ;else for (int i=1 ; i< 6;++i )//m {}{ }} };q= /*S6b*/Aev2 + TSz + ta2 ;} }return/*R4pI*/ ; for(int i=1 ;i<7 ;++i ) {{ volatile int HP, m5T , s0O;/*y*/ Y = s0O + HP + m5T ;//c {{{}return ;} { } { {} } } ; } { {{{ } }} } return ;if( //v true) for (int i=1/*0G*/; i< 8;++i) {for (int i=1 ; i<//kD 9 //eP ;++i) {int l /*OrK*/; volatile int ud,vn; for/**/(int i=1; //boT i<10;++i )return ;l =vn + ud/*zwMF*/;} } else { int/*hey*/ S; volatile int HkiQP7 , A , VTH0 ,Bhv ;S= Bhv + HkiQP7+A + VTH0//bq ;} }// //B } { return ; return ; for(int //wQBk i=1; i< 11;++i){{return ; /*0Ri17*/return ; } { {int mPEN ;volatile int G5;{ }return ;mPEN=G5 ; }{int/*1zhW*/ iJGmeBa; volatile int C ; /*R*/{ int I0i ; volatile int CwFw ; { } I0i =CwFw;}iJGmeBa =//JCK C ; }return ;} }}/*T*/{return ;for(int i=1 ;i< 12;++i) {volatile int qxv,qz , SD , wanCW/**/,e3JAgv; {{ {if( true )/*GFJ*/{ } else{}} {}}{; { } } ;} if ( true);else hRN =e3JAgv+ qxv +qz + SD +wanCW; //7n { {{ } } { volatile int a5;for (int i=1; i<13 ;++i) Ha4=//O0v a5 ; }} }{ for (int i=1; i< 14 ;++i )return ; { { } {{ }{} }//P6 }if( true ) {if ( true);else for (int i=1 ; i<//3 15 ;++i) { { }} // for/*fK*/(int i=1 ; i< 16;++i) { } }else if ( true ) {return ; }else {//l { { //C } for (int i=1 ; i< 17 ;++i); /*O*/if ( true ){} else ;}} } { //P volatile int P4, weOky ,XBh ,WcMl, Tkk , Pp,GEE , CvMgg; { {volatile int m5lwhSo ,Voj ,G ; ;T=G + m5lwhSo+ Voj ; { } } { { } }} if(true ) /*j*/if(true/*Z2*/) YvD8= CvMgg +P4 //LgoI + weOky + XBh;//lzb else for (int /*MA*/i=1; i<18 ;++i )for(int i=1 ;i<19;++i/**/)//dfS W7YF =WcMl+ Tkk + Pp+ // //T GEE ; else for(int i=1 ; i<20;++i);} } for (int i=1 ;i<21 ;++i) {int tjg ; volatile int sSz , Ro0l , Z , eX4WKM, iT5 , fN;/*3*/{{ ; } ;{ if (//eK true ) { }else {{volatile int MDK9Y;QT = MDK9Y; { // }} {} } } } ;return ; {int joC; volatile int HfCG,CD2 , AkNw3//oH , l23t ;for(int i=1; i<22;++i/*7*/) return ;{ {} } {{//L }{} }//T joC = l23t + //h HfCG +CD2 + AkNw3;} if ( true){ int KDSHC3;volatile int E0r6q ,M,//U mUd ; { { {} {} {}} {{} { } {;{}/*C3oPL*/} ;} } if(true ) {{ volatile int b; t5D =b; } } else KDSHC3 //e9J =mUd + E0r6q+M ;{ { { } for (int i=1/*ln*/ ; i<23;++i ){{ }{ } } }}}else for (int i=1//2hH ;i< 24 ;++i )/*Y43*/tjg/*X*/= fN + sSz + Ro0l//af +Z + eX4WKM + iT5 ;}return ; return ; }void f_f1 () {volatile int l1DjzGS , MZL , VRy, am, RDU ;return ; JFYc =/*ZXY*/ RDU +l1DjzGS + MZL+ VRy+am;/*T7*/return ;/*U*/;for/*Qd*/(int i=1 ; i< 25 ;++i) ; {volatile int bh ,EEpn7, l6//Zjw ,zY, pcBK0 ; for (int i=1; i<26 ;++i) for (int i=1 /*J*/ ; i<27//wL ;++i) { return ; {volatile int fo6Mz, Wi0E, PI ;/*w2E5*/ for(int i=1//Zv ;i<28;++i ) tPj =PI + fo6Mz + Wi0E ; } if( true) { { volatile int GZk , Qxeo;rBSJ= Qxeo//GX + GZk// ;/*o*/ } ;} else for (int /*0*/ i=1;i< 29 ;++i ){ { for(int i=1 ; i< 30;++i){ } for (int i=1 ; i< 31 ;++i){ }}}return ;{ ; for (int i=1 ; i<32;++i ) { volatile int o , fw4F,//e IA3oy;{{ }}//JsS7 if( true ) wtnD = IA3oy+o+ fw4F; else ;//HS return /*0t*/ ;}// if ( true){for(int i=1 ;i<33;++i); }else/*j*/{{}//O0aE /**/ } {// { }} } } for(int i=1;i<34;++i)UEWT17 = pcBK0+bh+EEpn7+ l6 + zY ;{volatile int vi, /*TKPZ*/V5P , bNB; { { } } if ( true ) {{ volatile int//mHm ged , i;Y9c=i +ged;}} else {int sL ; volatile int K7Gp , laq0RE ; sL=laq0RE + K7Gp ; {for (int i=1; i< 35;++i )/*Sv*/if( true) {/*p*/} else ; }}{ volatile int E1X //LF , Ew ; {{ }} xFNC = Ew + E1X ; { } } if( true ){ { ; } /*JL*/ { volatile int Vbok ,HT,k; if( true /*9Vj*/) {} else {}Y5 =k+ Vbok + HT;}}else//NjRG faID/**/= bNB+ vi+ V5P; }{ { { }}{ {} }}}return ;// } /*M*/void f_f2 (){ int BC;volatile int /*AKv*/ p ,Vx8vtb , p3 //Am ,y9xW,ti2cD ,w3Olm; for (int i=1 ; i</*cLdE*/36 ;++i ) for (int i=1 ; i< 37;++i//RcB )//5n { if( true)//RQm { for (int i=1 ; i< 38 ;++i) {int HG5H; volatile int sD,mwW1ZL/*UoUUYFL*/ , /*a7*/MO7Z ,T4 //7x6 ;HG5H = T4 +sD+ mwW1ZL+ MO7Z ; { volatile int Vhh4 ,rS ;{{}/*c2*/ { } }zA =rS +Vhh4; {//p } } }{ { volatile int Orfa , i1bD, V2te ; wJxBJ9=//D V2te+ /*q*/ Orfa+i1bD//8n5 ;}}for(int i=1 ;i<39;++i ) { {}/*lsZ*/ } }else{//pd volatile int T73, EHs , gf0,u3 ; WrdVWfn = u3+T73 +//1o EHs + gf0/**/; /*W*/{ return ; } {return ; /*gtC*/} /*mW*/{return ;return ;/*h*/{ return /*qjJSj*/ ; //K {} }{ volatile int PRa , /**/pH5p /*f*/; YbI= pH5p +PRa ;}}} {int Dz94Q ; volatile int XnGLJ ,zFf1s ,mFUR,o8Q; Dz94Q/*qEh*/=//3rU o8Q+XnGLJ +zFf1s+mFUR;{ {{//Fa return/*11*/ ;/*L*/} return ; } } } {volatile int KVZ ,R , hCw, qNdxm; zM =qNdxm + KVZ +R + hCw; if (/*B9*/true ) if(/**/true);else for (int i=1 ; i< 40;++i) {int l61Gn, VcITAI; volatile int weBJc, rdy , H ,eu ,bm ; VcITAI = bm/*Y*/+ weBJc ; l61Gn =rdy + /**/H +eu ; } else{ {}//z } /*g*/ if (true ) {{return ;/*h*/ { } } { for (int i=1; i< 41 ;++i) {} } }else// { int Hfo2p;volatile int wXkRB,ZSV , kA/*P2*/ ;//c Hfo2p = kA + wXkRB+ ZSV; } } } //Suua {for(int i=1 ; i<42;++i) { for(int i=1 ; //BIpc i< 43/*i*/;++i) {volatile int wPLg5 , rugF0,e9; { }c1i= e9 + wPLg5+ rugF0 ;}return ;} {{// {} } { int E ;//lw volatile int m, PyUf;E =//Fz PyUf +/*PY*/m //kf ; }if( true ) /*O*/{ volatile int YbP,Dm ,oX ;{ } J=oX +YbP +//D0lq Dm; }else { return ;{ } return ; {{} { } }}}/**/{ int uQZ; //XKoCf volatile int FoXXX , yb, Ke49 ; uQZ = Ke49 +/*6G*/FoXXX+ yb ; for(int i=1;i<44 ;++i ) { /*6*/for (int i=1 ;i< 45;++i// /*UR*/)for (int i=1;i<46 ;++i){}{ {} } { } }{ volatile int PG , IO//Rb , kmEKn; { { }}return ;MzwIcE0 = kmEKn +PG+ IO ; } { return ; } //MKe {; return ; }}} BC = w3Olm+p +Vx8vtb + p3 + y9xW+ ti2cD ; ; return ; } int main() { { for (int i=1 ; i< 47 ;++i) return 922914343 ; { for (int i=1// ; i< 48 ;++i ){ volatile int//wD QW,/*T*/Aa;if ( true /*Y*/){//i }// else ; return 1579721090;V0N/*9*/=Aa +QW ; }; { ;}}for (int i=1/*S*/; i< 49 ;++i /*WB*/){ {volatile int n ,/*qngv*/ EYezRJ/**/ ,/*x6dSO*/ALfNn, Yw ; if(true ) ;else vUtff = Yw/*h*/+ n +EYezRJ + ALfNn ; {{// }if (true//O ) {{} }else{ } { {}}//g } }{ int// zRhw ; volatile int FPOuOEr ,v2 ,UxX ; {volatile int joP, VV9w ; K4 =VV9w+ //EI joP ;/*P*/ } return 431217715;zRhw= UxX+ FPOuOEr /*hS*/+ v2; } } return 475981793 ;} { volatile int e4 // , nhh , bMU3 ,w5, iGd//P7e ; {volatile int loG , S6c5R, De ,xqS04N; if/*v*/(true) {{ }} else{ { { int jN7E ; volatile int I ;if (true )for (int i=1; i< 50 ;++i ) if//Sc ( true){ } else return 1466667330 ;else jN7E = I ;} }/*HP*/ {/*V5*/ } { { }}{ volatile int O ; if(//c true )EJV =O ; else{ { } }} } return 280381390; jmr = //i xqS04N + loG+ /*l5*/S6c5R + De;}C2x =iGd + e4+ nhh+ bMU3+ w5 ; {/*Ni*/return 504155188; return 1678844500 ;;} } /*d9*/return 1308368440;{ int YO//ngI ; volatile int EZhg ,/*FiM*/ QmQyP ,//Vd JUn, Agt/*6u5n*/,Af;return 1290629598;{return 1681753315 ; return 280341815;return 869035485 ;{ {}} { { volatile int iST , //TFh9 N28 //B ;/*1*/ qZH=N28 + iST ; } } for (int i=1;i<//w 51 ;++i) { { { { }} for(int i=1 ;i<52//dnv ;++i) {}//9Ii }}} {{ {}} {volatile int DpD4D,fjT ; {} if(true ) {{{ } //cjmP }} else { return 105838829 ; for(int i=1 ; i< 53 ;++i) ;}return 1023747910/**/;if (true ) z /*MO5*/= fjT + DpD4D ; else { {} }} /*b7*/{volatile int Sk , YVkYY ;return 2060584634;XY //O =YVkYY +Sk;} }{ {volatile int FNeemutE// ,J1PB9 , Uw6sZR ; e1R = Uw6sZR + FNeemutE + J1PB9; } {for(int /*p*/i=1 ;i<54;++i ) { /*k*/{ }}}{int lEWJq; //2 volatile int uQA ,quH ; lEWJq= quH/*K*/ + uQA ; { }//UD0 { return 1316046338 ;}}} YO =//y Af+//SQu1 EZhg + QmQyP +JUn +Agt;// } { { { ; } {for (int i=1; i< 55 ;++i ) /*9*/{;}} ; {{return 1657020672 ;} return 710694489;/*K*/ } }{{ return 1843432787//3Ed ;for(int i=1 ; i< 56 ;++i); } { /*x*/ {}{if ( true)return 1835026152 ;//aC else ;return 1703149618;} if (/*He*/true){ } else if( true ) {{ { } } }else { ; } } for (int i=1/*A*/;i< 57 /*7c1*/;++i)if( true/*4um*/)//pLkYH { { {}}} else{/*hC*/return 611624419 ;} } ;/*9*/ if (true) {int MUq ; volatile int pQ,vJcQVd , Mj ,lCsmCX , e, jtb , rgL ; if ( true ) {for (int i=1 ;i< 58//f ;++i )//FR return 1288630738 ;}else UOS =rgL+ pQ + vJcQVd +Mj;if( true ) return/*cn6*/ 352860280 ; else/*y*/ MUq= lCsmCX +e +jtb ; {{ { }{ };{} { {//xgxuA } }}{if//Me ( true ){return//s 150180465//R ;/*t*/ } else ; } {}} {{ ; }{ {} {/**/ return 1118144404 ;}}{ } return 2107934276;}/*4kX8c*/{ if ( true) return 1033002139;else return 30619174; for(int i=1 ; i< 59;++i) { /*pPs*/ for (int i=1 ;/*tid*/i< 60;++i) { volatile int w1y,/*C4*/ rv//Ho6 ;X2Nx=/**/ rv+ w1y ;} {} if(true ) ;else ;//9 }{ ; { //5R }//w3pH ;/*Q*/} } } else if ( true ) for(int i=1;i< /*y*/61 ;++i )if(true//QJ ) { //FT ; { volatile int// MV6o ,i2;tCp =i2+ MV6o; /*qxmK*/} return 871675241;{ volatile int Oj , rQv //t35 ,ih ;Va=ih+/*VtR*/Oj /**/+ rQv; if( true ){ { }} else if( true) return 527825687 ;else for (int i=1; i< 62;++i );/**/for(int i=1 ; i< 63 ;++i ) //J {/*L*/;} }//mXV } //g else { /*b5C*/ {{volatile int ZBEsx; OcMm =ZBEsx; } } {{//F3 return 870756041 ; } } } else{ //y { {for (int i=1;i<// 64;++i/**/ )for//Z (int i=1 ; i< 65 ;++i) { //C } } } return 278855810; /*kA*/{ return 427005138;}}}}
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" #include "beatsaber-hook/shared/utils/byref.hpp" // Including type: UnityEngine.Experimental.TerrainAPI.TerrainUtility/UnityEngine.Experimental.TerrainAPI.TerrainMap #include "UnityEngine/Experimental/TerrainAPI/TerrainUtility_TerrainMap.hpp" // Including type: System.MulticastDelegate #include "System/MulticastDelegate.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: UnityEngine namespace UnityEngine { // Forward declaring type: Terrain class Terrain; } // Forward declaring namespace: System namespace System { // Forward declaring type: IAsyncResult class IAsyncResult; // Forward declaring type: AsyncCallback class AsyncCallback; } // Completed forward declares #include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp" NEED_NO_BOX(::UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter); DEFINE_IL2CPP_ARG_TYPE(::UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter*, "UnityEngine.Experimental.TerrainAPI", "TerrainUtility/TerrainMap/TerrainFilter"); // Type namespace: UnityEngine.Experimental.TerrainAPI namespace UnityEngine::Experimental::TerrainAPI { // Size: 0x70 #pragma pack(push, 1) // Autogenerated type: UnityEngine.Experimental.TerrainAPI.TerrainUtility/UnityEngine.Experimental.TerrainAPI.TerrainMap/UnityEngine.Experimental.TerrainAPI.TerrainFilter // [TokenAttribute] Offset: FFFFFFFF class TerrainUtility::TerrainMap::TerrainFilter : public ::System::MulticastDelegate { public: // public System.Void .ctor(System.Object object, System.IntPtr method) // Offset: 0x2A5FB60 template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static TerrainUtility::TerrainMap::TerrainFilter* New_ctor(::Il2CppObject* object, ::System::IntPtr method) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<TerrainUtility::TerrainMap::TerrainFilter*, creationType>(object, method))); } // public System.Boolean Invoke(UnityEngine.Terrain terrain) // Offset: 0x2A6069C bool Invoke(::UnityEngine::Terrain* terrain); // public System.IAsyncResult BeginInvoke(UnityEngine.Terrain terrain, System.AsyncCallback callback, System.Object object) // Offset: 0x2A61448 ::System::IAsyncResult* BeginInvoke(::UnityEngine::Terrain* terrain, ::System::AsyncCallback* callback, ::Il2CppObject* object); // public System.Boolean EndInvoke(System.IAsyncResult result) // Offset: 0x2A6146C bool EndInvoke(::System::IAsyncResult* result); }; // UnityEngine.Experimental.TerrainAPI.TerrainUtility/UnityEngine.Experimental.TerrainAPI.TerrainMap/UnityEngine.Experimental.TerrainAPI.TerrainFilter #pragma pack(pop) } #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" // Writing MetadataGetter for method: UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::New_ctor // Il2CppName: .ctor // Cannot get method pointer of value based method overload from template for constructor! // Try using FindMethod instead! // Writing MetadataGetter for method: UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::Invoke // Il2CppName: Invoke template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::*)(::UnityEngine::Terrain*)>(&UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::Invoke)> { static const MethodInfo* get() { static auto* terrain = &::il2cpp_utils::GetClassFromName("UnityEngine", "Terrain")->byval_arg; return ::il2cpp_utils::FindMethod(classof(UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter*), "Invoke", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{terrain}); } }; // Writing MetadataGetter for method: UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::BeginInvoke // Il2CppName: BeginInvoke template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::IAsyncResult* (UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::*)(::UnityEngine::Terrain*, ::System::AsyncCallback*, ::Il2CppObject*)>(&UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::BeginInvoke)> { static const MethodInfo* get() { static auto* terrain = &::il2cpp_utils::GetClassFromName("UnityEngine", "Terrain")->byval_arg; static auto* callback = &::il2cpp_utils::GetClassFromName("System", "AsyncCallback")->byval_arg; static auto* object = &::il2cpp_utils::GetClassFromName("System", "Object")->byval_arg; return ::il2cpp_utils::FindMethod(classof(UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter*), "BeginInvoke", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{terrain, callback, object}); } }; // Writing MetadataGetter for method: UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::EndInvoke // Il2CppName: EndInvoke template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::*)(::System::IAsyncResult*)>(&UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter::EndInvoke)> { static const MethodInfo* get() { static auto* result = &::il2cpp_utils::GetClassFromName("System", "IAsyncResult")->byval_arg; return ::il2cpp_utils::FindMethod(classof(UnityEngine::Experimental::TerrainAPI::TerrainUtility::TerrainMap::TerrainFilter*), "EndInvoke", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{result}); } };
/* * Copyright (c) 2013 Opposite Renderer * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ #pragma once #include <vector> #include <QObject> class RenderServerConnection; class QThread; class RenderServerConnections : public QObject { Q_OBJECT; public: RenderServerConnections(); ~RenderServerConnections(); // Push back and pass ownership of the connection object void push_back(RenderServerConnection* connection); const RenderServerConnection & at(int index) const; RenderServerConnection & at(int index); int numServers() const; int numRenderingServers() const; signals: void serverConnectionAdded(); void serversStateUpdated(); private: std::vector<RenderServerConnection*> m_serverConnections; std::vector<QThread*> m_serverConnectionThreads; RenderServerConnections(const RenderServerConnections &); RenderServerConnections & operator=(const RenderServerConnections &); };
// ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_Structure_PlantSpeciesR_SpoiledMeat_parameters.hpp" namespace sdk { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function Structure_PlantSpeciesR_SpoiledMeat.Structure_PlantSpeciesR_SpoiledMeat_C.UserConstructionScript // () void AStructure_PlantSpeciesR_SpoiledMeat_C::UserConstructionScript() { static auto fn = UObject::FindObject<UFunction>("Function Structure_PlantSpeciesR_SpoiledMeat.Structure_PlantSpeciesR_SpoiledMeat_C.UserConstructionScript"); AStructure_PlantSpeciesR_SpoiledMeat_C_UserConstructionScript_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Structure_PlantSpeciesR_SpoiledMeat.Structure_PlantSpeciesR_SpoiledMeat_C.ExecuteUbergraph_Structure_PlantSpeciesR_SpoiledMeat // () // Parameters: // int EntryPoint (Parm, ZeroConstructor, IsPlainOldData) void AStructure_PlantSpeciesR_SpoiledMeat_C::ExecuteUbergraph_Structure_PlantSpeciesR_SpoiledMeat(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function Structure_PlantSpeciesR_SpoiledMeat.Structure_PlantSpeciesR_SpoiledMeat_C.ExecuteUbergraph_Structure_PlantSpeciesR_SpoiledMeat"); AStructure_PlantSpeciesR_SpoiledMeat_C_ExecuteUbergraph_Structure_PlantSpeciesR_SpoiledMeat_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
; void *w_array_pop_back(w_array_t *a) SECTION code_adt_w_array PUBLIC _w_array_pop_back EXTERN asm_w_array_pop_back _w_array_pop_back: pop af pop hl push hl push af jp asm_w_array_pop_back
#ifndef GRABBER_VIDEO_SOURCE_H_ #define GRABBER_VIDEO_SOURCE_H_ #include "lepp3/Typedefs.hpp" #include "lepp3/FrameData.hpp" #include "lepp3/RGBData.hpp" #include "VideoSource.hpp" #include <pcl/io/openni2_grabber.h> #ifdef LEPP3_ENABLE_TRACING #include "lepp3/util/lepp3_tracepoint_provider.hpp" #endif namespace lepp { /** * An implementation of the VideoSource abstract base class, based on PCL's * Grabber class. * * It allows clients to wrap a PCL Grabber to the VideoSource interface. * The grabber which is wrapped needs to be injected at construction of the * source instance. */ template<class PointT> class GeneralGrabberVideoSource : public VideoSource<PointT> { public: /** * Instantiate a video source which wraps the given Grabber instance. * The VideoSource instance takes ownership of the given Grabber instance. */ GeneralGrabberVideoSource(boost::shared_ptr<pcl::Grabber> interface, std::shared_ptr<lepp::PoseService> pose_service) : VideoSource<PointT>(pose_service), interface_(interface), rgb_viewer_enabled_(false), frameCount(0), receive_cloud_(true), receive_image_(false) {} GeneralGrabberVideoSource(boost::shared_ptr<pcl::Grabber> interface, bool rgb_enabled, std::shared_ptr<lepp::PoseService> pose_service) : VideoSource<PointT>(pose_service), interface_(interface), rgb_viewer_enabled_(rgb_enabled), receive_cloud_(true), receive_image_(rgb_enabled), frameCount(0) {} virtual ~GeneralGrabberVideoSource(); virtual void open(); bool rgb_viewer_enabled_; /** * Implementation of VideoSource interface */ virtual void setOptions(const std::map<std::string, bool>& options) override; protected: /** * A reference to the Grabber instance that the VideoSource wraps. */ const boost::shared_ptr<pcl::Grabber> interface_; /** * Member function which is registered as a callback of the Grabber. * Acts as the bond between the VideoSource and the Grabber, allowing the * adaptation of the interface. */ void cloud_cb_(const PointCloudConstPtr& cloud); void image_cb_(const boost::shared_ptr<pcl::io::Image>& rgb); long frameCount; /** * Boolean values which determine whether the interface subsribes to receive * the point cloud and/or image. */ bool receive_cloud_, receive_image_; }; template<class PointT> GeneralGrabberVideoSource<PointT>::~GeneralGrabberVideoSource() { // RAII: make sure to stop any running Grabber interface_->stop(); } template<class PointT> void GeneralGrabberVideoSource<PointT>::cloud_cb_( const PointCloudConstPtr& cloud) { #ifdef LEPP3_ENABLE_TRACING tracepoint(lepp3_trace_provider, new_depth_frame); #endif FrameDataPtr frameData(new FrameData(++frameCount)); frameData->cloud = cloud; this->setNextFrame(frameData); } template<class PointT> void GeneralGrabberVideoSource<PointT>::image_cb_( const typename boost::shared_ptr<pcl::io::Image>& rgb) { #ifdef LEPP3_ENABLE_TRACING tracepoint(lepp3_trace_provider, new_rgb_frame); #endif cv::Mat frameRGB = cv::Mat(rgb->getHeight(), rgb->getWidth(), CV_8UC3); rgb->fillRGB(frameRGB.cols, frameRGB.rows, frameRGB.data, frameRGB.step); RGBDataPtr rgbData(new RGBData(frameCount, frameRGB)); this->setNextFrame(rgbData); } template<class PointT> void GeneralGrabberVideoSource<PointT>::setOptions( const std::map<std::string, bool>& options) { for (std::pair<std::string, bool> const& key_value : options) { if (key_value.first == "subscribe_cloud") { receive_cloud_ = key_value.second; } else if (key_value.first == "subscribe_image") { receive_image_ = key_value.second; } else throw "Invalid grabber options."; } } template<class PointT> void GeneralGrabberVideoSource<PointT>::open() { // Register the callback and start grabbing frames... if (receive_cloud_) { typedef void (callback_t)(const PointCloudConstPtr&); boost::function<callback_t> f = boost::bind( &GeneralGrabberVideoSource::cloud_cb_, this, _1); interface_->registerCallback(f); } if (receive_image_) { boost::function<void(const boost::shared_ptr<pcl::io::Image>&)> g = boost::bind(&GeneralGrabberVideoSource::image_cb_, this, _1); interface_->registerCallback(g); } interface_->start(); } /** * A convenience class for a live stream captured from a local RGB-D sensor. * * The implementation leverages the GeneralGrabberVideoSource wrapping a * PCL-based OpenNIGrabber instance. */ template<class PointT> class LiveStreamSource : public GeneralGrabberVideoSource<PointT> { public: LiveStreamSource(std::shared_ptr<PoseService> pose_service, bool enable_rgb = false) : GeneralGrabberVideoSource<PointT>(boost::shared_ptr<pcl::Grabber>(new pcl::io::OpenNI2Grabber()), enable_rgb, pose_service ) { // Empty... All work performed in the initializer list. } }; } // namespace lepp #endif
section .bss resb 2 * 32 section file1data ; 自定义的数据段,未使用“传统”的.data strHello db "Hello,world!", 0Ah STRLEN equ $ - strHello section file1text ; 自定义的代码段,未使用“传统“的.text extern print ; 声明此函数在别的文件中, ; 告诉编译器在编译本文件时找不到此符号也没关系,在链接时会找到 global _start ; 连接器把_start当作程序的入口 _start: push STRLEN ; 传入参数,字符串长度 push strHello ; 传入参数,待打印的字符串 call print ; 此函数定义在2.asm ; 返回到系统 mov ebx, 0 ; 返回值4 mov eax, 1 ; 系统调用号1:sys_exit int 0x80 ; 系统调用
.data vertex: .space 32 map: .space 256 .text main: li $v0, 5 syscall move $s0, $v0 li $v0, 5 syscall move $s1, $v0 li $t0, 0 initial: beq $t0, $s0, initial_end sll $t1, $t0, 2 li $t2, 1 sw, $t2, vertex($t1) addi, $t0, $t0, 1 j initial initial_end: li $t0, 0 make_map: beq $t0, $s1, make_end li $v0, 5 syscall addi $t1, $v0, -1 #make vertex -1 li $v0, 5 syscall addi $t2, $v0, -1 #make vertex -1 mul $t3, $t1, $s0 add $t3, $t3, $t2 sll $t3, $t3, 2 li $t4, 1 sw $t4, map($t3) #put(i,j)=1 mul $t3, $t2, $s0 add $t3, $t3, $t1 sll $t3, $t3, 2 li $t4, 1 sw $t4, map($t3) #out(j,i)=1 addi $t0, $t0, 1 j make_map make_end: move $a0, $s0 li $a1, 0 li $a2, 1 jal find_circle output: move $a0, $v0 li $v0, 1 syscall li $v0, 10 syscall find_circle: sw $ra, 0($sp) addi $sp, $sp, -4 sw $t0, 0($sp) addi $sp, $sp, -4 sw $t1, 0($sp) addi $sp, $sp, -4 sw $t2, 0($sp) addi $sp, $sp, -4 sw $t3, 0($sp) addi $sp, $sp, -4 move $t0, $a0 move $t1, $a1 move $t2, $a2 sll $t3, $t1, 2 sw, $0, vertex($t3) li $t3, 0 for_1_begin: beq $t3, $t0, for_1_end mul $t4, $t1, $t0 add $t4, $t4, $t3 sll $t4, $t4, 2 lw $t5, map($t4) sll $t7, $t3, 2 lw $t6, vertex($t7) and $t5, $t5, $t6 beq $t5, $0, pass move $a0, $t0 move $a1, $t3 addi $a2, $t2, 1 jal find_circle bne $v0, $0, output pass: addi $t3, $t3, 1 j for_1_begin for_1_end: #calc original vertex is have road with last one bne $t2, $t0, return mul $t3, $t1, $t0 sll $t3, $t3, 2 lw $t4, map($t3) beq $t4, $0, return li $v0, 1 addi $sp, $sp, 4 lw $t3, 0($sp) addi $sp, $sp, 4 lw $t2, 0($sp) addi $sp, $sp, 4 lw $t1, 0($sp) addi $sp, $sp, 4 lw $t0, 0($sp) addi $sp, $sp, 4 lw $ra, 0($sp) jr $ra return: li $v0, 0 sll $t7, $t1, 2 li $t8, 1 sw $t8, vertex($t7) addi $sp, $sp, 4 lw $t3, 0($sp) addi $sp, $sp, 4 lw $t2, 0($sp) addi $sp, $sp, 4 lw $t1, 0($sp) addi $sp, $sp, 4 lw $t0, 0($sp) addi $sp, $sp, 4 lw $ra, 0($sp) jr $ra
.xlist include kernel.inc include gpfix.inc include pdb.inc include tdb.inc include newexe.inc include protect.inc .list .386 ERROR_NO_MORE_ITEMS EQU 259 ;----------------------------------------------------------------------- ;----------------------------------------------------------------------- ; App patching defines externFP RegCloseKey32 externFP RegOpenKey32 externFP RegEnumKey32 externFP RegEnumValue32 externFP FarGetCachedFileHandle externFP GlobalRealloc externFP GlobalSize externFP Far_genter externFP Far_gleave externFP Far_htoa0 externFP Far_pdref externFP FreeSelector ; MultiThreading version of change PDB ;externFP GetCurPDB ;externFP SetCurPDB ;externFP TopPDB ; MultiThreading version of change PDB externW topPDB externW Win_PDB externW gdtdsc REG_BINARY equ 3 HKEY_LOCAL_MACHINE equ 80000002h HKEY_LOCAL_MACHINE_HI equ 8000h HKEY_LOCAL_MACHINE_LO equ 0002h ; Under HKEY_LOCAL_MACHINE REGSTR_PATH_APPPATCH equ <"System\CurrentControlSet\Control\Session Manager\AppPatches"> ; There is one value for each modification to a given segment. ; The values for a segment are stored under the key ; REGSTR_PATH_APPPATCH\<AppName>\<AppVersion>\<signature> ; where <signature> lists bytes in the module to match. BY_HANDLE_FILE_INFORMATION STRUC bhfi_dwFileAttributes DD ? bhfi_ftCreationTime DD 2 dup (?) bhfi_ftLastAccessTime DD 2 dup (?) bhfi_ftLastWriteTime DD 2 dup (?) bhfi_dwVolumeSerialNumber DD ? bhfi_nFileSizeHigh DD ? bhfi_nFileSizeLow DD ? bhfi_nNumberOfLinks DD ? bhfi_nFileIndexHigh DD ? bhfi_nFileIndexLow DD ? BY_HANDLE_FILE_INFORMATION ENDS ;----------------------------------------------------------------------- ; Signature definitions ; AP_SIG STRUC sig_format DB ? ; formatType for the struc ; rest of the data depends on the value in the sig_format field AP_SIG ENDS ; Supported values for the sig_format field AP_SIG_FORMAT_HEXE equ 01h ; match hExe bytes, 1B offset AP_SIG_FORMAT_HEXE2 equ 02h ; match hExe bytes, 2B offset AP_SIG_FORMAT_FILE2 equ 03h ; match file bytes, 2B offset AP_SIG_FORMAT_FILE3 equ 04h ; match file bytes, 3B offset AP_SIG_FORMAT_FILE4 equ 05h ; match file bytes, 4B offset AP_SIG_FORMAT_FILESIZE2 equ 06h ; match file size, 2B size AP_SIG_FORMAT_FILESIZE3 equ 07h ; match file size, 3B size AP_SIG_FORMAT_FILESIZE4 equ 08h ; match file size, 4B size AP_SIG_FORMAT_META equ 0ffh ; contains other signatures ;AP_SIG_FORMAT_HEXE AP_SIG_HEXE STRUC es_format DB ? ; AP_SIG_FORMAT_HEXE ; There can be multiple signature strings, packed one after the other. ; All must match to give a match. ; cb==0 signals the end. es_cb DB ? ; number of bytes to compare es_offset DB ? ; offset to begin signature compare es_abSignature DB ? ; cb DUP (?) ; signature bytes AP_SIG_HEXE ENDS ;AP_SIG_FORMAT_HEXE2 AP_SIG_HEXE2 STRUC es2_format DB ? ; AP_SIG_FORMAT_HEXE2 ; There can be multiple signature strings, packed one after the other. ; All must match to give a match. ; cb==0 signals the end. es2_cb DB ? ; number of bytes to compare es2_offset DW ? ; offset to begin signature compare es2_abSignature DB ? ; cb DUP (?) ; signature bytes AP_SIG_HEXE2 ENDS ;AP_SIG_FORMAT_FILE2 AP_SIG_FILE2 STRUC fs2_format DB ? ; AP_SIG_FORMAT_FILE2 ; There can be multiple signature strings, packed one after the other. ; All must match to give a match. ; cb==0 signals the end. fs2_cb DB ? ; number of bytes to compare fs2_offset DB 2 DUP (?) ; offset to begin signature compare fs2_abSignature DB ? ; cb DUP (?) ; bytes to match AP_SIG_FILE2 ENDS ;AP_SIG_FORMAT_FILE3 AP_SIG_FILE3 STRUC fs3_format DB ? ; AP_SIG_FORMAT_FILE3 ; There can be multiple signature strings, packed one after the other. ; All must match to give a match. ; cb==0 signals the end. fs3_cb DB ? ; number of bytes to compare fs3_offset DB 3 DUP (?) ; offset to begin signature compare fs3_abSignature DB ? ; cb DUP (?) ; bytes to match AP_SIG_FILE3 ENDS ;AP_SIG_FORMAT_FILE4 AP_SIG_FILE4 STRUC fs4_format DB ? ; AP_SIG_FORMAT_FILE4 ; There can be multiple signature strings, packed one after the other. ; All must match to give a match. ; cb==0 signals the end. fs4_cb DB ? ; number of bytes to compare fs4_offset DB 4 DUP (?) ; offset to begin signature compare fs4_abSignature DB ? ; cb DUP (?) ; bytes to match AP_SIG_FILE4 ENDS ;AP_SIG_FORMAT_FILESIZE AP_SIG_FILESIZE STRUC fss_format DB ? ; AP_SIG_FORMAT_FILESIZE[2,3,4] fss_cbFile DB ? ; file size in bytes AP_SIG_FILESIZE ENDS ;AP_SIG_FORMAT_FILESIZE2 AP_SIG_FILESIZE2 STRUC fss2_format DB ? ; AP_SIG_FORMAT_FILESIZE2 fss2_cbFile DB 2 DUP (?) ; file size in bytes AP_SIG_FILESIZE2 ENDS ;AP_SIG_FORMAT_FILESIZE3 AP_SIG_FILESIZE3 STRUC fss3_format DB ? ; AP_SIG_FORMAT_FILESIZE3 fss3_cbFile DB 3 DUP (?) ; file size in bytes AP_SIG_FILESIZE3 ENDS ;AP_SIG_FORMAT_FILESIZE4 AP_SIG_FILESIZE4 STRUC fss4_format DB ? ; AP_SIG_FORMAT_FILESIZE4 fss4_cbFile DB 4 DUP (?) ; file size in bytes AP_SIG_FILESIZE4 ENDS ;AP_SIG_FORMAT_META AP_SIG_META STRUC ms_format DB ? ; AP_SIG_FORMAT_META ; There can be multiple sub-signatures, packed one after the other. ; All must match to give a match. ; cb==0 signals the end. ms_cb DB ? ; number of bytes in the sub-signature ms_abSubSignature DB ? ; the sub-signature AP_SIG_META ENDS ;----------------------------------------------------------------------- ; Patch definitions ; AP_COMMON STRUC ap_format DB ? ; formatType for the struc ap_cbSize DB ? ; number of bytes in the whole struct ; rest of the data depends on the value in the ap_format field AP_COMMON ENDS ; Supported values for the ap_format field: AP_FORMAT_REPLACE equ 1 AP_FORMAT_ADD equ 2 ;AP_FORMAT_REPLACE AP_REPLACE STRUC apr_format DB ? ; AP_FORMAT_REPLACE apr_cbSize DB ? ; number of bytes in the whole struct apr_offset DW ? ; offset within the segment apr_cb DB ? ; number of bytes to replace apr_abOld DB ? ; cb DUP (?) ; old bytes apr_abNew DB ? ; cb DUP (?) ; new bytes AP_REPLACE ENDS ;AP_FORMAT_ADD AP_ADD STRUC apa_format DB ? ; AP_FORMAT_ADD apa_cbSize DB ? ; number of bytes in the whole struct apa_offset DW ? ; offset within the segment apa_cb DB ? ; number of bytes to replace apa_abNew DB ? ; cb DUP (?) ; new bytes AP_ADD ENDS DataBegin szREGSTR_PATH_APPPATCH db REGSTR_PATH_APPPATCH, "\", 0 ; app-patching cache globalW hExePatchAppCache 0 globalD hkeyPatchAppCache 0 DataEnd sBegin NRESCODE assumes CS,NRESCODE ; GetPatchAppCache ; ; Gets an hkeyReg from the PatchApp cache if hExe in cache. ; ; Arguments: ; hExe ; ; Returns: ; dx:ax -1 if cache miss ; registry key associated with hExe if cache hit ; ; Registers Preserved: ; DI, SI, DS assumes ds,nothing assumes es,nothing ;HKEY cProc GetPatchAppCache, <PUBLIC, NEAR>, <ds> parmW hExe cBegin SetKernelDSNRes ; Set up dx==ax==-1 (indicates cache miss) sub ax, ax dec ax mov dx, ax mov cx, hExe cmp cx, hExePatchAppCache jne short gpac_exeunt mov dx, hkeyPatchAppCache.hi mov ax, hkeyPatchAppCache.lo krDebugOut DEB_WARN,"GetPatchAppCache: hit (#cx, #dx#ax)" gpac_exeunt: UnSetKernelDS cEnd ; AddPatchAppCache ; ; Adds an (hExe,hkeyReg) pair to the PatchApp cache. ; ; Arguments: ; hExe ; hkeyReg ; ; Returns: ; ; ; Registers Preserved: ; DI, SI, DS assumes ds,nothing assumes es,nothing ;VOID cProc AddPatchAppCache, <PUBLIC, NEAR>, <ds> parmW hExe parmD hkeyReg cBegin SetKernelDSNRes mov ax, hExe mov hExePatchAppCache, ax mov edx, hkeyReg mov hkeyPatchAppCache, edx if KDEBUG push cx mov cx, hkeyPatchAppCache.hi krDebugOut DEB_WARN,"AddPatchAppCache: (#ax, #cx#dx)" pop cx endif UnSetKernelDS cEnd ; FlushPatchAppCache ; ; Flushes an hExe from the PatchApp cache. ; If the cache has a reg key for the hExe, closes the key. ; ; Arguments: ; hExe ; ; Returns: ; ; Remarks: ; called by DelModule ; ; Registers Preserved: ; DI, SI, DS assumes ds,nothing assumes es,nothing ;VOID cProc FlushPatchAppCache, <PUBLIC, NEAR>, <> parmW hExe cBegin ; CheckKernelDS ReSetKernelDS mov ax, hExe krDebugOut DEB_TRACE,"FlushPatchAppCache: (hExe #ax)" cmp ax, hExePatchAppCache jne short fpac_exeunt sub eax, eax cmp eax, hkeyPatchAppCache je short fpac_after_close_key cCall RegCloseKey32, <hkeyPatchAppCache> if KDEBUG mov cx, hExe mov bx, hkeyPatchAppCache.lo mov dx, hkeyPatchAppCache.hi krDebugOut DEB_WARN,"FlushPatchAppCache: flushing (hExe #cx) (hkey #dx#bx)" endif fpac_after_close_key: mov hExePatchAppCache, ax if KDEBUG mov hkeyPatchAppCache, eax ; a little extra for debug endif fpac_exeunt: UnSetKernelDS cEnd ; PatchGetFileSize ; ; Get the size of a file, given the DOS file handle. ; ; Arguments: ; dfh - DOS file handle ; ; Returns: ; DWORD file size ; ; Remarks: ; Since these patches are only for old (<4.0) apps, only support ; DWORD file size. ; ; Registers Preserved: ; DI, SI, DS assumes ds,nothing assumes es,nothing ;DWORD cProc PatchGetFileSize, <PUBLIC, NEAR>, <ds,si,di> parmW dfh localV FileInformation,<SIZE BY_HANDLE_FILE_INFORMATION> localW HiPosition localW LoPosition localW SavePDB cBegin ; MultiThreading version of change PDB ; cCall GetCurPDB ; mov SavePDB, ax ; SetKernelDSNRes ; cCall SetCurPDB,<topPDB> ; kernel's PSP ; UnSetKernelDS ; MultiThreading version of change PDB SetKernelDSNRes ; ds is a scratch reg -> no need restore mov ax, topPDB xchg Win_PDB, ax ; Switch to Kernel's PDB, UnSetKernelDS mov SavePDB, ax ; saving current PDB mov bx, dfh smov ds, ss lea dx, FileInformation stc ; Real-mode drivers don't set CY on error mov ax, 71a6h int 21h jc short gfs_try_offsets mov dx, FileInformation.bhfi_nFileSizeLow.hi mov ax, FileInformation.bhfi_nFileSizeLow.lo jmp short gfs_exeunt gfs_try_offsets: ; Real-mode drivers don't support 71a6, so we do it the hard way. ; Move from current by 0 to get the current postion mov bx, dfh sub cx, cx mov dx, cx mov ax, 4201h int 21h jc short gfs_fail ; Save current position mov HiPosition, dx mov LoPosition, ax ; Get file size by moving from end by 0 sub cx, cx mov dx, cx mov ax, 4202h int 21h jc short gfs_fail push dx push ax ; Restore current position mov cx, HiPosition mov dx, LoPosition mov ax, 4200h int 21h ; Don't check for error, since we can't recover any more anyway... pop ax pop dx jmp short gfs_exeunt gfs_fail: sub ax, ax mov dx, ax gfs_exeunt: ; MultiThreading version of change PDB push ax mov ax, SavePDB SetKernelDSNRes ; ds restored on proc exit mov Win_PDB, ax UnSetKernelDS ; cCall SetCurPDB,<SavePDB> ; preserves dx pop ax ; MultiThreading version of change PDB cEnd ; CompareFileBytes ; ; Compares a sequence of bytes with those at a given offset in a file. ; ; Arguments: ; dfh ; lpBytes ; cb ; dwFileOffset ; ; Returns: ; WORD, zero iff match ; ; Remarks: ; The caller is responsible for preserving the offset in the file. ; ; Registers Preserved: ; DI, SI, DS assumes ds,nothing assumes es,nothing ;WORD cProc CompareFileBytes, <PUBLIC, NEAR>, <si,di,ds> parmW dfh parmD lpBytes parmW cb parmD dwFileOffset cBegin ; Seek to dwFileOffset. mov bx, dfh mov cx, dwFileOffset.hi mov dx, dwFileOffset.lo mov ax, 4200h int 21h jc short cfb_fail if KDEBUG ; The high byte of cb _must_ be 0. mov cx, cb cmp ch, 0 je short @F krDebugOut DEB_FERROR,"CompareFileBytes: cb (#cx) > 0ffh" @@: endif mov byte ptr [cb].1, 0 ; force cb < 100h ; Read from file. mov cx, cb smov ds, ss sub sp, cx mov dx, sp ; ds:dx = read buffer mov ah, 3fh int 21h jc short cps_fail_restore_stack ; Make sure we filled the buffer. cmp ax, cx jne short cps_fail_restore_stack ; Compare the bytes. les di, lpBytes ; es:di = signature bytes smov ds, ss mov si, sp ; ds:si = read buffer rep cmpsb jne short cps_fail_restore_stack sub ax, ax add sp, cb jmp short cfb_exit cps_fail_restore_stack: add sp, cb cfb_fail: or al, 1 cfb_exit: cEnd ; ComparePatchSignature ; ; Tests a patch signature against an hExe. ; ; Arguments: ; hExe ; lpPatchSignature ; ; Returns: ; WORD, zero iff match ; ; Registers Preserved: ; DI, SI, DS assumes ds,nothing assumes es,nothing ;WORD cProc ComparePatchSignature, <PUBLIC, NEAR>, <si,di,ds> parmW hExe parmD lpPatchSignature localW SavePDB localW dfh localW cbNonZero localD dwFileOffset cBegin beg_fault_trap cps_fault mov es, hExe lds si, lpPatchSignature cld .errnz AP_SIG.sig_format lodsb ;--------------------------------------------------- cmp al, AP_SIG_FORMAT_META jne short cps_maybe_hexe .errnz (AP_SIG_HEXE.ms_cb - AP_SIG_HEXE.ms_format) - 1 cps_loop_meta: lodsb mov ah, 0 mov cx, ax ; cx = size of sub-signature jcxz cps_meta_exeunt ; end of list. must be match. mov di, si add di, cx ; ds:di = next sub-signature cCall ComparePatchSignature,<hExe,ds,si> test ax, ax jnz cps_fail ; Got a match. Try the next one. mov si, di ; ds:si = next sub-signature jmp cps_loop_meta cps_meta_exeunt: jmp cps_exeunt ;--------------------------------------------------- ; AP_SIG_FORMAT_HEXE ; AP_SIG_FORMAT_HEXE2 cps_maybe_hexe: .errnz (AP_SIG_FORMAT_HEXE2-AP_SIG_FORMAT_HEXE)-1 cmp al, AP_SIG_FORMAT_HEXE jb short cps_maybe_filesize cmp al, AP_SIG_FORMAT_HEXE2 ja short cps_maybe_filesize ; Compute number of bytes in offset after first byte. mov dl, al sub dl, AP_SIG_FORMAT_HEXE .errnz (AP_SIG_HEXE.es_cb - AP_SIG_HEXE.es_format) - 1 mov ah, 0 cps_hexe_loop: lodsb mov cx, ax ; cx = size of signature block jcxz cps_hexe_match ; end of list. must be match. ; Set up bx with the offset in the hExe sub bx, bx ; bx = default offset (0) lodsb mov bl, al ; bl = low byte of offset test dl, dl ; more bytes? jz short @F lodsb mov bh, al ; bh = high byte of offset @@: mov di, bx ; es:di points to bytes in hExe rep cmpsb jne cps_fail jmp cps_hexe_loop cps_hexe_match: ; ax already 0 jmp cps_exeunt ;--------------------------------------------------- ; AP_SIG_FORMAT_FILESIZE2 ; AP_SIG_FORMAT_FILESIZE3 ; AP_SIG_FORMAT_FILESIZE4 cps_maybe_filesize: .errnz (AP_SIG_FORMAT_FILESIZE3-AP_SIG_FORMAT_FILESIZE2)-1 .errnz (AP_SIG_FORMAT_FILESIZE4-AP_SIG_FORMAT_FILESIZE3)-1 cmp al, AP_SIG_FORMAT_FILESIZE2 jb short cps_maybe_file cmp al, AP_SIG_FORMAT_FILESIZE4 ja short cps_maybe_file ; Compute number of non-zero bytes in file size high word mov cl, al sub cl, AP_SIG_FORMAT_FILESIZE2 push cx ; MultiThreading version of change PDB ; cCall GetCurPDB ; mov SavePDB, ax ; SetKernelDSNRes es ; cCall SetCurPDB,<topPDB> ; kernel's PSP ; UnSetKernelDS es ; MultiThreading version of change PDB push ds SetKernelDSNRes mov ax, topPDB xchg Win_PDB, ax ; Switch to Kernel's PDB, UnSetKernelDS pop ds mov SavePDB, ax ; saving current PDB ; Since these patches are only for old (<4.0) apps, only support ; DWORD file size. or ax, -1 cCall FarGetCachedFileHandle,<hExe,ax,ax> cmp ax, -1 je short cps_filesize_fh_cache_miss cCall PatchGetFileSize,<ax> pop cx ; cl = non-zero bytes in file size high word ; Low word of file size must match. ; [si] = low byte of signature file size cmp ax, [si] jne short cps_filesize_fail mov ch, 0 sub bx, bx ; bx = default high word of file size (0) jcxz cps_filesize_compare_high ; [si] = low word of signature file size inc si inc si ; [si] = low byte of high word of signature file size (if exists) ; bx = 0 ; cx = [1|2], non-zero bytes in file size high word lodsb mov bl, al dec cl jcxz cps_filesize_compare_high lodsb mov bh, al cps_filesize_compare_high: cmp bx, dx jne short cps_filesize_fail cps_filesize_match: ; File size matches. ; MultiThreading version of change PDB ; cCall SetCurPDB,<SavePDB> ; MultiThreading version of change PDB mov ax, SavePDB push ds SetKernelDSNRes mov Win_PDB, ax UnSetKernelDS pop ds sub ax, ax jmp cps_exeunt cps_filesize_fh_cache_miss: krDebugOut DEB_ERROR,"ComparePatchSignature: filesize fh cache miss" cps_filesize_fail: ; MultiThreading version of change PDB ; cCall SetCurPDB,<SavePDB> ; MultiThreading version of change PDB mov ax, SavePDB push ds SetKernelDSNRes mov Win_PDB, ax UnSetKernelDS pop ds jmp cps_fail ;--------------------------------------------------- ; AP_SIG_FORMAT_FILE2 ; AP_SIG_FORMAT_FILE3 ; AP_SIG_FORMAT_FILE4 cps_maybe_file: .errnz (AP_SIG_FORMAT_FILE3-AP_SIG_FORMAT_FILE2)-1 .errnz (AP_SIG_FORMAT_FILE4-AP_SIG_FORMAT_FILE3)-1 cmp al, AP_SIG_FORMAT_FILE2 jb cps_bad_format cmp al, AP_SIG_FORMAT_FILE4 ja cps_bad_format ; Compute number of non-zero bytes in file offset high word mov cl, al sub cl, AP_SIG_FORMAT_FILE2 mov ch, 0 mov cbNonZero, cx ; MultiThreading version of change PDB ; cCall GetCurPDB ; mov SavePDB, ax ; SetKernelDSNRes es ; cCall SetCurPDB,<topPDB> ; kernel's PSP ; UnSetKernelDS es ; MultiThreading version of change PDB push ds SetKernelDSNRes mov ax, topPDB xchg Win_PDB, ax ; Switch to Kernel's PDB, UnSetKernelDS pop ds mov SavePDB, ax ; saving current PDB mov es, hExe or ax, -1 push es cCall FarGetCachedFileHandle,<es,ax,ax> pop es cmp ax, -1 je short cps_file_fh_cache_miss mov bx, ax ; bx = dos file handle mov dfh, ax sub cx, cx mov dx, cx mov ax, 4201h int 21h jc cps_fail mov dwFileOffset.hi, dx mov dwFileOffset.lo, ax cps_file_loop: lodsb mov ah, 0 mov cx, ax ; cx = size of signature block jcxz cps_file_match ; end of list. must be match. mov di, cx ; di = number of bytes to match ; Get the file offset into dx:bx ; First get the low word. lodsw mov bx, ax ; bx = low word of file offset ; Get one or both bytes of the high word. sub dx, dx ; dx = default high word of file offset (0) mov cx, cbNonZero jcxz cps_file_compare ; [si] = low byte of high word of file offset ; dx = 0 ; cx = [1|2], non-zero bytes in file offset high word lodsb mov dl, al dec cl jcxz cps_file_compare lodsb mov dh, al cps_file_compare: ; ds:[si] = bytes to match in file ; di = byte count ; dx:bx = offset in file cCall CompareFileBytes,<dfh,ds,si,di,dx,bx> test ax, ax jnz short cps_file_fail add si, di ; ds:si = next signature block jmp cps_file_loop cps_file_fh_cache_miss: krDebugOut DEB_ERROR,"ComparePatchSignature: file fh cache miss" cps_file_fail: or al, 1 jmp short cps_file_exit cps_file_match: sub ax, ax cps_file_exit: mov si, ax ; si = return value ; Restore file position mov bx, dfh ; bx = dos file handle mov cx, dwFileOffset.hi mov dx, dwFileOffset.lo mov ax, 4200h int 21h ; Don't check error, since we can't do anything anyway. if KDEBUG jnc short @F krDebugOut DEB_ERROR,"ComparePatchSignature: failure restoring file position" @@: endif ; MultiThreading version of change PDB ; cCall SetCurPDB,<SavePDB> ; MultiThreading version of change PDB mov ax, SavePDB push ds SetKernelDSNRes mov Win_PDB, ax UnSetKernelDS pop ds mov ax, si jmp short cps_exeunt ;--------------------------------------------------- end_fault_trap cps_fault: fault_fix_stack krDebugOut DEB_ERROR,"ComparePatchSignature: trapped fault" cps_bad_format: krDebugOut DEB_ERROR,"ComparePatchSignature: invalid format" cps_fail: or al, 1 ; ensure we return "no_match" cps_exeunt: cEnd ; GetPatchAppRegKey ; ; Determines if we patch an app at load time, gets reg key if so. ; ; Arguments: ; hExe ; ; Returns: ; HKEY, non-zero iff we segment-patch info in the registry for this app. ; ; Registers Preserved: ; DI, SI, DS, ES assumes ds,nothing assumes es,nothing ;HKEY cProc GetPatchAppRegKey, <PUBLIC, FAR>, <si,di,ds,es> parmW hExe szKey_size = 200 abPatchSignature_size = 100 localD hkeyModule localD hkeySignature localD dwIndex localV szKey,szKey_size ; BUGBUG need a better size localV abPatchSignature,abPatchSignature_size ; BUGBUG need a better size cBegin ; We must refuse to patch system modules. ; Should be ok because of version check (in caller). if KDEBUG mov es, hExe cmp es:[ne_expver], 400h ; Hacks don't apply to 4.0 or above jb short @F ; Should never get here since the caller should have already checked. krDebugOut DEB_ERROR,"GetPatchAppRegKey: (#es) version later than 4.0" @@: endif cCall GetPatchAppCache,<hExe> ; ffff:ffff means a cache miss or cx, -1 cmp cx, dx jne gpark_exeunt cmp cx, ax jne gpark_exeunt ; Not in the cache. Get it from the registry and add to the cache. ; Copy the subkey prefix to the buffer. lea di, szKey smov es, ss SetKernelDSNRes lea si, szREGSTR_PATH_APPPATCH mov cx, szKey_size @@: lodsb stosb test al, al loopnz @B if KDEBUG jz short @F krDebugOut DEB_ERROR,"GetPatchAppRegKey: len(szREGSTR_PATH_APPPATCH) > szKey_size" @@: endif dec di UnSetKernelDS ; Append the module's base name (pascal format). mov ds, hExe mov si, ds:[ne_restab] lodsb if KDEBUG mov ah, 0 cmp cx, ax ja short @F krDebugOut DEB_ERROR,"GetPatchAppRegKey: len(reg path) > szKey_size" @@: endif movzx cx, al rep movsb sub al, al stosb ; NULL terminator ; Get the key for this module. mov hkeySignature, 0 ; In case we fail. mov eax, HKEY_LOCAL_MACHINE lea si, szKey lea di, hkeyModule ccall RegOpenKey32, <eax, ss, si, ss, di> or ax,dx jnz gpark_fail2 or dwIndex, -1 ; == mov dwIndex,-1 (but smaller) gpark_loop: inc dwIndex lea si, szKey ccall RegEnumKey32, <hkeyModule, dwIndex, ss, si, 0, szKey_size> or ax, dx jnz short gpark_loop_done ; First, convert string to binary. ; Reuse szKey since we don't need path any more (we have hKeyModule). lea si, abPatchSignature lea di, szKey krDebugOut DEB_WARN,"GetPatchAppRegKey: checking signature (@ss:di)" cCall ConvertPatchStringToBinary,<ss,si,abPatchSignature_size,ss,di> ; Skip a badly formatted patch signature. test ax, ax if KDEBUG jnz short @F lea cx, szKey krDebugOut DEB_ERROR,"PatchAppSeg: bad patch signature in registry, @ss:cx" @@: endif jz gpark_loop cCall ComparePatchSignature,<hExe,ss,si> test ax, ax jne gpark_loop if KDEBUG mov ax, hExe krDebugOut DEB_WARN,"GetPatchAppRegKey: (#ax) sig matches (@ss:di)" endif ; We have a match. Get the corresponding key. lea si, szKey lea di, hkeySignature ccall RegOpenKey32, <hkeyModule, ss, si, ss, di> or ax,dx jz short gpark_add krDebugOut DEB_ERROR,"GetPatchAppRegKey: RegOpenKey failed, #dx#ax" jmp short gpark_fail gpark_loop_done: if KDEBUG test dx, dx jnz short @F cmp ax, ERROR_NO_MORE_ITEMS je short gpark_after_loop_done_err @@: krDebugOut DEB_ERROR,"GetPatchAppRegKey: unexpected error #dx#ax" gpark_after_loop_done_err: endif gpark_fail: ; Mark that there are no patches in the registry. mov hkeySignature, 0 gpark_add: ; Close the reg key for the path to the end of the module name cCall RegCloseKey32, <hkeyModule> gpark_fail2: ; Add hkeySignature to the cache and set up return regs. cCall AddPatchAppCache,<hExe, hkeySignature> mov ax, hkeySignature.lo mov dx, hkeySignature.hi gpark_exeunt: cEnd ; ConvertPatchStringToBinary ; ; Convert a string of [0-9,A-F] with nibble-swapped bytes to binary. ; ; Arguments: ; lpBinary - output buffer ; cbBinary - size of output buffer in bytes ; lpString - input NULL-terminated string ; ; Returns: ; Boolean, TRUE iff we convert the entire string. ; ; Registers Preserved: ; DI, SI, DS, ES assumes ds, nothing assumes es, nothing ;BOOL cProc ConvertPatchStringToBinary, <PUBLIC, NEAR>,<di,si,ds> parmD lpBinary parmW cbBinary parmD lpString cBegin krDebugOut DEB_WARN,"ConvertPatchStringToBinary: enter" mov cx, cbBinary jcxz cpstb_bad les di, lpBinary lds si, lpString sub ah, ah cpstb_loop: lodsb cmp al, 0 je short cpstb_maybe_good cmp al, ' ' je cpstb_loop cmp al, ',' je cpstb_loop cmp al, '0' jb short cpstb_bad cmp al, '9' ja short cpstb_maybe_lower ; digit sub al, '0' jmp short cpstb_have_nibble cpstb_maybe_lower: or al, 20h ; map upper-case to lower-case cmp al, 'f' ja short cpstb_bad cmp al, 'a' jb short cpstb_bad ; lower-case sub al, 'a'-10 cpstb_have_nibble: cmp ah, 0 jne short cpstb_store_byte mov ah, al or ah, 80h jmp cpstb_loop cpstb_store_byte: shl ah, 4 or al, ah stosb sub ah, ah loop cpstb_loop cpstb_bad: krDebugOut DEB_ERROR, "ConvertPatchStringToBinary: bad char #al, or bad buffer size" sub ax, ax jmp short cpstb_end cpstb_maybe_good: cmp ah, 0 ; odd-length input string ? jne cpstb_bad cpstb_good: or al, 1 cpstb_end: cEnd ; PatchAppSegWorker ; ; Do the work of patching an app segment. ; ; Arguments: ; wSeg - the segment we are about to patch ; wPartySeg - a data aliase of the segment we are about to patch ; cbOriginalSeg - the value returned by GlobalSize(wSeg) ; lpcbCurrentSeg - ptr to the current size of the segment ; lpBinaryPatch - the APPPATCH struct to apply to wSeg ; ; Returns: ; VOID ; ; Registers Preserved: ; DI, SI, DS assumes ds, nothing assumes es, nothing ;VOID cProc PatchAppSegWorker, <PUBLIC, NEAR>,<si,di,ds> parmW wSeg parmW wPartySeg parmW cbOriginalSeg parmD lpcbCurrentSeg parmD lpBinaryPatch localW wAddPartySeg cBegin lds si, lpBinaryPatch mov es, wPartySeg krDebugOut DEB_WARN,"PatchAppSegWorker: applying patch to party seg #es" mov al, [si].AP_COMMON.ap_format cmp al, AP_FORMAT_REPLACE jne short pasw_maybe_add ; Replace some code in a segment. krDebugOut DEB_WARN,"PatchAppSegWorker: type==replace" ; Check size mov ch, 0 mov cl, [si].AP_REPLACE.apr_cb mov al, (AP_REPLACE.apr_abOld - AP_REPLACE.apr_format) add al, cl add al, cl cmp al, [si].AP_REPLACE.apr_cbSize if KDEBUG je short @F mov ah, ch mov dh, ch mov dl, [si].AP_REPLACE.apr_cbSize krDebugOut DEB_ERROR,"PatchAppSegWorker: actual size (#ax) != apa_cbSize (#dx)" @@: endif jne pasw_end mov di, [si].AP_REPLACE.apr_offset add di, cx cmp di, cbOriginalSeg ja pasw_replace_offset_too_large sub di, cx add si, (AP_REPLACE.apr_abOld - AP_REPLACE.apr_format) repe cmpsb ; compare old bytes to hExe bytes jne pasw_repl_no_match mov si, lpBinaryPatch.lo mov ch, 0 mov cl, [si].AP_REPLACE.apr_cb add si, (AP_REPLACE.apr_abOld - AP_REPLACE.apr_format) add si, cx ; skip over the old bytes sub di, cx ; rewind to the patch area start rep movsb ; replace the bytes jmp pasw_end pasw_maybe_add: cmp al, AP_FORMAT_ADD jne pasw_bad_format ; Add some code to the segment. krDebugOut DEB_WARN,"PatchAppSegWorker: type==add" ; Check size mov ch, 0 mov cl, [si].AP_ADD.apr_cb mov al, (AP_ADD.apa_abNew - AP_ADD.apa_format) add al, cl cmp al, [si].AP_ADD.apa_cbSize if KDEBUG je short @F mov ah, ch mov dh, ch mov dl, [si].AP_ADD.apa_cbSize krDebugOut DEB_ERROR,"PatchAppSegWorker: actual size (#ax) != apa_cbSize (#dx)" @@: endif jne pasw_end ; Make sure the add is beyond the original segment. mov di, [si].AP_ADD.apa_offset cmp di, cbOriginalSeg jb short pasw_offset_too_small ; Grow the segment if necessary. mov ah, 0 mov al, [si].AP_ADD.apa_cb add di, ax ; See if the segment is already big enough. les bx, lpcbCurrentSeg cmp di, es:[bx] jbe short pasw_do_add ; Segment too small. Grow it. cCall GlobalRealloc,<wSeg,0,di,0> ; Make sure we got the same sel back. mov cx, wSeg and al, not 1 and cl, not 1 cmp ax, cx jne short pasw_repl_realloc_failed ; Save the new size of the segment. les bx, lpcbCurrentSeg mov es:[bx], di pasw_do_add: mov ch, 0 mov cl, [si].AP_ADD.apa_cb ;Since wSeg may have grown, create a new party seg. mov bx, wSeg mov ax, 000Ah ;DPMI, Create Code Segment Alias int 031h mov es, ax sub di, cx add si, (AP_ADD.apa_abNew - AP_ADD.apa_format) rep movsb ; add the bytes cCall FreeSelector, <es> if KDEBUG jmp short pasw_end endif pasw_bad_format: if KDEBUG sub ah, ah krDebugOut DEB_ERROR,"PatchAppSegWorker: unknown format #ax" jmp short pasw_end endif pasw_repl_realloc_failed: if KDEBUG mov ax, wSeg krDebugOut DEB_ERROR,"PatchAppSegWorker: realloc failed on seg #ax" jmp short pasw_end endif pasw_repl_no_match: if KDEBUG krDebugOut DEB_WARN,"PatchAppSegWorker: replace failed in seg #es" jmp short pasw_end endif pasw_offset_too_small: if KDEBUG mov cx, cbOriginalSeg krDebugOut DEB_ERROR,"PatchAppSegWorker: add offset (#di) < size (#cx)" jmp short pasw_end endif pasw_replace_offset_too_large: if KDEBUG mov cx, cbOriginalSeg krDebugOut DEB_ERROR,"PatchAppSegWorker: replace offset (#di) > size (#cx)" endif pasw_end: cEnd ; PatchAppSeg ; ; Apply any patches for the given segment. ; ; Arguments: ; hkeyPatchApp - reg key containing patches for this app ; wSegNo - number of the segment in the module ; wSeg - selector of the segment ; ; Returns: ; BOOL - ax!=0 iff one or more patches applied ; ; Registers Preserved: ; CX, DI, SI, DS, ES assumes ds, nothing assumes es, nothing ;BOOL cProc PatchAppSeg, <PUBLIC, FAR>,<cx,si,di,ds,es> parmD hkeyPatchApp parmW wSegNo parmW wSeg szKey_size = 5 szValString_size = 32 abValData_size = 100 abBinaryPatch_size = 100 localD hkey localV szKey,szKey_size ; BUGBUG need a better size localV szValString,szValString_size ; BUGBUG need a better size localV abValData,abValData_size ; BUGBUG need a better size localV abBinaryPatch,abBinaryPatch_size ; BUGBUG need a better size localD cbValString localD cbValData localD dwType localD dwIndex localW cbOriginalSeg localW cbCurrentSeg localW wPartySeg cBegin if KDEBUG mov ax, wSegNo mov bx, wSeg krDebugOut DEB_WARN,"PatchAppSeg: enter, (wSegNo #ax) (wSeg #bx)" endif push wSeg call GlobalSize mov cbOriginalSeg,ax mov cbCurrentSeg,ax ; Segment number is the subkey. lea si, szKey cCall Far_htoa0, <ss, si, wSegNo> mov bx, ax mov byte ptr ss:[bx], 0 ; NULL terminator ; Get the key for this module/seg pair. lea si, szKey lea di, hKey cCall RegOpenKey32, <hkeyPatchApp, ss, si, ss, di> or ax,dx jnz pas_no_patches ; Turn off the code bit for the seg to make it writeable. ; NB - Bail if this is a data segment. mov bx, seg gdtdsc mov ds, bx assume ds:nothing mov ds, ds:gdtdsc mov bx, wSeg and bl, not 7 test byte ptr ds:[bx+5], DSC_CODE_BIT jz pas_no_patches ; bail if data seg mov bx, wSeg mov ax, 000Ah ;DPMI, Create Code Segment Alias int 031h mov wPartySeg, ax ; Mark this code segment not discardable so we don't have to deal ; with patching it again. call Far_genter mov dx, wSeg call Far_pdref ; ds:esi = arena record and ds:[esi].pga_flags, not (GA_DISCARDABLE or GA_DISCCODE) call Far_gleave or dwIndex, -1 pas_loop: sub ecx, ecx inc dwIndex push dword ptr hkey push dword ptr dwIndex mov cbValString, szValString_size mov cbValData, abValData_size push ss lea ax, szValString push ax push ss lea ax, cbValString push ax push ecx push ss lea ax, dwType push ax push ss lea ax, abValData push ax push ss lea ax, cbValData push ax cCall RegEnumValue32 or ax, dx jnz pas_loop_done if KDEBUG lea bx, szValString krDebugOut DEB_WARN,"PatchAppSeg: found patch @ss:bx" endif cmp dwType, REG_BINARY jne short pas_bad_type lea bx, abValData ; ss:bx points to patch movzx ecx, ss:[bx].AP_COMMON.ap_cbSize cmp cbValData, ecx if KDEBUG je short @F push bx mov eax, cbValData mov edx, eax ror edx, 16 mov ebx, ecx ror ebx, 16 krDebugOut DEB_ERROR,"PatchAppSeg: actual size (#dx:#ax) != ap_cbSize (#bx:#cx)" pop bx @@: endif jne pas_loop pas_apply_patch: lea ax, cbCurrentSeg ; ss:ax points to curr seg size ; Now apply the patch. cCall PatchAppSegWorker,<wSeg,wPartySeg,cbOriginalSeg,ss,ax,ss,bx> jmp pas_loop pas_bad_type: if KDEBUG mov eax, dwType mov edx, eax ror edx, 16 krDebugOut DEB_WARN,"PatchAppSeg: unimplemented type #dx:#ax" endif jmp pas_loop pas_no_patches: sub ax, ax jmp short pas_end pas_loop_done: if KDEBUG test dx, dx jnz short @F cmp ax, ERROR_NO_MORE_ITEMS je short pas_cleanup @@: krDebugOut DEB_WARN,"PatchAppSeg: unexpected error #dx#ax" endif pas_cleanup: cCall FreeSelector, <wPartySeg> cCall RegCloseKey32, <hkey> or al, 1 ; ax!=0 marks patch found in reg pas_end: cEnd sEnd NRESCODE end