case on dummy start end tables privdata ; ; each line is 160 pixels. ; top/bottom margin is 4 lines (4*160 pixels) rows anop dc i2'0*8*160+4*160+$2000' dc i2'1*8*160+4*160+$2000' dc i2'2*8*160+4*160+$2000' dc i2'3*8*160+4*160+$2000' dc i2'4*8*160+4*160+$2000' dc i2'5*8*160+4*160+$2000' dc i2'6*8*160+4*160+$2000' dc i2'7*8*160+4*160+$2000' dc i2'8*8*160+4*160+$2000' dc i2'9*8*160+4*160+$2000' dc i2'10*8*160+4*160+$2000' dc i2'11*8*160+4*160+$2000' dc i2'12*8*160+4*160+$2000' dc i2'13*8*160+4*160+$2000' dc i2'14*8*160+4*160+$2000' dc i2'15*8*160+4*160+$2000' dc i2'16*8*160+4*160+$2000' dc i2'17*8*160+4*160+$2000' dc i2'18*8*160+4*160+$2000' dc i2'19*8*160+4*160+$2000' dc i2'20*8*160+4*160+$2000' dc i2'21*8*160+4*160+$2000' dc i2'22*8*160+4*160+$2000' dc i2'23*8*160+4*160+$2000' dc i2'24*8*160+4*160+$2000' ; ; columns are simply x * 2 ; end ; ;ReverseScrollRegion(line1, line2) ; ReverseScrollRegion START line2 equ 9 line1 equ 7 _rtlb equ 3 _d equ 1 using tables ; brk $ea phb phd tsc tcd lda rows,x clc ; dec a ldx rows,x pha ; ; mvn: ; while (--a != -1) ; dest[y++] = dest[x++]; ; ; mvp: ; while(--a != -1) ; dest[y--] = dest[x--]; ; y = dest address = $2000 + 640 + (line2 + 1) * 8 * 160 -1 ; x = src address = dest - 160*8 ldx rows,x dec a tay sec sbc #160*8 tax pla ; length mvp $e10000,$e10000 ; ; now empty first line ; ldx rows,x clc ; dec a ldx rows,x pha ; src address = $2000 + line1 ; ldx #$e12000+1920 ; src address ; ldy #$e12000+640 ; dest address ; dest = $2000 + 640 + line1 * 8 * 160 ; src = dest + 1280 ldx rows,x tay clc adc #8*160 tax pla ; length mvn $e10000,$e10000 ; ; now empty last line ; ldx line2 dex dex jsr _ClearLine exit anop lda <_rtlb sta 23*8*160 ldx #$e12000+1920 ; src address ldy #$e12000+640 ; dest address ; ldx #$2000+1280 ; ldy #$2000 mvn $e10000,$e10000 ; ; now empty outline #24 ; ldx #23 jsr _ClearLine plb rtl END ; clear line in X (which has been pre-multiplied) _ClearLine PRIVATE using tables lda >rows,x tax lda #0 sta >$e10000,x ; stick a 0 in there txy ; destination address (src + 2) iny iny lda #8*160-3 ; length -1 mvn $e10000,$e10000 rts END ; ; ClearLine(int line_no); clears the line ; ClearLine START line equ 7 _rtlb equ 3 _d equ 1 ; brk $ea phb phd tsc tcd lda rows,x clc ldx rows,x dec a dec a pha ; save length ldx rows,x tax tay iny iny lda #0 sta >$e1000,x pla ; restore length mvn $e10000,$e10000 exit anop lda <_rtlb+2 sta rows,x clc adc start tax loop anop stz |0,x stz |160,x stz |320,x stz |480,x stz |640,x stz |800,x stz |960,x stz |1120,x inx inx dey bne loop exit anop lda <_rtlb+2 sta $e12000,x pld pla ;tmp pla sta 5,s pla sta 5,s pla plb rtl END ; ; clear the screen to black (or whatnot) ; ClearScreen START phb pea $e1e1 plb plb lda #0 ldy #32000 loop anop sta |$2000-2,y dey dey bne loop plb rtl END ; ; draw a character at the current Xpos & Ypos ; ; ; PrintChar(x, y, char, andMask, xorMask) PrintChar START using tables xorMask equ 15 andMask equ 13 char equ 11 yy equ 9 xx equ 7 _rtlb equ 3 _d equ 1 ; brk $ea phb phd tsc tcd ; sanity check on Xpos && Ypos ldx xx cpx #80 bcc ok2 exit2 anop brl exit ok2 anop ldy yy cpy #24 bcs exit2 lda rows,x clc adc xx tay ; ; $e12000 + pos = location to start drawing the character ; ; ; each char takes up 16 bytes :. the offset is (char - $20) * 16 ; ldx char lda >CHAR_SPACE,x eor CHAR_SPACE+2,x eor CHAR_SPACE+4,x eor CHAR_SPACE+6,x eor CHAR_SPACE+8,x eor CHAR_SPACE+10,x eor CHAR_SPACE+12,x eor CHAR_SPACE+14,x eor