foo
[a2gs_xortest] / xortest.s
1         org $800
2
3 LARGE = 0
4
5 REG_NEWVID = $c029
6 FB_BASE = $e12000
7
8         clc
9         xce
10
11         lda #$c1
12         sta REG_NEWVID
13
14         rep #$30        ; accum/index 16bit
15         lda #$0000
16         ldx #$0000
17 fillrest                ; @30f
18         stal $e19d00,x
19         inx
20         inx
21         cpx #$100
22         bne fillrest
23         
24         lda #$0000
25 cmap    pha             ; @31d
26         sta 0
27         asl
28         tax     ; offset = i * 2
29         asl
30         asl
31         asl
32         ora 0
33         sta 0
34         xba
35         ora 0
36         stal $e19e00,x
37         pla
38         inc
39         cmp #$0010
40         bne cmap
41
42 YVAL    = 0
43 TMPVAL  = 1
44 YNIB    = 2
45
46         sep #$20        ; accum 8bit  @337
47         ldx #0000       ; fb index
48         stz YVAL
49 yloop   ldy #0000       ; column/2 on Y reg  @33e
50 xloop   lda YVAL        ; @341
51
52         DO LARGE
53         lsr
54         FIN
55
56         and #$0f
57         sta YNIB
58         tya
59
60         DO LARGE = 0
61         asl
62         inc             ; increment X, next pixel on low nibble
63         FIN
64
65         and #$0f
66         sta TMPVAL      ; save first pixel X coordinate
67
68         DO LARGE = 0
69         dec             ; decrement back for high nibble pixel
70         FIN
71
72         eor YNIB
73         asl             ; move next pixel value to high nibble
74         asl
75         asl
76         asl
77         ora TMPVAL      ; first pixel X -> low nibble
78         eor YNIB
79
80         stal FB_BASE, x ; write the pixel pair
81         inx
82         iny
83         cpy #160        ; #$00a0
84         bne xloop
85         inc YVAL
86         lda YVAL
87         cmp #200        ; #$c8
88         bne yloop
89
90 infloop bra infloop     ; @36d
91
92         ; vi:ft=asm_ca65