#define begin { #define end } //================================== //plot one point //at x,y with color 1=white 0=black 2=invert #pragma warn- void video_pt(char x, char y, char c) begin #asm ; i=(x>>3) + ((int)y<<4) ; the byte with the pixel in it push r16 ldd r30,y+2 ;get x lsr r30 lsr r30 lsr r30 ;divide x by 8 ldd r12,y+1 ;get y lsl r12 ;mult y by 16 clr r13 lsl r12 rol r13 lsl r12 rol r13 lsl r12 rol r13 add r12, r30 ;add in x/8 ;v2 = screen[i]; r5 ;v3 = pos[x & 7]; r6 ;v4 = c r7 ldi r30,low(_screen) ldi r31,high(_screen) add r30, r12 adc r31, r13 ld r5,Z ;get screen byte ldd r26,y+2 ;get x ldi r27,0 andi r26,0x07 ;form x & 7 ldi r30,low(_pos*2) ldi r31,high(_pos*2) add r30,r26 adc r31,r27 lpm r6,Z ld r16,y ;get c ;if (v4==1) screen[i] = v2 | v3 ; ;if (v4==0) screen[i] = v2 & ~v3; ;if (v4==2) screen[i] = v2 ^ v3 ; cpi r16,1 brne tst0 or r5,r6 tst0: cpi r16,0 brne tst2 com r6 and r5,r6 tst2: cpi r16,2 brne writescrn eor r5,r6 writescrn: ldi r30,low(_screen) ldi r31,high(_screen) add r30, r12 adc r31, r13 st Z, r5 ;write the byte back to the screen pop r16 #endasm end #pragma warn+ #define OPEN 0 #define HALF 1 #define CLOSED 2 void video_putbutton(char x, char y, char d) begin switch(d) begin case OPEN: video_pt(x+1,y+2,0); video_pt(x+1,y+3,0); video_pt(x+1,y+4,0); video_pt(x+1,y+5,0); video_pt(x+2,y+1,0); video_pt(x+2,y+2,0); video_pt(x+2,y+3,0); video_pt(x+2,y+4,0); video_pt(x+2,y+5,0); video_pt(x+2,y+6,0); video_pt(x+3,y+1,0); video_pt(x+3,y+2,0); video_pt(x+3,y+3,0); video_pt(x+3,y+4,0); video_pt(x+3,y+5,0); video_pt(x+3,y+6,0); video_pt(x+4,y+1,0); video_pt(x+4,y+2,0); video_pt(x+4,y+3,0); video_pt(x+4,y+4,0); video_pt(x+4,y+5,0); video_pt(x+4,y+6,0); video_pt(x+5,y+1,0); video_pt(x+5,y+2,0); video_pt(x+5,y+3,0); video_pt(x+5,y+4,0); video_pt(x+5,y+5,0); video_pt(x+5,y+6,0); video_pt(x+6,y+2,0); video_pt(x+6,y+3,0); video_pt(x+6,y+4,0); video_pt(x+6,y+5,0); break; case HALF: video_pt(x+1,y+2,1); video_pt(x+1,y+3,1); video_pt(x+1,y+4,1); video_pt(x+1,y+5,1); video_pt(x+2,y+1,1); video_pt(x+2,y+2,1); video_pt(x+2,y+3,1); video_pt(x+2,y+4,1); video_pt(x+2,y+5,1); video_pt(x+2,y+6,1); video_pt(x+3,y+1,1); video_pt(x+3,y+2,1); video_pt(x+3,y+3,1); video_pt(x+3,y+4,1); video_pt(x+3,y+5,1); video_pt(x+3,y+6,1); video_pt(x+4,y+1,0); video_pt(x+4,y+2,0); video_pt(x+4,y+3,0); video_pt(x+4,y+4,0); video_pt(x+4,y+5,0); video_pt(x+4,y+6,0); video_pt(x+5,y+1,0); video_pt(x+5,y+2,0); video_pt(x+5,y+3,0); video_pt(x+5,y+4,0); video_pt(x+5,y+5,0); video_pt(x+5,y+6,0); video_pt(x+6,y+2,0); video_pt(x+6,y+3,0); video_pt(x+6,y+4,0); video_pt(x+6,y+5,0); break; case CLOSED: video_pt(x+1,y+2,1); video_pt(x+1,y+3,1); video_pt(x+1,y+4,1); video_pt(x+1,y+5,1); video_pt(x+2,y+1,1); video_pt(x+2,y+2,1); video_pt(x+2,y+3,1); video_pt(x+2,y+4,1); video_pt(x+2,y+5,1); video_pt(x+2,y+6,1); video_pt(x+3,y+1,1); video_pt(x+3,y+2,1); video_pt(x+3,y+3,1); video_pt(x+3,y+4,1); video_pt(x+3,y+5,1); video_pt(x+3,y+6,1); video_pt(x+4,y+1,1); video_pt(x+4,y+2,1); video_pt(x+4,y+3,1); video_pt(x+4,y+4,1); video_pt(x+4,y+5,1); video_pt(x+4,y+6,1); video_pt(x+5,y+1,1); video_pt(x+5,y+2,1); video_pt(x+5,y+3,1); video_pt(x+5,y+4,1); video_pt(x+5,y+5,1); video_pt(x+5,y+6,1); video_pt(x+6,y+2,1); video_pt(x+6,y+3,1); video_pt(x+6,y+4,1); video_pt(x+6,y+5,1); break; default: end end //requies 0<=s<=2 void video_shiftbutton(char x, char y, char d, char s) begin switch (s) begin case 0: break; case 1: switch(d) begin case OPEN: break; case HALF: video_pt(x,y+2,1); video_pt(x,y+3,1); video_pt(x,y+4,1); video_pt(x,y+5,1); video_pt(x+1,y+1,1); video_pt(x+1,y+6,1); video_pt(x+3,y+1,0); video_pt(x+3,y+2,0); video_pt(x+3,y+3,0); video_pt(x+3,y+4,0); video_pt(x+3,y+5,0); video_pt(x+3,y+6,0); break; case CLOSED: video_pt(x,y+2,1); video_pt(x,y+3,1); video_pt(x,y+4,1); video_pt(x,y+5,1); video_pt(x+1,y+1,1); video_pt(x+1,y+6,1); video_pt(x+5,y+1,0); video_pt(x+5,y+6,0); video_pt(x+6,y+2,0); video_pt(x+6,y+3,0); video_pt(x+6,y+4,0); video_pt(x+6,y+5,0); break; end break; // s==1 case 2: switch(d) begin case OPEN: break; case HALF: video_pt(x-1,y+2,1); video_pt(x-1,y+3,1); video_pt(x-1,y+4,1); video_pt(x-1,y+5,1); video_pt(x,y+1,1); video_pt(x,y+2,1); video_pt(x,y+3,1); video_pt(x,y+4,1); video_pt(x,y+5,1); video_pt(x,y+6,1); video_pt(x+1,y+1,1); video_pt(x+1,y+6,1); video_pt(x+2,y+1,0); video_pt(x+2,y+2,0); video_pt(x+2,y+3,0); video_pt(x+2,y+4,0); video_pt(x+2,y+5,0); video_pt(x+2,y+6,0); video_pt(x+3,y+1,0); video_pt(x+3,y+2,0); video_pt(x+3,y+3,0); video_pt(x+3,y+4,0); video_pt(x+3,y+5,0); video_pt(x+3,y+6,0); break; case CLOSED: video_pt(x-1,y+2,1); video_pt(x-1,y+3,1); video_pt(x-1,y+4,1); video_pt(x-1,y+5,1); video_pt(x,y+1,1); video_pt(x,y+2,1); video_pt(x,y+3,1); video_pt(x,y+4,1); video_pt(x,y+5,1); video_pt(x,y+6,1); video_pt(x+1,y+1,1); video_pt(x+1,y+6,1); video_pt(x+4,y+1,0); video_pt(x+4,y+6,0); video_pt(x+5,y+1,0); video_pt(x+5,y+2,0); video_pt(x+5,y+3,0); video_pt(x+5,y+4,0); video_pt(x+5,y+5,0); video_pt(x+5,y+6,0); video_pt(x+6,y+2,0); video_pt(x+6,y+3,0); video_pt(x+6,y+4,0); video_pt(x+6,y+5,0); break; end break; // s==1 default: end //switch on s end //display outline for 1 button void video_putoutline(char x, char y) begin video_pt(x,y+2,1); video_pt(x,y+3,1); video_pt(x,y+4,1); video_pt(x,y+5,1); video_pt(x+1,y+1,1); video_pt(x+1,y+6,1); video_pt(x+2,y,1); video_pt(x+2,y+7,1); video_pt(x+3,y,1); video_pt(x+3,y+7,1); video_pt(x+4,y,1); video_pt(x+4,y+7,1); video_pt(x+5,y,1); video_pt(x+5,y+7,1); video_pt(x+6,y+1,1); video_pt(x+6,y+6,1); video_pt(x+7,y+2,1); video_pt(x+7,y+3,1); video_pt(x+7,y+4,1); video_pt(x+7,y+5,1); end //display outline for all buttons void video_putoutlines(char x, char y) begin video_putoutline(x,y); y += 12; video_putoutline(x,y); y += 9; video_putoutline(x,y); y += 9; video_putoutline(x,y); y += 9; video_putoutline(x,y); y += 9; video_putoutline(x,y); y += 9; video_putoutline(x,y); y += 9; video_putoutline(x,y); end // put a set of buttons on the screen, vertically, only centers, all void video_putbuttons(char x, char y, unsigned char f, unsigned char h, unsigned char c) begin char v; if ((c & 0x80) == 0x80) { if ((f & 0x80) == 0x80) v = CLOSED; else if ((h & 0x80) == 0x80) v = HALF; else v = OPEN; video_putbutton_small(x,y,v); } y += 12; if ((c & 0x40) == 0x40) { if ((f & 0x40) == 0x40) v = CLOSED; else if ((h & 0x40) == 0x40) v = HALF; else v = OPEN; video_putbutton_small(x,y,v); } y += 9; if ((c & 0x20) == 0x20){ if ((f & 0x20) == 0x20) v = CLOSED; else if ((h & 0x20) == 0x20) v = HALF; else v = OPEN; video_putbutton_small(x,y,v); } y += 9; if ((c & 0x10) == 0x10){ if ((f & 0x10) == 0x10) v = CLOSED; else if ((h & 0x10) == 0x10) v = HALF; else v = OPEN; video_putbutton_small(x,y,v); } y += 9; if ((c & 0x08) == 0x08){ if ((f & 0x08) == 0x08) v = CLOSED; else if ((h & 0x08) == 0x08) v = HALF; else v = OPEN; video_putbutton_small(x,y,v); } y += 9; if ((c & 0x04) == 0x04){ if ((f & 0x04) == 0x04) v = CLOSED; else if ((h & 0x04) == 0x04) v = HALF; else v = OPEN; video_putbutton_small(x,y,v); } y += 9; if ((c & 0x02) == 0x02){ if ((f & 0x02) == 0x02) v = CLOSED; else if ((h & 0x02) == 0x02) v = HALF; else v = OPEN; video_putbutton_small(x,y,v); } y += 9; if ((c & 0x01) == 0x01){ if ((f & 0x01) == 0x01) v = CLOSED; else if ((h & 0x01) == 0x01) v = HALF; else v = OPEN; video_putbutton_small(x,y,v); } end //================================== void video_shiftleft(char x, char y, unsigned char f, unsigned char h, unsigned char s) begin char v; if ((f & 0x80) == 0x80) v = CLOSED; else if ((h & 0x80) == 0x80) v = HALF; else v = OPEN; video_shiftbutton_small(x,y,v,s); y += 12; if ((f & 0x40) == 0x40) v = CLOSED; else if ((h & 0x40) == 0x40) v = HALF; else v = OPEN; video_shiftbutton_small(x,y,v,s); y += 9; if ((f & 0x20) == 0x20) v = CLOSED; else if ((h & 0x20) == 0x20) v = HALF; else v = OPEN; video_shiftbutton_small(x,y,v,s); y += 9; if ((f & 0x10) == 0x10) v = CLOSED; else if ((h & 0x10) == 0x10) v = HALF; else v = OPEN; video_shiftbutton_small(x,y,v,s); y += 9; if ((f & 0x08) == 0x08) v = CLOSED; else if ((h & 0x08) == 0x08) v = HALF; else v = OPEN; video_shiftbutton_small(x,y,v,s); y += 9; if ((f & 0x04) == 0x04) v = CLOSED; else if ((h & 0x04) == 0x04) v = HALF; else v = OPEN; video_shiftbutton_small(x,y,v,s); y += 9; if ((f & 0x02) == 0x02) v = CLOSED; else if ((h & 0x02) == 0x02) v = HALF; else v = OPEN; video_shiftbutton_small(x,y,v,s); y += 9; if ((f & 0x01) == 0x01) v = CLOSED; else if ((h & 0x01) == 0x01) v = HALF; else v = OPEN; video_shiftbutton_small(x,y,v,s); end