vmw_font: more work on bios

This commit is contained in:
Vince Weaver 2023-08-27 00:48:36 -04:00
parent f628ad3d48
commit 7f84d3b7ed
4 changed files with 581 additions and 34 deletions

View File

@ -27,7 +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 \
font_vmw_1x8.s fonts/a2_cga_thin.inc \
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

View File

@ -31,35 +31,110 @@ bios_test:
jsr full_decomp
; test 1
; Bios screen 1
lda #<test1
ldy #>test1
jsr DrawCondensedString
lda #0
sta CH
sta CV
; test 2
lda #<bios_message_1
ldy #>bios_message_1
ldx #5
jsr draw_multiple_strings
lda #<test2
ldy #>test2
jsr DrawCondensedString
lda #0
sta CH
lda #176
sta CV
; test 3
lda #<bios_message_1a
ldy #>bios_message_1a
ldx #2
jsr draw_multiple_strings
lda #<test3
ldy #>test3
jsr DrawCondensedString
; test 4
;=========================
; do fake memory count
lda #<test4
ldy #>test4
jsr DrawCondensedString
lda #128
sta MEMCOUNT
memcount_loop:
lda KEYPRESS ; 4
bmi done_memcount ; 3
; test 5
lda #100
jsr WAIT
lda #<test5
ldy #>test5
jsr DrawCondensedString
jsr increment_memory
dec MEMCOUNT
bpl memcount_loop
done_memcount:
bit KEYRESET ; clear the keyboard buffer
jsr wait_until_keypress
;==============================
; print system config screen
;==============================
; TODO:
; clear/fade the energy star logo first
; clear offscreen so no blinds effect
jsr HGR
bit FULLGR
lda #<bios_message_2
ldy #>bios_message_2
ldx #11
jsr draw_multiple_strings
jsr wait_until_keypress
;====================
; print DOS string
;====================
jsr DrawCondensedStringAgain
jsr wait_until_keypress
;====================
; type the CD command
;====================
ldx #18
jsr draw_dos_command
;====================
; type the DIR command
;====================
ldx #7
jsr draw_dos_command
;====================
; show DIR
;====================
lda #<bios_message_6
ldy #>bios_message_6
ldx #7
jsr draw_multiple_strings
;=======================
; type the LEMM command
;=======================
jsr scroll_screen
jsr wait_until_keypress
ldx #5
jsr draw_dos_command
@ -67,19 +142,102 @@ end:
jmp end
test1:
; 0123456789012345678901234567890123456789
.byte 0,100,"PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS!",0
test2:
.byte 0,150,"pack my box with five dozen liquor jugs?",0
test3:
.byte 9,80,"This is a HGR font test.",0
test4:
.byte 0,170,"0123456789)(*&^%$#@!`~<>,./';:[]{}\|_+=",0
test5:
.byte 0,180,"@/\/\/\/\______ |",0
; 0123456789012345678901234567890123456789
bios_message_1:
.byte "Apple II Modular BIOS",13,0
.byte "Copyright (C) 1977-1991",13,13,0
.byte "Apple IIe ",13,13,0
.byte "65C02 CPU at 1.023MHz",13,0
.byte "Memory Test: 0B OK",13,0
bios_message_1a:
.byte "Press ",$17,"-D to enter SETUP",13,0
.byte "02/13/78-6502-564D57",0
.include "font_vmw_1x8.s"
bios_message_2:
.byte 10,0,"System Configuration",0
.byte 0,8, $1D
.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
bios_message3:
.byte 0,88,"Starting DOS 3.3...",0
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
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
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
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
.include "font_console_1x8.s"
.include "fonts/a2_cga_thin.inc"
.include "zx02_optim.s"
@ -93,3 +251,202 @@ hposn_high = $1800 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
.include "hgr_table.s"
wait_until_keypress:
lda KEYPRESS ; 4
bpl wait_until_keypress ; 3
bit KEYRESET ; clear the keyboard buffer
rts ; 6
memcount:
.byte $00,$00,$00
memcount_string:
; .byte 13,48,
.byte $00,$00,$00,$00,$00,$00,0
;================================
;================================
;================================
;================================
increment_memory:
sed
clc
lda memcount+2
adc #$24
sta memcount+2
lda memcount+1
adc #$10
sta memcount+1
lda memcount
adc #0
sta memcount
cld
; copy to output buffer
ldx #0
stx INL
stx LEAD0
do_memcount_loop:
memcount_top_nibble:
lda memcount,X
lsr
lsr
lsr
lsr
bne tn_display_digit
ldy LEAD0
bne tn_display_digit
tn_no_display_digit:
lda #$20 ; space
bne tn_actually_display_digit
tn_display_digit:
clc
adc #$30
sta LEAD0
tn_actually_display_digit:
ldy INL
sta memcount_string,Y
inc INL
memcount_bottom_nibble:
lda memcount,X
and #$f
bne display_digit
ldy LEAD0
bne display_digit
no_display_digit:
lda #$20 ; space
bne actually_display_digit
display_digit:
clc
adc #$30
sta LEAD0
actually_display_digit:
ldy INL
sta memcount_string,Y
inc INL
inx
cpx #3
bne do_memcount_loop
bit SPEAKER
lda #13
sta CH
lda #48
sta CV
lda #<memcount_string
ldy #>memcount_string
jmp DrawCondensedString ; tail call
;==============================
;==============================
;==============================
;==============================
draw_multiple_strings:
dex
stx STRING_COUNT
jsr DrawCondensedString
multiple_loop:
jsr DrawCondensedStringAgain
dec STRING_COUNT
bne multiple_loop
rts
;==============================
;==============================
;==============================
;==============================
draw_dos_command:
stx STRING_COUNT
dos_command_loop:
jsr DrawCondensedStringAgain
dos_command_inner:
; draw curosr
; erase cursor
jsr wait_until_keypress
dec STRING_COUNT
bne dos_command_loop
rts
;================================
;================================
;================================
;================================
scroll_screen:
ldx #8
stx INL
ldx #0
stx OUTL
scroll_yloop:
ldx INL
lda hposn_low,X
sta xloop_smc1+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
ldy #39
scroll_xloop:
xloop_smc1:
lda $2000,Y
xloop_smc2:
sta $2000,Y
dey
bpl scroll_xloop
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
rts

View File

@ -0,0 +1,173 @@
;license:MIT
;(c) 2023 by 4am
;
; drawing routines for Million Perfect Tiles Condensed
;
; Public functions:
; - DrawCondensedString
;
; VMW: commented, reformatted, minor changes, ca65 assembly
; hacked up some more
;------------------------------------------------------------------------------
; DrawCondensedString
;
; in: A/Y points to zero terminated string, with x-pos and y-pos at start
; out: clobbers all registers & flags
;------------------------------------------------------------------------------
DrawCondensedString:
; store the string location
sta OUTL
sty OUTH
DrawCondensedStringAgain:
lda OUTL
sta dcb_loop_smc+1
lda OUTH
sta dcb_loop_smc+2
ldy CV
; row0
lda hposn_low, Y ; get low memory offset
clc
adc CH ; add in x-coord
sta dcb_row0+4
lda hposn_high, Y ; get high memory offset
sta dcb_row0+5 ; save it out
iny ; go to next row
; row1
lda hposn_low, Y
adc CH
sta dcb_row1+4
lda hposn_high, Y
sta dcb_row1+5
iny
; row2
lda hposn_low, Y
adc CH
sta dcb_row2+4
lda hposn_high, Y
sta dcb_row2+5
iny
; row3
lda hposn_low, Y
adc CH
sta dcb_row3+4
lda hposn_high, Y
sta dcb_row3+5
iny
; row4
lda hposn_low, Y
adc CH
sta dcb_row4+4
lda hposn_high, Y
sta dcb_row4+5
iny
; row5
lda hposn_low, Y
adc CH
sta dcb_row5+4
lda hposn_high, Y
sta dcb_row5+5
iny
; row6
lda hposn_low, Y
adc CH
sta dcb_row6+4
lda hposn_high, Y
sta dcb_row6+5
iny
; row7
lda hposn_low, Y
adc CH
sta dcb_row7+4
lda hposn_high, Y
sta dcb_row7+5
ldx #0
dcb_loop:
dcb_loop_smc:
ldy $FDFD, X ; load next char into Y
beq dcb_done
cpy #13
bne not_linefeed
lda #0
sta CH
clc
lda CV
adc #8
sta CV
inx
jmp dcb_loop
not_linefeed:
; unrolled loop to write out each line
dcb_row0:
lda CondensedRow0-$19, Y ; get 1-byte font row
sta $FDFD, X ; write out to graphics mem
dcb_row1:
lda CondensedRow1-$19, Y
sta $FDFD, X
dcb_row2:
lda CondensedRow2-$19, Y
sta $FDFD, X
dcb_row3:
lda CondensedRow3-$19, Y
sta $FDFD, X
dcb_row4:
lda CondensedRow4-$19, Y
sta $FDFD, X
dcb_row5:
lda CondensedRow5-$19, Y
sta $FDFD, X
dcb_row6:
lda CondensedRow6-$19, Y
sta $FDFD, X
dcb_row7:
lda CondensedRow7-$19, Y
sta $FDFD, X
inc CH
inx ; move to next
bne dcb_loop ; bra (well, as long as string
; is less than 255 chars)
dcb_done:
; point to location after
sec ; always add 1
txa
adc OUTL
sta OUTL
lda #0
adc OUTH
sta OUTH
rts

View File

@ -8,6 +8,7 @@
;
; VMW: commented, reformatted, minor changes, ca65 assembly
; hacked up some more
;------------------------------------------------------------------------------
; DrawCondensedString
@ -22,6 +23,8 @@ DrawCondensedString:
sta OUTL
sty OUTH
DrawCondensedStringAgain:
ldy #0
lda (OUTL), Y ; get xpos
sta CH ; save the X column offset
@ -145,9 +148,23 @@ dcb_row7:
sta $FDFD, X
inx ; move to next
bpl dcb_loop
bne dcb_loop ; bra (well, as long as string
; is less than 255 chars)
dcb_done:
; point to location after
; need to be +3 currently as OUTL not updated earlier
inx
inx
sec ; always add 1
txa
adc OUTL
sta OUTL
lda #0
adc OUTH
sta OUTH
rts