User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 397,758 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,445 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser:
Sep 1st, 2006
Views: 4,802
This is somewhat a simple project I wrote by getting help from google groups I always recommend.
assemble this code using this command:
nasm -o 1.com 1.asm
asm Syntax
  1. ORG 100h
  2.  
  3. MOV si,sp ; Save stack pointer!
  4.  
  5. input_loop:
  6. XOR ax,ax
  7. INT 16h ; Use int16 to get a keystroke
  8.  
  9. CMP al,' ' ; is it a space char?
  10. JE input_loop ; if space, get another char
  11.  
  12. PUSH ax ; Save current char on stack top!
  13. CMP al,13 ; Terminating CR?
  14. JNE input_loop
  15.  
  16. POP ax ; Get rid of last pushed char (terminating CR)
  17. JMP test_stack
  18.  
  19. disp_loop:
  20. POP dx ; DL will get the pushed char
  21. MOV ah,2
  22. INT 21h
  23.  
  24. test_stack:
  25. CMP si,sp ; Is the stack back where we started?
  26. JNE disp_loop
  27.  
  28. done: ; So,exit
  29. MOV ax,0x4C00
  30. INT 0x21
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 3:47 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC