Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model
  2. .stack 100h      
  3.     max_cols EQU 720
  4.     max_rows EQU 400
  5. .code
  6. start:
  7.    
  8.     ; init video mode    
  9.     mov ax,0012h
  10.     int 10h
  11.  
  12.     call fill_screen
  13.    
  14.     ;mov al,02h
  15.     ;mov ah,0ch
  16.     ;mov al, 1h
  17.     ;int 10h
  18.    
  19.    
  20.    
  21.     jmp end_program
  22.  
  23.  
  24. fill_screen:
  25.     pop bx      ;save ret adress
  26.     mov dx, 1      
  27. loop_row:
  28.     mov cx, 1
  29. loop_col:
  30.     ; body here
  31.    
  32.     ;call print_coords
  33.     mov al, dl
  34.     xor al, cl
  35.     call fill_pixel
  36.    
  37.     ; end body
  38.     inc cx
  39.     cmp cx, max_cols
  40.     jne loop_col
  41.    
  42.     inc dx
  43.     cmp dx, max_rows
  44.     jne loop_row
  45.    
  46.    
  47.     push bx
  48.     ret
  49.  
  50. end_program:
  51.     mov ah, 4Ch
  52.     int 21h
  53.    
  54. print_coords:
  55.     push dx
  56.     push cx     ;save registers in stack
  57.     push ax
  58.    
  59.     mov ah, 2   ;print dl
  60.     or dl, 30h
  61.     int 21h
  62.    
  63.     mov dl, 'x'
  64.     int 21h
  65.    
  66.     mov dl, cl  ;print cl    
  67.     or dl, 30h
  68.     int 21h
  69.    
  70.     mov dl, 0Ah ;  LF
  71.     int 21h      
  72.    
  73.     mov dl, 0Dh ;  CR
  74.     int 21h
  75.    
  76.     pop ax
  77.     pop cx
  78.     pop dx
  79.     ret      
  80.    
  81. fill_pixel:   ;fills pixel in col cx and row dx with color in AL  
  82.  
  83.     mov ah, 0Ch
  84.     int 10h
  85.     ret
  86.    
  87.  
  88.  
  89. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement