Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 7th, 2007, 01:17 AM
saltfog saltfog is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 saltfog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 28 sec
Reputation Power: 0
Exclamation Assembly Print Date and Time

I'm currently work on printing the date to the screen. It prints to the screen but the wrong numbers. First run it prints 0</00/00, Second 0:/00/00, and last run 18/00/00. It seems to be printing in ascii. All I have is the month part now, if I could only figure this out then I could finish the rest of the date (day and year)

;NASM Template

;CS2650 Assembler Program #2

;Casey Jenkins

;

[BITS 16] ;Set code generation to 16 bit mode

%include 'exebin.mac' ;include file to simulate .com header



EXE_Begin ;assembler directive to indicate executable begin



[ORG 100H] ;set addressing to begin at 100H





dtfld: db'00/00/0000'





start:

;CLEARS SCREEN AND SCROLL AREA



mov ah,06h ;function 06h (Scroll Screen)

mov al,0 ;scroll all lines

mov bh,000 ;Attribute (black)

mov ch,0 ;Upper left row is zero

mov cl,0 ;Upper left column is zero

mov dh,23 ;Lower left row is 28

mov dl,79 ;Lower left column is 79

int 10H ;BIOS Interrupt 10h (video services)



;DISPLAYS NAME TO SCREEN



mov ah,13h ;function 13h (Display String)

mov al,0 ;Write mode is zero

mov bh,0 ;Use video page of zero

mov bl,0Ch ;Attribute (Red Text)

mov cx,13 ;Character string is 25 long

mov dh,4 ;position on row 4

mov dl,0 ;and column 28

push ds ;put ds register on stack

pop es ;pop it into es register

lea bp,[msg] ;load the offset address of string into BP

int 10H







;GET DATE FROM SYSTEM

;;;;;;;;;;;;;;;; GET MONTH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;

mov ah,1AH

int 21h

mov bh,dh ;copy contents to bh

shr bh,1 ;shift one bit

shr bh,1

shr bh,1

shr bh,1

or bh,30h ;add 30 to convert to ascii

mov [dtfld],bh

mov bh,dh

and bh,0fh

or bh,30h

mov [dtfld + 1],bh

int 04h





;DISPLAY DATE TO SCREEN



mov ah,13h ;function 13h (Display String)

mov al,0 ;Write mode is zero

mov bh,0 ;Use video page of zero

mov bl,0Ch ;Attribute (Red Text)

mov cx,8 ;Character string is 25 long

mov dh,5 ;position on row 4

mov dl,0 ;and column 28

;push ds ;put ds register on stack

;pop es ;pop it into es register

lea bp,[dtfld] ;load the offset address of string into BP

int 10H



msg:

db'CASEY JENKINS'





int 20h ;halt operation (VERY IMPORTANT!!!)





EXE_End

Reply With Quote
  #2  
Old April 14th, 2007, 05:13 PM
Purple Avenger Purple Avenger is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Posts: 271 Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level)Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level)Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level)Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level)Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 51 m 31 sec
Reputation Power: 9
Int 21h Function 1Ah sets the DTA - which has nothing to do with dates.

I suspect what you wanted was BIOS Int 1A function 0

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Assembly Print Date and Time


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway