📄 jumptbl.$
字号:
_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 ! 2jumpstrt: ! 3 PUSH strt ! 4 MOV BP,SP ! 5 PUSH _PRINTF ! 6 SYS ! 7 PUSH _GETCHAR ! 81: SYS ! 9 CMP AX,5 ! 10 JL 8f ! 11 CMPB AL,'0' ! 12 JL 1b ! 13 CMPB AL,'9' ! 14 JLE 2f ! 15 MOVB AL,'9'+1 ! 162: MOV BX,AX ! 17 AND BX,0Xf ! 18 SAL BX,1 ! 19 JMP tbl(BX) ! 20! CALL tbl(BX) ! 20! JMP 1b ! 218: PUSH 0 ! 22 PUSH _EXIT ! 23 SYS ! 24rout0: MOV AX,mes0 ! 25 JMP 9f ! 26rout1: MOV AX,mes1 ! 27 JMP 9f ! 28rout2: MOV AX,mes2 ! 29 JMP 9f ! 30rout3: MOV AX,mes3 ! 31 JMP 9f ! 32rout4: MOV AX,mes4 ! 33 JMP 9f ! 34rout5: MOV AX,mes5 ! 35 JMP 9f ! 36rout6: MOV AX,mes6 ! 37 JMP 9f ! 38rout7: MOV AX,mes7 ! 39 JMP 9f ! 40rout8: MOV AX,mes8 ! 41 JMP 9f ! 42erout: MOV AX,emes ! 439: PUSH AX ! 44 PUSH _PRINTF ! 45 SYS ! 46 ADD SP,4 ! 47 JMP 1b ! 48! RET ! 48.SECT .DATA ! 49tbl: .WORD rout0,rout1,rout2,rout3,rout4,rout5,rout6,rout7,rout8,rout8,erout ! 50mes0: .ASCIZ "This is a zero.\n" ! 51mes1: .ASCIZ "How about a one.\n" ! 52mes2: .ASCIZ "You asked for a two.\n" ! 53mes3: .ASCIZ "The digit was a three.\n" ! 54mes4: .ASCIZ "You typed a four.\n" ! 55mes5: .ASCIZ "You preferred a five.\n" ! 56mes6: .ASCIZ "A six was encountered.\n" ! 57mes7: .ASCIZ "This is number seven.\n" ! 58mes8: .ASCIZ "This digit is not accepted as an octal.\n" ! 59emes: .ASCIZ "This is not a digit. Try again.\n" ! 60strt: .ASCIZ "Type an octal digit with a return. Stop on end of file.\n" !61
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -