Re: Just started ASM...
- From: Frank Kotler <fbkotler@xxxxxxxxxxx>
- Date: Sat, 15 Apr 2006 23:29:07 -0400
cozofdeath wrote:
Hey thanks Frank! I'll have to check that debugger out. Any other
suggestion to help me, cuz this assembly stuff is ruff and you are
right debug does make me appreciate the more symbolic assembly. I
figured I'll dabble a little in 16bit then go 32. Is that not a good
way to go?
Seems like a good way to me. I may have mentioned that opinions differ. :) Since you seem to have already started down that path, the only question is how long to dabble in 16-bit code...
The simplest Windows program I know of uses the stack to pass parameters... You might want to learn how the stack works, how "call" and "ret" work, *before* you have to use 'em to access your OS. Some people learn by jumping into the deep end of the pool, I think you might be better off working up to it slowly...
I'd agree that it isn't worth spending a lot of time learning the complete workings of dos. You already know how to put a character on screen (int 29h is an even easier one for that - prints the character in al). File I/O routines can be used to get/print from/to the keyboard/screen, as well as disk files - might want to learn them (Windows and Linux work similarly, when you get to them). Learn to call a subroutine, and how to pass it parameters on the stack... Maybe then you'd be ready to move on...
This isn't the simplest dos program I know, but it uses the least dos (there's actually an "int 20h" hidden behind the "ret"). Let's see them do something equivalent in a "simple" Windows program! :)
Best,
Frank
;---------------------------------
; nasm -f bin -o hwnoint.com hwnoint.asm
org 100h
push word 0B800h ; segment of video memory
pop es ; (because stosw uses es:di)
mov di, (10 * 80 + 30) * 2 ; offset into screen
; (row * width + column) * 2 bytes/character
mov si, msg ; offset of our string
mov ah, 0B0h ; color (blinking black on cyan)
top:
lodsb ; get byte from [ds:si] into al
; and increment si for next one
or al, al ; this doesn't change al, but sets
jz depart ; the flags - if zero, we're done
stosw ; stores ax (char & color) to [es:si]
; and add 2 to di for next one
jmp short top ; do more
depart:
ret ; return to dos (or other caller)
msg db " Look, Ma! No ints! ",0 ; note 0, not '$', terminated
; '$' is just for int 21h/9
;------------------------------------
.
- Follow-Ups:
- Re: Just started ASM...
- From: Betov
- Re: Just started ASM...
- References:
- Just started ASM...
- From: cozofdeath
- Re: Just started ASM...
- From: cozofdeath
- Re: Just started ASM...
- From: James Daughtry
- Re: Just started ASM...
- From: cozofdeath
- Re: Just started ASM...
- From: Frank Kotler
- Re: Just started ASM...
- From: cozofdeath
- Just started ASM...
- Prev by Date: Re: NASM macros, defines that will be used later
- Next by Date: Re: why this assembly language is not good?
- Previous by thread: Re: Just started ASM...
- Next by thread: Re: Just started ASM...
- Index(es):
Relevant Pages
|
Loading