flat assembler
Message board for the users of flat assembler.

Index > Main > a littles bits......

Author
Thread Post new topic Reply to topic
Miguel



Joined: 16 Jun 2003
Posts: 21
Location: Spain
Miguel 26 Apr 2004, 23:31
Very Happy hello forum!
Here, two littles sources.........
Code:
 use16
  org  256

  mov  al, 13h                  ; ...load al with 13h (mode number)
  int  10h                      ; set mode 13h

  mov  bp, 320                  ; screen is 320 pixels wide
 x:
  les  ax, [bx]                 ; es = end of mem (9fffh), ax = 20cdh
  cwd                           ; => dx = 0 (for idiv)
  mov  ax, di                   ; get dest address
  idiv bp                       ; div by width => ax=y coord, dx=x coord
  imul dx                       ; mul x by y
  stosb                         ; store color in vram
  mov  dx, 3c9h                 ; dac data
  bt   cx, 6                    ; bit 6 of cx => carry flag
  salc                          ; set al from carry flag
  xor  ax, cx                   ; => all this is functionally equivalent to something like
                                ; "test al, 64" / "jz skip" / "not al" / "skip: blah"
                                ; which should be somewhat easier understandable, but bigger.
  out  dx, al                   ; write grayscale pixel values
  out  dx, al
  out  dx, al
  loop x                        ; pixel loop.

  mov ah,01h
  int 16h
  jz  x
  mov ax,03h
  int 10h
  ret
    

..and the other
Code:
                   use16
       org 100h

  start:
         mov al, 0x13
         cmc
         inc dx
         int 0x10
         push word 0xa000
         pop es

    pix:
         mul bx
         inc ax
         add ax, di
         adc [si], bx
         div word [si+12]

    clp:
         fmul dword [si]
         fiadd word [si]
         fistp word [bx]
         sub  ax, 130
         xchg ax, [bx]
         xor  cx, ax
         fild word [bx]
         fmul st0,st0
         xor  bx, bp
         xchg ax, dx
         fxch st1
         jnz  clp

         faddp st1, st0
         fsqrt
         fdivr dword [si]

         fild  word [bx]
         fild  word [bp]
         fpatan

         salc
         xchg ax, cx
         or   al, 0x87
         stosb

         mov ah,01h
         int 16h
         jz  pix

         mov ax,03h
         int 10h
         ret             
    

greetings!!!!

_________________
Hola,Hello...my english is not good..but..
we understand us.....
Post 26 Apr 2004, 23:31
View user's profile Send private message Reply with quote
Yawgmoth



Joined: 20 Aug 2003
Posts: 37
Yawgmoth 27 Apr 2004, 18:37
Cool!
Post 27 Apr 2004, 18:37
View user's profile Send private message Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder 07 May 2004, 06:24
Hmm.. First program is really cool and displays a nice visually-appealing thing;)

Second program has some sort of bug in it maybe?---it didn't work for me. It changed screen colors twice and then gave me a fatal error message. I thought maybe it was because you needed an finit before using your floating point, but I added that in there and it didn't seem to make a difference--same error.

Maybe it needs to run under a real DOS machine and not under an emulator, I don't know. What was it supposed to do?
Post 07 May 2004, 06:24
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 07 May 2004, 12:39
Second one is a colorful and spining double helix. Very nice!

Strange fact that the second don't work on your machine while the first does? They are using same interrupts. ¿?
Post 07 May 2004, 12:39
View user's profile Send private message Yahoo Messenger Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 07 May 2004, 12:45
BTW, there's an interesting web site with small (up to 256 bytes) demos: http://www.256b.com/.
Post 07 May 2004, 12:45
View user's profile Send private message Visit poster's website Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder 08 May 2004, 09:23
Well, perhaps it will aid the creator of the program to know that the error was invalid opcode FF FF 9F 00 9A

Odd thing is, I searched the .com file for this and it isn't there so I'm thinking maybe it is some sort of buffer-overflow thing?
Post 08 May 2004, 09:23
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.