Author Topic: reason why this program does not print a message  (Read 1976 times)

hellfix

  • Guest
reason why this program does not print a message
« on: June 11, 2012, 07:54:13 AM »
PAGE 60,132
TITLE SAMPLE - SHOWS DOS CALLING CONVENTIONS FOR .COM FILES
PAGE
COMSEG SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:COMSEG,DS:COMSEG,ES:COMSEG,SS:COMSEG
        ORG 80H             

CMDCNT DB ?          ;COMMAND LINE COUNT
CMDSTR DB 80 DUP(?)  ;COMMAND LINE BUFFER

   ORG 100H
   
START PROC FAR
JMP ENTRY
;-----------------
;DATA
;-----------
LOGO DB 'SAMPLE PROGRAM EXECUTED' ,13,10,'$'
;------------------
;SCAN INPUT PARAMETER LINE

ENTRY:  MOV DI,OFFSET CMDSTR
        MOV CH,0
   MOV CL,CMDCNT
   CMP CX,0
   
;NO PARAMETERS SUPPLIED - INSERT DEFUALT CODE HERE
       
   JMP SCANX
SCAN0:   MOV AL,[DI]      ;GET 1ST PARAMETER CHARACTER
        AND AL,0DH       ;CONVERT TO UPPDER CASE
;HANDLE PARAMETERS HERE
SCANN:  INC DI           ;POINT TO NEXT PARAMETER
        LOOP SCAN0       ;GET NEXT CHARACTER
SCANX:  NOP
;
;START OF MAIN PROGRAM

CALL CLRSCN           ;CLEAR THE SCREEN
CALL IAMHERE          ;DISPLAY MESSAGE

;RETURN TO DOS
DONE: PUSH DS
      MOV AX,0
      PUSH AX
      RET
START ENDP

;SUROUTINES
CLRSCN PROC
       PUSH AX
       MOV AX,2
       INT 10H
       POP AX
       RET
CLRSCN ENDP

;MESSAGE
IAMHERE PROC
        PUSH AX
   PUSH DX
   MOV AH,9
   MOV DX, OFFSET LOGO
   INT 21H
   POP DX
   POP AX
IAMHERE ENDP
COMSEG ENDS
       END START

im trying to pass arguments to the prorgam and print a message and clear the screen but the program does not print a message to the screen it only clears
the screen.

hellfix

  • Guest
Re: reason why this program does not print a message
« Reply #1 on: June 11, 2012, 08:16:01 AM »
I MADE THE PROGRAM MORE READABLE PLEASE REPLY

PAGE 60,132
TITLE SAMPLE - SHOWS DOS CALLING CONVENTIONS FOR .COM FILES
PAGE
COMSEG SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:COMSEG,DS:COMSEG,ES:COMSEG,SS:COMSEG

ORG 80H             
CMDCNT DB ?          ;COMMAND LINE COUNT
CMDSTR DB 80 DUP(?)  ;COMMAND LINE BUFFER
ORG 100H
   
START PROC FAR
       JMP ENTRY     ;JUMP PASS DATA
;--------------------------------------------
LOGO DB 'SAMPLE PROGRAM EXECUTED' ,13,10,'$'
;--------------------------------------------

;SCAN INPUT PARAMETER LINE

ENTRY:  MOV DI,OFFSET CMDSTR ;STRING
        MOV CH,0
   MOV CL,CMDCNT      ;PARAMETER COUNT
   CMP CX,0
   JNZ SCAN0          ;YES - PROCESS COMMAND LINE PARAMETERS
   JMP SCANX          ;NO - PARAMETERS
   
SCAN0:   MOV AL,[DL]
   AND AL,0DH         ;CONVERT TO UPPERCASE
   INC DI             ;INCREMENT STRING
   LOOP SCAN0
   
SCANX:  NOP

;START OF MAIN PROGRAM

CALL CLRSCN           ;CLEAR THE SCREEN
CALL IAMHERE          ;DISPLAY MESSAGE

;RETURN TO DOS
DONE: PUSH DS
      MOV AX,0
      PUSH AX
      RET
START ENDP

;CLEAR SCREEN
CLRSCN PROC
       PUSH AX
       MOV AX,2
       INT 10H
       POP AX
       RET
CLRSCN ENDP

;MESSAGE
IAMHERE PROC
        PUSH AX
   PUSH DX
   MOV AH,9
   MOV DX, OFFSET LOGO
   INT 21H
   POP DX
   POP AX
IAMHERE ENDP

COMSEG ENDS
END START

dedndave

  • Member
  • *****
  • Posts: 8751
  • Still using Abacus 2.0
    • DednDave
Re: reason why this program does not print a message
« Reply #2 on: June 11, 2012, 08:59:57 AM »
i have attached a simple tiny model program, including the batch file used to assemble it
see if it helps