Re: Just started ASM...



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
;------------------------------------

.



Relevant Pages

  • Re: Another easy way.........
    ... Bill H wrote: ... It is a windows program ... disk image to a Apple][that has a disk drive but not software on 5 ... I guess I'll either drop the hard drive in one of my DOS ...
    (comp.sys.ibm.pc.classic)
  • Re: OT: Yet Another Unhappy Customer for Vista
    ... putting them on the stack or in some data segment. ... I disassembled large sections of DOS while trying ... function entry point had more scar tissue than you could shake a stick ... they did extra work so that they could return ...
    (sci.electronics.design)
  • ofstream problem opening file
    ... XP computer and a DOS computer via a serial port. ... The Windows program ... The first file gives an unexplainable error on opening the ...
    (comp.lang.cpp)
  • Re: Not your usual DOS program
    ... Is a DOS .com program still limited to 64K on a 32 bit machine? ... The reason I'm asking is because Windows Me comes with a ... I think you will find that the reason the code relocates the stack is so ...
    (alt.lang.asm)
  • Stack Segment
    ... I'm trying to write a 16-bit DOS console app with MASM32 that converts ... It seems I need a STACK segment for the ... Converts a decimal digit input to binary and then display it ... Anyone know why the lines in the .stack segment aren't being ...
    (comp.lang.asm.x86)

Loading