CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Posts
    2

    pc based digital clock via parallel port using assembly language in tasm

    hi, i have this project and we already have a code and the circuit but it is not working..
    it's supposed to display the hours and minutes
    the problems are:
    1. the hour display is not displaying anything
    2. the minute displays but it is advanced by one minute

    so here's the code:
    TITLE CLOCK.ASM
    DOSSEG
    .MODEL SMALL
    .STACK 0100H
    .DATA
    PRINTERPORTBASEADDRESS equ 378h

    .CODE
    MAIN PROC
    MOV AX, @DATA
    MOV DS, AX

    CALL RTIME ; READ TIME
    CALL DisplayTime ;DISPLAY TIME

    MOV AX, 4C00H
    INT 21H
    MAIN ENDP

    RTIME PROC
    MOV AH, 02H
    INT 1AH
    RET

    ; CH - HOUR
    ; CL - MINUTES
    ; DH - SECONDS
    RTIME ENDP

    DisplayTime PROC
    push DX ; was DH
    push CX ; was CL
    ;
    mov AL,CH
    mov DX,PRINTERPORTBASEADDRESS
    out DX,AL
    mov AL,01h
    mov DX,PRINTERPORTBASEADDRESS+2
    out DX,AL ; enable display
    call Delay
    ;
    mov AL,00h
    mov DX,PRINTERPORTBASEADDRESS+2
    out DX,AL
    pop AX ; pop CL (minutes)
    mov DX,PRINTERPORTBASEADDRESS
    out DX,AL
    mov AL,02h
    mov DX,PRINTERPORTBASEADDRESS+2
    out DX,AL ; enable display
    call Delay
    ;
    mov AL,00h
    mov DX,PRINTERPORTBASEADDRESS+2
    out DX,AL
    pop AX ; pop DH (seconds)
    mov AL,AH
    mov DX,PRINTERPORTBASEADDRESS
    out DX,AL
    mov AL,08h
    mov DX,PRINTERPORTBASEADDRESS+2
    out DX,AL ; enable display
    call Delay
    ;
    mov DX,PRINTERPORTBASEADDRESS+2
    mov AL,00h
    out DX,AL
    ret

    DisplayTime ENDP

    Delay Proc
    MOV CX, 00100h
    X: PUSH CX
    MOV CX, 0FFFFh
    Y: LOOP Y
    POP CX
    LOOP X
    RET

    Delay ENDP
    END

    and the cicuit:
    http://postimage.org/image/2egfc6wsk/

  2. #2
    Join Date
    Oct 2011
    Posts
    2

    Re: pc based digital clock via parallel port using assembly language in tasm

    please help.

  3. #3
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: pc based digital clock via parallel port using assembly language in tasm

    I've never tried it but I would expect any NT system to not grant access to the hardware... Either use a non NT OS or use the appropriate Win32 APIs like OpenFile http://msdn.microsoft.com/en-us/libr...30(VS.85).aspx
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured