Posted: 18th Aug 2003 2:02
here my first ASM prog
just execute this code in DB ....and then open the .zip and execute the .exe and ENJOY

see source button
Posted: 18th Aug 2003 5:19
How did you learn all these data commands???
Posted: 18th Aug 2003 5:20
If you could explain please e-mail me if possible
Posted: 18th Aug 2003 6:12
lol

this is only a file.....readed byte by byte (1026 bytes)... and then it reconstruct the file... this is that simple

this is the prog i use to make these .dba:
+ Code Snippet
input "Source File Name=",Source$
open to read 1,Source$
open to write 2,"Rebuild.dba"

write string 2,"open to write 1,"FINAL.TXT""
write string 2,"Read Byte1"
write string 2,"while Byte1<>999"
write string 2,"  write byte 1,Byte1"
write string 2,"  read Byte1"
write string 2,"endwhile"
write string 2,"close file 1"
write string 2," "
write string 2," "
write string 2," "
write byte 2,asc("D")
write byte 2,asc("a")
write byte 2,asc("t")
write byte 2,asc("a")
write byte 2,asc(" ")

nb=0
for i=1 to file size(Source$)
   nb=nb+1

   read byte 1,Byte
   FirstCar=int(Byte/100)
   SecondCar=int((Byte-(int(Byte/100)*100))/10)
   ThirdCar=int(Byte-(int((Byte-(int(Byte/100)*100))/10)*10))-(int(Byte/100)*100)
   FirstCar=asc(str$(FirstCar))
   SecondCar=asc(str$(SecondCar))
   ThirdCar=asc(str$(ThirdCar))
   if (firstCar<>48)
      Write Byte 2,FirstCar
      Write Byte 2,SecondCar
      Write Byte 2,ThirdCar
      if nb<>30 then Write Byte 2,asc(",")
   else
      if (firstCar=48) and (SecondCar<>48)
         Write Byte 2,SecondCar
         Write Byte 2,ThirdCar
         if nb<>30 then Write Byte 2,asc(",")
      else
         if (firstCar=48) and (SecondCar=48)
            Write Byte 2,ThirdCar
            if nb<>30 then Write Byte 2,asc(",")
         endif
      endif
   endif

   if nb=30
      write byte 2,13
      write byte 2,10
      write byte 2,asc("D")
      write byte 2,asc("a")
      write byte 2,asc("t")
      write byte 2,asc("a")
      write byte 2,asc(" ")
      nb=0
   endif

next i
write byte 2,asc("9")
write byte 2,asc("9")
write byte 2,asc("9")
close file 1
close file 2


but this is not the point of my post
the .EXE in the .ZIP that i posted is a prog that i made in Assembly language... i know this is not a forum of assembly .....but..i was happy to finish my first prog...

here the code for masm:
+ Code Snippet
      .xlist
      include    stdlib.a
      includelib   stdlib.lib
      .list

dseg      segment   para public 'data'
;Global variable here


sens word 1

Buffer db 64000 DUP(?)

TempX dw 51
TempY dw 50
TempX2 dw 151
TempY2 dw 150

DeltaX dw ?
DeltaY dw ?
Y_INC dw ?
X_INC dw ?
Error dw ?

dseg      ends

cseg      segment   para public 'code'
      assume   cs:cseg, ds:dseg

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

      public   PSP
PSP      dw   ?
;-----------------------------------------



;--------------------------------------------
Main      proc
      mov   ax, dseg
      mov   ds, ax
      mov   es, ax
      meminit
;-------------------------------------------
;main prog here:
;320x200

      mov ah,0
      mov al,13h
      int 10h

debut:



   call cls
   call line
   call update
   cmp sens,1
   jne recule
   inc tempx
   inc tempx2
   jmp finrecule
recule:
   dec tempx
   dec tempx2
finrecule:
   mov ax,300
   cmp tempx2,ax
   jne checkLimite
   dec tempx
   dec tempx2
   mov sens,2
CheckLimite:
   mov ax,50
   cmp tempx,ax
   jne debut
   inc tempx
   inc tempx2
   mov sens,1

jmp debut

;-=-=-=-=-=-=-=-=-=-
; Line Drawing Procedure
; Draws a Line From
; (TempX, TempY) To (TempX2, TempY2)
;-=-=-=-=-=-=-=-=-=-
LINE PROC
MOV DI, OFFSET Buffer ; DI = Buffer + X + Y*320
ADD DI, TempX ; Setting Up Starting Point
MOV AX, TempY
SHL AX, 1
SHL AX, 1
SHL AX, 1
SHL AX, 1
SHL AX, 1
SHL AX, 1
ADD DI, AX
SHL AX, 1
SHL AX, 1
ADD DI, AX

XOR AX, AX
MOV Error, AX

MOV AX, TempX2 ; Set Delta X
SUB AX, TempX
MOV DeltaX, AX

MOV AX, TempY2 ; Set Delta Y
SUB AX, TempY
MOV DeltaY, AX

MOV AX, 1 ; Set X_INC To 1
MOV X_INC, AX
MOV AX, 320 ; Set Y_INC To 320
MOV Y_INC, AX

XOR AX, AX ; Test Delta X Against 0
CMP DeltaX, AX
JGE SHORT SKIP1
NEG X_INC ; Negate Them
NEG DeltaX

SKIP1:
CMP DeltaY, AX ; Test DeltaY Against Zero
JGE SHORT SKIP2
NEG Y_INC ; Negate Them
NEG DeltaY

SKIP2:
MOV AX, DeltaY
CMP DeltaX, AX ; DeltaX > DeltaY?
JLE SHORT ELSE1
MOV CX, DeltaX ; Loop DeltaX Times
INC CX
THEN:
DEC CX
MOV BYTE PTR [DI], 1 ; Set Color

MOV AX, DeltaY ; Set Error
ADD Error, AX
MOV AX, Error

CMP AX, DeltaX ; Error>DeltaX
JLE SHORT AGAIN
SUB AX, DeltaX ; Error -= DeltaX
MOV Error, AX
ADD DI, Y_INC ; DI += Y_INC

AGAIN:
ADD DI, X_INC ; DI += X_INC
TEST CX, CX ; Loop Back
JNZ SHORT THEN

JMP SHORT DONE_LINE
ELSE1:
MOV CX, DeltaY ; Loop DeltaY Times
INC CX
ELSE_LOOP:
DEC CX
MOV BYTE PTR [DI], 1 ; Set Color

MOV AX, DeltaX ; Set Error
ADD Error, AX
MOV AX, Error

CMP AX, 0 ; Error>0
JLE SHORT AGAIN2
SUB AX, DeltaY ; Error -= DeltaY
MOV Error, AX
ADD DI, X_INC ; DI += X_INC

AGAIN2:
ADD DI, Y_INC ; DI += Y_INC
TEST CX, CX ; Loop Back
JNZ SHORT ELSE_LOOP

DONE_LINE:
RET
LINE ENDP
;==========================
Update Proc

MOV SI, Offset Buffer
XOR DI, DI
mov ax,0A000h
mov es,ax
MOV CX, 32000

fill:
dec cx
mov ax,ds:[si]
mov es:[di],ax
inc si
inc di
cmp cx,0
ja fill

RET
update endp
;============================
cls proc

mov ax,ds
mov es,ax
MOV DI, Offset Buffer
MOV CX, 32000

fill2:
dec cx
mov ax,0
mov es:[di],ax
inc di
cmp cx,0
ja fill2

ret
cls endp


fin:
;---------------------------------------------
Quit:      ExitPgm         ;DOS macro to quit program.
Main      endp

cseg      ends

sseg      segment   para stack 'stack'
stk      byte   1024 dup ("stack   ")
sseg      ends

zzzzzzseg   segment   para public 'zzzzzz'
LastBytes   byte   16 dup (?)
zzzzzzseg   ends
      end   Main


but the first Code.... (for DB) ..in my first ..message build the .exe ....then dont care about the code..
Posted: 18th Aug 2003 12:43
only numbers, but it work ^^
it's amusing
Posted: 20th Aug 2003 0:48
here another one:

(just open the .zip and run the .exe)

+ Code Snippet
open to write 1,"face.zip"
Read Byte1
while Byte1<>999
  write byte 1,Byte1
  read Byte1
endwhile
close file 1



Data 80,75,3,4,20,0,0,0,8,0,144,102,19,47,225,173,214,204,147,1,0,0,64,29,1,0,8,0,0,0
Data 68,82,65,87,46,69,88,69,237,210,63,107,83,81,24,192,225,55,49,183,221,122,5,119,201,212,15,160,56,42
Data 5,33,33,160,67,145,26,210,16,69,237,32,184,169,80,23,7,201,162,70,226,87,176,4,58,23,205,144,46,105
Data 33,208,186,56,184,249,17,2,78,138,224,159,229,122,46,41,10,14,238,202,243,28,206,253,157,220,115,224,38,228
Data 94,221,92,171,188,140,74,212,211,44,138,113,158,22,201,110,126,54,93,43,105,236,230,193,127,45,207,203,191,120
Data 49,79,198,226,78,190,88,229,241,107,63,63,121,25,182,226,109,60,74,51,139,205,248,145,94,146,219,241,38,206
Data 165,110,69,45,150,211,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,248,139,73,196,240,195,240,112,28,123,103,222,157,158,223,141,253,229,152,94,136,131
Data 203,209,42,178,39,23,199,113,191,118,156,69,12,106,163,78,12,178,81,55,214,175,183,167,17,59,235,49,218,136
Data 157,107,49,106,199,252,74,220,188,209,233,31,85,251,199,213,254,247,216,62,154,103,49,175,198,199,215,211,94,156
Data 47,38,241,106,120,184,31,143,91,131,218,234,179,172,209,104,54,203,51,159,102,47,210,67,15,122,81,238,164,175
Data 144,182,22,27,159,103,147,181,202,215,213,110,156,90,234,68,214,139,193,183,193,202,70,60,175,61,205,26,205,86
Data 121,224,75,249,185,88,234,198,159,231,138,149,118,244,47,181,35,182,223,207,102,191,127,223,131,135,183,238,220,171
Data 215,235,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,250,239,246,39,80,75,1,2,20,11,20,0,0
Data 0,8,0,144,102,19,47,225,173,214,204,147,1,0,0,64,29,1,0,8,0,0,0,0,0,0,0,0,0,32
Data 0,0,0,0,0,0,0,68,82,65,87,46,69,88,69,80,75,5,6,0,0,0,0,1,0,1,0,54,0,0
Data 0,185,1,0,0,0,0,999
Posted: 20th Aug 2003 3:01
Theres no way to close the face prog!
Posted: 20th Aug 2003 3:40
lol.....
alt+tab, then right click on it...or ..ill had something to leave ..next time..
Posted: 26th Aug 2003 21:31
How is assembly?
Posted: 26th Aug 2003 21:56
Mattman, what is it you want to know about assembly using data statements? i am off mentally today...i am not sure what ur asking...even though the question is not directed at me i am hoping to help as i just learned about ASM...
Posted: 27th Aug 2003 1:27
do you mean..... ..what is assembly language is looking like?

if its your question... this is my code... it does the same thing than the ... DB prog..that i posted above:


this is assembly language:
+ Code Snippet
      .xlist
      include    stdlib.a
      includelib   stdlib.lib
      .list

dseg      segment   para public 'data'
;Global variable here


sens word 1

Buffer db 64000 DUP(?)

TempX dw 51
TempY dw 50
TempX2 dw 151
TempY2 dw 150

DeltaX dw ?
DeltaY dw ?
Y_INC dw ?
X_INC dw ?
Error dw ?

dseg      ends

cseg      segment   para public 'code'
      assume   cs:cseg, ds:dseg

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

      public   PSP
PSP      dw   ?
;-----------------------------------------



;--------------------------------------------
Main      proc
      mov   ax, dseg
      mov   ds, ax
      mov   es, ax
      meminit
;-------------------------------------------
;main prog here:
;320x200

      mov ah,0
      mov al,13h
      int 10h

debut:



   call cls
   call line
   call update
   cmp sens,1
   jne recule
   inc tempx
   inc tempx2
   jmp finrecule
recule:
   dec tempx
   dec tempx2
finrecule:
   mov ax,300
   cmp tempx2,ax
   jne checkLimite
   dec tempx
   dec tempx2
   mov sens,2
CheckLimite:
   mov ax,50
   cmp tempx,ax
   jne debut
   inc tempx
   inc tempx2
   mov sens,1

jmp debut

;-=-=-=-=-=-=-=-=-=-
; Line Drawing Procedure
; Draws a Line From
; (TempX, TempY) To (TempX2, TempY2)
;-=-=-=-=-=-=-=-=-=-
LINE PROC
MOV DI, OFFSET Buffer ; DI = Buffer + X + Y*320
ADD DI, TempX ; Setting Up Starting Point
MOV AX, TempY
SHL AX, 1
SHL AX, 1
SHL AX, 1
SHL AX, 1
SHL AX, 1
SHL AX, 1
ADD DI, AX
SHL AX, 1
SHL AX, 1
ADD DI, AX

XOR AX, AX
MOV Error, AX

MOV AX, TempX2 ; Set Delta X
SUB AX, TempX
MOV DeltaX, AX

MOV AX, TempY2 ; Set Delta Y
SUB AX, TempY
MOV DeltaY, AX

MOV AX, 1 ; Set X_INC To 1
MOV X_INC, AX
MOV AX, 320 ; Set Y_INC To 320
MOV Y_INC, AX

XOR AX, AX ; Test Delta X Against 0
CMP DeltaX, AX
JGE SHORT SKIP1
NEG X_INC ; Negate Them
NEG DeltaX

SKIP1:
CMP DeltaY, AX ; Test DeltaY Against Zero
JGE SHORT SKIP2
NEG Y_INC ; Negate Them
NEG DeltaY

SKIP2:
MOV AX, DeltaY
CMP DeltaX, AX ; DeltaX > DeltaY?
JLE SHORT ELSE1
MOV CX, DeltaX ; Loop DeltaX Times
INC CX
THEN:
DEC CX
MOV BYTE PTR [DI], 1 ; Set Color

MOV AX, DeltaY ; Set Error
ADD Error, AX
MOV AX, Error

CMP AX, DeltaX ; Error>DeltaX
JLE SHORT AGAIN
SUB AX, DeltaX ; Error -= DeltaX
MOV Error, AX
ADD DI, Y_INC ; DI += Y_INC

AGAIN:
ADD DI, X_INC ; DI += X_INC
TEST CX, CX ; Loop Back
JNZ SHORT THEN

JMP SHORT DONE_LINE
ELSE1:
MOV CX, DeltaY ; Loop DeltaY Times
INC CX
ELSE_LOOP:
DEC CX
MOV BYTE PTR [DI], 1 ; Set Color

MOV AX, DeltaX ; Set Error
ADD Error, AX
MOV AX, Error

CMP AX, 0 ; Error>0
JLE SHORT AGAIN2
SUB AX, DeltaY ; Error -= DeltaY
MOV Error, AX
ADD DI, X_INC ; DI += X_INC

AGAIN2:
ADD DI, Y_INC ; DI += Y_INC
TEST CX, CX ; Loop Back
JNZ SHORT ELSE_LOOP

DONE_LINE:
RET
LINE ENDP
;==========================
Update Proc

MOV SI, Offset Buffer
XOR DI, DI
mov ax,0A000h
mov es,ax
MOV CX, 32000

fill:
dec cx
mov ax,ds:[si]
mov es:[di],ax
inc si
inc di
cmp cx,0
ja fill

RET
update endp
;============================
cls proc

mov ax,ds
mov es,ax
MOV DI, Offset Buffer
MOV CX, 32000

fill2:
dec cx
mov ax,0
mov es:[di],ax
inc di
cmp cx,0
ja fill2

ret
cls endp


fin:
;---------------------------------------------
Quit:      ExitPgm         ;DOS macro to quit program.
Main      endp

cseg      ends

sseg      segment   para stack 'stack'
stk      byte   1024 dup ("stack   ")
sseg      ends

zzzzzzseg   segment   para public 'zzzzzz'
LastBytes   byte   16 dup (?)
zzzzzzseg   ends
      end   Main
Posted: 27th Aug 2003 2:35
I meant, how is it? to learn. Easy, hard, moderate with a quarter of a monkey's beard with a pinch of toenail clippings? How long did it take you to learn ASM?
Posted: 27th Aug 2003 5:37
hmmmm ..i dont know ... ..maybe one month to understand everything about ..pointer..memory .....register and everything else.. but i did not finish to learn thing about assembly (..im at chapter 9 on 25)

from .. the day that i did this program...i made many program.. more and more complex.... without reading nothing .. (only a interuption list) ... just playing around with pointer memory.. to be comfortable..with them.. and now im doing a Lander game.. in space.. .. almost completed (80%) .. ill post it soon..

but.... if you dont even know one programmation language.. i dont think you will understand asm ....easily...

i was already knowing... almost 10 programmation laguage... (web programmation included)... then i was already ... familiar with programmation... but ..try it.. you will see by yourself.. this is the better way to know....
Posted: 27th Aug 2003 18:04
I know: HTML, PHP, DBC and VB
Posted: 27th Aug 2003 18:25
html wont help you
..anyway just try a little tutorial.....and see what you feel..
Posted: 27th Aug 2003 22:08
ASM *shudders* get it away from me!
I had a bad time with z80, and I'm always going to have a bad time with all assembler. Why I even looked at this thread is mind boggling!
Posted: 27th Aug 2003 22:09
Im gonna learn Java soon
Posted: 23rd Sep 2003 18:01
ya know i was just passing through here looking for a thread i'd lost a while back but need info from...

ya know i thought you were a good coder before, but christ
Boy you've got MAD SKILLZ

definately quality mate
Posted: 23rd Sep 2003 19:41
thx
it is so nice to read a commment like that

almost all of my code that is posted....have no reply...
or some poor comment... maybe DB user are not enough.. avanced to see the quality of my snippet...

now i am working on a 3d engine in delphi (witouth DirectX or OpenGl..i mean i do all calculation myself (the only graphic api that i use is 'SetPixel'))...
and im now modifying it to be completly ....with api.. i mean ill do EVETYHING.. myself.. i wont use 'uses'.. ill make my own window..

i will do it this way to code it in Assembly... but i do it in delphi first to ..be able to debug it easyly....

...anyway ill post it here even if its not related to DB.. for now here is an old version(exe or code):
http://www.brainwasher.free-host.com

late ill post my new version..
Posted: 24th Sep 2003 2:13
I hate using asm. I had to use it to move/copy files through DOS before for a test i had. mov and registers and all that junk, grrr.