#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    3
    Rep Power
    0

    Assembly-ShowFileTime


    Code:
    INCLUDE Irvine32.inc
    
    .data
    Time WORD 1010100001111b	; it will be displayed as 10:16:15
    
    .code
    main PROC
    	call Clrscr
    
    	mov  ax, Time	
    	call ShowFileTime
    		exit
    main ENDP
    ShowFileTime PROC
    
    	push ebx
    	push edx
    	mov ax,Time 
    	
    	and eax,00FFh
    	and ebx,00FFh
    	and edx,00FFh
    
    	call WriteDec
    	call DumpRegs
    	
    	
    	; ---------------------------------------------
    
    	mov al,':'	; display a ":"
    	call WriteChar
    	and eax,00FFh
    	and ebx,00FFh
    	and edx,00FFh
    
    	call WriteDec
    	call DumpRegs
    	
    	
    	
    	; ---------------------------------------------
    
    	mov al, ':'	; display a ":"
    	call WriteChar
    
    	and eax,00FFh
    	and ebx,00FFh
    	and edx,00FFh
    
    	call WriteDec
    	call DumpRegs
    	call Crlf
    
    	pop edx
    	pop ebx
    	ret
    ShowFileTime ENDP
    END main
    Suppose the time field of a file directory entry uses bits 0-4 for the seconds, bits 5-10 for the minutes, and bits 11-15 for the hours (24-hour clock). For example, the following binary value indicates a time of 02:16:07, in hh:mm:ss format:
    00010 010000 00111
    Write a procedure named ShowFileTime that receives a binary file time value in the AX
    register and displays the time in hh:mm:ss format

    So i read your rules and i do very so much realize you do not do homework. But i just do not know were to start i have done searching but im just not quite shure what im even looking for. So if someone could just push me in the right direction it would be greatly appreciated and if i could give more information as to what im doing, need done, or anything else please let me know.

    Thanks Ahead
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    Thinking on these may help:

    Can you work out what time a certain bit pattern represents by hand?
    What steps did you take to do that?

    Do you understand the bit-shift instructions (SAL,SAR,SHL,SHR)?
    And the bitwise logical instructions (AND,OR,XOR)?

    What does this code do?
    Code:
    mov ax, 11110000b
    shr ax, 4
    What does this code do?
    Code:
    mov ax, 11010101b
    and ax, 00001111b
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    3
    Rep Power
    0
    Thanks so much shortly after reading this i figured out exactly what it was i needed to do. So i thank you greatly!!!!!

    Now i have a question.. Do i post my final result for other people with this homework assignment or would that be considered doing it for someone?

    Just let me know and when i finish up i will or will not post it.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    For homework assignments you shouldn't post complete solutions. Hopefully any other/future students with your assignment will gain the same benefit by figuring out the solution themselves.

    In other cases though, the code or some description of what worked is helpful to people who find the post in the future. Especially if many possible solutions are posted.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    3
    Rep Power
    0
    Alright well for future homework assignment people i found the Rotate command to help greatly with the Shr/Shl Commands.
    rol- Roll Left
    ror- Roll Right

    So basically:
    If we are starting with the commands and functions i set in my code then..
    Code:
    mov ax,time
    rol ax,4
    This Basically takes 1010100001111 and rotates it like a tank so:
    101010000111 becomes 1000011111010 (1010 is shifted to back like a tank would rolling forward and the "4" is how many times it rotates)
    So these will be needed and you need to know When you Rotate or Shift its permanent throughout the script so you need to reset it.

IMN logo majestic logo threadwatch logo seochat tools logo