flat assembler
Message board for the users of flat assembler.
Index
> Main > Of 'LEA' and DS:DX |
Author |
|
typedef 26 Jul 2010, 02:09
sorry for the unformatted code..i was using my psp...sorry
|
|||
26 Jul 2010, 02:09 |
|
DOS386 26 Jul 2010, 02:12
Code: lea dx, [blah] Also, don't make things complicated, there is no need to define segments if you don't have > 64 KiB of bloat. > to make sure its DS:DX? PUSH CS POP DS Why do you remove the code tags ??? |
|||
26 Jul 2010, 02:12 |
|
revolution 26 Jul 2010, 02:24
This:
Code: lea dx,[stringName] Code: mov dx,stringName |
|||
26 Jul 2010, 02:24 |
|
LocoDelAssembly 26 Jul 2010, 02:37
I think you should not use "org 100" no need to force some origin (which probably will kill relocations). Also note that when you want to produce COM files then you should use org with $100, or 0x100 or 100h.
Your program in COM version: Code: org $100 ; This is the entry always: mov ah,4bh ;exampl. load/Exec mov al,00 mov dx,stringName ;<-- ; Exit program: int $20 ; Now lets put some data: stringName DB 'fasm...',0 In the case of doing MZ executables, I think that you will need "mov ax, data / mov ds, ax" since I don't think DOS will setup it for you (and I believe you can't rely that using "push CS / pop DS" will work always). But as DOS386 recommended, don't define more segments than you really need, in this case you should drop data segment and simply put all that data at the end of cod segment (and in this case "push CS / pop DS" is fine of course). |
|||
26 Jul 2010, 02:37 |
|
typedef 26 Jul 2010, 02:38
thx. you guys are awesome....quick responses.... +5
|
|||
26 Jul 2010, 02:38 |
|
typedef 26 Jul 2010, 02:47
im used to C/C++ and so i find ASM quiet 'complicated'. 'complicated' in a way that i kinda feel familiar with it more than i do compared with C/C++
|
|||
26 Jul 2010, 02:47 |
|
DOS386 26 Jul 2010, 03:01
> In the case of doing MZ executables, I
> think that you will need "mov ax, data > / mov ds, ax" since I don't think > DOS will setup it for you Only if you have multiple segments, as both DS and ES point to the PSP at MZ program start. > (and I believe you can't rely > that using "push CS / pop DS" will work always) It will as long as one has just 1 segment. _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
26 Jul 2010, 03:01 |
|
vid 26 Jul 2010, 09:53
typedef: DOS Asm indeed has levels you don't need to care about in C/C++. It might be better idea to start with linux / windows asm, where you don't have to complicate things with segments & stuff.
However, if you are taking school course, they (in my experience) seldom realize this, and seldom know linux/windows assembly themselves. |
|||
26 Jul 2010, 09:53 |
|
DOS386 27 Jul 2010, 01:21
vid wrote: better idea to start with linux / windows asm, where you don't have to complicate things with segments & stuff There are other (more horrible) things there Quote: if you are taking school course, they (in my experience) seldom realize this, and seldom know linux/windows assembly themselves Bad shool. If you want to develop for DOS, then you need "MZ" / "org $0100" / "INT $21" etc., OTOH if you don't want to develop for DOS, then you should avoid such stuff and pick the correct examples instead, and download the correct package of FASM. |
|||
27 Jul 2010, 01:21 |
|
vid 27 Jul 2010, 13:27
Quote: There are other (more horrible) things there In case he's moving from C/C++ to Asm, eg. he already knows windows interface, what horrible things for him are there? |
|||
27 Jul 2010, 13:27 |
|
typedef 29 Jul 2010, 05:58
OK. Thanks guys...Question answered. This thread can now be closed..
|
|||
29 Jul 2010, 05:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.