dos33fsprogs/games/peasant/draw_box.s

117 lines
1.4 KiB
ArmAsm
Raw Normal View History

2021-08-12 02:07:33 +00:00
;========================
; draw dialog box
;========================
2021-08-12 04:42:12 +00:00
; from X1H:X1L,Y1 to X2H:X2L, Y2
; FIXME: X1H/X2H mostly ignored
2021-08-12 02:07:33 +00:00
draw_box:
; draw rectangle
2021-08-12 04:42:12 +00:00
lda #$33 ; color is white1
2021-08-12 02:07:33 +00:00
sta VGI_RCOLOR
2021-08-12 04:42:12 +00:00
lda BOX_X1L
2021-08-12 02:07:33 +00:00
sta VGI_RX1
2021-08-12 04:42:12 +00:00
lda BOX_Y1
2021-08-12 02:07:33 +00:00
sta VGI_RY1
2021-08-12 04:42:12 +00:00
sec
lda BOX_X2L
sbc BOX_X1L
2021-08-12 02:07:33 +00:00
sta VGI_RXRUN
2021-08-12 04:42:12 +00:00
sec
lda BOX_Y2
sbc BOX_Y1
2021-08-12 02:07:33 +00:00
sta VGI_RYRUN
jsr vgi_simple_rectangle
; draw lines
2021-08-12 04:42:12 +00:00
ldx #2 ; color is purple
lda colortbl,X
2021-08-12 02:07:33 +00:00
sta HGR_COLOR
2021-08-12 04:42:12 +00:00
; draw outer rectangle, x+6, y+5 x-6, y-5
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
clc
lda BOX_X1L
adc #6
sta BOX_X1L
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
sec
lda BOX_X2L
sbc #6
sta BOX_X2L
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
clc
lda BOX_Y1
adc #5
sta BOX_Y1
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
sec
lda BOX_Y2
sbc #5
sta BOX_Y2
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
jsr draw_rectangle
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
; draw inner rectangle, x+7, y+6 x-7, y-6
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
inc BOX_X1L
dec BOX_X2L
inc BOX_Y1
dec BOX_Y2
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
jsr draw_rectangle
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
; make vertical line extra thick
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
inc BOX_X1L
dec BOX_X2L
jsr draw_rectangle
; make vertical line extra thick
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
inc BOX_X1L
dec BOX_X2L
2021-08-12 02:07:33 +00:00
2021-08-12 04:42:12 +00:00
jsr draw_rectangle
rts
draw_rectangle:
2021-08-12 02:07:33 +00:00
ldy #0
2021-08-12 04:42:12 +00:00
ldx BOX_X1L
lda BOX_Y1
2021-08-12 02:07:33 +00:00
jsr HPLOT0 ; plot at (Y,X), (A)
ldx #0
2021-08-12 04:42:12 +00:00
lda BOX_X2L
ldy BOX_Y1
2021-08-12 02:07:33 +00:00
jsr HGLIN ; line to (X,A),(Y)
ldx #0
2021-08-12 04:42:12 +00:00
lda BOX_X2L
ldy BOX_Y2
2021-08-12 02:07:33 +00:00
jsr HGLIN ; line to (X,A),(Y)
ldx #0
2021-08-12 04:42:12 +00:00
lda BOX_X1L
ldy BOX_Y2
2021-08-12 02:07:33 +00:00
jsr HGLIN ; line to (X,A),(Y)
ldx #0
2021-08-12 04:42:12 +00:00
lda BOX_X1L
ldy BOX_Y1
2021-08-12 02:07:33 +00:00
jsr HGLIN ; line to (X,A),(Y)
rts
2021-08-12 04:42:12 +00:00