mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-12 12:30:07 +00:00
Draw ground grid
This commit is contained in:
parent
34d61ebb68
commit
e72a9bc297
@ -1,16 +1,127 @@
|
||||
import STDLIB
|
||||
predef memset, memcpy, cin
|
||||
predef memset, memcpy, getc, heapalloc, heapmark, heaprelease
|
||||
end
|
||||
import HGR1
|
||||
end
|
||||
|
||||
byte i = 0
|
||||
word hcolor[] = $0000, $552A, $2A55, $7F7F, $8080, $D5AA, $AAD5, $FFFF
|
||||
repeat
|
||||
memset($2000, $2000, hcolor[i])
|
||||
i = (i + 1) & 7
|
||||
until ^$C000 >= 128
|
||||
^$C010
|
||||
^$C054
|
||||
^$C051
|
||||
const view_height = 64 ; scan count of ground view
|
||||
const fix_bits = 8 ; number of fixed point bits
|
||||
;
|
||||
; Hardware addresses
|
||||
;
|
||||
const speaker=$C030
|
||||
const showgraphics=$C050
|
||||
const showtext=$C051
|
||||
const showfull=$C052
|
||||
const showmix=$C053
|
||||
const showpage1=$C054
|
||||
const showpage2=$C055
|
||||
const showlores=$C056
|
||||
const showhires=$C057
|
||||
const keyboard=$C000
|
||||
const keystrobe=$C010
|
||||
const hgr1=$2000
|
||||
const hgr2=$4000
|
||||
const page1=0
|
||||
const page2=1
|
||||
word hgrpage[] = hgr1, hgr2
|
||||
word hgrscan[] = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00
|
||||
word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80
|
||||
word = $0100,$0500,$0900,$0D00,$1100,$1500,$1900,$1D00
|
||||
word = $0180,$0580,$0980,$0D80,$1180,$1580,$1980,$1D80
|
||||
word = $0200,$0600,$0A00,$0E00,$1200,$1600,$1A00,$1E00
|
||||
word = $0280,$0680,$0A80,$0E80,$1280,$1680,$1A80,$1E80
|
||||
word = $0300,$0700,$0B00,$0F00,$1300,$1700,$1B00,$1F00
|
||||
word = $0380,$0780,$0B80,$0F80,$1380,$1780,$1B80,$1F80
|
||||
word = $0028,$0428,$0828,$0C28,$1028,$1428,$1828,$1C28
|
||||
word = $00A8,$04A8,$08A8,$0CA8,$10A8,$14A8,$18A8,$1CA8
|
||||
word = $0128,$0528,$0928,$0D28,$1128,$1528,$1928,$1D28
|
||||
word = $01A8,$05A8,$09A8,$0DA8,$11A8,$15A8,$19A8,$1DA8
|
||||
word = $0228,$0628,$0A28,$0E28,$1228,$1628,$1A28,$1E28
|
||||
word = $02A8,$06A8,$0AA8,$0EA8,$12A8,$16A8,$1AA8,$1EA8
|
||||
word = $0328,$0728,$0B28,$0F28,$1328,$1728,$1B28,$1F28
|
||||
word = $03A8,$07A8,$0BA8,$0FA8,$13A8,$17A8,$1BA8,$1FA8
|
||||
word = $0050,$0450,$0850,$0C50,$1050,$1450,$1850,$1C50
|
||||
word = $00D0,$04D0,$08D0,$0CD0,$10D0,$14D0,$18D0,$1CD0
|
||||
word = $0150,$0550,$0950,$0D50,$1150,$1550,$1950,$1D50
|
||||
word = $01D0,$05D0,$09D0,$0DD0,$11D0,$15D0,$19D0,$1DD0
|
||||
word = $0250,$0650,$0A50,$0E50,$1250,$1650,$1A50,$1E50
|
||||
word = $02D0,$06D0,$0AD0,$0ED0,$12D0,$16D0,$1AD0,$1ED0
|
||||
word = $0350,$0750,$0B50,$0F50,$1350,$1750,$1B50,$1F50
|
||||
word = $03D0,$07D0,$0BD0,$0FD0,$13D0,$17D0,$1BD0,$1FD0
|
||||
word hcolor[] = $0000,$552A,$2A55,$7F7F,$8080,$D5AA,$AAD5,$FFFF
|
||||
;
|
||||
; def draw_scan(d8p8, scanptr)
|
||||
;
|
||||
asm draw_scan
|
||||
!SOURCE "plvm02zp.inc"
|
||||
WFIXL = $80
|
||||
WFIXH = $81
|
||||
WINT = $82
|
||||
PIX = $83
|
||||
LDA ESTKL,X
|
||||
STA TMPL
|
||||
LDA ESTKH,X
|
||||
STA TMPH
|
||||
LDA ESTKL+1,X
|
||||
STA WFIXL
|
||||
STA WFIXH
|
||||
LDA ESTKH+1,X
|
||||
LSR
|
||||
STA WINT
|
||||
ROR WFIXH
|
||||
ROR WFIXL
|
||||
LDA #$FF
|
||||
SEC
|
||||
SBC WFIXL
|
||||
STA WFIXL
|
||||
LDA #$FF
|
||||
SBC WFIXH
|
||||
STA WFIXH
|
||||
LDA #$FF
|
||||
SBC WINT
|
||||
STA WINT
|
||||
LDY #$01
|
||||
STY PIX
|
||||
DEY
|
||||
- EOR ESTKH+1,X
|
||||
LSR
|
||||
BCC +
|
||||
LDA PIX
|
||||
ORA (TMP),Y
|
||||
STA (TMP),Y
|
||||
+ ASL PIX
|
||||
BPL +
|
||||
LDA #$01
|
||||
STA PIX
|
||||
INY
|
||||
CPY #36
|
||||
BEQ ++
|
||||
+ LDA ESTKL+1,X
|
||||
CLC
|
||||
ADC WFIXL
|
||||
STA WFIXL
|
||||
LDA ESTKH+1,X
|
||||
ADC WFIXH
|
||||
STA WFIXH
|
||||
LDA #$00
|
||||
ADC WINT
|
||||
STA WINT
|
||||
BNE -
|
||||
BEQ -
|
||||
++ INX
|
||||
RTS
|
||||
end
|
||||
def draw_ground(page)
|
||||
byte ip
|
||||
|
||||
for ip = 1 to view_height
|
||||
draw_scan((127 << fix_bits) / ip, hgrpage[page] + hgrscan[ip + 191 - view_height] + 2)
|
||||
next
|
||||
end
|
||||
|
||||
draw_ground(page1)
|
||||
getc
|
||||
^showpage1
|
||||
^showtext
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user