duke: draw box around quit prompt

This commit is contained in:
Vince Weaver 2020-12-15 10:54:27 -05:00
parent 8a222dd57a
commit db9eaa4932
4 changed files with 99 additions and 3 deletions

View File

@ -42,7 +42,7 @@ DUKE: duke.o
ld65 -o DUKE duke.o -C ../linker_scripts/apple2_2000.inc
duke.o: duke.s zp.inc hardware.inc duke.s \
print_help.s gr_fast_clear.s quit_yn.s \
print_help.s gr_fast_clear.s quit_yn.s text_drawbox.s \
graphics/duke_graphics.inc \
maps/level1_map.lzsa \
status_bar.s draw_duke.s move_duke.s gr_putsprite_crop.s \

View File

@ -195,6 +195,8 @@ done_with_duke:
.include "status_bar.s"
.include "keyboard.s"
.include "joystick.s"
.include "text_drawbox.s"
.include "print_help.s"
.include "quit_yn.s"

View File

@ -4,12 +4,22 @@ print_quit:
bit KEYRESET ; clear keyboard
bit SET_TEXT
jsr normal_text
lda #' '|$80
sta clear_all_color+1
jsr clear_all
lda #6
sta drawbox_x1
lda #33
sta drawbox_x2
lda #8
sta drawbox_y1
lda #13
sta drawbox_y2
jsr drawbox
jsr normal_text
lda #<quit_text
sta OUTL
lda #>quit_text

84
duke/text_drawbox.s Normal file
View File

@ -0,0 +1,84 @@
; draw inverse box on text screen
; we could use HLIN/VLIN instead?
; note Y should be in text coords (0..23) not GR (0..47)
drawbox:
lda drawbox_y1
jsr text_hlin
lda drawbox_y2
jsr text_hlin
jsr text_vlins
rts
;========================
; text hlin
;========================
; draw from x1,A to x2,A
text_hlin:
asl
tay
lda gr_offsets,Y
sta OUTL
lda gr_offsets+1,Y
clc
adc DRAW_PAGE
sta OUTH
lda #' '
ldy drawbox_x1
drawbox_hlin_loop:
sta (OUTL),Y
iny
cpy drawbox_x2
bne drawbox_hlin_loop
rts
;========================
; text vlin
;========================
; draw from A,y1 to A,y2
text_vlins:
ldx drawbox_y1
text_vlins_loop:
txa
asl
tay
lda gr_offsets,Y
sta OUTL
lda gr_offsets+1,Y
clc
adc DRAW_PAGE
sta OUTH
lda #' '
ldy drawbox_x1
sta (OUTL),Y
ldy drawbox_x2
sta (OUTL),Y
inx
cpx drawbox_y2
bcc text_vlins_loop
beq text_vlins_loop ; ble
rts
drawbox_x1: .byte $00
drawbox_x2: .byte $00
drawbox_y1: .byte $00
drawbox_y2: .byte $00