Friday 1 July 2016

Assembly | Print Hangman on the Middle of the Video Screen

Assembly Print Hangman Programming 8086

Description: The following code can answer “How to print in assembly language?” This is one of the simplest assembly language programming 8086 examples where the program prints a hangman on the screen like this

                                 O
                                              /|\
                                              / \

[org 0x0100]

   mov ax , 0xB800
   mov es , ax
  
   mov ax , 80
   mov cx , 12
   mul cx
   mov cx , 40
   add al , cl
   mov cx , 2
   mul cx
   mov di , ax            ;DI=Middle of the screen
  
   mov ah , 0x0F
   mov al , 'O'
   mov [es:di] , ax
  
   add di , 158
   mov al , '/'
   mov [es:di] , ax
  
   add di , 2
   mov al , '|'
   mov [es:di] , ax
  
   add di , 2
   mov al , '\'
   mov [es:di] , ax
  
   add di , 156
   mov al , '/'
   mov [es:di] , ax
  
   add di , 4
   mov al , '\'
   mov [es:di] , ax
  
   mov ax , 0x4c00
   int 0x21
   

No comments

Post a Comment

Recent Posts