⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paramexe.asm

📁 介绍用Java解析网络数据的三种特殊方法
💻 ASM
字号:

; This sample prints out the command
; line parameters.
; In DOS you simply add this line
; after an executable:
; paramexe.exe my parameters
; In emulator you should set them by
; selecting "Set command line parameters"
; from "File" menu of emulator window.


; Directive to select
; "make EXE" by default when
; source file is compiled:
   #MAKE_EXE#

DSEG    SEGMENT 'DATA'
buffer  DB  100 dup (' ')
msg DB 'No command line parameters!', 13, 10, '$'
DSEG    ENDS

SSEG    SEGMENT STACK   'STACK'
    DW  100h    DUP(?)
SSEG    ENDS

CSEG    SEGMENT 'CODE'

;*******************************************

START   PROC    FAR

; set segment registers:
    MOV AX, DSEG
    
    MOV DS, AX

; we'll keep PSP address in ES,
; so ES is not set to data segment.

; address of command line:
MOV SI, 80h

; copy command line to our buffer:
XOR CX, CX      ; zero CX register.
MOV CL, ES:[SI] ; get command line size.

LEA DI, buffer  ; load buffer address to DI.

CMP CX, 0       ; CX = 0 ?
JZ  no_param    ; then skip the copy.

INC SI      ; copy from second byte.
next_char:
MOV AL, ES:[SI]
MOV [DI], AL
INC SI
INC DI
LOOP    next_char

copied:
; set '$' sign in the end of the buffer:
MOV BYTE PTR [DI], '$'

; print out the buffer:
LEA DX, buffer
MOV AH, 9h
INT 21h


JMP exit    ; skip error message.

no_param:
; print out the error message:
LEA DX, msg
MOV AH, 09h
INT 21h
JMP exit

; exit here:
exit:

; return to operating system:
MOV AH, 4Ch
INT 21h

RET
START   ENDP

;*******************************************

CSEG    ENDS
    END START

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -