omarosh

Untitled

Jun 7th, 2021 (edited)
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. https://stackoverflow.com/questions/28665528/while-do-while-for-loops-in-assembly-language-emu8086
  2. https://www.geeksforgeeks.org/purpose-of-an-interrupt-in-computer-organization/
  3. https://stackoverflow.com/questions/27487137/assembly-language-if-and-else-statements/33737370
  4. https://stackoverflow.com/questions/47556705/what-does-xlat-instruction-do-in-8086
  5.  
  6.  
  7. For 8086 assembly, something like this:
  8.  
  9.     if(x == 1) {
  10.         add();
  11.     }
  12. Would become something like this:
  13.  
  14.     cmp ax,1
  15.     jne .skipIt
  16.     call add
  17. .skipIt:
  18.  
  19.  
  20.  
  21.  
  22.         xor cx,cx   ; cx-register is the counter, set to 0
  23. loop1   nop         ; Whatever you wanna do goes here, should not change cx
  24.         inc cx      ; Increment
  25.         cmp cx,3    ; Compare cx to the limit
  26.         jle loop1   ; Loop while less or equal
  27.  
  28.         mov cx,4    ; 4 iterations
  29. loop1   nop         ; Whatever you wanna do goes here, should not change cx
  30.         loop loop1  ; loop instruction decrements cx and jumps to label if not 0
  31.  
  32. times 4 nop
  33.  
  34.  
  35.  
  36.  
Add Comment
Please, Sign In to add comment