News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

16-Bit ASM?

Started by sslz, September 17, 2009, 09:08:31 PM

Previous topic - Next topic

sslz

Hi I'm new here - just started learning ASM. I have been going through a few ASM books and some mention 16-Bit ASM. Is it worthwhile learning this? I have 2 books relating to 32-Bit ASM. I don't want to take any shortcuts but at the same time I don't want to invest time learning something I will never use. Is 16-Bit ASM ever used anymore?

2-Bit Chip

16-bit is for is for the ancient Windows DOS. It's pretty much obsolete.

Slugsnack

IMO it's not really worth learning. A lot of things that you will need like interrupts, learning to use segmentation, etc. are rendered next to useless in win32

elegem

16-bit is now virtually obselete...best to start with 32-bit...its also easier to learn.

dedndave

i think it is good to know 16-bit code
well - that's cuz i spent so many years writing it - lol
there is a lot more to learn in the 32-bit world
but, you really are kind of wasting your time to learn 16-bit
for anyone new to assembler, i would suggest skipping 16-bit code altogether

Slugsnack

soon people are gonna be saying don't learn 32 bit !! learn 64 bit. you sure you wanna learn something that is 2 back from the current generation ? : )

MichaelW

I think most beginners should skip 16-bit coding, unless they anticipate a need to work with DOS applications, 16-bit or 32-bit.
eschew obfuscation

hutch--

32 and 64 bit assembler are similar enough for one to follow after the other where 16 bit DOS code is structurally different, it uses an ancient segment/offset addressing mode that is useless in later code. 32 bit is worth learning becuase while 64 bit code is coming, it will be a long time coming before the tools and OS are much use.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Magnum

Quote from: sslz on September 17, 2009, 09:08:31 PM
Hi I'm new here - just started learning ASM. I have been going through a few ASM books and some mention 16-Bit ASM. Is it worthwhile learning this? I have 2 books relating to 32-Bit ASM. I don't want to take any shortcuts but at the same time I don't want to invest time learning something I will never use. Is 16-Bit ASM ever used anymore?

I would recommend spending the time learning 32 bit. Once you feel comfortable with it, you could look at some 16 bit code.

This code for example assembles in at 229 bytes and will work on every Windows OS from 3.1 -> XP.
If you are one of those folks who do a lot of stuff at the command line, some 16 bit stuff still fills a niche.

Good luck on your journey.

Andy

:: when.asm Tasm code
.model  tiny
.code
.386

ORG     100h

start:
       jmp   begin

mark         db           'AK 5/11/07'

days         LABEL        WORD

dw offset su, offset mo, offset tu, offset we, offset th, offset fr, offset sa
su db 'Sunday $'                                                                                                                                               
mo db 'Monday $'
tu db 'Tuesday $'
we db 'Wednesday $'
th db 'Thursday $'
fr db 'Friday $'                                                                           
sa db 'Saturday $'

BEGIN:
       mov     ax, cs
       mov     ds, ax
       mov     ah,2ah        ; date, month in dh, day in dl,
       int     21h           ; year in cx
       movzx   bx,al
       add     bx,bx
       mov     dx,cs:[days+bx] ; print day of the week
       mov     ah,9
       int     21h

       MOV     AH,2Ah
       INT     21h           ; Get Date
       MOV     AL,DH         ; DH contains month
       MOV     BL,'-'
       CALL    SHOWIT        ; call month
       MOV     AL,DL         ; DL has day
       CALL    SHOWIT
       MOV     AX,CX         ; CX contains year
       MOV     BL,64h        ; 64h = 100
       DIV     BL            ; Split year
       MOV     AL,AH         ; move year to al
       MOV     BL, 00        ; Used by 'JL Last_L'
       CALL    SHOWIT        ; call year
       MOV     DL,' '        ; 0D = CR
       INT     21h           ; Display 2 spaces
       INT     21h           ;

       MOV     AH,2Ch
       INT     21h           ; Get Time
       MOV     BL,3Ah        ; 3Ah = ':'
       MOV     AL,CH         ; CH contains hour

       CALL    SHOWIT
       MOV     AL,CL         ; CL contains minutes
       CALL    SHOWIT
       MOV     BL,20h
       MOV     AL,DH         ; DH contains seconds
       CALL    SHOWIT
       MOV     DL,' '         
       INT     21h             
       mov     dl,0ah         ; carriage return
       int     21h
       MOV     AX,4C00h
       INT     21h             
SHOWIT:
       PUSH    DX            ; Save DX, holds date or time
       MOV     DL,0Ah        ; move 10 into DL
       XOR     AH,AH         ; Zero AH
       DIV     DL            ; Div by 10
       OR      AX,3030h      ; Convert to ASCII
       MOV     DX,AX
       MOV     AH,02h
       INT     21h           ; Display_character from DL, First charter
       MOV     DL,DH
       INT     21h           ; Display_character from DL, Second charter
       cmp     bl, 21h       ; Is it '/','-',or':'?
       JL      LAST_D        ; If not, quit
       MOV     DL,BL
       INT     21h           ; Display_character from DL, '/' or ':'

LAST_D:
       POP     DX            ; Restore DX
       RET                   ; End branch

END  START
Have a great day,
                         Andy

GregL

Don't bother learning 16-bit, learn 32-bit and then learn 64-bit (x64).


FORTRANS

Hi,

   If you have the books for 32-bit assembly, go for that.
16-bit is fine for learning the concepts of assembly, but is
no more valid for that than 8-bit or 32-bit.  16-bit has
different trade-offs in ease of use compared to 32-bit.  It
is arguably easier to program for MS-DOS than Windows,
but that is not the current paradigm.

Regards,

Steve N.