mirror of
https://github.com/nippur72/apple1-videocard-lib.git
synced 2024-12-22 13:30:38 +00:00
rename symbols, add string input demo
This commit is contained in:
parent
bb67042ebf
commit
1941f613d8
@ -1,5 +1,3 @@
|
|||||||
// TODO make screen tables parametric (fixed values calculated by macros)
|
|
||||||
|
|
||||||
#include "../lib/utils.h"
|
#include "../lib/utils.h"
|
||||||
#include "../lib/apple1.h"
|
#include "../lib/apple1.h"
|
||||||
#include "../lib/tms9918.h"
|
#include "../lib/tms9918.h"
|
||||||
@ -38,8 +36,8 @@ void main() {
|
|||||||
|
|
||||||
byte key = 'H';
|
byte key = 'H';
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if(key == '1') prova_screen1();
|
if(key == '1') demo_screen1();
|
||||||
else if(key == '2') prova_screen2();
|
else if(key == '2') demo_screen2();
|
||||||
else if(key == 'A') demo_amiga_hand();
|
else if(key == 'A') demo_amiga_hand();
|
||||||
else if(key == 'I') demo_interrupt();
|
else if(key == 'I') demo_interrupt();
|
||||||
else if(key == 'E') flip_external_input();
|
else if(key == 'E') flip_external_input();
|
||||||
|
@ -163,7 +163,7 @@ void demo_amiga_hand() {
|
|||||||
screen2_puts(0, 4, FG_BG(COLOR_BLACK,COLOR_WHITE), "READY.");
|
screen2_puts(0, 4, FG_BG(COLOR_BLACK,COLOR_WHITE), "READY.");
|
||||||
|
|
||||||
for(word p=0;p<612;p+=4) {
|
for(word p=0;p<612;p+=4) {
|
||||||
vti_line(amiga_data[p],amiga_data[p+1],amiga_data[p+2],amiga_data[p+3]);
|
screen2_line(amiga_data[p],amiga_data[p+1],amiga_data[p+2],amiga_data[p+3]);
|
||||||
}
|
}
|
||||||
screen2_puts(18, 12, FG_BG(COLOR_DARK_BLUE, COLOR_WHITE), "APPLE1");
|
screen2_puts(18, 12, FG_BG(COLOR_DARK_BLUE, COLOR_WHITE), "APPLE1");
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ void flip_external_input() {
|
|||||||
else woz_puts("EXT INPUT OFF\r");
|
else woz_puts("EXT INPUT OFF\r");
|
||||||
|
|
||||||
// fill color table with transparent color so that external input can be seen
|
// fill color table with transparent color so that external input can be seen
|
||||||
tms_set_vram_write_addr(SCREEN1_COLOR_TABLE);
|
tms_set_vram_write_addr(TMS_COLOR_TABLE);
|
||||||
for(byte i=32;i!=0;i--) {
|
for(byte i=32;i!=0;i--) {
|
||||||
TMS_WRITE_DATA_PORT(FG_BG(COLOR_DARK_YELLOW, COLOR_TRANSPARENT));
|
TMS_WRITE_DATA_PORT(FG_BG(COLOR_DARK_YELLOW, COLOR_TRANSPARENT));
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
|
#include <string.h>
|
||||||
|
|
||||||
void screen1_square_sprites() {
|
void screen1_square_sprites() {
|
||||||
// fills first sprite pattern with 255
|
// fills first sprite pattern with 255
|
||||||
tms_set_vram_write_addr(SCREEN1_SPRITE_PATTERNS); // start writing in the sprite patterns
|
tms_set_vram_write_addr(TMS_SPRITE_PATTERNS); // start writing in the sprite patterns
|
||||||
for(byte i=0;i<8;i++) {
|
for(byte i=0;i<8;i++) {
|
||||||
TMS_WRITE_DATA_PORT(255);
|
TMS_WRITE_DATA_PORT(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set sprite coordinates
|
// set sprite coordinates
|
||||||
tms_set_vram_write_addr(SCREEN1_SPRITE_ATTRS); // start writing in the sprite attribute
|
tms_set_vram_write_addr(TMS_SPRITE_ATTRS); // start writing in the sprite attribute
|
||||||
for(byte i=0;i<32;i++) {
|
for(byte i=0;i<32;i++) {
|
||||||
TMS_WRITE_DATA_PORT((6+i)*8); NOP; NOP; NOP; NOP; // y coordinate
|
TMS_WRITE_DATA_PORT((6+i)*8); NOP; NOP; NOP; NOP; // y coordinate
|
||||||
TMS_WRITE_DATA_PORT((6+i)*8); NOP; NOP; NOP; NOP; // x coordinate
|
TMS_WRITE_DATA_PORT((6+i)*8); NOP; NOP; NOP; NOP; // x coordinate
|
||||||
@ -15,18 +17,34 @@ void screen1_square_sprites() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void prova_screen1() {
|
byte buffer[32];
|
||||||
|
void demo_screen1() {
|
||||||
tms_init_regs(SCREEN1_TABLE);
|
tms_init_regs(SCREEN1_TABLE);
|
||||||
screen1_prepare();
|
screen1_prepare();
|
||||||
screen1_load_font();
|
screen1_load_font();
|
||||||
|
|
||||||
screen1_home(); screen1_puts("*** P-LAB VIDEO CARD SYSTEM ***");
|
screen1_putc(CHR_CLS);
|
||||||
screen1_locate(0, 2); screen1_puts("16K VRAM BYTES FREE");
|
screen1_puts(
|
||||||
screen1_locate(0, 4); screen1_puts("READY.");
|
"*** P-LAB VIDEO CARD SYSTEM ***\n"
|
||||||
|
"16K VRAM BYTES FREE\n\n"
|
||||||
|
"READY.\n\n\n"
|
||||||
|
);
|
||||||
|
|
||||||
screen1_locate(0, 10);
|
screen1_puts("what about " REVERSE_ON " REVERSE text " REVERSE_OFF " ?\n\n\n\n");
|
||||||
for(word i=0;i<256;i++) screen1_putc((byte)i);
|
|
||||||
|
for(word i=32;i<128;i++) screen1_putc((byte)i);
|
||||||
|
screen1_puts("\n\n" REVERSE_ON);
|
||||||
|
for(word i=32;i<128;i++) screen1_putc((byte)i);
|
||||||
|
|
||||||
screen1_square_sprites();
|
screen1_square_sprites();
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
screen1_puts(REVERSE_OFF "\n\nWRITE HERE: >");
|
||||||
|
screen1_strinput(buffer,16);
|
||||||
|
if(strlen(buffer)==0) break;
|
||||||
|
screen1_puts("\n\n\nyou wrote: '");
|
||||||
|
screen1_puts(buffer);
|
||||||
|
screen1_puts("'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
void prova_screen2() {
|
void demo_screen2() {
|
||||||
tms_init_regs(SCREEN2_TABLE);
|
tms_init_regs(SCREEN2_TABLE);
|
||||||
|
|
||||||
byte text_color = FG_BG(COLOR_BLACK,COLOR_WHITE);
|
byte text_color = FG_BG(COLOR_BLACK,COLOR_WHITE);
|
||||||
@ -13,20 +13,20 @@ void prova_screen2() {
|
|||||||
screen2_puts(5,(byte)(6+i),(byte)(((15-i)<<4)+i)," SCREEN 2 ");
|
screen2_puts(5,(byte)(6+i),(byte)(((15-i)<<4)+i)," SCREEN 2 ");
|
||||||
}
|
}
|
||||||
|
|
||||||
vti_line(18, 45,232,187);
|
screen2_line(18, 45,232,187);
|
||||||
vti_line(18,187,232, 45);
|
screen2_line(18,187,232, 45);
|
||||||
|
|
||||||
SCREEN2_PLOT_MODE = PLOT_MODE_RESET;
|
screen2_plot_mode = PLOT_MODE_RESET;
|
||||||
|
|
||||||
vti_line(18+5, 45,232+5,187);
|
screen2_line(18+5, 45,232+5,187);
|
||||||
vti_line(18+5,187,232+5, 45);
|
screen2_line(18+5,187,232+5, 45);
|
||||||
|
|
||||||
SCREEN2_PLOT_MODE = PLOT_MODE_INVERT;
|
screen2_plot_mode = PLOT_MODE_INVERT;
|
||||||
|
|
||||||
vti_line(18+5+5, 45,232+5+5,187);
|
screen2_line(18+5+5, 45,232+5+5,187);
|
||||||
vti_line(18+5+5,187,232+5+5, 45);
|
screen2_line(18+5+5,187,232+5+5, 45);
|
||||||
|
|
||||||
SCREEN2_PLOT_MODE = PLOT_MODE_SET;
|
screen2_plot_mode = PLOT_MODE_SET;
|
||||||
|
|
||||||
//vti_ellipse_rect(7,9,202,167);
|
//vti_ellipse_rect(7,9,202,167);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user