I'm getting my butt kicked by a simple assignment for my x86 programming class. Since this is a class, Im not asking for people to solve the problem for me, I just need a sanity check and someone to point me in the right direction.
The problem is a simple one: convert a 4-digit hex number into decimal. Heres the problem code:
mov AL, value4
mov AH, value2
mov BL, value3
mov BH, value1
mov CL, 04h
SHL AH, CL
SHL AL, CL
add AX, BX
; add AH, value4
; add AL, value2
jmp T104
negative:
; Print minus sign, complement, etc
jmp endit
T104:
CMP AX, 10000
jb T103
sub AX, 10000
inc t5
jmp T104
T103:
CMP AX, 1000
jb T102
sub AX, 1000
inc t4
jmp T103
T102:
CMP AX, 100
jb T101
sub AX, 100
inc t3
jmp T102
T101:
CMP AX, 10
jb T100
sub AX, 10
inc t2
jmp T101
T100:
CMP AX, 1
jb section2
sub AX, 1
inc t1
jmp T100
This code is supposed to increment a series of counters representing each power of 10.
Can anyone look at this and help? My suspicion is that the problem is before the Txxx labels.
Jason
The problem is a simple one: convert a 4-digit hex number into decimal. Heres the problem code:
mov AL, value4
mov AH, value2
mov BL, value3
mov BH, value1
mov CL, 04h
SHL AH, CL
SHL AL, CL
add AX, BX
; add AH, value4
; add AL, value2
jmp T104
negative:
; Print minus sign, complement, etc
jmp endit
T104:
CMP AX, 10000
jb T103
sub AX, 10000
inc t5
jmp T104
T103:
CMP AX, 1000
jb T102
sub AX, 1000
inc t4
jmp T103
T102:
CMP AX, 100
jb T101
sub AX, 100
inc t3
jmp T102
T101:
CMP AX, 10
jb T100
sub AX, 10
inc t2
jmp T101
T100:
CMP AX, 1
jb section2
sub AX, 1
inc t1
jmp T100
This code is supposed to increment a series of counters representing each power of 10.
Can anyone look at this and help? My suspicion is that the problem is before the Txxx labels.
Jason