dos33fsprogs/games/peasant/hgr_text_box.s

120 lines
1.6 KiB
ArmAsm
Raw Normal View History

;===========================
; hgr text box
;===========================
; point OUTL:OUTH at it
; x1h,x1l,y1 x2h,x2l,y2
; then X,Y of text
; CR moves to next line
; 0 ends
hgr_text_box:
ldy #0
;====================
; draw text box
lda (OUTL),Y
sta BOX_X1H
iny
lda (OUTL),Y
sta BOX_X1L
iny
lda (OUTL),Y
sta BOX_Y1
iny
lda (OUTL),Y
sta BOX_X2H
iny
lda (OUTL),Y
sta BOX_X2L
iny
lda (OUTL),Y
sta BOX_Y2
skip_box_save_smc:
lda #1
beq skip_box_save
jsr hgr_partial_save
skip_box_save:
jsr draw_box
clc
lda OUTL
adc #6
sta OUTL
lda OUTH
adc #0
sta OUTH
2021-08-31 05:15:12 +00:00
; fallthrough
2021-08-31 05:15:12 +00:00
;=======================
; disp_put_string
; OUTL:OUTH has co-ords followed by string
; CR (13) goes to next line
disp_put_string:
ldy #0
lda (OUTL),Y
sta CURSOR_X
2021-08-31 05:15:12 +00:00
jsr inc_outl
lda (OUTL),Y
sta CURSOR_Y
jsr inc_outl
disp_put_string_cursor:
lda CURSOR_X
sta SAVED_X
2021-08-31 05:15:12 +00:00
disp_one_line:
disp_put_string_loop:
2021-08-31 05:15:12 +00:00
ldy #0
lda (OUTL),Y
beq disp_put_string_done
cmp #13
beq disp_end_of_line
jsr hgr_put_char_cursor
inc CURSOR_X
jsr inc_outl
jmp disp_put_string_loop
disp_end_of_line:
clc
lda CURSOR_Y
adc #8
sta CURSOR_Y
lda SAVED_X
sta CURSOR_X
jsr inc_outl
jmp disp_put_string_loop
disp_put_string_done:
2021-09-20 05:13:16 +00:00
jsr inc_outl ; put to next
rts
;============================
; like above, but don't save
;============================
hgr_text_box_nosave:
lda #0
sta skip_box_save_smc+1
jsr hgr_text_box
lda #1
sta skip_box_save_smc+1
rts