flat assembler
Message board for the users of flat assembler.

Index > Windows > Help me to convert this to FASM.

Author
Thread Post new topic Reply to topic
saigon



Joined: 29 May 2006
Posts: 62
saigon 01 Jun 2006, 15:09
Hello!

I found this ASM code in the net, but don't know from which assembler this code comes

Code:
;
; Example for showing some pixels in 640*480*16..
; have fun
;

ideal
p386n

assume cs:code
segment code
org 100h

start:
                mov     ax,12h                  ; init video mode
                int     10h
                push    0a000h                  ; set dest
                pop     es

                xor     di,di                   ; start linksboven
                mov     bl,10101010b            ; raster
                mov     ah,1                    ; begin with color 1

bolo:           call    setplane                ; set color
                mov     cx,32                   ; 32 rows of 1 color
lolo:           push    cx                      ; push
                mov     cx,80                   ; 1 line = 80*8bit=640 bytes
zolo:           mov     [es:di],bl              ; write raster
                inc     di                      ; di+1
                loop    zolo                    ; loop
                ror     bl,1                    ; rotate raster right by 1
                pop     cx                      ; pop
                loop    lolo                    ; loop

                ror     bl,1                    ; rotate raster again

                inc     ah                      ; increase color
                cmp     ah,16                   ; if color not 16 jump
                jne     bolo                    ; jump?

                xor     ah,ah                   ; w8 for keypress
                int     16h

                mov     ax,3                    ; reset textmode
                int     10h

                mov     ax,4c00h                ; leave
                int     21h

        ; -- ----------------------------

setplane:       mov     dx,3c4h                 ; select plane
                mov     al,2                    ; i - ah
                out     dx,ax
                ret

        ; ------------------------------

ends code
end start    


As the code says it shows an example to use the 640*480*16 screenmode. I needed this as I am making my first game in FASM Smile

Thank you very much Razz
Post 01 Jun 2006, 15:09
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 01 Jun 2006, 15:16
just remove this
Code:
ideal 
p386n 

assume cs:code 
segment code     
and this
Code:
ends code 
end start    


A COM file will be generated

Maybe that code is in TASM?

Regards


Last edited by LocoDelAssembly on 01 Jun 2006, 15:18; edited 1 time in total
Post 01 Jun 2006, 15:16
View user's profile Send private message Reply with quote
saigon



Joined: 29 May 2006
Posts: 62
saigon 01 Jun 2006, 15:18
Thanks! I compiled the file, but the output is *.bin and not *.com. Did I miss something?
Post 01 Jun 2006, 15:18
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 01 Jun 2006, 15:19
maybe you removed "org 100h" too?
Post 01 Jun 2006, 15:19
View user's profile Send private message Reply with quote
saigon



Joined: 29 May 2006
Posts: 62
saigon 01 Jun 2006, 15:23
Yes, that was my mistake. Thank you very much!
EDIT: The code looks like it's from TASM, but I was unsure because we have a lot assemblers lurking out there today Wink
Post 01 Jun 2006, 15: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.