1
0
mirror of https://github.com/deater/dos33fsprogs.git synced 2025-03-19 13:31:08 +00:00

driven: add in dni counting

currently broken for some reason
This commit is contained in:
Vince Weaver 2024-10-24 01:21:15 -04:00
parent 7725a54281
commit ccbad61311
14 changed files with 983 additions and 22 deletions

@ -12,6 +12,7 @@ driven.dsk: QBOOT QLOAD \
MUSIC \
music.inc qload.inc \
./part00_intro/INTRO \
./part01_dni/DNI \
./part20_credits/CREDITS
cp $(EMPTY_DISK) driven.dsk
$(DOS33_RAW) driven.dsk 0 0 QBOOT 0 1
@ -21,6 +22,7 @@ driven.dsk: QBOOT QLOAD \
$(DOS33_RAW) driven.dsk 4 0 MUSIC 0 0
$(DOS33_RAW) driven.dsk 9 0 ./part00_intro/INTRO 0 0
$(DOS33_RAW) driven.dsk 13 0 ./part20_credits/CREDITS 0 0
$(DOS33_RAW) driven.dsk 17 0 ./part01_dni/DNI 0 0
#second_d1.dsk: QBOOT QLOAD \
# music.inc qload.inc \
@ -66,6 +68,9 @@ driven.dsk: QBOOT QLOAD \
part00_intro/INTRO:
cd part00_intro && make
part01_dni/DNI:
cd part01_dni && make
part20_credits/CREDITS:
cd part20_credits && make

30
demos/driven/NOTES Normal file

@ -0,0 +1,30 @@
Disk Usage:
Disk1 Map (disk has 35 tracks, each 4k in size)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
T 0 = Qboot / SAVES
T 1 = QLOAD 1244 bytes 3T (?) 3k free
T 4 = MUSIC 4803 bytes 5T (?) 0k free
T 9 = INTRO ? bytes 4T (16384) 3k free
T 13 = CREDITS ? bytes 4T (16384) 1k free
note: below is not accurate
RAM usage:
MAIN AUX
---- ---
$00 ZP ZP
$01 Stack Stack
$02-$03 Disk Code
$04-$07 Lores page1 ??? 1k
$08-$0B Lores page2 ??? 1k
$0C-$0F ?? ??? 1k
$10-$1F library code ??? 4k
$20-$3F hires page1 ??? 8k
$40-$5F hires page2 ??? 8k
$60-$BF current code ??? 24k
$C0-$CF I/O I/O
$D0-$FF music ??? 12k
$D0-$DF ?? ??? 4k

@ -46,6 +46,7 @@ HLINE = $F819 ; HLINE Y,$2C at A
VLINE = $F828 ; VLINE A,$2D at Y
CLRSCR = $F832 ; Clear low-res screen
CLRTOP = $F836 ; clear only top of low-res screen
GBASCALC= $F847
SETCOL = $F864 ; COLOR=A
ROM_TEXT2COPY = $F962 ; iigs
TEXT = $FB36

@ -0,0 +1,22 @@
include ../../../Makefile.inc
PNG_TO_40x48D = ../../utils/gr-utils/png_to_40x48d
PNG_TO_40x96 = ../../utils/gr-utils/png_to_40x96
LINKERSCRIPTS = ../../../linker_scripts/
all: DNI
###
DNI: dni.o
ld65 -o DNI dni.o -C $(LINKERSCRIPTS)/apple2_4000.inc
dni.o: dni.s \
../zp.inc ../hardware.inc
ca65 -o dni.o dni.s -l dni.lst
####
clean:
rm -f *~ *.o *.lst DNI

@ -0,0 +1,476 @@
; Plasma D'ni Numbers
; by Vince `deater` Weaver / Dsr
; originally based on Plasmagoria (GPL3) code by French Touch
.include "../hardware.inc"
.include "../zp.inc"
lores_colors_fine=$8000
;======================================
; start of code
;======================================
plasma_mask:
bit LORES ; set lo-res
bit FULLGR
lda #0
sta DRAW_PAGE
sta NUMBER_HIGH
sta NUMBER_LOW
sta WHICH_TRACK
goopy:
lda #$4
clc
adc DRAW_PAGE
tax
lda #$0 ; black
jsr clear_1k
lda #$4
sta XPOS
lda #$5
sta YPOS
jsr draw_full_dni_number
jsr inc_base5
jsr flip_page
lda #200
jsr wait
lda NUMBER_HIGH
cmp #$02
beq next_scene
jmp goopy
next_scene:
lda #$0
sta DRAW_PAGE
bit PAGE1
ldx #$20 ; ???
lda #$FF ; white
jsr clear_1k
; ============================================================================
; init lores colors (inline)
; ============================================================================
lda #<lores_colors_fine
sta INL
lda #>lores_colors_fine
sta INH
multiple_init_lores_colors:
init_lores_colors:
ldx #0
ldy #0
init_lores_colors_loop:
lcl_smc1:
lda lores_colors_lookup,X
sta (INL),Y
iny
sta (INL),Y
iny
sta (INL),Y
iny
sta (INL),Y
iny
beq done_init_lores_colors
inx
txa
and #$f
tax
jmp init_lores_colors_loop
done_init_lores_colors:
lda lcl_smc1+1
clc
adc #$10
sta lcl_smc1+1
inc INH
lda INH
cmp #$84
bne multiple_init_lores_colors
;====================================
; do plasma
;====================================
do_plasma:
; init
BP3:
;=============================
; adjust color palette
; lda WHICH_TRACK
; clc
; adc #$80
; sta display_lookup_smc+2
; ============================================================================
; Precalculate some values (inlined)
; ============================================================================
precalc:
lda PARAM1 ; self modify various parts
sta pc_off1+1
lda PARAM2
sta pc_off2+1
lda PARAM3
sta pc_off3+1
lda PARAM4
sta pc_off4+1
; Table1(X) = sin1(PARAM1+X)+sin2(PARAM1+X)
; Table2(X) = sin3(PARAM3+X)+sin1(PARAM4+X)
ldx #$28 ; 40
pc_b1:
pc_off1:
lda sin1
pc_off2:
adc sin2
sta Table1,X
pc_off3:
lda sin3
pc_off4:
adc sin1
sta Table2,X
inc pc_off1+1
inc pc_off2+1
inc pc_off3+1
inc pc_off4+1
dex
bpl pc_b1
inc PARAM1
inc PARAM1
dec PARAM2
inc PARAM3
dec PARAM4
; ============================================================================
; Display Routines
; ============================================================================
display_normal:
ldx #23 ; lines 0-23 lignes 0-23
display_line_loop:
txa
asl
tay
lda gr_offsets,Y
sta GBASL
lda gr_offsets+1,Y
sta GBASH
; jsr GBASCALC
; set up pointer for mask
ldy WHICH_TRACK ; CURRENT_EFFECT
lda GBASL
sta INL
lda GBASH
clc
adc #$1c ; load from $2000
; adc graphics_loc,Y
sta INH
lda GBASH
clc
adc DRAW_PAGE
sta GBASH
ldy #39 ; col 0-39
lda Table2,X ; setup base sine value for row
sta display_row_sin_smc+1
display_col_loop:
lda Table1,Y ; load in column sine value
display_row_sin_smc:
adc #00 ; add in row value
; MASKING happens HERE
and (INL),Y
sta display_lookup_smc+1 ; patch in low byte of lookup
display_lookup_smc:
lda lores_colors_fine ; attention: must be aligned
sta (GBASL),Y
dey
bpl display_col_loop
dex
bpl display_line_loop
; ============================================================================
lda #4
sta XPOS
lda #5
sta YPOS
lda NUMBER_HIGH
and #$3
clc
adc #$80
sta display_lookup_smc+2
lda NUMBER_HIGH
and #$f
cmp #0
beq effect3
cmp #1
beq effect4
cmp #2
beq effect0
cmp #3
beq effect1
cmp #4
beq effect2
effect2:
ldx #$20
lda #$00 ; black
sta SIN_COUNT
jsr clear_1k
lda DRAW_PAGE
pha
lda #$1c
sta DRAW_PAGE
jsr draw_full_dni_number
pla
sta DRAW_PAGE
ldx #$20
jsr invert_1k
inc FRAMEL
lda FRAMEL
and #$3
bne no_inc_effect2
jsr inc_base5
no_inc_effect2:
jmp done_effect
effect0:
; full mask, so full plasma
ldx #$20
lda #$FF ; white
jsr clear_1k
; overlay with number
jsr draw_full_dni_number
; increment each 8th frame
inc FRAMEL
lda FRAMEL
and #$3
bne no_inc_effect0
jsr inc_base5
no_inc_effect0:
jmp done_effect
effect3:
ldx SIN_COUNT
lda sine_table,X
sta YPOS
effect4:
effect1:
ldx #$20
lda #$0 ; black
jsr clear_1k
lda DRAW_PAGE
pha
lda #$1c
sta DRAW_PAGE
jsr draw_full_dni_number
pla
sta DRAW_PAGE
inc SIN_COUNT
lda SIN_COUNT
cmp #25
bne sin_ok
lda #0
sta SIN_COUNT
sin_ok:
inc FRAMEL
lda FRAMEL
and #$3
bne no_inc_effect1
jsr inc_base5
no_inc_effect1:
done_effect:
jsr flip_page
inc COMPT1
beq zoop
; bne BP3
jmp BP3
zoop:
dec COMPT2
beq zoop2
; bne BP3
jmp BP3
zoop2:
; beq do_plasma ; bra
jmp do_plasma ; bra
.align $100
lores_colors_lookup:
; dark
.byte $00,$88,$55,$99,$ff,$bb,$33,$22,$66,$77,$44,$cc,$ee,$dd,$99,$11
; pink
.byte $00,$11,$33,$BB,$FF,$BB,$33,$11,$00,$11,$33,$BB,$FF,$BB,$33,$11
; blue
.byte $00,$22,$66,$77,$FF,$77,$66,$22,$00,$22,$66,$77,$FF,$77,$66,$22
; green
.byte $00,$44,$CC,$DD,$FF,$DD,$CC,$44,$00,$44,$CC,$DD,$FF,$DD,$CC,$44
;.include "make_tables.s"
.align $100
sin1:
.incbin "tables"
sin2=sin1+$100
sin3=sin1+$200
.include "print_dni_numbers.s"
.include "number_sprites.inc"
.include "../gr_offsets.s"
.include "inc_base5.s"
.include "../wait.s"
.include "page_flip.s"
;======================
;
;======================
; X = page
; A = value
clear_1k:
stx OUTH
ldx #0
stx OUTL
ldx #4
; lda #0
ldy #0
inner_loop:
sta (OUTL),Y
iny
bne inner_loop
inc OUTH
dex
bne inner_loop
rts
;======================
;
;======================
; X = page
invert_1k:
stx OUTH
ldx #0
stx OUTL
ldx #4
ldy #0
invert_inner_loop:
lda (OUTL),Y
eor #$FF
sta (OUTL),Y
iny
bne invert_inner_loop
inc OUTH
dex
bne invert_inner_loop
rts
sine_table:
.byte 5,6,7,8,9
.byte 10,10,10,10,9
.byte 8,7,6,5,4
.byte 3,2,1,0,0
.byte 0,1,2,3,4

@ -0,0 +1,43 @@
; four-digit base 5 increment
inc_base5:
inc NUMBER_LOW
lda NUMBER_LOW
and #$f
cmp #5
bne inc_base5_done
clc
lda NUMBER_LOW
adc #$b
sta NUMBER_LOW
lda NUMBER_LOW
cmp #$50
bne inc_base5_done
; if here, overflow to top byte
lda #0
sta NUMBER_LOW
inc NUMBER_HIGH
lda NUMBER_HIGH
and #$f
cmp #5
bne inc_base5_done
clc
lda NUMBER_HIGH
adc #$b
sta NUMBER_HIGH
lda NUMBER_HIGH
cmp #$50
bne inc_base5_done
lda #$0
sta NUMBER_HIGH
inc_base5_done:
rts

@ -0,0 +1,141 @@
; 18x13
; frame
frame_sprite:
.byte 3,41 ; 3*13, ((3*13)+2)
.byte $FF,$FF,$C0
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $60,$01,$80
.byte $FF,$FF,$C0
zero_sprite:
.byte 1,8 ; 1*6
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $06
one_sprite:
.byte 1,13 ; 11+2
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
two_sprite:
.byte 1,13 ; 11+2
.byte $80
.byte $C0
.byte $60
.byte $60
.byte $60
.byte $60
.byte $60
.byte $60
.byte $60
.byte $C0
.byte $80
three_sprite:
.byte 1,13 ; 11+2
.byte $06
.byte $0C
.byte $18
.byte $30
.byte $60
.byte $C0
.byte $60
.byte $30
.byte $18
.byte $0c
.byte $06
four_sprite:
.byte 2,24 ; 11*2+2
.byte $00,$00
.byte $00,$00
.byte $07,$F0
.byte $06,$00
.byte $06,$00
.byte $06,$00
.byte $06,$00
.byte $06,$00
.byte $06,$00
.byte $06,$00
.byte $06,$00
empty_sprite:
.byte 1,3
.byte $00
five_sprite:
.byte 2,14 ; 2*6
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $FF,$F0
ten_sprite:
.byte 2,24 ; 2*11
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $3F,$c0
.byte $40,$20
.byte $80,$10
fifteen_sprite:
.byte 2,24 ; 2*11
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $00,$00
.byte $80,$10
.byte $C0,$30
.byte $60,$60
.byte $30,$c0
.byte $19,$80
.byte $0f,$00
.byte $06,$10
twenty_sprite:
.byte 2,14 ; 2*6
.byte $30,$00
.byte $30,$00
.byte $30,$00
.byte $30,$00
.byte $30,$00
.byte $3f,$f0

@ -0,0 +1,21 @@
;==========
; flip page
;==========
flip_page:
lda DRAW_PAGE
beq draw_page2
draw_page1:
bit PAGE2
lda #0
beq done_flip
draw_page2:
bit PAGE1
lda #$4
done_flip:
sta DRAW_PAGE
rts

@ -0,0 +1,180 @@
;=====================
draw_full_dni_number:
lda NUMBER_HIGH
beq draw_only_low_dni_number
; drawing high number
jsr draw_dni_number
; adjust for right number
lda #14
bne draw_low_dni_number ; bra
draw_only_low_dni_number:
lda #7
draw_low_dni_number:
clc
adc XPOS
sta XPOS
lda NUMBER_LOW
;=====================
; number in A
draw_dni_number:
sta DRAW_NUMBER
; draw frame
lda #<frame_sprite
sta INL
lda #>frame_sprite
sta INH
jsr put_number_sprite
; adjust to be inside frame
inc YPOS
inc XPOS
inc XPOS
inc XPOS
; draw ones values
lda DRAW_NUMBER
bne regular_number
; lda LEADING_ZERO ; if 0 then regular
; beq regular_number
; if all zeros, then draw special zero char
lda #<zero_sprite
sta INL
lda #>zero_sprite
jmp finally_draw
regular_number:
and #$f
tax
lda ones_sprites_l,X
sta INL
lda ones_sprites_h,X
finally_draw:
sta INH
jsr put_number_sprite
lda DRAW_NUMBER
lsr
lsr
lsr
lsr
tax
lda fives_sprite_l,X
sta INL
lda fives_sprite_h,X
sta INH
jsr put_number_sprite
; restore
dec YPOS
dec XPOS
dec XPOS
dec XPOS
rts
;=====================
put_number_sprite:
ldy #0
lda (INL),Y
sta pns_xsize_smc+1
iny
lda (INL),Y
sta pns_ysize_smc+1
iny
lda #0
sta SPRITEY
pns_yloop:
lda SPRITEY
clc
adc YPOS
asl
tax
lda gr_offsets,X
; clc
adc XPOS
sta pns_out_smc+1
lda gr_offsets+1,X
; clc
adc DRAW_PAGE
sta pns_out_smc+2
lda #0
sta SPRITEX
pns_xloop:
ldx #8 ; rotate through 8 bits
lda (INL),Y
sta COLOR
pns_inner_loop:
asl COLOR
bcc pns_transparent
lda #$FF
pns_out_smc:
sta $400
pns_transparent:
inc pns_out_smc+1
dex
bne pns_inner_loop
iny
inc SPRITEX
lda SPRITEX
pns_xsize_smc:
cmp #3
bne pns_xloop
inc SPRITEY
pns_ysize_smc:
cpy #39
bcc pns_yloop ; blt
rts
ones_sprites_l:
.byte <empty_sprite,<one_sprite,<two_sprite,<three_sprite,<four_sprite
ones_sprites_h:
.byte >empty_sprite,>one_sprite,>two_sprite,>three_sprite,>four_sprite
fives_sprite_l:
.byte <empty_sprite,<five_sprite,<ten_sprite,<fifteen_sprite,<twenty_sprite
fives_sprite_h:
.byte >empty_sprite,>five_sprite,>ten_sprite,>fifteen_sprite,>twenty_sprite

@ -0,0 +1,13 @@
#include <stdio.h>
#include <math.h>
int main(int argc, char **argv) {
double x;
for(x=0;x<25;x++) {
printf("%.2lf %.2lf\n",x,5.0+5.0*sin(x*6.28/25));
}
return 0;
}

Binary file not shown.

@ -164,43 +164,43 @@ error_string:
which_disk_array:
.byte 1,1,1,1 ; MUSIC_INTRO, MUSIC_MAIN, INTRO, CREDITS
.byte 1,1,1,1 ;
.byte 1,1,1,1 ; DNI
.byte 1,1,1,1 ;
.byte 1,1 ;
load_address_array:
.byte $D0,$D0,$80,$80 ; MUSIC_INTRO, MUSIC_MAIN, INTRO, CREDITS
.byte $60,$60,$60,$60 ;
.byte $40,$60,$60,$60 ; DNI
.byte $60,$60,$60,$60 ;
.byte $60,$80 ;
start_address:
.byte $D0,$D0,$80,$80 ; MUSIC_INTRO, MUSIC_MAIN, INTRO, CREDITS
.byte $60,$60,$60,$80 ;
.byte $40,$60,$60,$80 ; DNI
.byte $80,$80,$80,$60 ;
.byte $80,$80 ;
aux_dest:
.byte $D0,$D0,$A0,$A0 ; MUSIC_INTRO, MUSIC_MAIN, INTRO, CREDITS
.byte $70,$50,$40,$30 ;
.byte $70,$50,$40,$30 ; DNI
.byte $20,$10,$80,$20 ;
.byte $10,$A0 ;
track_array:
.byte 2,4,9,13 ; MUSIC_INTRO, MUSIC_MAIN, INTRO, CREDITS
.byte 19,21,23,24 ;
.byte 17,21,23,24 ; DNI
.byte 25,26,27,28 ;
.byte 34,9 ;
sector_array:
.byte 0,0,0,0 ; MUSIC_INTRO, MUSIC_MAIN, INTRO, CREDITS
.byte 0,0,0,0 ;
.byte 0,0,0,0 ; DNI
.byte 0,0,0,0 ;
.byte 0,0 ;
length_array:
.byte 32,48,48,64 ; MUSIC_INTRO, MUSIC_MAIN, INTRO, CREDITS
.byte 32,32,16,16 ;
.byte 32,32,16,16 ; DNI
.byte 16,16,16,96 ;
.byte 16,16 ;

@ -165,7 +165,36 @@ load_program_loop:
;=======================
;=======================
; Load music / chess
; Load dni
;=======================
;=======================
sei ; stop music interrupts
jsr mute_ay_both
jsr clear_ay_both ; stop from making noise
; load dni
lda #4 ; DNI
sta WHICH_LOAD
jsr load_file
; restart music
cli ; start interrupts (music)
;=======================
;=======================
; Run Dni
;=======================
;=======================
jsr $4000
;=======================
;=======================
; Load Credits
;=======================
;=======================

@ -33,6 +33,8 @@ MASK = $2E
COLOR = $30
;INVFLG = $32
WHICH_TRACK = $54
;==========================
; $60-$6F unused currently
;==========================
@ -94,6 +96,9 @@ TOTAL_RAM = $8F
; $90-$CF currently free
;=============================
Table1 = $A0 ; 40 bytes ($28) A0-C7
Table2 = $C8 ; 40 bytes ($28) C8-EF
;=============================
; $D0-$D9 = hgr move
;=============================
@ -131,26 +136,21 @@ MASKH = $ED
; $F0-$FB can re-use in each file
;==============================================
; tunnel
XX = $F2
MINUSXX = $F3
YY = $F4
MINUSYY = $F5
D = $F6
R = $F7
CX = $F8
CY = $F9
RR = $FA
; D'NI
SPRITEY = $F2
SPRITEX = $F3
SPRITE_XSIZE = $F4
SIN_COUNT = $F5
NUMBER_HIGH = $F6
NUMBER_LOW = $F7
DRAW_NUMBER = $F8
; Credits
BACKUP_OUTL = $F2
BACKUP_OUTH = $F3
; Nuts/ opener
SPRITE_Y = $F2
SPRITE_X = $F3
CURRENT_ROW = $F4
; PLASMACUBE
OUT1 = $F0