Archived

This topic is now archived and is closed to further replies.

question about using asm in winxp

This topic is 5587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

k i''m just starting to learn assembly i''m using tasm 5 and have winxp as my os. here is my question since i''m not in pure dos(using the console window in xp)would that change around any of the interupts or make them work different. cause i have this code from the tut i''m using and it says it will print out the msg using int 21h/ax=0600h but it won''t work here is the code .286 .model tiny .data message db ''Hello World!'',10,13,0 .code org 100h start: mov bx, offset message myloop: mov dl, [bx] ; --> means fetch a character pointed by BX to DL. inc bx ; --> BX = BX + 1 cmp dl, 0 ; --> Is DL zero? je quit ; --> If yes, then quit mov ah, 06 ; --> Otherwise, do the print service and repeat int 21h jmp myloop quit: mov ax, 4c00h int 21h end ohh it is ment to be made a .com file thx for any help

Share this post


Link to post
Share on other sites
I haven''t used TASM so I can''t say for sure, but you''ve got to be careful using separate sections (.data & .code) to build a .com file. The assembler *might* be putting the .data before the .code (ie in file order), which would mean that the computer is trying to execute the message bytes rather than your code. Try putting the .data section after the .code section, this *might* fix it but again I can''t say for sure with TASM.

Alternatively, I did think that XP has totally moved away from DOS which might mean that the int 0x21 won''t work as expected (if at all), but I''m sure someone knows more about XP than me and can correct that.

Share this post


Link to post
Share on other sites
The reason this may not be working is that there is an error in the code. You say you want to set ax -> 0600h, and yet you are only setting ah to 06. It might be that al already is set to something other than 0, so in fact ax becomes 06E5h or something similar.

You should change the line

mov ah, 06 ; --> Otherwise, do the print service and repeat


to:


mov ax, 0600h ; <--- Notice the difference?



jx

Share this post


Link to post
Share on other sites
It might also help to change:

.286

to

.486

Also make sure you are in fullscreen mode when you run it.

---
Make it work.
Make it fast.

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book

Share this post


Link to post
Share on other sites
Captain Jester: That shouldn''t really make a difference to his problem - it will just allow him to use instructions from the 386 and 486 chips. Even so, for future reference baddrizz, change the .286 to .586 so you can use instructions from all current intel chips. (i''m not sure if tasm supports .686)

Share this post


Link to post
Share on other sites