0 Members and 3 Guests are viewing this topic.
Lbl CLR.Clear a 6*6 spot on both buffers.r₁ is the X coordinate and r₂ is the Y coordinateAsm(447D85856F29293AA5834FCB39CB39CB390911409319E5E607874F)([03FF81FFC0FFE07FF03FF81FFC0FFE07])Asm(095E2356E10606C57EA377237EA277013105097EA377237EA27701D9FA09C110E6)Return
ld b,h ld a,l add a,l add a,l ld l,a add hl,hl add hl,hl ld a,(axv_r1) ld c,a srl c srl c srl c add hl,bc ld de,plotSScreen add hl,de push hl and %00000111 add a,a ld c,a ld hl,$0000 ;Replace with mask LUT add hl,bc ld e,(hl) inc hl ld d,(hl) pop hl ld b,6DrawLoop: push bc ld a,(hl) and e ld (hl),a inc hl ld a,(hl) and d ld (hl),a ld bc,appBackUpScreen-plotSScreen-1 add hl,bc ld a,(hl) and e ld (hl),a inc hl ld a,(hl) and d ld (hl),a ld bc,plotSScreen-appBackUpScreen-1+12 add hl,bc pop bc djnz DrawLoop
.POLYGONFix 510->A .The X coordinate of the vertex selector10->B .The Y coordinate of the vertex selector0->T .Total amount of vertexes20->M .Maximum amount of vertexes (not necessary -- only for sanity checks)L4->V .Pointer to the list of VertexesL1->C .Pointer to some free ram (for Calculations)ClrDrawClrDraw^^rRectI(A-1,B-1,3,3)^^rRepeat getKey(15) RectI(A-1,B-1,3,3)^^r getKey(3)-getKey(2)+A->A getKey(1)-getKey(4)+B->B RectI(A-1,B-1,3,3)^^r Rect(80,9,40,40) RectI(80,9,40,40) Text(80,10,A>Dec) Text(80,18,B>Dec) Text(80,30,T>Dec) If getKey(54) .Adds a vertex If T<M A->{T*2+V} .The last element in the list must equal the first one. B->{T*2+1+V} T+1->T Pxl-On(A,B) End For(Z,0,20) .Delay for usability DispGraph^^r End End If getKey(48) .Draws the polygon {V}->{T*2+V} {V+1}->{T*2+V+1} sub(POL,T,V,C) 0->T For(Z,0,20) DispGraph^^r End End If getKey(56) .Clears the screen ClrDraw ClrDraw^^r RectI(A-1,B-1,3,3)^^r 0->T End DispGraph^^rEndReturnLbl POL .Parameters . r1: The total amount of vertexes . r2: A list of vertexes (pairs of X and Y coordinates, each one byte) . r3: A pointer to some free ram (Amount needed == approx. (max polygon width) * 2) . .Destroyed . W, X, Y, Z, r3, r4, r5, r6 . r3->W For(r4,0,r1-1) r4*2+r2->r5 r4+1*2+r2->r6 {r5}-{r6}->X {r5+1}-{r6+1}->Y If X>=>=0 For(Z,0,X) {r5}-Z->{r3} ~Y*Z//X+{r5+1}->{r3+1} r3+2->r3 M+2->M End Else For(Z,0,abs(X)) {r5}+Z->{r3} Y*Z//X+{r5+1}->{r3+1} r3+2->r3 M+2->M End End End For(Z,1,r3-W/2-1) Line({Z*2+W},{Z*2+W+1},{Z*2+W},{Z*~2+r3+1})^^r EndReturn
.ITERATEIter()→LDisp (L)()►Dec,iDisp (L)()►Dec,iDisp (L)()►Dec,iIter()→MDisp (M)()►Dec,iDisp (M)()►Dec,iDisp (L)()►Dec,iLbl IterReturnλ( λ( λ( r₁+1→r₁ ) )(0))()
asm(prgmITERATE 1 2 3 1 2 4
:Lbl TXT:.sub(TXT,Initial X,Initial Y,String):r1->r4:For(I,0,length(r3)):If {I+r3}->{L1}r-255:Text(r1,r2,L1):r4+4->r4:Else:r2+7->r2:r1->r4:End:End:Return
:"TEXT[FF]NEWLINE[FF]ANOTHER LINE"->Str1:sub(TXT,X,Y,Str1)
.ATEST140→X→Y48→S32→TRepeat getKey(15)If getKey(54)ClrHomeDisp "N",N>Dec," O",O>Dec,i,"X",X>Dec," Y",Y>DecWhile getKey(54)Pause 10EndEndX+getKey(3)-(getKey(2))→XX→NY+getKey(1)-(getKey(4))→YY→OIf N>>9595→N(95-S)//(X-S)*(O-T)→OO+T→OEndIf O>>6363→O63-T//(Y-T)*(N-S)→NN+48→NEndIf N<<0-1→N~S//(X-S)*(O-T)+T→OEndIf O<<0-1→O~T//(Y-T)*(N-S)+S→NEndLine(S,T,N,O)DispGraphClrDrawPause 20EndGenerated by the BBify'r (http://clrhome.tk/resources/bbify/)
.ATEST240→X→Y48→S32→TRepeat getKey(15)If getKey(54)ClrHomeDisp "N",N>Dec," O",O>Dec,i,"X",X>Dec," Y",Y>DecWhile getKey(54)Pause 10EndEndX+getKey(3)-(getKey(2))→XX→NY+getKey(1)-(getKey(4))→YY→OIf N>>9595→N(95-S)//(N-S)*(O-T)→OO+T→OEndIf O>>6363→O63-T//(O-T)*(N-S)→NN+48→NEndIf N<<0-1→N~S//(N-S)*(O-T)+T→OEndIf O<<0-1→O~T//(O-T)*(N-S)+S→NEndLine(S,T,N,O)DispGraphClrDrawPause 20EndGenerated by the BBify'r (http://clrhome.tk/resources/bbify/)