Multiply by two in FAT16?
Go to solution
Solved by Cookiecrumbles222,
41 minutes ago, Cookiecrumbles222 said:Hey, guys so I'm coding this translator but I can't seem to get it to multiply by two anyone know why it's not working? the code is below, the issue is definitely in the multiply by 2 lines, the output is 23:46:0< i want it to be 23:46:12, With the input C6BD. Thanks for any help!
TITLE test Template ; Name: Kade Cook ; Date: 7/21/2019 INCLUDE Irvine32.inc .data ;--------- Enter Data Here vPlace byte "Summer 2019",0 vThing byte "Assembler",0 vName byte "Kade Cook",0 vTimeField byte "--:--:--",0 .code main PROC ;--------- Enter Code Below Here call clrscr mov dh, 15 ;----- row mov dl, 20 ;----- column call gotoxy mov edx, offset vPlace call WriteString mov dh, 16 mov dl, 20 call gotoxy mov edx, offset vThing call WriteString mov dh, 17 mov dl, 20 call gotoxy mov edx, offset vName call WriteString mov dh, 19 mov dl, 20 call gotoxy call ReadHex ;--- Stores in EAX ror ax,8 ;-- 1001 --> 1100 mov ecx, eax ;--- Make backup ;---------------------------------------------------------------------------------------------------- Set Hours AND ax, 1111100000000000b ;--- Get first 5 bits the Hour SHR ax, 11 ;--- Shift to end 0000000000011111 MOV bh, 10 ;--- Math DIV bh ;--- Math ADD ax, 3030h ;--- Make normal number mov word ptr [vTimeField+0], ax ;--- Put into the string --- hrs +0 || mins +3 || secs +6 mov dh, 20 ;--- Moves mouse mov dl, 20 ;--- Moves mouse call gotoxy ;--- Moves mouse ;---------------------------------------------------------------------------------------------------- Set Mins mov eax,ecx AND ax, 0000011111100000b ;--- Get middle 6 bits the Mins SHR ax, 5 ;--- Shift to end MOV bh, 10 ;--- Math DIV bh ;--- Math ADD ax, 3030h ;--- Make normal number mov word ptr [vTimeField+3], ax ;--- Put into the string --- hrs +0 || mins +3 || secs +6 ;---------------------------------------------------------------------------------------------------- Set Secs mov eax,ecx AND ax, 0000000000011111b ;--- Get last 5 bits the Secs MOV bh, 10 ;--- Math DIV bh ;--- Math SHL ax, 1 ;--- Multiply by 2 ADD ax, 3030h ;--- Make normal number mov word ptr [vTimeField+6], ax ;--- Put into the string --- hrs +0 || mins +3 || secs +6 mov edx, offset vTimeField ;--- Write to screen call WriteString ;--- Write to screen call ReadHex exit main ENDP END main
I figured it out if anyone stumbles upon this post later the solution is to change the order of operations and move the multiply by two line above the math line where you divide.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now