汇编-实现基本链表

汇编-实现基本链表

weixin_30539625 2014-06-01 18:34:00  218  收藏

文章标签: 数据结构与算法

版权

mAlloc proc nSize:dword
    
    add nSize,4
    invoke GlobalAlloc,GMEM_ZEROINIT or GMEM_FIXED,nSize    
     
    ret
mAlloc endp
 
 init_L proc _struct1
LOCAL _headaddress
    invoke mAlloc,sizeof _struct
        mov _headaddress,eax
        assume eax:ptr _struct
        mov [eax].address,eax
      
        assume eax:NOTHING
        mov eax,_headaddress
       ret
init_L endp    
getdata_L proc _L,_i
    
    xor ecx,ecx
    mov eax,_L
    .while ecx<=65536
          assume eax:ptr _struct
          .if ecx==_i
                  mov eax,eax
                  .break
                  ret
        .endif
        
           mov eax,[eax].next
           inc ecx
           
    .endw
    ret

getdata_L endp

insert_L proc   _L,_i
LOCAL _firstaddress
LOCAL _posaddress
     
    mov eax,_L
    mov _firstaddress,eax
    xor ecx,ecx
    .while ecx<_i
        push ecx
        assume eax:ptr _struct
            invoke mAlloc,sizeof _struct
        mov _posaddress,eax
        mov [eax].address,eax
        m2m [eax].back,_firstaddress
        mov eax,_firstaddress
        m2m [eax].next,_posaddress
        m2m _firstaddress,_posaddress     
         
         pop ecx
                
        
        inc ecx
    .endw
     
 
     
    mov eax,_L
    ret
insert_L endp
delete_L proc    _L,_i
 LOCAL _address
        mov eax,_L
        xor ecx,ecx
        .while ecx<65536
            push ecx
            
            assume eax:ptr _struct
            .if ecx==_i
                  
                 m2m _address,[eax].next
                 mov eax,[eax].back
                 m2m [eax].next,_address 
                .break
                ret
            .endif
            mov eax,[eax].next
            
            pop ecx
            inc ecx
        .endw
    ret

delete_L endp    

 

转载于:https://www.cnblogs.com/fuyunlong/p/3763619.html

相关资源:动态链表汇编语言实现

https://blog.csdn.net/weixin_30539625/article/details/98868382

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值