diff --git a/graphics/hgr/hgr_font_4am/Makefile b/graphics/hgr/hgr_font_4am/Makefile index a3803f61..c912aecd 100644 --- a/graphics/hgr/hgr_font_4am/Makefile +++ b/graphics/hgr/hgr_font_4am/Makefile @@ -27,6 +27,7 @@ BIOS_TEST: bios_test.o ld65 -o BIOS_TEST bios_test.o -C $(LINKER_SCRIPTS)/apple2_6000.inc bios_test.o: bios_test.s \ + hgr_clear_screen.s \ font_console_1x8.s fonts/a2_cga_thin.inc \ zx02_optim.s graphics/a2_energy.hgr.zx02 ca65 -o bios_test.o bios_test.s -l bios_test.lst diff --git a/graphics/hgr/hgr_font_4am/bios_test.s b/graphics/hgr/hgr_font_4am/bios_test.s index 662c9afc..eb578b02 100644 --- a/graphics/hgr/hgr_font_4am/bios_test.s +++ b/graphics/hgr/hgr_font_4am/bios_test.s @@ -83,9 +83,33 @@ done_memcount: ; clear/fade the energy star logo first ; clear offscreen so no blinds effect + lda #$cc + jsr fade_logo_mask + + lda #200 + jsr WAIT + + lda #$33 + jsr fade_logo_mask + + lda #200 + jsr WAIT + + ; clear screen while offscreen + ; avoid blinds effect + jsr hgr_page2_clearscreen + bit PAGE2 + jsr hgr_page1_clearscreen + bit PAGE1 + jsr HGR bit FULLGR + lda #10 + sta CH + lda #0 + sta CV + lda #bios_message_2 ldx #11 @@ -128,11 +152,6 @@ done_memcount: ; type the LEMM command ;======================= - jsr scroll_screen - - jsr wait_until_keypress - - ldx #5 jsr draw_dos_command @@ -154,88 +173,90 @@ bios_message_1a: .byte "02/13/78-6502-564D57",0 bios_message_2: - .byte 10,0,"System Configuration",0 - .byte 0,8, $1D + + .byte "System Configuration",13,0 + + .byte $1D ; 0,8 + .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E + .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E + .byte $1E,$1E,$15,$1E,$1E,$1E,$1E,$1E + .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E + .byte $1E,$1E,$1E,$1E,$1E,$1E + .byte $1C, 13,0 + .byte $1F," CPU Type: 65C02 ",$14," Base Memory: 48K ",$1F,13,0 ; 16 + .byte $1F," Co-Proc: NONE ",$14," Lang Card: 16K ",$1F,13,0 ; 24 + .byte $1F," Clock: 1.023MHz ",$14," AUX Memory: 64K ",$1F,13,0 ; 32 + + .byte $19 ; 40 + .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E + .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E + .byte $1E,$1E,$13,$1E,$1E,$1E,$1E,$1E + .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E + .byte $1E,$1E,$1E,$1E,$1E,$1E + .byte $18, 13, 0 + + .byte $1F," Slot 6 Disk 1: Disk II 140K ",$1F,13,0 ; 48 + .byte $1F," Slot 6 Disk 2: Disk II 140K ",$1F,13,0 ; 56 + .byte $1F," Slot 4 : VIA 6522/Mockingboard ",$1F,13,0 ; 64 + .byte $1F," Slot 1 : Super Serial Card ",$1F,13,0 ; 72 + + + .byte $1B ; 80 .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E .byte $1E,$1E,$1E,$1E,$1E,$1E - .byte $1C, 0 - .byte 0,16, $1F," CPU Type: 65C02 Base Memory: 48K ",$1F,0 - .byte 0,24,$1F," Co-Proc: NONE Lang Card: 16K ",$1F,0 - .byte 0,32,$1F," Clock: 1.023MHz AUX Memory: 64K ",$1F,0 - - .byte 0,40,$19 - .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E - .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E - .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E - .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E - .byte $1E,$1E,$1E,$1E,$1E,$1E - .byte $18, 0 - - .byte 0,48,$1F," Slot 6 Disk 1: Disk II 140K ",$1F,0 - .byte 0,56,$1F," Slot 6 Disk 2: Disk II 140K ",$1F,0 - .byte 0,64,$1F," Slot 4 : VIA 6522/Mockingboard ",$1F,0 - .byte 0,72,$1F," Slot 1 : Super Serial Card ",$1F,0 - - - .byte 0,80,$1B - .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E - .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E - .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E - .byte $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E - .byte $1E,$1E,$1E,$1E,$1E,$1E - .byte $1A, 0 + .byte $1A, 13,0 bios_message3: - .byte 0,88,"Starting DOS 3.3...",0 + .byte "Starting DOS 3.3...",13,13,0 ; 88 bios_message4: - .byte 0,104,"S6D1>",0 - .byte 5,104,"c",0 - .byte 6,104,"d",0 - .byte 7,104," ",0 - .byte 8,104,"g",0 - .byte 9,104,"a",0 - .byte 10,104,"m",0 - .byte 11,104,"e",0 - .byte 12,104,"s",0 - .byte 13,104,"\",0 - .byte 14,104,"l",0 - .byte 15,104,"e",0 - .byte 16,104,"m",0 - .byte 17,104,"m",0 - .byte 18,104,"i",0 - .byte 19,104,"n",0 - .byte 20,104,"g",0 - .byte 21,104,"s",0 + .byte "S6D1>",0 ; 104 + .byte "c",0 + .byte "d",0 + .byte " ",0 + .byte "g",0 + .byte "a",0 + .byte "m",0 + .byte "e",0 + .byte "s",0 + .byte "\",0 + .byte "l",0 + .byte "e",0 + .byte "m",0 + .byte "m",0 + .byte "i",0 + .byte "n",0 + .byte "g",0 + .byte "s",13,13,0 bios_message5: - .byte 0,112,"S6D1>",0 - .byte 5,112,"d",0 - .byte 6,112,"i",0 - .byte 7,112,"r",0 - .byte 8,112," ",0 - .byte 9,112,"/",0 - .byte 10,112,"w",0 + .byte "S6D1>",0 ; 112 + .byte "d",0 + .byte "i",0 + .byte "r",0 + .byte " ",0 + .byte "/",0 + .byte "w",13,0 bios_message_6: - .byte 0,128,"Directory of s6d1:\games\lemmings\.",0 - .byte 0,136,"[.] [..] QBOOT QLOAD",0 - .byte 0,144,"LEVEL1 LEVEL2 LEVEL3 LEVEL4",0 - .byte 0,152,"LEVEL5 LEVEL6 LEVEL7 LEVEL8",0 - .byte 0,160,"LEVEL9 LEVEL10 LEMM",0 - .byte 0,168,"13 File(s) 90,624 Bytes.",0 - .byte 0,176," 2 Dir(s) 52,736 Bytes free.",0 + .byte "Directory of s6d1:\games\lemmings\.",13,0 ; 128 + .byte "[.] [..] QBOOT QLOAD",13,0 + .byte "LEVEL1 LEVEL2 LEVEL3 LEVEL4",13,0 + .byte "LEVEL5 LEVEL6 LEVEL7 LEVEL8",13,0 + .byte "LEVEL9 LEVEL10 LEMM",13,0 + .byte " 13 File(s) 90,624 Bytes.",13,0 + .byte " 2 Dir(s) 52,736 Bytes free.",13,13,0 bios_message7: - .byte 0,184,"S6D1>",0 - .byte 5,184,"l",0 - .byte 6,184,"e",0 - .byte 7,184,"m",0 - .byte 8,184,"m",0 + .byte "S6D1>",0 ; 184 + .byte "l",0 + .byte "e",0 + .byte "m",0 + .byte "m",0 .include "font_console_1x8.s" .include "fonts/a2_cga_thin.inc" @@ -378,75 +399,83 @@ draw_dos_command: dos_command_loop: jsr DrawCondensedStringAgain + lda OUTL + pha + lda OUTH + pha + dos_command_inner: ; draw curosr + lda #dos_cursor + jsr DrawCondensedString + dec CH + lda #200 + jsr WAIT - ; erase cursor + lda KEYPRESS + bmi dos_keypress + jsr DrawCondensedStringAgain + dec CH + lda #200 + jsr WAIT - jsr wait_until_keypress + lda KEYPRESS + bmi dos_keypress + + jmp dos_command_inner +dos_keypress: + bit KEYRESET + + pla + sta OUTH + pla + sta OUTL dec STRING_COUNT bne dos_command_loop rts +dos_cursor: + .byte "_",0 + .byte " ",0 - ;================================ - ;================================ - ;================================ - ;================================ -scroll_screen: - ldx #8 - stx INL - ldx #0 - stx OUTL -scroll_yloop: - ldx INL + ;======================= + ;======================= + ;======================= + ; 210,0 to 210,64 +fade_logo_mask: + sta mask_smc+1 + +fade_logo: + ldx #63 +outer_loop: + lda hposn_low,X - sta xloop_smc1+1 + sta inner_loop_smc1+1 + sta inner_loop_smc2+1 lda hposn_high,X - sta xloop_smc1+2 - - ldx OUTL - lda hposn_low,X - sta xloop_smc2+1 - lda hposn_high,X - sta xloop_smc2+2 + sta inner_loop_smc1+2 + sta inner_loop_smc2+2 ldy #39 -scroll_xloop: -xloop_smc1: +inner_loop: +inner_loop_smc1: lda $2000,Y -xloop_smc2: +mask_smc: + and #$CC +inner_loop_smc2: sta $2000,Y dey - bpl scroll_xloop + cpy #29 + bne inner_loop - inc INL - inc OUTL - - lda INL - cmp #192 - bne scroll_yloop - - ; blank bottom line - - - lda #$00 - ldy #39 -scroll_hline_xloop: - sta $23D0,Y - sta $27D0,Y - sta $2BD0,Y - sta $2FD0,Y - sta $33D0,Y - sta $37D0,Y - sta $3BD0,Y - sta $3FD0,Y - dey - bpl scroll_hline_xloop + dex + bpl outer_loop rts +.include "hgr_clear_screen.s" diff --git a/graphics/hgr/hgr_font_4am/font_console_1x8.s b/graphics/hgr/hgr_font_4am/font_console_1x8.s index 5f5b72d2..1ed4811c 100644 --- a/graphics/hgr/hgr_font_4am/font_console_1x8.s +++ b/graphics/hgr/hgr_font_4am/font_console_1x8.s @@ -10,6 +10,9 @@ ; VMW: commented, reformatted, minor changes, ca65 assembly ; hacked up some more +FONT_OFFSET = $13 + + ;------------------------------------------------------------------------------ ; DrawCondensedString ; @@ -121,6 +124,18 @@ dcb_loop_smc: adc #8 sta CV inx + + lda CV + cmp #192 + bcc dcb_loop + + lda #184 + sta CV + + stx XSAVE + jsr scroll_screen + ldx XSAVE + jmp dcb_loop @@ -128,28 +143,28 @@ not_linefeed: ; unrolled loop to write out each line dcb_row0: - lda CondensedRow0-$19, Y ; get 1-byte font row + lda CondensedRow0-FONT_OFFSET, Y ; get 1-byte font row sta $FDFD, X ; write out to graphics mem dcb_row1: - lda CondensedRow1-$19, Y + lda CondensedRow1-FONT_OFFSET, Y sta $FDFD, X dcb_row2: - lda CondensedRow2-$19, Y + lda CondensedRow2-FONT_OFFSET, Y sta $FDFD, X dcb_row3: - lda CondensedRow3-$19, Y + lda CondensedRow3-FONT_OFFSET, Y sta $FDFD, X dcb_row4: - lda CondensedRow4-$19, Y + lda CondensedRow4-FONT_OFFSET, Y sta $FDFD, X dcb_row5: - lda CondensedRow5-$19, Y + lda CondensedRow5-FONT_OFFSET, Y sta $FDFD, X dcb_row6: - lda CondensedRow6-$19, Y + lda CondensedRow6-FONT_OFFSET, Y sta $FDFD, X dcb_row7: - lda CondensedRow7-$19, Y + lda CondensedRow7-FONT_OFFSET, Y sta $FDFD, X inc CH @@ -171,3 +186,66 @@ dcb_done: rts + + ;================================ + ;================================ + ; scroll_screen + ;================================ + ;================================ + ; scrolls hgr page1 up by 8, filling with empty space at bottom + ; trashes A,X,Y + +scroll_screen: + ldx #8 + stx SCROLL_IN + ldx #0 + stx SCROLL_OUT + +scroll_yloop: + ldx SCROLL_IN + lda hposn_low,X + sta xloop_smc1+1 + lda hposn_high,X + sta xloop_smc1+2 + + ldx SCROLL_OUT + lda hposn_low,X + sta xloop_smc2+1 + lda hposn_high,X + sta xloop_smc2+2 + + ldy #39 +scroll_xloop: +xloop_smc1: + lda $2000,Y +xloop_smc2: + sta $2000,Y + dey + bpl scroll_xloop + + inc SCROLL_IN + inc SCROLL_OUT + + lda SCROLL_IN + cmp #192 + bne scroll_yloop + + ; blank bottom line + + + lda #$00 + ldy #39 +scroll_hline_xloop: + sta $23D0,Y + sta $27D0,Y + sta $2BD0,Y + sta $2FD0,Y + sta $33D0,Y + sta $37D0,Y + sta $3BD0,Y + sta $3FD0,Y + dey + bpl scroll_hline_xloop + + rts + diff --git a/graphics/hgr/hgr_font_4am/fonts/Makefile b/graphics/hgr/hgr_font_4am/fonts/Makefile index d96f427b..fef88595 100644 --- a/graphics/hgr/hgr_font_4am/fonts/Makefile +++ b/graphics/hgr/hgr_font_4am/fonts/Makefile @@ -4,10 +4,10 @@ PNG2FONT = ../../../../utils/hgr-utils/png2font all: a2_lowercase_font.inc a2_cga_thin.inc a2_lowercase_font.inc: a2_lowercase.png - $(PNG2FONT) -i a2_lowercase.png > a2_lowercase_font.inc + $(PNG2FONT) -i -o 0x19 a2_lowercase.png > a2_lowercase_font.inc a2_cga_thin.inc: a2_cga_thin.png - $(PNG2FONT) -i a2_cga_thin.png > a2_cga_thin.inc + $(PNG2FONT) -i -o 0x13 a2_cga_thin.png > a2_cga_thin.inc clean: diff --git a/graphics/hgr/hgr_font_4am/fonts/a2_cga_thin.png b/graphics/hgr/hgr_font_4am/fonts/a2_cga_thin.png index db7a6917..43576603 100644 Binary files a/graphics/hgr/hgr_font_4am/fonts/a2_cga_thin.png and b/graphics/hgr/hgr_font_4am/fonts/a2_cga_thin.png differ diff --git a/graphics/hgr/hgr_font_4am/hgr_clear_screen.s b/graphics/hgr/hgr_font_4am/hgr_clear_screen.s new file mode 100644 index 00000000..0c854415 --- /dev/null +++ b/graphics/hgr/hgr_font_4am/hgr_clear_screen.s @@ -0,0 +1,84 @@ + +hgr_page1_clearscreen: + + ldy #0 +hgr_page1_cls_loop: + sta $2000,Y + sta $2100,Y + sta $2200,Y + sta $2300,Y + sta $2400,Y + sta $2500,Y + sta $2600,Y + sta $2700,Y + sta $2800,Y + sta $2900,Y + sta $2A00,Y + sta $2B00,Y + sta $2C00,Y + sta $2D00,Y + sta $2E00,Y + sta $2F00,Y + sta $3000,Y + sta $3100,Y + sta $3200,Y + sta $3300,Y + sta $3400,Y + sta $3500,Y + sta $3600,Y + sta $3700,Y + sta $3800,Y + sta $3900,Y + sta $3A00,Y + sta $3B00,Y + sta $3C00,Y + sta $3D00,Y + sta $3E00,Y + sta $3F00,Y + iny + bne hgr_page1_cls_loop + + rts + + +hgr_page2_clearscreen: + + ldy #0 +hgr_page2_cls_loop: + sta $4000,Y + sta $4100,Y + sta $4200,Y + sta $4300,Y + sta $4400,Y + sta $4500,Y + sta $4600,Y + sta $4700,Y + sta $4800,Y + sta $4900,Y + sta $4A00,Y + sta $4B00,Y + sta $4C00,Y + sta $4D00,Y + sta $4E00,Y + sta $4F00,Y + sta $5000,Y + sta $5100,Y + sta $5200,Y + sta $5300,Y + sta $5400,Y + sta $5500,Y + sta $5600,Y + sta $5700,Y + sta $5800,Y + sta $5900,Y + sta $5A00,Y + sta $5B00,Y + sta $5C00,Y + sta $5D00,Y + sta $5E00,Y + sta $5F00,Y + iny + bne hgr_page2_cls_loop + + rts + diff --git a/graphics/hgr/hgr_font_4am/zp.inc b/graphics/hgr/hgr_font_4am/zp.inc index 986d95ee..35e9c221 100644 --- a/graphics/hgr/hgr_font_4am/zp.inc +++ b/graphics/hgr/hgr_font_4am/zp.inc @@ -33,9 +33,14 @@ P3 = $F4 P4 = $F5 P5 = $F6 +XSAVE = $F6 +SCROLL_IN=$F7 +SCROLL_OUT=$F8 + +STRING_COUNT = $F9 +MEMCOUNT= $FA +LEAD0 = $FB INL = $FC INH = $FD OUTL = $FE OUTH = $FF - - diff --git a/utils/hgr-utils/png2font.c b/utils/hgr-utils/png2font.c index 21e57f16..9e91de1a 100644 --- a/utils/hgr-utils/png2font.c +++ b/utils/hgr-utils/png2font.c @@ -276,10 +276,11 @@ int main(int argc, char **argv) { char *filename; int output_type=OUTPUT_ORIGINAL; + int start_offset=0x20; /* Parse command line arguments */ - while ( (c=getopt(argc, argv, "hvdib") ) != -1) { + while ( (c=getopt(argc, argv, "hvdibo:") ) != -1) { switch(c) { @@ -295,9 +296,12 @@ int main(int argc, char **argv) { case 'i': output_type=OUTPUT_INTERLEAVE; break; - case 'b': + case 'b': output_type=OUTPUT_BINARY; break; + case 'o': + start_offset=strtod(optarg,NULL); + break; default: print_help(argv[0],0); break; @@ -319,6 +323,7 @@ int main(int argc, char **argv) { } fprintf(stderr,"Loaded image %d by %d\n",xsize,ysize); + fprintf(stderr,"Using font offset of 0x%x\n",start_offset); /* for now, assume 5x8 font starting at 14,8 */ for(row=0;row<4;row++) { @@ -340,7 +345,7 @@ int main(int argc, char **argv) { /* old-fashioned output */ if (output_type==OUTPUT_ORIGINAL) { printf("hgr_font:\n"); - for(c=0x20;c<0x80;c++) { + for(c=start_offset;c<0x80;c++) { printf("; %c $%02X\n",c,c); for(y=0;y<8;y++) { print_fancy_byte(font_data[c][y]); @@ -350,7 +355,7 @@ int main(int argc, char **argv) { else if (output_type==OUTPUT_INTERLEAVE) { for(row=0;row<8;row++) { printf("CondensedRow%d:\n",row); - for(y=0x19;y<0x80;y++) { + for(y=start_offset;y<0x80;y++) { print_interleave_byte(font_data[y][row],y); } }