| | |
another addition with tasm
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2009
Posts: 46
Reputation:
Solved Threads: 0
Assembly Syntax (Toggle Plain Text)
.model small .stack .data .code start: mov ah,1 int 21h mov ah,2 mov dl,0ah int 21h push ax mov ah,1 int 21h mov ah,2 int 21h pop bx add ax,bx aaa add al,30h mov dl,al mov ah,2 int 21h end start
im using a different approach in adding 2 digits..
i was wondering why my 2nd input wont show even there is service 2,,can someone help me with this problem..thnks
You need something like the following. I did this in an editor so you'll have to debug it! Note the comments!
Asm Syntax (Toggle Plain Text)
.model small .stack .data .code start: mov ah,1 int 21h ; DOS - Read character from StdIn (Key) ; al=char read ; mov ah,2 ; mov dl,0ah ; WRITE LineFeed ???? ; int 21h ; DOS - Write character to StdOut ; ; NOTE: AL is now destroyed! as LineFeed was written! ;;; BASED upon your error, and this next push.... mov ah,2 mov dl,al int 21h push ax ; Save Old Character mov ah,1 int 21h ; DOS - Read character from StdIn (Key) ; al = char read mov ah,2 int 21h ; DOS - Write character to StdOut pop bx ; Restore Old Character ; al = 2nd char bl = 1st char ; You aren't doing BCD so why are you using the instruction AAA ? ;;; add ax,bx ;;; aaa mov ah,0 add al,bl daa ; Decimal adjust High Nibble, Low Nibble ;ah=high digit, al=low digit mov dh,al ; Save lower digit mov dl,ah ; Upper digit add dl,30h mov ah,2 int 21h ; DOS - Write Digit Upper ASCII mov dl,dh ; Lower Digit add dl,30h mov ah,2 int 21h ; DOS - Write digit Lower ASCII end start
Last edited by wildgoose; Sep 2nd, 2009 at 5:07 pm.
My mistake
Line #40 should be
daa puts result of two unpacked adds into upper nibble of al.
aaa adds the BCD (lower nibble) carry result onto the ah register. Why it needs to be pre-cleared.
Line #40 should be
Assembly Syntax (Toggle Plain Text)
;daa ; Decimal adjust aaa ; Ascii adjust
daa puts result of two unpacked adds into upper nibble of al.
aaa adds the BCD (lower nibble) carry result onto the ah register. Why it needs to be pre-cleared.
Last edited by wildgoose; Sep 2nd, 2009 at 5:50 pm.
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 0
0
#5 Oct 14th, 2009
awts... is this code right?im troubled by this codes.. NEW kid in town.. just studied assembly..can any1 help me out? here is me e-add..
lockheart_l@yahoo.com
lockheart_l@yahoo.com
![]() |
Similar Threads
- Addition with Two Dimensional Arrays (C++)
- TASM Arithmetic (Assembly)
- Nasm to tasm code help (Assembly)
- TASM Begginer (Assembly)
- what is the visual basic express addition please (VB.NET)
- need assistance with tasm (Assembly)
Other Threads in the Assembly Forum
- Previous Thread: job
- Next Thread: Auxiliary Carry Flag Help
Views: 823 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for Assembly
3d 68hc11 6811 80386 :( adress array asm assembler assembly boot bootloader buffer compression cursor debug directory division docs dos draw emulator endtask error exceptions file int10h integer intel interrupt interrupts language loop newbie nohau osdevelopment print program range read remainder shape string text theory tsr x86





