home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / asm_kit / shifts.asm < prev    next >
Assembly Source File  |  1985-06-21  |  2KB  |  57 lines

  1. ;SHIFT STAUTS TEST PROGRAM
  2. ;  displays shift status continuously
  3. ;
  4. sh_stat              equ 2h
  5. key_rom              equ 16h
  6. display              equ 2h
  7. doscall              equ 21h
  8. return               equ 0dh
  9. ;
  10. ;***************************************************************
  11. ;
  12. pro_nam segment                         ;start of segmnet
  13. ;
  14. ;---------------------------------------------------------------
  15. main                 proc   far
  16. ;
  17.                      assume cs:pro_nam
  18. ;
  19. again:               mov  ah,sh_stat
  20.                      int  key_rom
  21.                      mov  bx,ax
  22.                      call binihex
  23.                      mov  dl,return
  24.                      mov  ah,display
  25.                      int  doscall
  26.                      jmp  again
  27. ;
  28. main                 endp
  29. ;---------------------------------------------------------------
  30. binihex              proc  near
  31. ;
  32. ;SUBROUTINE TO CONVERT BINARY NUMBER IN BX
  33. ;  TO HEX ON CONSOLE SCREEN
  34. ;
  35.                      mov ch,4           ;number of digits
  36. rotate:              mov cl,4           ;set count to 4 bits
  37.                      rol bx,cl          ;left digit to right
  38.                      mov al,bl          ;move to AL
  39.                      and al,0fh         ;mask off left digit
  40.                      add al,30h         ;convert hex to ASCII
  41.                      cmp al,3ah         ;is it > 9?
  42.                      jl  printit        ;jump if digit = 0 to 9
  43.                      add al,7h          ;digit is A to F
  44. printit:
  45.                      mov dl,al          ;put ASCII char in DL
  46.                      mov ah,display     ;Display Output function
  47.                      int doscall        ;call DOS
  48.                      dec ch             ;done 4 digits?
  49.                      jnz rotate         ;not yet
  50.                      ret                ;done subroutine
  51. ;
  52. binihex              endp
  53. ;---------------------------------------------------------------
  54. pro_nam              ends
  55. ;***************************************************************
  56.                      end                ;end of program
  57.