Results 1 to 5 of 5

Thread: Graphics tutorials

  1. #1
    ChimpFace9000
    Guest

    Post Graphics tutorials

    Are there any graphics tutorials in pure assembly? Ive done a few that were for assembly in pscal or c, but i just cant get those to work because they were meant to be used in an hll. Any thing would be appriciated.

  2. #2
    ChimpFace9000
    Guest
    Ok, ive figured out how to do some simple graphics. Its just a pixel bouncing around the screen. My problem is that when the pixel gets to the bottom, it disapears. Heres the code...
    Code:
    	.model tiny
    	.386
    	.code
    	org 100h
    start:
    	mov	ax, 0013h
    	int	10h
    
    	mov	ax, 0a000h
    	mov	es, ax
    
    main_loop:
    	mov	di, 0a000h					; Clear screen, es = address
    	mov	ax, 0000h					; color
    	mov	cx, 64000					; size
    	rep	stosw
    
    	mov	dx, 03dah					; Wait for retrace
    waitforretrace:
    	in	al, dx
    	and	al, 08h
    	jz	waitforretrace
    
    	mov	bx, [PointX]
    	mov	dx, [PointY]
    	xchg	dh, dl
    	mov	al, [PointColor]
    	mov	di, dx
    	shr	di, 2
    	add	di, dx
    	add	di, bx
    	stosb
    
    	cmp	PointX, 0000h					; Update directin bytes
    	je	directionx0
    	cmp	PointX, 320
    	je	directionx1
    afterdirectionx:
    	cmp	PointY, 0000h
    	je	directiony0
    	cmp	PointY, 200
    	je	directiony1
    afterdirectiony:
    
    	cmp	DirectionX, 00h					; Update points
    	je	incpointx
    	dec	PointX
    afterpointx:
    	cmp	DirectionY, 00h
    	je	incpointy
    	dec	PointY
    afterpointy:
    
    	mov	ah, 86h						; Wait
    	xor	cx, cx
    	mov	dx, 2240h
    	int	15h
    
    	mov	ah, 01h						; Check for keypress
    	int	16h
    	jz	main_loop
    	xor	ah, ah						; Get the keypress
    	int	16h
    	cmp	al, 1bh						; Check for escape
    	jne	main_loop
    
    	mov	ax, 0003h
    	int	10h
    
    	ret
    
    directionx0:
    	mov	DirectionX, 00h
    	jmp	afterdirectionx
    directionx1:
    	mov	DirectionX, 01h
    	jmp	afterdirectionx
    directiony0:
    	mov	DirectionY, 00h
    	jmp	afterdirectiony
    directiony1:
    	mov	DirectionY, 01h
    	jmp	afterdirectiony
    incpointx:
    	inc	PointX
    	jmp	afterpointx
    incpointy:
    	inc	PointY
    	jmp	afterpointy
    ;--------------------------------------------------------------------------------------------------------
    PointX		word	0
    PointY		word	0
    PointColor	byte	10
    DirectionX	byte	0					; 0 = plus, 1 = minus
    DirectionY	byte	0
    ;--------------------------------------------------------------------------------------------------------
    
    end start
    Ive also attached the finished file. Any idea why its doing that?
    Attached Files Attached Files

  3. #3
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    tried to compile

    i tried to compile your code, and it would not work i am useing tasm 5...what did you use to compile?

  4. #4
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    tried to compile

    i tried to compile your code, and it would not work i am useing tasm 5...what did you use to compile?

  5. #5
    ChimpFace9000
    Guest
    I use masm. Thats ok, ive figured it out. Now i use a buffer and then copy it to the screen. Much faster.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width