I need help =( what is the code for entering time from 8:00 to 5:00 only? and it will tell me if im late or if im on time please help me!! =(((( the output is like this

ENTER TIME LOG-IN : 8:00
ENTER TIME LOGOUT: 5:00
YOU ARE ON TIME!
Posted on 2011-10-07 12:04:41 by joanarizadc
Show us what you have done so far and we'll go from there.
Posted on 2011-10-07 13:02:26 by p1ranha
Wow, 8 to 5? Those hours suck.
Posted on 2011-10-08 06:11:47 by Homer
I always believed an hour lunch to be too long.
Posted on 2011-10-08 07:26:22 by JimmyClif

Wow, 8 to 5? Those hours suck.


Tell me about it :)
Posted on 2011-10-08 11:03:26 by SpooK
I thought 8:00 to 5:00 WAS lunch hour!

But seriously,  joanarizadc, show us what you've got. There are both DOS and BIOS interrupts that deal with "time". There may be an AM/PM issue. What are you trying, and what happens?

Best,
Frank

Posted on 2011-10-09 10:49:23 by fbkotler
but it's wrong i don't know how to input a time :(
Posted on 2011-10-09 11:45:55 by joanarizadc
Show us what you've got! Just comments are okay. We're NOT gonna do your homework for ya!

Best,
Frank



Posted on 2011-10-09 12:16:32 by fbkotler
sorry :sad: don't be angry

Posted on 2011-10-09 12:52:06 by joanarizadc
Now you're talking!

We like you to use "code tags" around your code. Put the word "code" in square brackets "[]" at the beginning of your code, and "/code" (in "[]") at the end. Like so:


; looks pretty good so far.
      mov ah,09h
      lea dx,input1
      int 21h

      mov ah,01h
      int 21h



      mov ah,09h
      lea dx,input2
      int 21h


      mov ah,01h
      int 21h

      cmp al,'8'
      cmp al,'5'
      je yes

      cmp al,'1'
      cmp al,'7'
      je no
; ...


Well, you've gotta write the code - that's the "assignment", no? There are different ways you might approach it. There's a "buffered input" dos interrupt... int 21h with 0Ah in ah. Requires a "special" buffer to be provided. Or look into int 21h ax = 0C0Ah (flushes the input queue first - might be helpful).

Or... you could keep using int 21h, ah = 1, but do it in a loop...


; get a character (int 21h/1 or int 21h/7 or /8)
; is it a carriage return (13 or 0Dh)?
; if so, we've got a time
; is it a ':'?
; if so, just skip it
; but we might want to switch between storing "hours" and storing :minutes"?
; is it a valid decimal digit?
; if not, Houston we have a problem!
; Go "BZZZZZT" and start over?
; we have a good digit (character)
; do we need to "convert" it to a number? (maybe not...)
; Is it an "hours" digit?
; store it?
; and so on...
; jump back to get another character
; time logic...

Something like that?
You've got:

      cmp al,'8'
      cmp al,'5'
      je yes

      cmp al,'1'
      cmp al,'7'
      je no


That's not going to work. The second "cmp" in a row will set the flags, altering the flags set by the first "cmp". You've gotta do 'em one at a time...

cmp al, '8'
je good_login
; do what if not equal?
good_login:
    cmp al, '5'
    je good_times
; do something if not
good_times:
; print "on time"
;...

That might be all you need, depending on the requirements of the assignment, and on the "rules" for login/logout. If I log in at "7:52" and log out at "5:04", is that "on time"? How about "8:01" and "4:59"? How about "8:01" and "5:02"?

What about AM/PM? Do you want to make the user enter "AM" or "PM"? Or maybe make 'em use "military" (24-hour) time? You might want to expand your "prompt", or you might assume that the user's been "trained" and just issue "further instructions" if they make a mistake. Administering an electric shock is supposed to be effective, too, but it would take special hardware...

It might be to your advantage to multiply "hours" (the number, not the character) by 60 and add in the "minutes" (do we care about seconds?). Compare just one set of numbers? Login is 480 and logout is 1020, or so?

It depends. Just writing code and seeing "what it turns out to be" can be fun, too, but you're probably better off if you know exactly what you want to do before you start trying to do it! :)

We haven't mentioned getting the current time, but there are interrupts for that, if you need it. (see if the user is lying?) If you haven't got "Ralf Brown's Interrupt List", there's a link to it in the "sticky" above - you'll want it!

Nobody's angry, we just don't want to cheat you out of learning assembly. Of course, if someone else in your class is reading this, then you're "sharing" your code, and that's considered "cheating" too. You can't win! I'm more into "cooperating to solve problems", myself, but schools don't always see it that way...

If I'm angry, I sign "Sincerely,"!

Best,
Frank

Posted on 2011-10-09 15:04:41 by fbkotler