📄 ishow.s
字号:
.bss .align 4.globl bufbuf: .skip 128b: .word .text .align 4.globl ireadiread: xorl %ebx,%ebx # File 0 is stdin movl $buf,%ecx movl $128,%edx movl $3,%eax # System read call id int $0x80 movl $buf,%ecx xorl %ebx,%ebx xorl %edx,%edx xor %si,%sitop1: cmpl $0,%eax jle next2 movb (%ecx),%dl cmpb $'0',%dl jl cont1 cmpb $'9',%dl jle next1cont1: cmpb $'-',%dl jne nomin mov $1,%sinomin: addl $1,%ecx subl $1,%eax jmp top1 next1: cmpl $0,%eax jle next2 xorl %edx,%edx movb (%ecx),%dl subb $'0',%dl jl next2 cmpb $9,%dl jg next2 imull $10,%ebx addl %edx,%ebx addl $1,%ecx subl $1,%eax jmp next1next2: cmp $0,%si je next3 negl %ebxnext3: movl %ebx,%eax retidigits: # %eax holds parameter movl $10,%ebx xorl %edx,%edx idivl %ebx,%eax cmpl $0,%eax jz labela pushl %edx call idigits pop %edxlabela: movl b,%ebx addl $48,%edx movb %dl,(%ebx) addl $1,%ebx movl %ebx,b ret.globl ishowishow: movl $buf,%ebx movl %ebx,b cmpl $0,%eax jge labelb neg %eax movl b,%ebx movb $'-',%dl movb %dl,(%ebx) addl $1,%ebx movl %ebx,blabelb: call idigits movl $1,%ebx movl $buf,%ecx movl b,%edx subl %ecx,%edx movl $4,%eax int $0x80 ret.globl fshowfshow: subl $4,%esp fstps (%esp) call fdigits addl $4,%esp movl %eax,%edx movl $1,%ebx movl $buf,%ecx movl $4,%eax int $0x80 ret .globl freadfread: xorl %ebx,%ebx # File 0 is stdin movl $buf,%ecx movl $128,%edx movl $3,%eax # System read call id int $0x80 push %eax # Number of chars read call fgather pop %eax ret.global cshowcshow: movl %eax, buf movl $4, %eax movl $1, %ebx movl $buf, %ecx movl $1, %edx int $0x80 ret.global newlinenewline: movl $10, buf movl $4, %eax movl $1, %ebx movl $buf, %ecx movl $1, %edx int $0x80 ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -