dgr_view: double-lores image viewer

had a *lot* of trouble trying to get this to work, even more
so the BASIC version I first tried
This commit is contained in:
Vince Weaver 2020-07-23 10:27:54 -04:00
parent 35ac540ffc
commit fe15716573
11 changed files with 443 additions and 0 deletions

BIN
dgr_view/CHANNELWOOD.DGRA Normal file

Binary file not shown.

BIN
dgr_view/CHANNELWOOD.DGRB Normal file

Binary file not shown.

BIN
dgr_view/MYST.DGRA Normal file

Binary file not shown.

BIN
dgr_view/MYST.DGRB Normal file

Binary file not shown.

24
dgr_view/Makefile Normal file
View File

@ -0,0 +1,24 @@
include ../Makefile.inc
DOS33 = ../dos33fs-utils/dos33
PNG2GR = ../gr-utils/png2gr
PNG2RLE = ../gr-utils/png2rle
all: dgr_view.dsk
dgr_view.dsk: $(DOS33) DGR_VIEW
cp empty.dsk dgr_view.dsk
$(DOS33) -y dgr_view.dsk BSAVE -a 0x1000 DGR_VIEW
###
DGR_VIEW: dgr_view.o
ld65 -o DGR_VIEW dgr_view.o -C ../linker_scripts/apple2_1000.inc
dgr_view.o: dgr_view.s
ca65 -o dgr_view.o dgr_view.s -l dgr_view.lst
clean:
rm -f *~ *.o DGR_VIEW *.lst

BIN
dgr_view/SELENETIC.DGRA Normal file

Binary file not shown.

BIN
dgr_view/SELENETIC.DGRB Normal file

Binary file not shown.

BIN
dgr_view/dgr_view.dsk Normal file

Binary file not shown.

222
dgr_view/dgr_view.s Normal file
View File

@ -0,0 +1,222 @@
.include "zp.inc"
dgr_view:
sta EIGHTYCOL ; 80col C00d
lda SET_GR ; graphics C050
lda LORES ; lores C056
lda FULLGR ; mixset C053
sta SET80STORE ; 80store C001
lda AN3 ; AN3 C05E
;==================
; myst
;==================
lda #<myst_aux
sta aux_smc1+1
lda #>myst_aux
sta aux_smc1+2
lda #<myst_bin
sta bin_smc1+1
lda #>myst_bin
sta bin_smc1+2
; copy to AUX
bit PAGE1
jsr copy_to_aux
; copy to MAIN
bit PAGE0
jsr copy_to_main
myst_wait:
lda KEYPRESS
bpl myst_wait
bit KEYRESET
;==================
; channelwood
;==================
lda #<channelwood_aux
sta aux_smc1+1
lda #>channelwood_aux
sta aux_smc1+2
lda #<channelwood_bin
sta bin_smc1+1
lda #>channelwood_bin
sta bin_smc1+2
; copy to AUX
bit PAGE1
jsr copy_to_aux
; copy to MAIN
bit PAGE0
jsr copy_to_main
cw_wait:
lda KEYPRESS
bpl cw_wait
bit KEYRESET
;==================
; selenetic
;==================
lda #<selenetic_aux
sta aux_smc1+1
lda #>selenetic_aux
sta aux_smc1+2
lda #<selenetic_bin
sta bin_smc1+1
lda #>selenetic_bin
sta bin_smc1+2
; copy to AUX
bit PAGE1
jsr copy_to_aux
; copy to MAIN
bit PAGE0
jsr copy_to_main
forever:
jmp forever
;===============================
; copy to AUX
;===============================
copy_to_aux:
lda #<$400
sta smc2+1
lda #>$400
sta smc2+2
ldy #0
ctp1_outer_loop:
ldx #0
ctp1_loop:
aux_smc1:
lda $9999,X
smc2:
sta $400,X
inx
cpx #120
bne ctp1_loop
lda aux_smc1+1
clc
adc #$80
sta aux_smc1+1
lda aux_smc1+2
adc #0
sta aux_smc1+2
lda smc2+1
clc
adc #$80
sta smc2+1
lda smc2+2
adc #0
sta smc2+2
iny
cpy #8
bne ctp1_outer_loop
rts
;=========================
; copy to main
;=========================
copy_to_main:
lda #<$400
sta smc4+1
lda #>$400
sta smc4+2
ldy #0
ctp2_outer_loop:
ldx #0
ctp2_loop:
bin_smc1:
lda $9999,X
smc4:
sta $400,X
inx
cpx #120
bne ctp2_loop
lda bin_smc1+1
clc
adc #$80
sta bin_smc1+1
lda bin_smc1+2
adc #0
sta bin_smc1+2
lda smc4+1
clc
adc #$80
sta smc4+1
lda smc4+2
adc #0
sta smc4+2
iny
cpy #8
bne ctp2_outer_loop
rts
channelwood_aux:
.incbin "CHANNELWOOD.DGRA"
channelwood_bin:
.incbin "CHANNELWOOD.DGRB"
myst_aux:
.incbin "MYST.DGRA"
myst_bin:
.incbin "MYST.DGRB"
selenetic_aux:
.incbin "SELENETIC.DGRA"
selenetic_bin:
.incbin "SELENETIC.DGRB"
.if 0
lookup:
; 0 1 2 3 4 5 6 7 8 9 A B C D E F
.byte $00,$08,$01,$09,$02,$0A,$03,$0B,$04,$0C,$05,$0D,$06,$0E,$07,$0F
.byte $80,$88,$81,$89,$82,$8A,$83,$8B,$84,$8C,$85,$8D,$86,$8E,$87,$8F
.byte $10,$18,$11,$19,$12,$1A,$13,$1B,$14,$1C,$15,$1D,$16,$1E,$17,$1F
.byte $90,$98,$91,$99,$92,$9A,$93,$9B,$94,$9C,$95,$9D,$96,$9E,$97,$9F
.byte $20,$28,$21,$29,$22,$2A,$23,$2B,$24,$2C,$25,$2D,$26,$2E,$27,$2F
.byte $A0,$A8,$A1,$A9,$A2,$AA,$A3,$AB,$A4,$AC,$A5,$AD,$A6,$AE,$A7,$AF
.byte $30,$38,$31,$39,$32,$3A,$33,$3B,$34,$3C,$35,$3D,$36,$3E,$37,$3F
.byte $B0,$B8,$B1,$B9,$B2,$BA,$B3,$BB,$B4,$BC,$B5,$BD,$B6,$BE,$B7,$BF
.byte $40,$48,$41,$49,$42,$4A,$43,$4B,$44,$4C,$45,$4D,$46,$4E,$47,$4F
.byte $C0,$C8,$C1,$C9,$C2,$CA,$C3,$CB,$C4,$CC,$C5,$CD,$C6,$CE,$C7,$CF
.byte $50,$58,$51,$59,$52,$5A,$53,$5B,$54,$5C,$55,$5D,$56,$5E,$57,$5F
.byte $D0,$D8,$D1,$D9,$D2,$DA,$D3,$DB,$D4,$DC,$D5,$DD,$D6,$DE,$D7,$DF
.byte $60,$68,$61,$69,$62,$6A,$63,$6B,$64,$6C,$65,$6D,$66,$6E,$67,$6F
.byte $E0,$E8,$E1,$E9,$E2,$EA,$E3,$EB,$E4,$EC,$E5,$ED,$E6,$EE,$E7,$EF
.byte $70,$78,$71,$79,$72,$7A,$73,$7B,$74,$7C,$75,$7D,$76,$7E,$77,$7F
.byte $F0,$F8,$F1,$F9,$F2,$FA,$F3,$FB,$F4,$FC,$F5,$FD,$F6,$FE,$F7,$FF
.endif

BIN
dgr_view/empty.dsk Normal file

Binary file not shown.

197
dgr_view/zp.inc Normal file
View File

@ -0,0 +1,197 @@
.define EQU =
;; Zero page monitor routines addresses
WNDLFT EQU $20
WNDWDTH EQU $21
WNDTOP EQU $22
WNDBTM EQU $23
CH EQU $24
CV EQU $25
GBASL EQU $26
GBASH EQU $27
BASL EQU $28
BASH EQU $29
H2 EQU $2C
V2 EQU $2D
MASK EQU $2E
COLOR EQU $30
INVFLG EQU $32
; More zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
COLOR1 EQU $E0
COLOR2 EQU $E1
MATCH EQU $E2
XX EQU $E3
YY EQU $E4
YADD EQU $E5
LOOP EQU $E6
MEMPTRL EQU $E7
MEMPTRH EQU $E8
NAMEL EQU $E9
NAMEH EQU $EA
NAMEX EQU $EB
CHAR EQU $EC
DISP_PAGE EQU $ED
DRAW_PAGE EQU $EE
FIRST EQU $F0
LASTKEY EQU $F1
PADDLE_STATUS EQU $F2
XPOS EQU $F3
YPOS EQU $F4
TEMP EQU $FA
RUN EQU $FA
TEMP2 EQU $FB
TEMPY EQU $FB
INL EQU $FC
INH EQU $FD
OUTL EQU $FE
OUTH EQU $FF
;; Flying Routine Only
TURNING EQU $60
;SCREEN_X EQU $61 ; not used?
SCREEN_Y EQU $62
ANGLE EQU $63
HORIZ_SCALE_I EQU $64
HORIZ_SCALE_F EQU $65
FACTOR_I EQU $66
FACTOR_F EQU $67
DX_I EQU $68
DX_F EQU $69
SPACEX_I EQU $6A
SPACEX_F EQU $6B
CX_I EQU $6C
CX_F EQU $6D
DY_I EQU $6E
DY_F EQU $6F
SPACEY_I EQU $70
SPACEY_F EQU $71
CY_I EQU $72
CY_F EQU $73
TEMP_I EQU $74
TEMP_F EQU $75
DISTANCE_I EQU $76
DISTANCE_F EQU $77
SPACEZ_I EQU $78
SPACEZ_F EQU $79
DRAW_SPLASH EQU $7A
SPEED EQU $7B
SPLASH_COUNT EQU $7C
OVER_LAND EQU $7D
NUM1L EQU $7E
NUM1H EQU $7F
NUM2L EQU $80
NUM2H EQU $81
RESULT EQU $82 ; 83,84,85
NEGATE EQU $86 ; UNUSED?
LAST_SPACEX_I EQU $87
LAST_SPACEY_I EQU $88
LAST_MAP_COLOR EQU $89
DRAW_SKY EQU $8A
COLOR_MASK EQU $8B
SHIPY EQU $E4
;; World Map Only
ODD EQU $7B
DIRECTION EQU $7C
REFRESH EQU $7D
ON_BIRD EQU $7E
MOVED EQU $7F
STEPS EQU $80
TFV_X EQU $81
TFV_Y EQU $82
NEWX EQU $83
NEWY EQU $84
MAP_X EQU $85
GROUND_COLOR EQU $86
KEYPRESS EQU $C000
KEYRESET EQU $C010
;; SOFT SWITCHES
CLR80STORE EQU $C000 ; PAGE0/PAGE1 normal
SET80STORE EQU $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead
EIGHTYCOL EQU $C00D
SET_GR EQU $C050
SET_TEXT EQU $C051
FULLGR EQU $C052
TEXTGR EQU $C053
PAGE0 EQU $C054
PAGE1 EQU $C055
LORES EQU $C056 ; Enable LORES graphics
HIRES EQU $C057 ; Enable HIRES graphics
AN3 EQU $C05E ; Annunciator 3
PADDLE_BUTTON0 EQU $C061
PADDL0 EQU $C064
PTRIG EQU $C070
;; BASIC ROUTINES
NORMAL EQU $F273
;; MONITOR ROUTINES
HLINE EQU $F819 ;; HLINE Y,$2C at A
VLINE EQU $F828 ;; VLINE A,$2D at Y
CLRSCR EQU $F832 ;; Clear low-res screen
CLRTOP EQU $F836 ;; clear only top of low-res screen
SETCOL EQU $F864 ;; COLOR=A
TEXT EQU $FB36
TABV EQU $FB5B ;; VTAB to A
BASCALC EQU $FBC1 ;;
VTAB EQU $FC22 ;; VTAB to CV
HOME EQU $FC58 ;; Clear the text screen
WAIT EQU $FCA8 ;; delay 1/2(26+27A+5A^2) us
SETINV EQU $FE80 ;; INVERSE
SETNORM EQU $FE84 ;; NORMAL
COUT EQU $FDED ;; output A to screen
COUT1 EQU $FDF0 ;; output A to screen
COLOR_BLACK EQU 0
COLOR_RED EQU 1
COLOR_DARKBLUE EQU 2
COLOR_PURPLE EQU 3
COLOR_DARKGREEN EQU 4
COLOR_GREY EQU 5
COLOR_MEDIUMBLUE EQU 6
COLOR_LIGHTBLUE EQU 7
COLOR_BROWN EQU 8
COLOR_ORANGE EQU 9
COLOR_GREY2 EQU 10
COLOR_PINK EQU 11
COLOR_LIGHTGREEN EQU 12
COLOR_YELLOW EQU 13
COLOR_AQUA EQU 14
COLOR_WHITE EQU 15
COLOR_BOTH_RED EQU $11
COLOR_BOTH_DARKBLUE EQU $22
COLOR_BOTH_DARKGREEN EQU $44
COLOR_BOTH_GREY EQU $55
COLOR_BOTH_MEDIUMBLUE EQU $66
COLOR_BOTH_LIGHTBLUE EQU $77
COLOR_BOTH_BROWN EQU $88
COLOR_BOTH_ORANGE EQU $99
COLOR_BOTH_LIGHTGREEN EQU $CC
COLOR_BOTH_YELLOW EQU $DD
COLOR_BOTH_WHITE EQU $FF
AUX_BOTH_MEDIUMBLUE EQU $33 ; 0011 0011
AUX_BOTH_GREY EQU $AA ; 1010 1010