📄 sscanf.$
字号:
! This program is meant to show the SSCANF! system subroutine.! The format string claims that a byte, an octal,! a four byte string, a decimal and a string! can be expected. In the read string all those! elements can be found.! The arguments are pushed in reverse order as usual.! before the call is made.! Note that the end of line is not processed in the! string request %s.! Note also that the request for the charer string is! %4c, which can take the four characters and does not ! need a place for the closing ascii-0_EXIT = 1 ! seven system call numbers_READ = 3_WRITE = 4_OPEN = 5_CLOSE = 6_CREAT = 8_LSEEK = 19_GETCHAR = 117 ! five system subroutine numbers_SPRINTF = 121_PUTCHAR = 122_SSCANF = 125_PRINTF = 127STDIN = 0 ! three initially opened file descriptorsSTDOUT = 1STDERR = 2.SECT .TEXT ! Definition of section header labelsTxtSecHd:.SECT .DATADatSecHd:.SECT .TEXT.SECT .TEXT ! 2 PUSH octer ! 3 PUSH fmt ! 4 PUSH str ! 5 PUSH _SSCANF ! 6 SYS ! 7 ADD SP,8 ! 8.SECT .DATA ! 9fmt: .ASCIZ "%o" ! 10str: .ASCIZ "0123" ! 11formatter: .ASCIZ "%c %o %4c %d %s" ! 12readstr: .ASCIZ "A 01001 ball 997 cq\n" ! 13.ALIGN 2 ! 14.SECT .BSS ! 15lstr: .SPACE 4 ! 18deccer: .SPACE 2 ! 17charer: .SPACE 4 ! 16octer: .SPACE 2 ! 19byter: .SPACE 1 ! 20.SECT .TEXT ! 21 PUSH lstr ! 24 PUSH deccer ! 23 PUSH charer ! 22 PUSH octer ! 25 PUSH byter ! 26 PUSH formatter ! 27 PUSH readstr ! 28 PUSH _SSCANF ! 29 SYS ! 30 ADD SP,16 ! 31 PUSH 0 ! 32 PUSH _EXIT ! 33 SYS ! 34
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -