Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program that Displays an alphanumeric character on the screen in graphics mode

Posted By: Adalgar Fischer     Category: Cobol     Views: 4028

Program that Displays an alphanumeric character on the screen in graphics mode.

Code for Program that Displays an alphanumeric character on the screen in graphics mode in Cobol

IDENTIFICATION DIVISION.
PROGRAM-ID. Test_DRAW_CHARn.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 VGA16-MODE       PIC X(10) VALUE "VGA16".
77 TEXT-MODE        PIC X(10) VALUE "TEXT".
77 STATUS-CODE      PIC X.

01 COLOURS.
   02 BLACK         PIC 9(4) COMP VALUE 0.
   02 DARK_BLUE     PIC 9(4) COMP VALUE 1.
   02 DARK_GREEN    PIC 9(4) COMP VALUE 2.
   02 DARK_CYAN     PIC 9(4) COMP VALUE 3.
   02 DARK_RED      PIC 9(4) COMP VALUE 4.
   02 DARK_MAGENTA  PIC 9(4) COMP VALUE 5.
   02 BROWN         PIC 9(4) COMP VALUE 6.
   02 LIGHT_GRAY    PIC 9(4) COMP VALUE 7.
   02 DARK_GRAY     PIC 9(4) COMP VALUE 8.
   02 LIGHT_BLUE    PIC 9(4) COMP VALUE 9.
   02 LIGHT_GREEN   PIC 9(4) COMP VALUE 10.
   02 LIGHT_CYAN    PIC 9(4) COMP VALUE 11.
   02 LIGHT_RED     PIC 9(4) COMP VALUE 12.
   02 LIGHT_MAGENTA PIC 9(4) COMP VALUE 13.
   02 YELLOW        PIC 9(4) COMP VALUE 14.
   02 WHITE         PIC 9(4) COMP VALUE 15.

01 PUT_PICTURE_BOOL.
   02 PPB_REPLACE   PIC 9(4) COMP VALUE 0.
   02 PPB_AND       PIC 9(4) COMP VALUE 1.
   02 PPB_OR        PIC 9(4) COMP VALUE 2.
   02 PPB_XOR       PIC 9(4) COMP VALUE 3.

77 x                PIC 9(4) COMP.
77 y                PIC 9(4) COMP.
77 ascii_no         PIC 9(4) COMP.
77 color            PIC 9(4) COMP.

PROCEDURE DIVISION.
MAIN.
   CALL "SET_VIDEO_MODE" USING VGA16-MODE STATUS-CODE
   IF STATUS-CODE = "Y"
      MOVE 30 TO x
      MOVE 1 TO color
      PERFORM VARYING ascii_no FROM 32 BY 1 UNTIL ascii_no > 127
         MOVE 30 TO y
         CALL "DRAW_CHAR1" USING BY VALUE x, BY VALUE y,
                                 BY VALUE ascii_no, BY VALUE color,
                                 BY VALUE PPB_OR
         ADD 30 TO y
         CALL "DRAW_CHAR3" USING BY VALUE x, BY VALUE y,
                                 BY VALUE ascii_no, BY VALUE color,
                                 BY VALUE PPB_OR
         ADD 13 TO x
         IF color < 15 ADD 1 TO color ELSE MOVE 1 TO color END-IF
      END-PERFORM

      MOVE 30 TO x
      MOVE 1 TO color
      PERFORM VARYING ascii_no FROM 32 BY 1 UNTIL ascii_no > 127
         MOVE 90 TO y
         CALL "DRAW_CHAR2" USING BY VALUE x, BY VALUE y,
                                 BY VALUE ascii_no, BY VALUE color,
                                 BY VALUE PPB_OR
         ADD 30 TO y
         CALL "DRAW_CHAR4" USING BY VALUE x, BY VALUE y,
                                 BY VALUE ascii_no, BY VALUE color,
                                 BY VALUE PPB_OR
         ADD 28 TO x
         IF color < 15 ADD 1 TO color ELSE MOVE 1 TO color END-IF
      END-PERFORM
      ACCEPT FOO
      CALL "SET_VIDEO_MODE" USING TEXT-MODE STATUS-CODE
   END-IF
  
Share: 



Adalgar Fischer
Adalgar Fischer author of Program that Displays an alphanumeric character on the screen in graphics mode is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!