
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; DATA
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
align 2
d6locs0         label   byte
temp0=0
temp1=79
temp2=0
temp3=67
temp4=11h
rept 64
                db low(temp0*100+temp2),high(temp0*100+temp2),temp4,temp2+1
  temp0=temp0+temp1
  if temp0 gt 199
    temp0=temp0-200
    temp1=temp1-3
  endif
  temp2=temp2+temp3
  if temp2 gt 79
    temp2=temp2-80
    temp3=temp3-4
  endif
  if temp4 eq 11h
    temp4=22h
  else
    if temp4 eq 22h
      temp4=44h
    else
      if temp4 eq 44h
        temp4=88h
      else
        temp4=11h
      endif
    endif
  endif
endm
d6locs1         label   byte
temp0=56
temp1=95
temp2=49
temp3=59
temp4=33h
rept 32
                db low(temp0*100+temp2),high(temp0*100+temp2),temp4,temp2+1
  temp0=temp0+temp1
  if temp0 gt 199
    temp0=temp0-200
    temp1=temp1-6
  endif
  temp2=temp2+temp3
  if temp2 gt 79
    temp2=temp2-80
    temp3=temp3-5
  endif
  temp4=temp4 xor 0ffh
endm

d6locs2         label   byte
temp0=132
temp1=96
temp2=13
temp3=73
rept 16
                db low(temp0*100+temp2),high(temp0*100+temp2),?,temp2+1
  temp0=temp0+temp1
  if temp0 gt 199
    temp0=temp0-200
    temp1=temp1-8
  endif
  temp2=temp2+temp3
  if temp2 gt 79
    temp2=temp2-80
    temp3=temp3-7
  endif
endm

d6cntr          db      0f0h
d6num           db      0
d6numd          db      1

;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
; CODE
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±

;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
p60:
        mov al,d6cntr
        dec al
        jnz short p60f0
        mov d6cntr,0f0h
        mov d6num,0
        mov d6numd,1
        jmp setnext
p60f0:
        mov d6cntr,al
        mov ch,d6num
        mov cl,d6numd
        cmp al,010h
        jne short p60f1
        mov cl,-1
        mov d6numd,cl
p60f1:

        add ch,cl
        jz short p60f2
        cmp ch,10h
        jb short p60f3
p60f2:
        mov d6numd,0
p60f3:
        mov d6num,ch

        mov edi,_vidptr
        mov dx,3c5h
        xor ebx,ebx
        mov ah,0c7h

        mov esi,offset d6locs2
        mov cl,10h
p60l2:
        mov bx,[esi]
        add bx,400
        cmp bx,100*200
        jb short p60l2f0
        sub bx,100*200
p60l2f0:
        dec ebx
        dec byte ptr [esi+3]
        jnz short p60l2f1
        mov byte ptr [esi+3],80
        add ebx,80
p60l2f1:
        mov [esi],bx
        cmp cl,ch
        ja short p60l2c
        @outb 6
        mov [edi+ebx],ah
        mov [edi+ebx+300],ah
        @outb 0fh
        mov [edi+ebx+100],ah
        mov [edi+ebx+200],ah
p60l2c:
        add esi,4
        dec cl
        jnz p60l2

        mov esi,offset d6locs1
        shl ch,1
        mov cl,20h
p60l1:
        mov bx,[esi]
        add bx,200
        cmp bx,100*200
        jb short p60l1f0
        sub bx,100*200
p60l1f0:
        mov al,[esi+2]
        xor al,0ffh
        jns short p60l1f1
        dec ebx
        dec byte ptr [esi+3]
        jnz short p60l1f1
        mov byte ptr [esi+3],80
        add ebx,80
p60l1f1:
        mov [esi],bx
        mov [esi+2],al
        cmp cl,ch
        ja short p60l1c
        out dx,al
        mov [edi+ebx],ah
        mov [edi+ebx+100],ah
p60l1c:
        add esi,4
        dec cl
        jnz p60l1

        mov esi,offset d6locs0
        shl ch,1
        mov cl,40h
p60l0:
        mov bx,[esi]
        add bx,100
        cmp bx,100*200
        jb short p60l0f0
        sub bx,100*200
p60l0f0:
        mov al,[esi+2]
        ror al,1
        jnc short p60l0f1
        dec ebx
        dec byte ptr [esi+3]
        jnz short p60l0f1
        mov byte ptr [esi+3],80
        add ebx,80
p60l0f1:
        mov [esi],bx
        mov [esi+2],al
        cmp cl,ch
        ja short p60l0c
        out dx,al
        mov [edi+ebx],ah
p60l0c:
        add esi,4
        dec cl
        jnz p60l0

        ret

