I haven't done much assembly with my new computer. A while ago, I had to repair some files in my system directory because it wasn't letting me even execute commands in a console window.
Again, I'm having more weird behavior. I'm trying to execute a simple program that uses MS DOS interrupts to obtain the date using 2AH.
Function 2ah is as follows:
Returns the system date
Parameters: NONE
Returns:
AL Day of week
CX Year
DH Month
DL Day
I Execute the following instructions (i.e just trying to properly call the DOS function, and see that the AH register contains reasonable results)
Code:
dosseg
.model small
.stack 100h
.data
DAYLEN EQU 10
dow db 'Sunday, '
db 'Monday, '
db 'Tuesday, '
db 'Wednesday,'
db 'Thursday, '
db 'Friday, '
db 'Saturday, '
dowlen db 7,7,8,10,9,7,9
datestr db 30 dup('$')
.code
main PROC ;everything near for now
mov ax, @data ;don't to do need this in a86 typically
mov ds, ax
mov ah, 2ah
int 21h
mov ax, 4c00h; Dos terminate program
int 21h
main ENDP
END main
When I trace the program using debug, it gives me odd results:
-t
AX=0B9C BX=0000 CX=0089 DX=0000 SP=0100 BP=0000 SI=0000 DI=0000
DS=0B8B ES=0B8B SS=0BA4 CS=0B9B IP=0013 NV UP EI PL NZ NA PO NC
0B9B:0013 8ED8 MOV DS,AX
-t
AX=0B9C BX=0000 CX=0089 DX=0000 SP=0100 BP=0000 SI=0000 DI=0000
DS=0B9C ES=0B8B SS=0BA4 CS=0B9B IP=0015 NV UP EI PL NZ NA PO NC
0B9B:0015 B42A MOV AH,2A
-t
AX=2A9C BX=0000 CX=0089 DX=0000 SP=0100 BP=0000 SI=0000 DI=0000
DS=0B9C ES=0B8B SS=0BA4 CS=0B9B IP=0017 NV UP EI PL NZ NA PO NC
0B9B:0017 CD21 INT 21
2ah called here, AH should have value 3, i.e AX = 03xx, the next insruction listed should be mov ax, 4c00h
-t
AX=2A9C wtf BX=0000 CX=0089 DX=0000 SP=00FA BP=0000 SI=0000 DI=0000
DS=0B9C ES=0B8B SS=0BA4 CS=00A7 IP=107C NV UP DI PL NZ NA PO NC
00A7:107C 90
NOP wtf
-
Namely, the AH register never changes (AX high, the top two bytes, should be between 0 and 6), and right after it calls the first interrupt it goes directly to a bunch of NO operations, then never actually executes the last interrupt which should successfully ends the program.
I hadn't touched anything assembly other than inline in visual studio on my new computer, but I'm quite certain i've gotten other simple programs I've written to work. I'm really just confused, but I'm hoping its just some type of noob error.
I wasn't sure where to put this question.