I am trying to write a simple assembly program that allows me to assign values and display them at certain points. I am only at "checkpoint A", which means I have yet to do any swapping, and already I am not showing what I expected. Why do I not see the output being alpha, beta, ... that is, why not 23, AB01, EF45, 89, CD67?
;===========================================================
DOSSEG
.MODEL SMALL,BASIC
;===========================================================
EXTRN PUTHEX:FAR
EXTRN PUTSTRNG:FAR
EXTRN NEWLINE:FAR
;
; S T A C K S E G M E N T D E F I N I T I O N
;
.STACK 256
;===========================================================
;
; D A T A S E G M E N T D E F I N I T I O N
;
.DATA
ALPHA DB 35
BETA DW 01ABH
GAMMA DW 45EFH
LAMDA DB CONSTANT
OMEGA DW 67CDH
CONSTANT EQU 10001001B
;===========================================================
; C O D E S E G M E N T D E F I N I T I O N
.CODE
ASSUME DS:NOTHING,ESGROUP
PR_2_2:
;*** CHECKPOINT A ***
MOV AL,ALPHA
MOV BL,0 ; DISPLAY 8 BITS
CALL PUTHEX ; OF NUMBER IN HEX
CALL NEWLINE ; DISPLAY NEWLINE
MOV AX,BETA
MOV BL,1 ; DISPLAY 16 BITS
CALL PUTHEX
CALL NEWLINE
MOV AX,GAMMA
MOV BL,1 ; DISPLAY 16 BITS
CALL PUTHEX
CALL NEWLINE
MOV AL,LAMDA
MOV BL,0 ; DISPLAY 8 BITS
CALL PUTHEX
CALL NEWLINE
MOV AX,OMEGA
MOV BL,1 ; DISPLAY 16 BITS
CALL PUTHEX
CALL NEWLINE
MOV AH,CONSTANT
MOV AL,ALPHA
MOV BX,GAMMA
XCHG AH,BH
XCHG AX,BETA
MOV ALPHA,AH
MOV LAMDA,AL
;*** CHECKPOINT B ***
MOV CX,OMEGA
XCHG BL,CH
MOV GAMMA,BX
MOV OMEGA,CX
;*** CHECKPOINT C ***
.EXIT ;RETURN TO DOS
END PR_2_2
;===========================================================
DOSSEG
.MODEL SMALL,BASIC
;===========================================================
EXTRN PUTHEX:FAR
EXTRN PUTSTRNG:FAR
EXTRN NEWLINE:FAR
;
; S T A C K S E G M E N T D E F I N I T I O N
;
.STACK 256
;===========================================================
;
; D A T A S E G M E N T D E F I N I T I O N
;
.DATA
ALPHA DB 35
BETA DW 01ABH
GAMMA DW 45EFH
LAMDA DB CONSTANT
OMEGA DW 67CDH
CONSTANT EQU 10001001B
;===========================================================
; C O D E S E G M E N T D E F I N I T I O N
.CODE
ASSUME DS:NOTHING,ESGROUP
PR_2_2:
;*** CHECKPOINT A ***
MOV AL,ALPHA
MOV BL,0 ; DISPLAY 8 BITS
CALL PUTHEX ; OF NUMBER IN HEX
CALL NEWLINE ; DISPLAY NEWLINE
MOV AX,BETA
MOV BL,1 ; DISPLAY 16 BITS
CALL PUTHEX
CALL NEWLINE
MOV AX,GAMMA
MOV BL,1 ; DISPLAY 16 BITS
CALL PUTHEX
CALL NEWLINE
MOV AL,LAMDA
MOV BL,0 ; DISPLAY 8 BITS
CALL PUTHEX
CALL NEWLINE
MOV AX,OMEGA
MOV BL,1 ; DISPLAY 16 BITS
CALL PUTHEX
CALL NEWLINE
MOV AH,CONSTANT
MOV AL,ALPHA
MOV BX,GAMMA
XCHG AH,BH
XCHG AX,BETA
MOV ALPHA,AH
MOV LAMDA,AL
;*** CHECKPOINT B ***
MOV CX,OMEGA
XCHG BL,CH
MOV GAMMA,BX
MOV OMEGA,CX
;*** CHECKPOINT C ***
.EXIT ;RETURN TO DOS
END PR_2_2