[graphics c] how to draw a figure with graphics.h??

2»

Comments

  • I think that the bib "tools.h" must be in the include directory can you send it to me Tyler? you cand send it to me by email if it's possible
    thanks in advance

  • : hey, could u do that in borland turbo c++ 3.0? if you could, i would much appriciate a sample code. plz! thanx in advance, and i think im learning as much as the guy who wrote this post in the first place =)
    :
    [green]
    I could but I don't have borland turbo C 3.0. I'll post my assembler source though. All you have to do is download FASM windows IDE version and compile. It will generate a .com file that when executed will create a directory called "PAL" and a file called "Palette.pal" in that directory. It will fail if you already have that directory on your disk.
    [/green]

    [code]
    use16 ;create a .com executable
    ORG 100h

    xor al, al ;zero register AL for use
    mov cx, 768
    cld
    mov di, palette
    mov dx, 03c8h ;set the palette index to zero
    out dx, al


    Copy_Palette:

    cmp cx, 0 ;cx==768 and is decremented by 3-
    ;each loop cycle
    je done ;if cx==0 then we are done writing to palette-
    mov dx, 03c9h ;array
    insb
    insb ;write 3 bytes to palette array
    insb ;after the 3rd byte the palette index is-
    inc al ;automatically incremented
    sub cx, 3
    jmp Copy_Palette


    done:
    mov ah, 39h
    mov dx, pal ;create directory
    int 21h
    jc Write_Error

    mov ah, 03ch
    mov dx, palette_file ;create palette file
    mov cx, 0
    int 21h
    jc Write_Error
    mov [palette_handle], ax

    mov ah, 40h
    mov bx, [palette_handle] ;write date to palette file
    mov cx, 768
    mov dx, palette
    int 21h
    jc Write_Error
    cmp ax, 768 ;did it write to file 768 bytes?
    je WriteOK

    mov ah, 03eh
    mov bx, [palette_handle] ;close file
    int 21h
    jc Close_Error

    ;ERROR CODES

    Close_Error:
    mov dx, close
    mov ah, 9
    int 21h
    jmp _End


    Write_Error:
    mov dx, error
    mov ah, 9
    int 21h
    jmp _End

    ;SUCESS

    WriteOK:
    mov dx, writeok
    mov ah, 9
    int 21h


    _End:
    mov ah, 7
    int 21h
    mov ax, 3
    int 10h
    mov ax, 4c00h
    int 21h

    ;DATA AREA

    palette db 768 dup(0)
    palette_file db "C:palpalette.pal",0
    palette_handle dw 0
    error db "Write failed!",13, 10, '$'
    writeok db "768bytes written!",13,10,'$'
    pal db "pal",0
    close db "Couldn't Close file!",0
    [/code]
  • : : hey, could u do that in borland turbo c++ 3.0? if you could, i would much appriciate a sample code. plz! thanx in advance, and i think im learning as much as the guy who wrote this post in the first place =)
    : :
    : [green]
    : I could but I don't have borland turbo C 3.0. I'll post my assembler source though. All you have to do is download FASM windows IDE version and compile. It will generate a .com file that when executed will create a directory called "PAL" and a file called "Palette.pal" in that directory. It will fail if you already have that directory on your disk.

    hey look, i downloaded it and i dont know how to run anyprograms because when i click on the FASM.EXE it does nothing. anyways, im not sure that i have all the minimum requirements, even though i have a windows XP, i dont think i have some of the files i need like win32. what should i do?
  • : hey look, i downloaded it and i dont know how to run anyprograms because when i click on the FASM.EXE it does nothing. anyways, im not sure that i have all the minimum requirements, even though i have a windows XP, i dont think i have some of the files i need like win32. what should i do?
    :
    ok, never mind, i got the program to run, however, i cant run anything because i dont have the win32. and also,i was able 2 run ur program and it didnt do anything exept say 758 bites writen or something like that.
  • : Hi there
    : I really need your help, I have a project which simule soda distributor with using turbo c 3.0 and the lib graphics.h, i know how to draw many things like rectangle,circle... but the problem that I want to draw like a soda bottle which is coloured , i made all possible combinations but i didn't get any result unfortunately, is here someone who can help me please?
    : thanks
    :
    [green]
    If it said 768 bytes written then check your C: drive for a directory called PAL. There you will find the file. You don't need any windows API's to run this program. It is all 16bit.
    [/green]

  • : : Hi there
    : : I really need your help, I have a project which simule soda distributor with using turbo c 3.0 and the lib graphics.h, i know how to draw many things like rectangle,circle... but the problem that I want to draw like a soda bottle which is coloured , i made all possible combinations but i didn't get any result unfortunately, is here someone who can help me please?
    : : thanks
    : :
    : [green]
    : If it said 768 bytes written then check your C: drive for a directory called PAL. There you will find the file. You don't need any windows API's to run this program. It is all 16bit.
    : [/green]
    :
    :
    hey it says i need something to open it with, umm, and i used the FASM and it doesnt do anything, what should i use to open it with?

  • : : : Hi there
    : : : I really need your help, I have a project which simule soda distributor with using turbo c 3.0 and the lib graphics.h, i know how to draw many things like rectangle,circle... but the problem that I want to draw like a soda bottle which is coloured , i made all possible combinations but i didn't get any result unfortunately, is here someone who can help me please?
    : : : thanks
    : : :
    : : [green]
    : : If it said 768 bytes written then check your C: drive for a directory called PAL. There you will find the file. You don't need any windows API's to run this program. It is all 16bit.
    : : [/green]
    : :
    : :
    : hey it says i need something to open it with, umm, and i used the FASM and it doesnt do anything, what should i use to open it with?
    :
    :
    [green]
    I hope your kidding right? View it in a hex editor if your not. All it is, is a dump of the palette.
    [/green]

  • : [green]
    : I hope your kidding right? View it in a hex editor if your not. All it is, is a dump of the palette.
    : [/green]

    look, im only a beginner, so what is a hex editor? is it the FASM? i mean, im sorry it sounds stupid, but i dont kno what that is =(.
  • :
    : : [green]
    : : I hope your kidding right? View it in a hex editor if your not. All it is, is a dump of the palette.
    : : [/green]
    :
    : look, im only a beginner, so what is a hex editor? is it the FASM? i mean, im sorry it sounds stupid, but i dont kno what that is =(.
    :
    [green]
    FASM is an assembler/compiler. Hex editor can view files in hex format so you can modify them or do what ever. FHRED is a free hex editor I use and can be found by googling.
    [/green]

  • : [blue]I have done pretty huge programs with TC 3.0 in my time - early 90s. :-)All kinds: editors, machine controllers, other stuff... - you name it.[/blue]
    :


    yup, same here, ( though i'm limited to DOS environ those days... inport, outport, inportb, outportb, asm, interrupts, TSR's). parking area monitoring, robotics, alarm systems. way back then i see my graphics as cool, many would frown on those now a days.



  • [b][red]This message was edited by tylerhadfun at 2006-4-5 15:5:55[/red][/b][hr]
    [blue]
    :
    : yup, same here, ( though i'm limited to DOS environ those days... inport, outport, inportb, outportb, asm, interrupts, TSR's). parking area monitoring, robotics, alarm systems. way back then i see my graphics as cool, many would frown on those now a days.
    : [/blue]


    lol, thats what i use, and i dont consider my graphics good, but im only in highschool, and i know thing that my fellow students dont know about graphics. but i like the cheep graphics that i make lol =)


  • hey weapon x
    you said you have developed many graphics program with tc 3.0 can you send me some of yours if it's possible to see them?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories