include BDS.LIB include EPDATA ;jumped to when cseq finds draw command ;causes a break ;purpose is to skip up page and draw all lines draw:: push b ;check there was no page break lhld vposition xchg lhld tm inx h call albu jc .drX ;now save current v. position to return to when done drawing lhld skdots dad d push h ;search lines to find how far back up the page we have to go lxi h,lilist-6 mvi a,NUMLINES push psw lxi b,0FFFFH .dr1: pop psw dcr a jm .dr3 push psw lxi d,6 dad d mov e,m inx h mov d,m inx h mov a,d ora e jz .dr1 push h mov h,b mov l,c call albu jnc $+5 mov b,d mov c,e pop h jmp .dr1 .dr3: ;BC is min v. pos in list, or FFFF if none mov d,b mov e,c inx d mov a,d ora e jz .drRET dcx d lhld vposition call cmh dad d ;HL now neg. skips we have to do shld skdots ;Ready to start drawing at v. position after next paperup ; (a) For each pass: clear buffer, draw 8 dots for each line, sendit ; (b) skip down for next row, and if not past old v. position, go to (a) .drLOOP: call drrow call drrow call drrow lhld skdots lxi d,PICA-3 dad d shld skdots xchg lhld vposition dad d ;cf old v. position on stack pop d push d call albu jnc .drLOOP .drRET: ;return down to v. position when got the draw command lhld vposition call cmh pop d dad d shld skdots ;last thing to do is zero out the lines to show that they have been drawn .drX: lxi d,NUMLINES*8 lxi h,lilist .drXL: mvi m,0 inx h dcx d mov a,d ora e jnz .drXL pop b ret ;clear buffer, draw 8 dots for each line, sendit drrow: call clrgbuf## mvi a,NUMLINES lxi h,lilist .drrLOOP: push psw push h ;no draw if no line mov a,m inx h ora m dcx h cnz dr8 lxi d,8 pop h dad d pop psw dcr a jnz .drrLOOP call bumpgpt## jmp sendit## ;draw 8 dots for the line at HL dr8: lxi d,v0 mvi b,8 .dr8.1: mov a,m stax d inx h inx d dcr b jnz .dr8.1 ;y-coordinate lhld vposition xchg lhld skdots dad d ;the first dot mvi a,80H .dr8LOOP: push psw push h call dr1 pop h inx h inx h inx h pop psw ora a rar jnc .dr8LOOP ret ;draw one dot in Acc at y=HL dr1: mov c,a ;to be passed to vdotset xchg ;DE = y lhld v1 call albu ;passed where line starts? rnc lhld v0 call cmh dad d mov a,h ;not yet to where line starts? ora a rm ;no preadjust yet xra a sta _preadj call adjfact ;v - v0 push h lhld c1draw xchg lhld c0draw push h call albu mvi a,0 jnc $+5 xchg inr a sta _nslflag ;HL is min(c0,c1) call cmh dad d ;save to figure num of dots shld _hdiff call adjfact ;HL is |c1 - c0| xchg pop h xthl ;HL is v - v0 and c0 put back on stack call usmul ;HL is |c1 - c0|*(v - v0) push h lhld v1 xchg lhld v0 call cmh dad d ;HL is v1 - v0 ;pause to figure delta-h push h xchg lhld _hdiff xchg call usdiv shld _hdiff pop d pop h ;add den.-1 to numerator dcx d ;(check not div by 0) mov a,d ora a jp $+5 pop d ;clean stack and abort ret dad d inx d ;HL/DE xchg call usdiv ;HL is ( |c1 - c0|*(v - v0) )/(v1 - v0) ;adjust by lost factor lda _preadj mov e,a call shllbe lda _nslflag ora a jz $+6 call cmh pop d ;(now stack clean) dad d ;add min(c0,c1) ;(check bounds; OR in byte; set maxgpt up if less) xchg lda _hdiff jmp vvdotset## adjfact: mov a,h ora a rz push h lxi h,_preadj inr m pop h inx h ;? mvi e,1 call shlrbe jmp adjfact v0: dw 0 c0draw: dw 0 v1: dw 0 c1draw: dw 0 _nslflag: db 0 _preadj: db 0 _hdiff: dw 0 end