mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-26 00:29:29 +00:00
graphics: hgr: update mod9 code
This commit is contained in:
parent
714ea7565c
commit
b9402c8dbe
|
@ -1,3 +1,8 @@
|
|||
; Sort of plotting (X^Y) % 9
|
||||
; but in hires
|
||||
|
||||
; by Vince `deater` Weaver <vince@deater.net>
|
||||
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
HGRPAGE = $E6
|
||||
|
@ -7,46 +12,55 @@ HGR_Y = $E2
|
|||
HGR_COLOR = $E4
|
||||
HGR_HORIZ = $E5
|
||||
|
||||
OUR_MASK = $FB
|
||||
YY = $FC
|
||||
SAVEX = $FD
|
||||
TEMP = $FE
|
||||
OLD = $FF
|
||||
|
||||
PAGE0 = $C054
|
||||
PAGE1 = $C055
|
||||
PAGE0 = $C054
|
||||
PAGE1 = $C055
|
||||
|
||||
COLORTBL = $F6F6
|
||||
COLORTBL = $F6F6
|
||||
|
||||
HGR = $F3E2
|
||||
HGR2 = $F3D8
|
||||
HCLR = $F3F2
|
||||
HPOSN = $F411
|
||||
HPLOT0 = $F457 ;; plot at (Y,X), (A)
|
||||
HPLOT1 = $F45A
|
||||
COLOR_SHIFT = $F47E
|
||||
HGR2 = $F3D8
|
||||
HGR = $F3E2
|
||||
HCLR = $F3F2
|
||||
HPOSN = $F411
|
||||
HPLOT0 = $F457 ; plot at (Y,X), (A)
|
||||
HPLOT1 = $F45A ; skip the HPOSN call
|
||||
COLOR_SHIFT = $F47E ; shift color for odd/even Y (0..7 or 7..13)
|
||||
MOVE_RIGHT = $F48A ; move next plot location one to the right
|
||||
|
||||
MOVE_RIGHT = $F48A
|
||||
|
||||
HCOLOR1 = $F6F0
|
||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X
|
||||
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||
|
||||
|
||||
mod9_lookup = $1000
|
||||
|
||||
|
||||
;==============================
|
||||
; mod9 start
|
||||
;==============================
|
||||
mod9_start:
|
||||
jsr make_mod9_lookup
|
||||
jsr make_mod9_lookup ; setup modulo 9 lookup table
|
||||
; could inline it here
|
||||
|
||||
jsr HGR2 ; clear page1
|
||||
; A is 0 after
|
||||
|
||||
tiny_yloop:
|
||||
sta OUR_MASK
|
||||
|
||||
mod9_reset:
|
||||
ldy #0
|
||||
sty YY
|
||||
|
||||
mod9_yloop:
|
||||
|
||||
ldy #0
|
||||
ldx #0 ; XX = 0
|
||||
yy_smc:
|
||||
lda #0 ; Y co-ord
|
||||
|
||||
jsr HPOSN ; plot at (Y,X), (A)
|
||||
lda YY ; Y co-ord
|
||||
jsr HPOSN ; set cursor position to (Y,X), (A)
|
||||
|
||||
ldx #0
|
||||
|
||||
|
@ -54,30 +68,41 @@ tiny_xloop:
|
|||
|
||||
stx SAVEX
|
||||
|
||||
; jsr HPLOT1
|
||||
|
||||
;===============here
|
||||
|
||||
txa
|
||||
eor yy_smc+1
|
||||
eor YY
|
||||
tax
|
||||
lda mod9_lookup,X
|
||||
|
||||
|
||||
;=================
|
||||
|
||||
blurgh:
|
||||
and #$1
|
||||
ldx OUR_MASK
|
||||
bne weird_pattern
|
||||
|
||||
cmp #0
|
||||
beq store_color
|
||||
|
||||
lda #3
|
||||
store_color:
|
||||
jmp color_ready
|
||||
|
||||
|
||||
|
||||
|
||||
weird_pattern:
|
||||
|
||||
and OUR_MASK
|
||||
|
||||
color_ready:
|
||||
tax
|
||||
|
||||
tya
|
||||
lsr ; check even or odd
|
||||
php
|
||||
|
||||
; jsr HCOLOR1
|
||||
lda COLORTBL,X
|
||||
; sta HGR_COLOR
|
||||
sta HGR_BITS
|
||||
|
||||
plp
|
||||
|
@ -87,33 +112,50 @@ blurgh:
|
|||
|
||||
no_shift:
|
||||
|
||||
; beq store_color
|
||||
jsr HPLOT1 ; plot at current position
|
||||
|
||||
; lda #$7f
|
||||
;store_color:
|
||||
; sta HGR_COLOR
|
||||
jsr MOVE_RIGHT ; move current position right (trashes A)
|
||||
|
||||
ldx SAVEX ; restore X
|
||||
|
||||
jsr HPLOT1
|
||||
jsr MOVE_RIGHT ; trashes A
|
||||
|
||||
ldx SAVEX
|
||||
;==================================
|
||||
|
||||
inx
|
||||
bne tiny_xloop
|
||||
bne tiny_xloop ; repeat until X=256
|
||||
|
||||
inc yy_smc+1
|
||||
ldy yy_smc+1
|
||||
;==================================
|
||||
|
||||
inc YY ; repeat until Y=192
|
||||
ldy YY
|
||||
cpy #192
|
||||
bne tiny_yloop
|
||||
bne mod9_yloop
|
||||
|
||||
inc blurgh+1
|
||||
ldy #0
|
||||
sty yy_smc+1
|
||||
beq tiny_yloop
|
||||
;==================================
|
||||
|
||||
change_pattern:
|
||||
inc OUR_MASK ; change pattern
|
||||
lda OUR_MASK
|
||||
|
||||
check_4:
|
||||
cmp #4
|
||||
bne check_9
|
||||
lda #8
|
||||
sta OUR_MASK
|
||||
|
||||
check_9:
|
||||
cmp #9
|
||||
bne done_check
|
||||
lda #0
|
||||
sta OUR_MASK
|
||||
|
||||
done_check:
|
||||
jmp mod9_reset
|
||||
|
||||
|
||||
|
||||
;=============================
|
||||
; setup the mod9 lookup table
|
||||
;=============================
|
||||
make_mod9_lookup:
|
||||
ldy #0
|
||||
m9_xreset:
|
||||
|
@ -121,11 +163,14 @@ m9_xreset:
|
|||
m9_loop:
|
||||
txa
|
||||
sta mod9_lookup,Y
|
||||
|
||||
iny
|
||||
beq m9_done
|
||||
|
||||
inx
|
||||
cpx #9
|
||||
beq m9_xreset
|
||||
bne m9_loop
|
||||
|
||||
m9_done:
|
||||
rts
|
||||
|
|
Loading…
Reference in New Issue
Block a user