c-programming

Simple C programs
git clone git://git.laack.co/c-programming.git
Log | Files | Refs

ex3.asm (1136B)


      1 ; ========================================================================
      2 ;
      3 ; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved.
      4 ;
      5 ; This software is provided 'as-is', without any express or implied
      6 ; warranty. In no event will the authors be held liable for any damages
      7 ; arising from the use of this software.
      8 ;
      9 ; Please see https://computerenhance.com for further information
     10 ;
     11 ; ========================================================================
     12 
     13 ; ========================================================================
     14 ; LISTING 39
     15 ; ========================================================================
     16 
     17 bits 16
     18 
     19 ; Register-to-register
     20 mov si, bx
     21 mov dh, al
     22 
     23 ; 8-bit immediate-to-register
     24 mov cl, 12
     25 mov ch, -12
     26 
     27 ; 16-bit immediate-to-register
     28 mov cx, 12
     29 mov cx, -12
     30 mov dx, 3948
     31 mov dx, -3948
     32 
     33 ; Source address calculation
     34 mov al, [bx + si]
     35 mov bx, [bp + di]
     36 mov dx, [bp]
     37 
     38 ; Source address calculation plus 8-bit displacement
     39 mov ah, [bx + si + 4]
     40 
     41 ; Source address calculation plus 16-bit displacement
     42 mov al, [bx + si + 4999]
     43 
     44 ; Dest address calculation
     45 mov [bx + di], cx
     46 mov [bp + si], cl
     47 mov [bp], ch