PC ASM - assembler for X86.

Heresy #01
███████████████████▄ ▄▄█████████████████▄
█████████ ▀████████▄ ████████▀ ▀██
█████████ █████████ ███████▀
█████████ █████████ ███████ ▄▄▄▄▄▄ ▄▄▄▄▄ ▄▄▄▄▄▄▄
█████████ ▄████████▀ ███████ ▐▄▄▄▄▄█ ▐▄▄▄▄▄▄ ▐ ▌ █
███████████████████▀ ████████ ▐ ▀ ▄▄▄▄▄▄▀ ▐ ▌ █
█████████ █████████▄
█████████ █████████▄ ▄██
█████████ a$h ▀▀█████████████████▀


    In the sixth Born Dead there was an article about programming in
68000, that is, on the Amiga. I don't know if anyone was interested in this
but a thought arose: what about PC? :)
    After all, many more people use the RS together with Speccy.
And quite often there is a need to write a small
utilities on PC for transferring something for Specky, or
converting, or just fuck who needs to be sent ;).
    In short, I’m a novice in this matter, but what will I learn?
I will share ;). I won't brainwash you about registers.
and commands, as it is in any reference book. And here's what I
I didn’t find it in the reference books, what I had to look for
Insight'om in exe's or consult with Dark Lion and
the like - I will share this with you.

───────────────────────────────────────
1. Keyboard plug - disables keyboard polling
(including Ctrl-Break and Ctrl-Alt-Del ;)

;mute
      in al,21h
      mov [varib],al
      or al,2
      out 21h,al... ;your program

;and before leaving
;restore
      mov al,[varib]
      out 21h,al

varib db 0
───────────────────────────────────────
2. Printing a message - well, this seems to be the most
simple, but who knows? :)

     mov dx,OFFSET text
     mov ah,9h
     int 21h

text db "Speccy was here :)",Odh,Oah,"$"

;code Odh and Oah are called CR+LF
;(carriage return and line feed)
;they are placed so that the next message
;printed on a new line,
;dollar sign means end of message ($=24h)
───────────────────────────────────────
3. Poll any key
if the keyboard is cut off by procedure 1.,
then naturally you won’t succeed

no_key:
     mov ah,1
     int 16h
     jz no_key
     ...
───────────────────────────────────────
4. Poll the esc key

no_esc:
     in al,60h
     cmp al,1
     jnz no_esc
     ...
───────────────────────────────────────
5. Exit to Dos
(it could be shorter, of course, but it’ll do for a start)

     mov ah,Chch
     int 21h

───────────────────────────────────────
    A little clarification. Unlike the z80, it is accepted on the PC
write numbers in
    - hex format with "h" at the end (example: 21h), adding zero
    first if the number begins with a letter (ex: Oah)
    - in binary format add "b" at the end (example: 00001111b)
───────────────────────────────────────
Now you can try these procedures
rivet your first program:
(please note - the marks are placedwith a colon,
with the exception of data tags).

;--- Your first PC programm ;) ---

     .model tiny
     .code
     org 100h ;com file starts
                     ;c addresses 256
start:
      mov dx,OFFSET text
      mov ah,9h
      int 21h

no_esc:
      in al,60h
      cmp al,1
      jnz no_esc

      mov ah,Chch
      int 21h

text db "Speccy was here :)",Oah,Odh,"$"

end start
;------------------------------------------

    All this can be done in any editor (very convenient for this
built into Dos Navigator), then written to disk, to a file with
extension, for example, first.asm
    Now, if you have an assembler, you can compile it in
com file. Through the command line we set:
    tasmx /m2 first.asm
and get the object file first.obj, link it to .com:
    tlink /t /x first.obj
and see the new file first.com - launch it!

    I know that for many, all of the above has already happened a long time ago.
known.  We ask such people to share their
knowledge, best practices, useful procedures, etc.

Share your thoughts about the article