Drawing circles of increasing radius

95 views Asked by At

here's the code to draw a circle:

My_PaintArea:
    mov     ebx,pointercolor                ;pointer ARRAY, RGB color values (BGR)
    push    [ebx]
    push    [ebx+4]
    push    [ebx+8]
    call    glColor3f                       ;- API Function -

    mov  ebx,pointervertex               ;pointer ARRAY, z y x vertex coordinat.

    finit
    fld a
    fmul pi
    fdiv dz
    fcos
    fmul r
    fst x_
    mov eax,x_
    mov [ebx],eax


    fld a
    fmul pi
    fdiv dz
    fsin
    fmul r
    fst y_
    mov eax,y_
    mov [ebx+4],eax

    push    [ebx]
    push    [ebx+4]
    push    [ebx+8]

    call    glVertex3f                      ;- API Function -

    mov     ebx,pointercolor
    push    [ebx+12]
    push    [ebx+16]
    push    [ebx+20]
    call    glColor3f  ;- API Function -

    mov ebx, pointervertex

    add a,5 

    fld a
    fmul pi
    fdiv dz
    fcos
    fmul r
    fst x__
    mov eax,x__
    mov [ebx+12],eax

    fld a
    fmul pi
    fdiv dz
    fsin
    fmul r
    fst y__
    mov eax,y__
    mov [ebx+16],eax

    push    [ebx+12]
    push    [ebx+16]
    push    [ebx+20]

    call    glVertex3f  
    ;add r,1                    ;- API Function -
   ; add pom1,1
    ;cmp pom1,5       
    ;jne My_PaintArea

ret                                     ;go out of here

The last 4 lines are commented out. Why does the program run an infinite loop (I assume)? pom1 is 0 at the start, so my idea is this should draw 5 circles of increasing radius (1,2,3,4,5).

EDIT: I should clarify, the program crashes when I leave the program without the comments, with the last 4 lines commented it draws a circle correctly (one circle).

0

There are 0 answers