• Looking for .COM program sources in NASM Assembly

    From Paolo Amoroso@paolo.amoroso@gmail.com to comp.os.msdos.programmer on Sun Sep 4 03:48:21 2022
    From Newsgroup: comp.os.msdos.programmer

    I'm looking for source code of MS-DOS .COM programs in real-mode 8086 Assembly written in NASM syntax. Any repositories or recommendations?
    I'm learning Assembly programming under MS-DOS (and MikeOS). To avoid the complexity of x86 segmentation, for the time being I prefer to focus on single-segment programs, as I plan to write small programs anyway. So I'd like to study examples of how such systems organize and reference data and code. I searched a bit but found remarkably little .COM code.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kerr-Mudd, John@admin@127.0.0.1 to comp.os.msdos.programmer on Sun Sep 4 14:05:33 2022
    From Newsgroup: comp.os.msdos.programmer

    On Sun, 4 Sep 2022 03:48:21 -0700 (PDT)
    Paolo Amoroso <paolo.amoroso@gmail.com> wrote:

    I'm looking for source code of MS-DOS .COM programs in real-mode 8086 Assembly written in NASM syntax. Any repositories or recommendations?

    I'm learning Assembly programming under MS-DOS (and MikeOS). To avoid the complexity of x86 segmentation, for the time being I prefer to focus on single-segment programs, as I plan to write small programs anyway. So I'd like to study examples of how such systems organize and reference data and code. I searched a bit but found remarkably little .COM code.


    Just to get you going

    ; Hi.com
    ;13:54 2022-09-04 23 clean asm
    ;13:58 2022-09-04 23 to middle of screen added comments
    ;14:01 2022-09-04 22 commented out section header; no aligment
    cpu 8086
    org 0x100
    ;section .code ; not required
    mov ah,0xB8 ; B800 text mode screen seg
    push ax
    pop es ; es:di pts to scrn
    mov si,WelcomeStr ;
    mov cl,WelcomeLth ;
    mov ah,02 ; green
    mov di,2*(12*80+40) ; middle of screen
    PrtaChar: ; printloop
    lodsb ; get a char
    stosw ; put char to screen, attribute in ah
    loop PrtaChar
    ret ; all done
    ;section .data ; not required for this example
    WelcomeStr db 'Hi!'
    WelcomeLth equ $-WelcomeStr



    Sorry, I've tried DDGo and got lots of dead ends too. try clax for some
    older posts, but I'm not suggesting my stuff is best practice!

    news:comp.lang.asm.x86
    (moderated, so your post might not show up for a while)
    --
    Bah, and indeed Humbug.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Steve Nickolas@usotsuki@buric.co to comp.os.msdos.programmer on Sun Sep 4 12:47:53 2022
    From Newsgroup: comp.os.msdos.programmer

    On Sun, 4 Sep 2022, Paolo Amoroso wrote:

    I'm looking for source code of MS-DOS .COM programs in real-mode 8086 Assembly written in NASM syntax. Any repositories or recommendations?

    I'm learning Assembly programming under MS-DOS (and MikeOS). To avoid
    the complexity of x86 segmentation, for the time being I prefer to focus
    on single-segment programs, as I plan to write small programs anyway. So
    I'd like to study examples of how such systems organize and reference
    data and code. I searched a bit but found remarkably little .COM code.

    I happen to have some in https://github.com/buricco/doslite

    -look for the .a86 files.

    -uso.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Paolo Amoroso@paolo.amoroso@gmail.com to comp.os.msdos.programmer on Mon Sep 5 00:39:35 2022
    From Newsgroup: comp.os.msdos.programmer

    Kerr-Mudd, Steve, thanks for the code and the advice.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kerr-Mudd, John@admin@127.0.0.1 to comp.os.msdos.programmer on Mon Sep 5 10:54:49 2022
    From Newsgroup: comp.os.msdos.programmer

    On Sun, 4 Sep 2022 12:47:53 -0400
    Steve Nickolas <usotsuki@buric.co> wrote:

    On Sun, 4 Sep 2022, Paolo Amoroso wrote:

    I'm looking for source code of MS-DOS .COM programs in real-mode 8086 Assembly written in NASM syntax. Any repositories or recommendations?

    I'm learning Assembly programming under MS-DOS (and MikeOS). To avoid
    the complexity of x86 segmentation, for the time being I prefer to focus on single-segment programs, as I plan to write small programs anyway. So I'd like to study examples of how such systems organize and reference
    data and code. I searched a bit but found remarkably little .COM code.

    I happen to have some in https://github.com/buricco/doslite

    -look for the .a86 files.


    I was going to object that a86 isn't nasm but your chcp.a86 assembled
    without error (though I have to say that I dislike numbers as labels)
    --
    Bah, and indeed Humbug.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Steve Nickolas@usotsuki@buric.co to comp.os.msdos.programmer on Mon Sep 5 15:46:27 2022
    From Newsgroup: comp.os.msdos.programmer

    This message is in MIME format. The first part should be readable text,
    while the remaining parts are likely unreadable without MIME-aware tools.

    --8323329-2147281719-1662407188=:15708
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE

    On Mon, 5 Sep 2022, Kerr-Mudd, John wrote:

    I was going to object that a86 isn't nasm but your chcp.a86 assembled
    without error (though I have to say that I dislike numbers as labels)

    NASM doesn't care what extension you give it. =F0=9F=A4=AA

    -uso.
    --8323329-2147281719-1662407188=:15708--
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Herbert Kleebauer@klee@unibwm.de to comp.os.msdos.programmer on Tue Sep 6 00:05:27 2022
    From Newsgroup: comp.os.msdos.programmer

    On 06.09.2022 00:03, Herbert Kleebauer wrote:
    is just the data of the exe file format). Because NASM uses an awful
    syntax you have to include "mac.inc" to be able to use a readable
    instruction format (I post mac.inc in a follow up):



    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; mac.inc ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro seg 1
    %define __seg__ %1
    [BITS %1]
    %endmacro

    seg 16

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


    %macro dc.b 1+
    db %1
    %endmacro

    %macro dc.w 1+
    dw %1
    %endmacro

    %macro dc.l 1+
    dd %1
    %endmacro

    %macro blk.b 1
    resb %1
    %endmacro

    %macro blk.b 2
    times %1 db %2
    %endmacro

    %macro blk.w 1
    resw %1
    %endmacro

    %macro blk.l 1
    resd %1
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro move.l 2
    reg32
    %ifidn %2,-[sp]
    push dword %1
    %elifidn %1,[sp]+
    pop dword %2
    %elifidn %2,[r6]+-{s1}
    %ifidn %1,r0
    stosd
    %endif
    %elifidn %2,[r6.w]+-{s1}
    %ifidn %1,r0
    stosd
    %endif
    %elifidn %1,[r5]+-
    %ifidn %2,r0
    lodsd
    %endif
    %else
    mov dword %2,%1
    %endif
    reg0
    %endmacro

    %macro move.w 2
    reg16
    %ifidn %2,-[sp]
    push word %1
    %elifidn %1,[sp]+
    pop word %2
    %elifidn %1,[r5]+-
    %ifidn %2,r0
    lodsw
    %endif
    %elifidn %2,[r6.w]+-{s1}
    %ifidn %1,r0
    stosw
    %endif
    %else
    mov word %2,%1
    %endif
    reg0
    %endmacro

    %macro move.b 2
    %ifidn %1,[r5]+-
    %ifidn %2,[r6]+-{s1}
    movsb
    %endif
    %elifidn %2,[r6.w]+-{s1}
    %ifidn %1,r0
    stosb
    %endif
    %else
    reg8
    mov byte %2,%1
    reg0
    %endif
    %endmacro


    %macro moveq.l 2
    reg32
    %ifidn %2,-[sp]
    push dword %1
    %endif
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro movu.bw 2
    reg16
    movzx %2,byte %1
    reg0
    %endmacro

    %macro movu.bl 2
    reg32
    movzx %2,byte %1
    reg0
    %endmacro

    %macro movu.wl 2
    reg32
    movzx %2,word %1
    reg0
    %endmacro

    %macro movem.l 2
    %if __seg__ = 16
    db $66
    %endif
    %ifidn %2,-[sp]
    pusha
    %else
    popa
    nop
    %endif
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro exg.l 2
    reg32
    xchg %2,%1
    reg0
    %endmacro

    %macro exg.w 2
    reg16
    xchg %2,%1
    reg0
    %endmacro

    %macro exg.b 2
    reg8
    xchg %1,%2
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro add.l 2
    reg32
    add %2,%1
    reg0
    %endmacro

    %macro add.w 2
    reg16
    add word %2,%1
    reg0
    %endmacro

    %macro add.b 2
    reg8
    add %2,%1
    reg0
    %endmacro

    %macro addq.l 2
    reg32
    add %2,%1
    reg0
    %endmacro

    %macro addq.w 2
    reg16
    add word %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro addc.l 2
    reg32
    adc %2,%1
    reg0
    %endmacro

    %macro addc.w 2
    reg16
    adc word %2,%1
    reg0
    %endmacro

    %macro addc.b 2
    reg8
    adc %2,%1
    reg0
    %endmacro


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro sub.l 2
    reg32
    sub %2,%1
    reg0
    %endmacro

    %macro sub.w 2
    reg16
    sub word %2,%1
    reg0
    %endmacro

    %macro sub.b 2
    reg8
    sub %2,%1
    reg0
    %endmacro

    %macro subq.l 2
    reg32
    sub %2,%1
    reg0
    %endmacro

    %macro subq.w 2
    reg16
    sub word %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro subc.l 2
    reg32
    sbb %2,%1
    reg0
    %endmacro

    %macro subc.w 2
    reg16
    sbb word %2,%1
    reg0
    %endmacro

    %macro subc.b 2
    reg8
    sbb %2,%1
    reg0
    %endmacro


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro cmp.l 2
    reg32
    cmp %2,long %1
    reg0
    %endmacro

    %macro cmp.w 2
    reg16
    cmp %2,word %1
    reg0
    %endmacro

    %macro cmp.b 2

    %ifidn %1,[r6]+-{s1}
    %ifidn %2,[r5]+-
    %if __seg__ = 16
    db $66
    %endif
    cmpsb
    %endif

    %elifidn %1,[r6.l]+-{s1}
    %ifidn %2,[r5.l]+-
    %if __seg__ = 16
    db $66
    %endif
    cmpsb
    %endif

    %elifidn %1,[r6.w]+-{s1}
    %ifidn %2,[r5.w]+-
    %if __seg__ = 32
    db $66
    %endif
    cmpsb
    %endif

    %else
    reg8
    cmp %2,byte %1
    reg0
    %endif
    %endmacro

    %macro cmpq.l 2
    reg32
    cmp %2,long %1
    reg0
    %endmacro

    %macro cmpq.w 2
    reg16
    cmp %2,word %1
    reg0
    %endmacro


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro and.l 2
    reg32
    and %2,%1
    reg0
    %endmacro

    %macro and.w 2
    reg16
    and %2,%1
    reg0
    %endmacro

    %macro and.b 2
    reg8
    and %2,%1
    reg0
    %endmacro

    %macro andq.l 2
    reg32
    and %2,%1
    reg0
    %endmacro

    %macro andq.w 2
    reg16
    and %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro or.l 2
    reg32
    or %2,%1
    reg0
    %endmacro

    %macro or.w 2
    reg16
    or %2,%1
    reg0
    %endmacro

    %macro or.b 2
    reg8
    or %2,%1
    reg0
    %endmacro

    %macro orq.l 2
    reg32
    or %2,%1
    reg0
    %endmacro

    %macro orq.w 2
    reg16
    or %2,%1
    reg0
    %endmacro


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro eor.l 2
    reg32
    xor %2,%1
    reg0
    %endmacro

    %macro eor.w 2
    reg16
    xor %2,%1
    reg0
    %endmacro

    %macro eor.b 2
    reg8
    xor %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro tst.l 2
    reg32
    test dword %2,%1
    reg0
    %endmacro

    %macro tst.w 2
    reg16
    test word %2,%1
    reg0
    %endmacro

    %macro tst.b 2
    reg8
    test byte %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro lsl.l 2
    reg32
    shl %2,%1
    reg0
    %endmacro

    %macro lsl.w 2
    reg16
    shl %2,%1
    reg0
    %endmacro

    %macro lsl.b 2
    reg8
    shl %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro lsr.l 2
    reg32
    shr %2,%1
    reg0
    %endmacro

    %macro lsr.w 2
    reg16
    shr %2,%1
    reg0
    %endmacro

    %macro lsr.b 2
    reg8
    shr %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro asr.l 2
    reg32
    sar %2,%1
    reg0
    %endmacro

    %macro asr.w 2
    reg16
    sar %2,%1
    reg0
    %endmacro

    %macro asr.b 2
    reg8
    sar %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro rol.l 2
    reg32
    rol %2,%1
    reg0
    %endmacro

    %macro rol.w 2
    reg16
    rol %2,%1
    reg0
    %endmacro

    %macro rol.b 2
    reg8
    rol %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro ror.l 2
    reg32
    ror %2,%1
    reg0
    %endmacro

    %macro ror.w 2
    reg16
    ror %2,%1
    reg0
    %endmacro

    %macro ror.b 2
    reg8
    ror %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


    %macro btst.l 2
    reg32
    bt dword %2, %1
    reg0
    %endmacro

    %macro bchg.l 2
    reg32
    btc dword %2, %1
    reg0
    %endmacro

    %macro bset.w 2
    %ifidn %1,0
    %ifidn %2,sr
    stc
    %endif
    %endif
    %endmacro

    %macro bclr.w 2
    %ifidn %2,sr
    %ifidn %1,0
    clc
    %endif
    %ifidn %1,10
    cld
    %endif
    %endif
    %endmacro


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro neg.l 1
    reg32
    neg %1
    reg0
    %endmacro

    %macro neg.w 1
    reg16
    neg %1
    reg0
    %endmacro

    %macro neg.b 1
    reg8
    neg %1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro not.l 1
    reg32
    not %1
    reg0
    %endmacro

    %macro not.w 1
    reg16
    not %1
    reg0
    %endmacro

    %macro not.b 1
    reg8
    not %1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro inc.l 1
    reg32
    inc dword %1
    reg0
    %endmacro

    %macro inc.w 1
    reg16
    inc %1
    reg0
    %endmacro

    %macro inc.b 1
    reg8
    inc %1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro dec.l 1
    reg32
    dec dword %1
    reg0
    %endmacro

    %macro dec.w 1
    reg16
    dec %1
    reg0
    %endmacro

    %macro dec.b 1
    reg8
    dec %1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro muls.l 3
    reg32
    %ifidn %3,r1|r0
    imul dword %1
    %else
    imul %2,%1
    %endif
    reg0
    %endmacro

    %macro mulu.l 3
    reg32
    %ifidn %3,r1|r0
    mul dword %1
    %else
    mul %2,%1
    %endif
    reg0
    %endmacro

    %macro mulu.b 3
    reg8
    %ifidn %3,m0|r0
    mul %1
    %else
    mul %2,%1
    %endif
    reg0
    %endmacro

    %macro divs.l 2
    reg32
    idiv %1
    reg0
    %endmacro

    %macro divu.l 2
    reg32
    div dword %1
    reg0
    %endmacro

    %macro divu.w 2
    reg16
    div word %1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro lea.l 2
    reg32
    lea %2,%1
    reg0
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro adj_dec_sub 1
    das
    %endmacro

    %macro in.b 2
    reg8
    in %2,%1
    reg0
    %endmacro

    %macro out.b 2
    reg8
    out %2,%1
    reg0
    %endmacro

    %macro ext.l 2
    %ifidn %2,r1|r0
    %ifidn %1,r0
    cdq
    %endif
    %endif
    %endmacro

    %macro ext.w 2
    %ifidn %2,r1|r0
    %ifidn %1,r0
    cwd
    %endif
    %endif
    %endmacro

    %macro ext.l 1
    %ifidn %1,r0
    cwde
    %endif
    %endmacro

    %macro ext.w 1
    %ifidn %1,r0
    cbw
    %endif
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro trap 1
    int %1
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro br.b 1
    jmp %1
    %endmacro
    %macro br.l 1
    jmp %1
    %endmacro
    %macro jmp.l 1
    jmp %1
    %endmacro

    %macro bmi.b 1
    js %1
    %endmacro
    %macro bmi.l 1
    js %1
    %endmacro

    %macro bpl.b 1
    jns %1
    %endmacro
    %macro bpl.l 1
    jns %1
    %endmacro

    %macro bcc.b 1
    jnc %1
    %endmacro
    %macro bcc.l 1
    jnc %1
    %endmacro

    %macro bhs.b 1
    jnc %1
    %endmacro
    %macro bhs.l 1
    jnc %1
    %endmacro

    %macro bls.b 1
    jbe %1
    %endmacro
    %macro bls.l 1
    jbe %1
    %endmacro

    %macro bcs.b 1
    jc %1
    %endmacro
    %macro bcs.l 1
    jc %1
    %endmacro

    %macro blo.b 1
    jc %1
    %endmacro
    %macro blo.l 1
    jc %1
    %endmacro

    %macro bhi.b 1
    ja %1
    %endmacro
    %macro bhi.l 1
    ja %1
    %endmacro

    %macro beq.b 1
    jz %1
    %endmacro
    %macro beq.l 1
    jz %1
    %endmacro

    %macro bne.b 1
    jne %1
    %endmacro
    %macro bne.l 1
    jne %1
    %endmacro

    %macro bgt.b 1
    jg %1
    %endmacro
    %macro bgt.l 1
    jg %1
    %endmacro

    %macro bge.b 1
    jge %1
    %endmacro
    %macro bge.l 1
    jge %1
    %endmacro

    %macro ble.b 1
    jle %1
    %endmacro
    %macro ble.l 1
    jle %1
    %endmacro

    %macro dbf.l 2
    loop %2
    %endmacro

    %macro dbf.w 2
    loop %2
    %endmacro

    %macro jmp.ww 1
    jmp far %1
    %endmacro


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    %macro jsr.l 1
    call dword %1
    %endmacro

    %macro bsr.l 1
    call dword %1
    %endmacro

    %macro bsr.w 1
    call word %1
    %endmacro

    %macro rts.l 0
    %if __seg__ = 16
    db $66
    %endif
    ret
    %endmacro

    %macro rts.l 1
    %if __seg__ = 16
    db $66
    %endif
    ret %1
    %endmacro

    %macro rts.w 0
    %if __seg__ = 32
    db $66
    %endif
    ret
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %macro rep_r2 1+
    rep
    %1
    %endmacro

    %macro repeq_r2 1+
    repe
    %1
    %endmacro

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    %define r0.b al
    %define r1.b dl
    %define r2.b cl
    %define r3.b bl
    %define m0 ah
    %define m1 dh
    %define m2 ch
    %define m3 bh

    %define r0.w ax
    %define r1.w dx
    %define r2.w cx
    %define r3.w bx
    %define r4.w bp
    %define r5.w si
    %define r6.w di
    %define r7.w sp

    %define r0.l eax
    %define r1.l edx
    %define r2.l ecx
    %define r3.l ebx
    %define r4.l ebp
    %define r5.l esi
    %define r6.l edi
    %define r7.l esp

    %define s0 ds
    %define s1 es
    %define s2 fs
    %define s3 gs
    %define s6 cs
    %define s7 ss


    %macro reg0 0
    %undef r0
    %undef r1
    %undef r2
    %undef r3
    %undef r4
    %undef r5
    %undef r6
    %undef r7
    %endmacro

    %macro reg8 0
    %define r0 al
    %define r1 dl
    %define r2 cl
    %define r3 bl
    %endmacro

    %macro reg16 0
    %define r0 ax
    %define r1 dx
    %define r2 cx
    %define r3 bx
    %define r4 bp
    %define r5 si
    %define r6 di
    %define r7 sp
    %endmacro

    %macro reg32 0
    %define r0 eax
    %define r1 edx
    %define r2 ecx
    %define r3 ebx
    %define r4 ebp
    %define r5 esi
    %define r6 edi
    %define r7 esp
    %endmacro


    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Paolo Amoroso@paolo.amoroso@gmail.com to comp.os.msdos.programmer on Tue Sep 6 00:00:13 2022
    From Newsgroup: comp.os.msdos.programmer

    On Tuesday, September 6, 2022 at 12:03:36 AM UTC+2, Herbert Kleebauer wrote:
    But it doesn't make much sense to write .com programs which can't
    be run natively on a current computer system. Windows programs also
    I actually don't have Windows devices and don't plan to get any. On the desktop I use exclusively chromeOS, here are some notes on my emulation setup based on DOSBox-X as well as my motivations and goals: https://journal.paoloamoroso.com/setting-up-an-ms-dos-emulation-and-development-environment
    So MS-DOS and .COM are more than enough for my personal experimentation and fun.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kerr-Mudd, John@admin@127.0.0.1 to comp.os.msdos.programmer on Tue Sep 6 10:09:13 2022
    From Newsgroup: comp.os.msdos.programmer

    On Tue, 6 Sep 2022 00:05:27 +0200
    Herbert Kleebauer <klee@unibwm.de> wrote:

    On 06.09.2022 00:03, Herbert Kleebauer wrote:
    is just the data of the exe file format). Because NASM uses an awful
    syntax you have to include "mac.inc" to be able to use a readable instruction format (I post mac.inc in a follow up):

    [lines snipped]

    a NASM DOS program to do what you posted would be about (guesses) 50 bytes.
    OK I'll post it here. Remind me in a week if I've not done so earlier.
    --
    Bah, and indeed Humbug.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Herbert Kleebauer@klee@unibwm.de to comp.os.msdos.programmer on Wed Sep 7 10:11:10 2022
    From Newsgroup: comp.os.msdos.programmer

    On 06.09.2022 11:09, Kerr-Mudd, John wrote:
    On Tue, 6 Sep 2022 00:05:27 +0200

    is just the data of the exe file format). Because NASM uses an awful

    a NASM DOS program to do what you posted would be about (guesses) 50 bytes. OK I'll post it here. Remind me in a week if I've not done so earlier.

    The code and therefore the size is the same. The CPU doesn't know which OS
    is running, it just executes your instructions step by step. The binary
    of a Windows executable is much larger than a DOS .com program not because
    of a bigger code but because of the file structure and the more complicated interface to the OS.

    Time goes by so slowly, but not so slowly that it still makes sense
    to write DOS .com programs. If somebody wants to write assembly code
    which can't be executed on current computer systems I would suggest
    PDP11 or 68000. In opposite to 16 bit 8086 they have a well designed
    processor architecture and there are also emulators available as
    for DOS/x86.

    ruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruarua
    ruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruarua
    ruaruaruaruarueruCruCruCruCruCrueruaruaruaruCruaruaruarueruaruaruarueruCruCruCruCruCrueruaruaruarua
    ruaruaruaruarueruarueruerueruarueruaruCruaruaruCruaruaruaruCruaruarueruarueruerueruarueruaruaruarua
    ruaruaruaruarueruaruCruCruCruarueruaruaruCruaruarueruarueruerueruarueruaruCruCruCruarueruaruaruarua
    ruaruaruaruaruCruCruCruCruCruCruCruarueruaruCruarueruaruCruarueruaruCruCruCruCruCruCruCruaruaruarua
    ruaruaruaruaruCruCruCruaruCruCruCrueruCruaruaruaruarueruaruarueruerueruaruaruaruCruaruaruaruaruarua
    ruaruaruaruaruCruaruCrueruarueruCruCrueruarueruaruerueruaruaruCruCruaruerueruaruCrueruCruaruaruarua
    ruaruaruaruaruCruCrueruCruaruCruCrueruCruarueruaruarueruaruarueruCrueruCruarueruaruCrueruaruaruarua
    ruaruaruaruaruCruaruaruaruaruCruCruCruCruaruaruaruCrueruCruarueruCruCruCruaruaruCrueruCruaruaruarua
    ruaruaruaruaruCruaruCruaruaruaruCruCruaruaruCruaruaruCrueruerueruCruCruCruerueruaruaruaruaruaruarua
    ruaruaruaruarueruCruCruCruCruCrueruarueruerueruarueruarueruerueruaruCruaruerueruarueruCruaruaruarua
    ruaruaruaruarueruarueruerueruarueruaruCruaruaruaruaruCruaruaruCruCruCrueruerueruaruCruaruaruaruarua
    ruaruaruaruarueruaruCruCruCruarueruarueruarueruaruarueruCruCrueruCruaruarueruaruaruaruCruaruaruarua
    ruaruaruaruaruCruCruCruCruCruCruCruaruCruCruCruCruCruaruaruCruCruaruCruCruaruaruaruCruCruaruaruarua
    ruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruarua
    ruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruaruarua


    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Herbert Kleebauer@klee@unibwm.de to comp.os.msdos.programmer on Wed Sep 7 10:32:36 2022
    From Newsgroup: comp.os.msdos.programmer

    On 06.09.2022 09:00, Paolo Amoroso wrote:

    So MS-DOS and .COM are more than enough for my personal experimentation and fun.

    But even then you should only use 32 bit instructions. This
    allows you to run the code in DOS, Windows and Linux without
    modifications. Only the part of the OS interface has to be
    different. But for a start it is enough to use only three
    OS functions getc(), putc() and exit().



    --- Synchronet 3.21d-Linux NewsLink 1.2