flat assembler
Message board for the users of flat assembler.

Index > DOS > A lot of firsts...

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
Hello, I'm kinda new here and just figured out how to use FASM ( I used TASM and MASM before). I like what you have sone with this assembler. Easy to figure out and I just love the win IDE. I'm kind of an occasional asm coder though. More of like a noob. Anyways here are my firsts...
1. This is my first FASM program( I downloaded FASM like 2 hours ago)
2. This is my first <256 proggie
3. And lastly, this is my first post.

Anyways, here's the 247 byte tunnel:

Code:
;*****************************************************************
; tunnel by rel
; Assemble with fasm
;       Http://Rel.Betterwebber.com
;*****************************************************************

diameter         equ 64
diamxscale       equ 64 * diameter
scale            equ 256
scx              equ 160
scy              equ 100

org 100h


frame     dw  0
ishort    dw  0
short_var dw  0



;*****************************************************************
;*****************************************************************
;*****************************************************************

   push word 0a000h
   pop es

   mov   ax, 0013h       ; mode 13h
   int   10h             ; we are now in 320x200x256
   
   fninit

;====set palette
   mov   dx, 03c8h                      ;palette write register
   out   dx, al                         ;send value
   inc   dx                             ;0x3c9(write RGB values)
   mov cx, 256                          ;whole 256 colors
   fldpi                                ;st0 = pi
   mov [ishort], 180                     ;st0 = 180, st1 = pi
   fild [ishort]
   palloop:
        mov bx, 256
        sub bx, cx
        shl bx,1

        mov [ishort], bx
        fild [ishort]                    ;st0 = deg, st1 = 180, st2 = pi
        fmul st0, st2
        fdiv st0, st1
        fsin                            ;st0 = sin(rad)
        mov [ishort], 64
        fimul [ishort]
        fistp [ishort]

        mov ax, [ishort]
        out  dx, al                     ;red
        shl al,1                        ;blue

        out  dx, al
        shr al, 2
        out  dx, al                     ;than green

   loop palloop                         ;go back if not 0
        fstp st0
        fstp st0
MainLoop:

        inc [frame]
        ;===========tunnel
        mov dx,200
        mov di, 0
      tunnel_yloop:
        mov cx,320
      tunnel_xloop:

        ;atan2
        fldpi                                   ;st0 = pi
        mov [short_var], scy
        sub [short_var], dx
        fild [short_var]                        ;st0 = dy, st1 = pi

        mov [short_var], scx
        sub [short_var], cx
        fild [short_var]                        ;st0 = dx, st1 = dy, st2 = pi

        fpatan                                  ;st0 = atan(dy/dx) = atan(st1/st0)

        mov [short_var], scale
        fimul [short_var]                       ;atan(st0))*256/pi
        fdiv st0, st1
        fistp [short_var]                       ;short_var = scaledpi

        mov ax, scx
        sub ax, cx                              ;cmx
        mov [ishort], ax
        fild [ishort]                           ;st0 = cmx
        fmul st0, st0                           ;cmx * cmx
        mov ax, scy
        sub ax, dx
        mov [ishort], ax
        fild [ishort]                           ;st0 = cmy st1 = cmx*cmx
        fmul st0, st0                           ;cmy * cmy
        fadd st0, st1                           ;st0 cmx^2 + cmy^2
        fsqrt                                   ;sqrt st0
        mov [ishort], diamxscale                ;st0 = diamxscale st1 = sqrt(dist)
        fild [ishort]
        fdiv st0, st1
        fistp [ishort]
        fstp st0
        fstp st0
        fstp st0
        mov ax, [ishort]
        mov bx, [short_var]
        add ax, [frame]
        add bx, [frame]
        xor ax, bx
        mov [es:di], al

        inc di
        loop tunnel_xloop
        dec dx
        jnz tunnel_yloop



        mov   ah, 01h           ; check for keypress
        int   16h               ; is a key waiting in the buffer?
        Jz MainLoop

        mov   ax, 004ch
        int   21h               ; return to dos    



Enjoy!
Very Happy


I made a little radial displacement to the original tunnel. :*)

Code:
;*****************************************************************
; flower tunnel by rel
; Assemble with fasm
;       Http://Rel.Betterwebber.com
;*****************************************************************

diameter        = 64
diamxscale      = (64 * diameter)
scale           = 256

org 100h


;*****************************************************************
;*****************************************************************
;*****************************************************************

   push word 0a000h
   pop es

   mov   ax, 0013h       ; mode 13h
   int   10h             ; we are now in 320x200x256

   fninit

;====set palette
   mov   dx, 03c8h                      ;palette write register
   out   dx, al                         ;send value
   inc   dx                             ;0x3c9(write RGB values)
   mov cx, 256                          ;whole 256 colors
   fldpi                                ;st0 = pi
   mov [ishort], 180                     ;st0 = 180, st1 = pi
   fild [ishort]
   palloop:
        mov bx, 256
        sub bx, cx
        shl bx,1

        mov [ishort], bx
        fild [ishort]                    ;st0 = deg, st1 = 180, st2 = pi
        fmul st0, st2
        fdiv st0, st1
        fsin                            ;st0 = sin(rad)
        mov [ishort], 64
        fimul [ishort]
        fistp [ishort]

        mov ax, [ishort]
        out  dx, al                     ;red
        shl al,1                        ;blue
        out  dx, al
        shr al, 2
        out  dx, al                     ;than green

   loop palloop                         ;go back if not 0
        fstp st0
        fstp st0

        mov [fold_num], 5
MainLoop:
        mov [scx],160
        mov [scy],100

        inc [frame]


        ;displacement
        fild [frame]
        mov [ishort], 50
        fidiv [ishort]
        fsin
        mov [ishort], 120
        fimul [ishort]
        fistp [ishort]
        mov ax, [ishort]
        add [scx], ax
        fild [frame]
        mov [ishort], 60
        fidiv [ishort]
        fsin
        mov [ishort], 80
        fimul [ishort]
        fistp [ishort]
        mov ax, [ishort]
        add [scy], ax

        ;flower
        ;fold_off += 0.2
        mov [ishort], 2
        fild [ishort]
        mov [ishort], 10
        fidiv [ishort]
        fadd [fold_off]
        fstp [fold_off]
        ;fold_scale = 0.3 * sin(frame / 40)
        mov [ishort], 5
        fild [ishort]
        mov [ishort], 10
        fidiv [ishort]
        fild [frame]                   ;st0 = frame; st1 = 0.3
        mov [ishort], 40
        fidiv [ishort]
        fsin
        fmul st0, st1
        fstp [fold_scale]
        fstp st0




        ;===========tunnel
        mov dx,200
        mov di, 0
      tunnel_yloop:
        mov cx,320
      tunnel_xloop:

        ;atan2
        fldpi                                   ;st0 = pi
        mov ax, [scy]
        mov [short_var], ax
        sub [short_var], dx
        fild [short_var]                        ;st0 = dy, st1 = pi

        mov ax, [scx]
        mov [short_var], ax
        sub [short_var], cx
        fild [short_var]                        ;st0 = dx, st1 = dy, st2 = pi

        fpatan                                  ;st0 = atan(dy/dx) = atan(st1/st0)
        ;flower
        ;xdist = xdist * ((sin(fold_off + fold_num * angle) * fold_scale)+1)
        fstp [real_var]
        fld [real_var]                          ;restore
        fld [real_var]
        fimul [fold_num]
        fadd [fold_off]
        fsin
        fmul [fold_scale]
        mov [ishort], 1
        fiadd [ishort]
        fstp [real_var]                         ;real_var =((sin(fold_off + fold_num * angle) * fold_scale)+1)

        mov [short_var], scale
        fimul [short_var]                       ;atan(st0))*256/pi
        fdiv st0, st1
        fistp [short_var]                       ;short_var = scaledpi

        mov ax, [scx]
        sub ax, cx                              ;cmx
        mov [ishort], ax
        fild [ishort]                           ;st0 = cmx
        fmul st0, st0                           ;cmx * cmx
        mov ax, [scy]
        sub ax, dx
        mov [ishort], ax
        fild [ishort]                           ;st0 = cmy st1 = cmx*cmx
        fmul st0, st0                           ;cmy * cmy
        fadd st0, st1                           ;st0 cmx^2 + cmy^2
        fsqrt                                   ;sqrt st0
        fmul [real_var]
        mov [ishort], diamxscale                ;st0 = diamxscale st1 = sqrt(dist)
        fild [ishort]
        fdiv st0, st1
        fistp [ishort]
        fstp st0
        fstp st0
        fstp st0
        mov ax, [ishort]
        mov bx, [short_var]
        add ax, [frame]
        add bx, [frame]
        xor ax, bx
        mov [es:di], al

        inc di
        dec cx
        jnz tunnel_xloop
        dec dx
        jnz tunnel_yloop



        mov   ah, 01h           ; check for keypress
        int   16h               ; is a key waiting in the buffer?
        Jz MainLoop

        ;textmode
        mov ax, 0003h
        int 10h

        ret




frame           dw  0
ishort          dw  0
short_var       dw  0
scx             dw  0
scy             dw  0

fold_num        dw  0
fold_off        dd  0
fold_scale      dd  0
real_var        dd  0



    

_________________
Hello


Last edited by relsoft on 06 Apr 2006, 00:52; edited 1 time in total
Post 03 Apr 2006, 13:39
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
nice look! just would be not bad to restore videomode Wink
Post 03 Apr 2006, 13:56
View user's profile Send private message Visit poster's website Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
Yeah, Somehow within the IDE, it won't return to the OS. But if you run it from let's say explorer.exe in winxp it returns to the OS as it should. Dunno why.
Sad

_________________
Hello
Post 03 Apr 2006, 14:05
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Have you tryed:
Code:
mov   ax, 0003h      int   10hmov   ax, 004chint   21h               ; return to     
Post 03 Apr 2006, 14:52
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
when it returns to the windows it destroyed and there is no sence in any video mode after it, but when it runs from commandline and returns to the console window, it will not restore text videomode (usually, 3h) some FM, as well as DOS Navigator, can force restoring videomode after program returns, but, imho, it is better to add 2 commands to the proggy to not think about this at all Wink regards! anyway, cool look!
Post 03 Apr 2006, 14:53
View user's profile Send private message Visit poster's website Reply with quote
viki



Joined: 03 Jan 2006
Posts: 40
Location: Czestochowa, Poland
viki
I'm really intrested how to improve the speed. What about using precalculated tables instead of sin or atan fpu instuctions? Is it possible to calculate tables during compilation process?
Post 03 Apr 2006, 20:39
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
viki: interesting idea. but surely it's better to make include file with tables, you can generate tables at run-time, save them to file, and then use some table extractor to turn binary file into .asm source
Post 03 Apr 2006, 20:48
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
Shoorick:

I tried to add an int 10h setting the vid mode to 03h but somehow it won't go out of the IDE when I run ti from there. Any thought's on how to fix this? Thanks!

Viki: Yep, I used to use precalculated tables to make use of trig when didn't know how to use the FPU ( just learned how to use the FPU instructions from a week ago) One way to make use of tables is to generate it from a high level language scaling your sin/cos table from 0 to 256 instead of 0 to 2pi. Although making use of tables would increase the com size and I am supposed to make this intro in less than 256 bytes. I may post something later on after I read the FASM tutorial.

Anyways, I made a little enhancement but it became too bloated.

Code:

;*****************************************************************
; tunnel by rel
; Assemble with fasm
;       Http://Rel.Betterwebber.com
;*****************************************************************

diameter         equ 64
diamxscale       equ 64 * diameter
scale            equ 256

org 100h


frame     dw  0
ishort    dw  0
short_var dw  0
scx       dw  0
scy       dw  0



;*****************************************************************
;*****************************************************************
;*****************************************************************

   push word 0a000h
   pop es

   mov   ax, 0013h       ; mode 13h
   int   10h             ; we are now in 320x200x256

   fninit

;====set palette
   mov   dx, 03c8h                      ;palette write register
   out   dx, al                         ;send value
   inc   dx                             ;0x3c9(write RGB values)
   mov cx, 256                          ;whole 256 colors
   fldpi                                ;st0 = pi
   mov [ishort], 180                     ;st0 = 180, st1 = pi
   fild [ishort]
   palloop:
        mov bx, 256
        sub bx, cx
        shl bx,1

        mov [ishort], bx
        fild [ishort]                    ;st0 = deg, st1 = 180, st2 = pi
        fmul st0, st2
        fdiv st0, st1
        fsin                            ;st0 = sin(rad)
        mov [ishort], 64
        fimul [ishort]
        fistp [ishort]

        mov ax, [ishort]
        out  dx, al                     ;red
        shl al,1                        ;blue

        out  dx, al
        shr al, 2
        out  dx, al                     ;than green

   loop palloop                         ;go back if not 0
        fstp st0
        fstp st0
MainLoop:
        mov [scx],160
        mov [scy],100

        inc [frame]

        ;displacement
        fild [frame]
        mov [ishort], 50
        fidiv [ishort]
        fsin
        mov [ishort], 120
        fimul [ishort]
        fistp [ishort]
        mov ax, [ishort]
        add [scx], ax
        fild [frame]
        mov [ishort], 60
        fidiv [ishort]
        fsin
        mov [ishort], 80
        fimul [ishort]
        fistp [ishort]
        mov ax, [ishort]
        add [scy], ax

        ;===========tunnel
        mov dx,200
        mov di, 0
      tunnel_yloop:
        mov cx,320
      tunnel_xloop:

        ;atan2
        fldpi                                   ;st0 = pi
        mov ax, [scy]
        mov [short_var], ax
        sub [short_var], dx
        fild [short_var]                        ;st0 = dy, st1 = pi

        mov ax, [scx]
        mov [short_var], ax
        sub [short_var], cx
        fild [short_var]                        ;st0 = dx, st1 = dy, st2 = pi

        fpatan                                  ;st0 = atan(dy/dx) = atan(st1/st0)

        mov [short_var], scale
        fimul [short_var]                       ;atan(st0))*256/pi
        fdiv st0, st1
        fistp [short_var]                       ;short_var = scaledpi

        mov ax, [scx]
        sub ax, cx                              ;cmx
        mov [ishort], ax
        fild [ishort]                           ;st0 = cmx
        fmul st0, st0                           ;cmx * cmx
        mov ax, [scy]
        sub ax, dx
        mov [ishort], ax
        fild [ishort]                           ;st0 = cmy st1 = cmx*cmx
        fmul st0, st0                           ;cmy * cmy
        fadd st0, st1                           ;st0 cmx^2 + cmy^2
        fsqrt                                   ;sqrt st0
        mov [ishort], diamxscale                ;st0 = diamxscale st1 = sqrt(dist)
        fild [ishort]
        fdiv st0, st1
        fistp [ishort]
        fstp st0
        fstp st0
        fstp st0
        mov ax, [ishort]
        mov bx, [short_var]
        add ax, [frame]
        add bx, [frame]
        xor ax, bx
        mov [es:di], al

        inc di
        loop tunnel_xloop
        dec dx
        jnz tunnel_yloop



        mov   ah, 01h           ; check for keypress
        int   16h               ; is a key waiting in the buffer?
        Jz MainLoop

        ;textmode
        mov ax, 0003h
        int 10h

        mov   ax, 004ch
        int   21h





    

_________________
Hello
Post 03 Apr 2006, 23:22
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
I tried to add an int 10h setting the vid mode to 03h but somehow it won't go out of the IDE when I run ti from there.
=====
it may depends on IDE (which IDE?) - i use winasm studio with add-in, and it runs dos projects via command interpreter window (optional - to not be closed immediatelly)
i added these "mov ax,3/int 10h" exactly before suggestion you to do the same, and it works proper both from explorer and cmd window.

regards!
Post 04 Apr 2006, 05:29
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
relsoft wrote:
Hello, I'm kinda new here and just figured out how to use FASM ( I used TASM and MASM before). I like what you have sone with this assembler. Easy to figure out and I just love the win IDE. I'm kind of an occasional asm coder though. More of like a noob. Anyways here are my firsts...
1. This is my first FASM program( I downloaded FASM like 2 hours ago)
2. This is my first <256 proggie
3. And lastly, this is my first post.

Anyways, here's the 247 byte tunnel:
...


hi!
impressive

what whould be your problem again?

i have tested it and worked fine.

you might want to put the dws at the end anyway
Code:
frame     dw  0
ishort    dw  0
short_var dw  0
scx       dw  0
scy       dw  0
    


for exit either is fine...
Code:
        ret                                     ; simplest exit
;        int 20h                                ; simpler exit
;        mov   ax, 004ch                        ; dos exit
;        int   21h
    

you may want to set back textmode before you exit,
then you can addidionally restore es
Code:
org 100h
push es
.
.
.
        ;textmode
        mov ax, 0003h
        int 10h
pop es
.
.
.
    


...
Code:
        mov ah,1                                ; check for keypress, this does not work at higher frame rates.
        int   16h                               ; is a key waiting in the buffer?
        Jz MainLoop

;         in al,$60                             ; this only works on w9x and dos ;( no winxp...
;         or al,al
;         jz MainLoop

    


this might speed up a bit (not on xp)
Code:
;====set palette
  cli                                  ; clear interrupts this might speed up a bit
   mov   dx, 03c8h                      ;palette write register
    

...
Code:
   loop palloop                         ;go back if not 0
  sti                             ; set interrupts back
    
Post 04 Apr 2006, 06:59
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
I agree with MATRIX impressive.
I converted it to run on "Dex4u OS" (my OS).
Code:
;*****************************************************************; tunnel by rel (Modded to run on Dex4u OS by Dex); Assemble with fasm; A:\fasm tunnel.asm tunnel.dex;       Http://Rel.Betterwebber.com;*****************************************************************use32        ORG 0x200000          ; where our program is loaded to        jmp start             ; jump to the start of program.        db 'DEX1'             ; We check for this, to make shore it a valid Dex4u file.diameter         equ 64diamxscale       equ 64 * diameterscale            equ 256start:        mov ax,18h            ; set ax to nonlinear base        mov ds,ax             ; add them to ds        mov es,ax             ; and es. ;----------------------------------------------------; ; Get calltable address.                             ; ;----------------------------------------------------;        mov edi,Functions     ; this is the interrupt        mov al,0              ; we use to load the DexFunction.inc        mov ah,0x0a           ; with the address to dex4u functions.        int 40h ;----------------------------------------------------; ; Change to mode 13h.                                ; ;----------------------------------------------------;        mov ax,0x0013         ;Dex4u realmode int, set to mode 13h        call [RealModeInt10h]        mov edi,0xA0000       ;Dex4u point to screen;*****************************************************************;*****************************************************************;*****************************************************************   fninit;====set palette        mov   dx, 03c8h                  ;palette write register        out   dx, al                     ;send value        inc   dx                         ;0x3c9(write RGB values)        mov cx, 256                      ;whole 256 colors   fldpi                                 ;st0 = pi   mov [ishort], 180                     ;st0 = 180, st1 = pi   fild [ishort]   palloop:        mov bx, 256        sub bx, cx        shl bx,1        mov [ishort], bx        fild [ishort]                    ;st0 = deg, st1 = 180, st2 = pi        fmul st0, st2        fdiv st0, st1        fsin                             ;st0 = sin(rad)        mov [ishort], 64        fimul [ishort]        fistp [ishort]        mov ax, [ishort]        out  dx, al                     ;red        shl al,1                        ;blue        out  dx, al        shr al, 2        out  dx, al                     ;than green   loop palloop                         ;go back if not 0        fstp st0        fstp st0        push  es        mov   ax,8h                     ;set up lin selector        mov   es,axMainLoop:        mov [scx],160        mov [scy],100        inc [frame]        ;displacement        fild [frame]        mov [ishort], 50        fidiv [ishort]        fsin        mov [ishort], 120        fimul [ishort]        fistp [ishort]        mov ax, [ishort]        add [scx], ax        fild [frame]        mov [ishort], 60        fidiv [ishort]        fsin        mov [ishort], 80        fimul [ishort]        fistp [ishort]        mov ax, [ishort]        add [scy], ax        ;===========tunnel        mov dx,200        mov edi, 0        add   edi,0xA0000      tunnel_yloop:        mov cx,320      tunnel_xloop:        ;atan2        fldpi                                   ;st0 = pi        mov ax, [scy]        mov [short_var], ax        sub [short_var], dx        fild [short_var]                        ;st0 = dy, st1 = pi        mov ax, [scx]        mov [short_var], ax        sub [short_var], cx        fild [short_var]                        ;st0 = dx, st1 = dy, st2 = pi        fpatan                                  ;st0 = atan(dy/dx) = atan(st1/st0)        mov [short_var], scale        fimul [short_var]                       ;atan(st0))*256/pi        fdiv st0, st1        fistp [short_var]                       ;short_var = scaledpi        jmp @ftunnel_xloop1:                                  ;NOTE: got a loop our of range error (Dex4u only), so did this temp.        jmp tunnel_xloop@@:        mov ax, [scx]        sub ax, cx                              ;cmx        mov [ishort], ax        fild [ishort]                           ;st0 = cmx        fmul st0, st0                           ;cmx * cmx        mov ax, [scy]        sub ax, dx        mov [ishort], ax        fild [ishort]                           ;st0 = cmy st1 = cmx*cmx        fmul st0, st0                           ;cmy * cmy        fadd st0, st1                           ;st0 cmx^2 + cmy^2        fsqrt                                   ;sqrt st0        mov [ishort], diamxscale                ;st0 = diamxscale st1 = sqrt(dist)        fild [ishort]        fdiv st0, st1        fistp [ishort]        fstp st0        fstp st0        fstp st0        mov ax, [ishort]        mov bx, [short_var]        add ax, [frame]        add bx, [frame]        xor ax, bx        mov byte[es:edi], al        inc edi        loop  tunnel_xloop1        dec dx        jnz tunnel_yloop        call [KeyPressedNoWait]        cmp ax,1        jne MainLoop                            ;Dex4u no keypress then loop        ;textmode        pop   es        call  [SetDex4uFonts]                   ;Dex4u set text mode        ret                                     ;Dex4u return contol to CLIframe     dw  0ishort    dw  0short_var dw  0scx       dw  0scy       dw  0include 'DexFunctions.inc'                      ;Dex4u function call table    


http://www.dex4u.com/uploads/Tunnel.zip
Post 04 Apr 2006, 11:01
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Dex4u wrote:
diamxscale equ 64 * diameter
just how things shouldn't be done. For numeric constants use numeric constants Smile, not equates. If there was some operator with higher priority than * (i am not sure if there is some), then using it with diamxscale could cause unwanted results.
Post 04 Apr 2006, 11:09
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
@vid, i did not write the code, i converted it to run on "Dex4u OS", i want to only change the "Dex4u" part to show how easy it is to convert Dos progs to Dex4u OS.
Its from the original Wink.
Post 04 Apr 2006, 11:20
View user's profile Send private message Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
Thanks for the comments!

Shoorick: I'm using the IDE bundled with FASM.

Matrix: Cool!!! So a ret would suffice. Never knew that. Thanks! I also found out about the var declarations after the code from some posts here. ;*). I'll remember to save es from now on. :*)

vid: What do you mean by using numeric constants?
this?

Code:
diamxscale = 64 * diameter    


Or would () suffice?

Code:
diamxscale equ (64 * diameter)    



Dex: Wow you made your own OS. That's rad!

_________________
Hello
Post 04 Apr 2006, 13:24
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
relsoft: first one is the "right" solution
Post 04 Apr 2006, 13:48
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
vid wrote:
relsoft: first one is the "right" solution


Oh, so equ is depreciated in FASM?
thanks!

_________________
Hello
Post 04 Apr 2006, 14:14
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
not deprecated, but it is for TEXTUAL SUBSTITUTIONS. For example when you want to replace every occurence of symbol "abcd" with "any babe cheats death" you write "abcd equ any babe cheats death".

these substitutions are done before rest of assembling, this stage is called "preprocessing"

But if you want some symbol to stand for numeric value, you use this way: "a = 5", where every time "a" is used in numeric expressions, it stands for value 5.

problem with equ is for example this:
Code:
x equ 5+3
dd x*5    

after TEXTUAL SUBSTITUTION of "x" to "5+3" becomes
Code:
dd 5+3*5    


you see it...
Post 04 Apr 2006, 16:12
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Post 04 Apr 2006, 17:11
View user's profile Send private message Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
vid. thanks for the explanation. :*)

Dex. I just went to your OS's site and that's one fine project you have there. Anyways, if I say develop a game with FASM in 13h ( I already have a lot of base code for GFX routines like mode7, sprite, translucency, triangle fillers all in ASM but still not converted to FASM), http://rel.betterwebber.com/junk.php?id=22 and I use real mode, would it be hard to convet to dex4u?

I may have a little time next week as I'll be on vacation from work and I'll be offline so I might as well make something with my free time. Although I'm also developing an OpenGL game ( Image)with a friend, the computer I'll be using while on vacation can't handle the ARB extensions which means I'm stuck with non-opengl apps while on vacation. :*)

_________________
Hello
Post 05 Apr 2006, 01:03
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Nice game relsoft, As for converting to run on Dex4u OS, i think you will find it easy.
As even though Dex4u is 32bit pmode OS, it as built in functions to do bios int's
Example of change to mode 13h, in Dex4u
Code:
mov ax,0x0013         ;Dex4u realmode int, set to mode 13hcall [RealModeInt10h]    

Example of putpixel
Code:
mov edi,0xA0000       ;Dex4u point to screen,NOTE:"0xA0000" not "0xA000"add edi,200                 ; Offset from, start of screenmov al,[color]             ;color of pixelmov byte[es:edi],al     ;putpixel or you can do "stosb"    
Note on the above examples i have used the call-table functions ( [RealModeInt10h] ), but Dex4u also as int 40h, to do the samething, as int 40h is, = too Dos int 21h or bios int 10h.
You can also use upto 4GB of memory, use vesa high res mode, as easy as 13h. Built in support for loading from hdd, cd, floppy, usb etc. support for bmp, gif, built in games keyboard ( for multi-keypresss), it was designed for demo and games programmers. The OS works the same as the Xbox OS, heres the xbox OS spec:
http://www.extremetech.com/article2/0,1697,1670116,00.asp
Basically a 32bit pomode Dos, like Dex4u.
Oh and its got a fasm port and editor so you can dev on it, too Wink .
Post 05 Apr 2006, 08:56
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.