Re: [Freedos-devel] Learning DOS assembly programming

2023-12-31 Thread Jim Hall via Freedos-devel
Thanks to everyone for sharing their advice on learning assembly
programming. I've started exploring how to write assembly programs in
NASM. I'm not looking to write anything "big" in NASM, just learn
enough about it so I can write a few programs here and there.

Thanks also to Danilo for pointing me to root42's YouTube channel. The
videos are helpful, but I find he skips over steps for what he's
doing, so it's sometimes hard to follow. Not a problem, I just google
what he's doing and figure it out from there, which works well for me.
(But it does highlight the old saying that it takes some skill to
explain something, but much more skill to explain something *simply*.)

I'm also discovering that the Toy CPU emulator that I wrote last year
was already a good primer for learning assembly language. The Toy
emulated a simple fetch/decode/execute for a *very* simplified CPU
(very reduced instruction set). And while the Toy's opcodes aren't
anything like Intel's opcodes, thinking "like a computer" to program
the Toy in machine code is good practice for writing assembly
programs. :-)
https://github.com/freedosproject/toycpu

Jim


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-31 Thread tom ehlert via Freedos-devel
>It is also possible to write TSRs and Device Drivers in higher-level languages 
>but it is very cumbersome and you need to do a lot of "tricks" to get things 
>to do what you want without wasting a lot of memory.
I wouldn't call it "tricks". It's "technics". Advanced programming is usually 
not done by newbies.

mKEYB is 98% high langage, but still by far the smallest general keyboard 
driver ever.
FreeDOS kernel is 99% "C" (with a couple of "technics")

with the use of modern tools (including inline assembly) assembly is close to 
"dinosaur fate". 


> For me, the debugger is just as, if not even more, important than the 
> assembler.  

sure. you just ´missed out on SoftICE

what a waste on life hours

Tom



___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-29 Thread Jerome Shidel via Freedos-devel
Hi,

> On Dec 26, 2023, at 11:42 AM, Jim Hall via Freedos-devel 
>  wrote:
> 
> I actually never learned DOS assembly programming, but decided I'd
> like to start.
> 
> What assembler do you recommend, and where is a good place to start
> learning about DOS assembly programming? Start with a "Hello world"
> program and eventually move up to writing an assembly version of TYPE
> and CHOICE, things like that.
> 
> I was thinking about NASM, since it's open source and we include it in
> the distribution. Looking around, I found a bunch of tutorials on
> https://asmtutor.com/ that look easy enough to follow, although it's
> for Linux. Any similar tutorials to learn DOS assembly programming?
> 
> Or would you recommend a different DOS assembler (and how-to guide) as
> a place to start?
> 

Almost everything that I do nowadays (for FreeDOS) is in assembly using NASM. 

For example, V8Power Tools is all done in NASM. (However, there was no “design” 
or any plan during its creation. It simply was written organically based on the 
immediate needs for the installer. It is a massive bowl of spaghetti with very 
few comments. I would not advise studying it to learn assembly.)

This kind of makes me want to write a series of videos on writing assembly for 
DOS using NASM. Starting with the very basics on up through advanced topics. 

:-)

Jerome

> 
> ___
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel



___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-29 Thread Andy Stamp via Freedos-devel
A few years ago I wanted to learn assembly (more than just inline or a
small example in NASM) and went through Peter Norton's Assembly Language
Book for the IBM PC.
It uses MASM syntax but the Watcom Assembler was close enough for the
examples in the book.

It's under $7 on Thriftbooks which I think is worth it.

On Fri, Dec 29, 2023 at 12:02 AM Pedro Luis Carballosa Mass via
Freedos-devel  wrote:

> You can use the book Advanced MSDOS Programming by Ray Duncan, but this
> autor use MASM and C not NASM.
>
> El mié, 27 dic 2023 a las 20:37, marcelo.spitteler--- via Freedos-devel (<
> freedos-devel@lists.sourceforge.net>) escribió:
>
>> A86.
>>
>> Sent from Yahoo Mail on Android
>> 
>>
>> On Tue, Dec 26, 2023 at 13:49, Jim Hall via Freedos-devel
>>  wrote:
>> I actually never learned DOS assembly programming, but decided I'd
>> like to start.
>>
>> What assembler do you recommend, and where is a good place to start
>> learning about DOS assembly programming? Start with a "Hello world"
>> program and eventually move up to writing an assembly version of TYPE
>> and CHOICE, things like that.
>>
>> I was thinking about NASM, since it's open source and we include it in
>> the distribution. Looking around, I found a bunch of tutorials on
>> https://asmtutor.com/ that look easy enough to follow, although it's
>> for Linux. Any similar tutorials to learn DOS assembly programming?
>>
>> Or would you recommend a different DOS assembler (and how-to guide) as
>> a place to start?
>>
>>
>> ___
>> Freedos-devel mailing list
>> Freedos-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/freedos-devel
>>
>> ___
>> Freedos-devel mailing list
>> Freedos-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/freedos-devel
>>
> ___
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel
>


-- 
--Andy
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-28 Thread Pedro Luis Carballosa Mass via Freedos-devel
You can use the book Advanced MSDOS Programming by Ray Duncan, but this
autor use MASM and C not NASM.

El mié, 27 dic 2023 a las 20:37, marcelo.spitteler--- via Freedos-devel (<
freedos-devel@lists.sourceforge.net>) escribió:

> A86.
>
> Sent from Yahoo Mail on Android
> 
>
> On Tue, Dec 26, 2023 at 13:49, Jim Hall via Freedos-devel
>  wrote:
> I actually never learned DOS assembly programming, but decided I'd
> like to start.
>
> What assembler do you recommend, and where is a good place to start
> learning about DOS assembly programming? Start with a "Hello world"
> program and eventually move up to writing an assembly version of TYPE
> and CHOICE, things like that.
>
> I was thinking about NASM, since it's open source and we include it in
> the distribution. Looking around, I found a bunch of tutorials on
> https://asmtutor.com/ that look easy enough to follow, although it's
> for Linux. Any similar tutorials to learn DOS assembly programming?
>
> Or would you recommend a different DOS assembler (and how-to guide) as
> a place to start?
>
>
> ___
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel
>
> ___
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel
>
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-27 Thread marcelo.spitteler--- via Freedos-devel
A86. 

Sent from Yahoo Mail on Android 
 
  On Tue, Dec 26, 2023 at 13:49, Jim Hall via 
Freedos-devel wrote:   I actually never 
learned DOS assembly programming, but decided I'd
like to start.

What assembler do you recommend, and where is a good place to start
learning about DOS assembly programming? Start with a "Hello world"
program and eventually move up to writing an assembly version of TYPE
and CHOICE, things like that.

I was thinking about NASM, since it's open source and we include it in
the distribution. Looking around, I found a bunch of tutorials on
https://asmtutor.com/ that look easy enough to follow, although it's
for Linux. Any similar tutorials to learn DOS assembly programming?

Or would you recommend a different DOS assembler (and how-to guide) as
a place to start?


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel
  
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-27 Thread Radek Krzyśków via Freedos-devel
Hello Jim,

I started learning assembly with 32-bit x86 Intel syntax (Windows),
and it is easier to understand a flat memory model rather than all the
segment-register addressing and some limitations of registers
usage/combinations.

Anyways, when it comes to real mode 16-bit DOS, the best way to start
is by examining some simple ".COM" programs with the
"DEBUG.COM"/"DEBUG.EXE", get familiar with the syntax, etc. (use
virtual machine or "DOSBox" emulator to not crash the real OS)

Learn about structures like "Program Segment Prefix", the Stack,
calling conventions, the 640kB conventional memory. Compare some "C"
source code with a program that does the same in "ASM" using system
interrupts and user procedures.


Some useful resources:
https://en.wikibooks.org/wiki/X86_Assembly
https://www.pcjs.org/documents/books/mspl13/msdos/

https://archive.org/details/Advanced_MS-DOS_Programming_2nd_Edition_Ray_Duncan/
https://fd.lod.bz/rbil/index.html


Then of course you can read through source code repositories, like the
"MS-DOS 2.0" archive:
https://github.com/microsoft/MS-DOS/tree/master/v2.0/source


As others already suggested, assemble tiny ".COM" programs with
"NASM", then maybe compare output from "DEBUG" listing to your ".ASM"
source code.


Best regards,
Radek


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-27 Thread Ben Collver via Freedos-devel
In the early 90's, i learned assembly on DOS using the A86 assembler and the 
book Using Assembly Language by Allen Wyatt.  It was enlightening to use the 
D86 debugger to step through other code, including the code in the BIOS ROM.  
The IDA disassembler came in handy later on.

A86 & D86:

http://www.eji.com/a86/

IDA:

http://www.dcee.net/Files/Programm/Utils/

I agree that NASM would be a great choice to learn with, and i think DEBUG.COM 
is adequate for stepping through simple code.  Below are links to additional 
free reference material for ASM on DOS.

https://web.archive.org/web/20180127094538/http:/kipirvine.com/asm/debug/Debug_Tutorial.pdf

https://www.plantation-productions.com/Webster/www.artofasm.com/DOS/index.html

https://pacman128.github.io/pcasm/

https://www.seabios.org/Developer_links

http://bespin.org/~qz/pc-gpe/

Best regards,
-Ben

___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-27 Thread Aitor Santamaría via Freedos-devel
Hello Jim,

As the rest suggested, I'd go for NASM too. It's plain and easy to get
ongoing. It was my favourite when I wrote a couple of ASM utilities like
APPEND.

The drawback is that once you get used to it,  you start reading assembly
written for MASM or TASM and you happen to find a different syntax in what
refers to memory indirection. And no matter if you think that NASM syntax
is more coherent (I do, or perhaps I do because I started with NASM), most
of the code out there follows the MASM/TASM syntax and you need to get used
to it.

Just adding my own experience,
Aitor




On Tue, 26 Dec 2023 at 17:49, Jim Hall via Freedos-devel <
freedos-devel@lists.sourceforge.net> wrote:

> I actually never learned DOS assembly programming, but decided I'd
> like to start.
>
> What assembler do you recommend, and where is a good place to start
> learning about DOS assembly programming? Start with a "Hello world"
> program and eventually move up to writing an assembly version of TYPE
> and CHOICE, things like that.
>
> I was thinking about NASM, since it's open source and we include it in
> the distribution. Looking around, I found a bunch of tutorials on
> https://asmtutor.com/ that look easy enough to follow, although it's
> for Linux. Any similar tutorials to learn DOS assembly programming?
>
> Or would you recommend a different DOS assembler (and how-to guide) as
> a place to start?
>
>
> ___
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel
>
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-27 Thread tom ehlert via Freedos-devel
Hallo Herr Jim Hall via Freedos-devel,

am Dienstag, 26. Dezember 2023 um 17:42 schrieben Sie:

> I actually never learned DOS assembly programming, but decided I'd
> like to start.

> What assembler do you recommend,
for noobies, they are all the same: take NASM.

"hello World" programmers don't need highly optimizing C++ complers nor do they 
have a need for macros.



>  and where is a good place to start
> learning about DOS assembly programming? 
get a book.
read other peoples programs. with a little luck there are even comments in the 
source.
while FreeDOS luckily is almost free from assembler nonsense, there is still 
enough .ASM
to learn from.
read what ASM the C compiler generates from your C programs.


> Start with a "Hello world"
> program and eventually move up to writing an assembly version of TYPE
> and CHOICE, things like that.

get the Ralph Brown interrupt list
implement stuff in C.
learn to single step your programs using DEBUG. 

learning to program (in any language) is mostly about reading and 
understanding, 
not so much about writing programs. 


Tom



___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-26 Thread Danilo Pecher via Freedos-devel
Hi Jim,

NASM already comes with FreeDOS. It's a good one to start with. It
works perfectly fine under DOS. There is a German youtuber named
'root42' who has made some pretty good DOS Assembler tutorials in
English.

cheers, Danilo


On Tue, 26 Dec 2023 at 17:50, Jim Hall via Freedos-devel
 wrote:
>
> I actually never learned DOS assembly programming, but decided I'd
> like to start.
>
> What assembler do you recommend, and where is a good place to start
> learning about DOS assembly programming? Start with a "Hello world"
> program and eventually move up to writing an assembly version of TYPE
> and CHOICE, things like that.
>
> I was thinking about NASM, since it's open source and we include it in
> the distribution. Looking around, I found a bunch of tutorials on
> https://asmtutor.com/ that look easy enough to follow, although it's
> for Linux. Any similar tutorials to learn DOS assembly programming?
>
> Or would you recommend a different DOS assembler (and how-to guide) as
> a place to start?
>
>
> ___
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Learning DOS assembly programming

2023-12-26 Thread Steve Nickolas via Freedos-devel

On Tue, 26 Dec 2023, Jim Hall via Freedos-devel wrote:


I actually never learned DOS assembly programming, but decided I'd
like to start.

What assembler do you recommend, and where is a good place to start
learning about DOS assembly programming? Start with a "Hello world"
program and eventually move up to writing an assembly version of TYPE
and CHOICE, things like that.

I was thinking about NASM, since it's open source and we include it in
the distribution. Looking around, I found a bunch of tutorials on
https://asmtutor.com/ that look easy enough to follow, although it's
for Linux. Any similar tutorials to learn DOS assembly programming?


I've used NASM because it's easier than the traditional x86 assemblers.  A 
simple .COM might look like this:


  cpu   8086
  org   0x0100
entry:mov   dx, msg
  mov   ah, 0x09; PUTSTR
  int   0x21
  mov   ax, 0x4C00
  int   0x21; EXIT CODE 0
msg:  db"Hello, cruel world.", 13, 10, "$"

My own implementation of CHOICE is actually written in NASM - it's one of 
the programs I wrote to learn x86 ASM (and it reads a lot like I was 
thinking in 6502).


-uso.


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


[Freedos-devel] Learning DOS assembly programming

2023-12-26 Thread Jim Hall via Freedos-devel
I actually never learned DOS assembly programming, but decided I'd
like to start.

What assembler do you recommend, and where is a good place to start
learning about DOS assembly programming? Start with a "Hello world"
program and eventually move up to writing an assembly version of TYPE
and CHOICE, things like that.

I was thinking about NASM, since it's open source and we include it in
the distribution. Looking around, I found a bunch of tutorials on
https://asmtutor.com/ that look easy enough to follow, although it's
for Linux. Any similar tutorials to learn DOS assembly programming?

Or would you recommend a different DOS assembler (and how-to guide) as
a place to start?


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel