Skip to content

Commit 5874689

Browse files
authored
Merge branch 'davidgiven:master' into more
2 parents 3b89aed + dcf018b commit 5874689

File tree

23 files changed

+1029
-182
lines changed

23 files changed

+1029
-182
lines changed

.github/workflows/ccpp.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ jobs:
7171
images/snes.smc
7272
images/x16.zip
7373
images/vic20_iec_1541.d64
74+
images/vic20_jiffy_1541.d64
7475
images/vic20_iec_fd2000.d64
76+
images/vic20_jiffy_fd2000.d64
7577
images/vic20_yload_1541.d64
7678

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ jobs:
8282
pet8096.d64
8383
snes.smc
8484
vic20_iec_1541.d64
85-
vic20_iec_fd2000.d64
85+
vic20_jiffy_1541.d64
86+
vic20_jiffy_fd2000.d2m
8687
vic20_yload_1541.d64
8788
x16.zip
8889
fail-if-no-assets: false
@@ -128,7 +129,8 @@ jobs:
128129
cpm65/images/pet8096.d64
129130
cpm65/images/snes.smc
130131
cpm65/images/vic20_iec_1541.d64
131-
cpm65/images/vic20_iec_fd2000.d64
132+
cpm65/images/vic20_jiffy_fd2000.d2m
133+
cpm65/images/vic20_jiffy_1541.d64
132134
cpm65/images/vic20_yload_1541.d64
133135
cpm65/images/x16.zip
134136
tag_name: dev

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,14 @@ the same time.
187187
188188
- `vic20_yload_1541.d64`: 1541 format, with the fastloader. Only works on a
189189
1541 (or compatible).
190+
- `vic20_jiffy_1541.d64`: 1541 format with JiffyDOS. Only works on a 1541
191+
(or compatible) with the JiffyDOS ROM installed. This _should_ also work on
192+
an SD2IEC, although this is untested. You do *not* need the JiffyDOS kernal
193+
ROM in the VIC-20 itself.
190194
- `vic20_iec_1541.d64`: 1541 format, uses old-fashioned IEC code. Should
191195
work anywhere which supports `d64` images, although very, very slowly.
192-
- `vic20_iec_fd2000.d2m`: CMD FD-2000 format, uses old-fashioned IEC code.
193-
Faster that the `d64` IEC version, but still pretty slow. But you do
194-
get lots of disk space.
196+
- `vic20_jiffy_fd2000.d2m`: CMD FD-2000 format, with JiffyDOS. The FD-2000
197+
has JiffyDOS support built in. You get over a megabyte of free space.
195198
196199
- You need a fully expanded VIC-20 with all memory banks populated, for the
197200
full 35kB.

build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@
4747
"images/pet8032.d64": "src/arch/commodore+pet8032_diskimage",
4848
"images/pet8096.d64": "src/arch/commodore+pet8096_diskimage",
4949
"images/snes.smc": "src/arch/snes+snes_cartridge",
50+
"images/vic20_jiffy_1541.d64": "src/arch/commodore+vic20_jiffy_1541_diskimage",
5051
"images/vic20_yload_1541.d64": "src/arch/commodore+vic20_yload_1541_diskimage",
5152
"images/vic20_iec_1541.d64": "src/arch/commodore+vic20_iec_1541_diskimage",
52-
"images/vic20_iec_fd2000.d2m": "src/arch/commodore+vic20_iec_fd2000_diskimage",
53+
"images/vic20_jiffy_fd2000.d2m": "src/arch/commodore+vic20_jiffy_fd2000_diskimage",
5354
"images/x16.zip": "src/arch/x16+diskimage",
5455
"images/sorbus.zip": "src/arch/sorbus+diskimage",
5556
"images/nano6502.img": "src/arch/nano6502+diskimage",

diskdefs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ end
3232

3333
diskdef fd2000
3434
seclen 128
35-
tracks 157 # Skips the last two tracks which contain the partition table
35+
tracks 155 # Skips the first three and last two tracks
3636
sectrk 80
3737
blocksize 4096
3838
maxdir 128

include/wait.inc

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,38 @@
3030
.endm
3131

3232
.macro WAIT8
33-
cmp (0, x) ; 6
34-
nop ; 2
33+
WAIT6
34+
WAIT2
3535
.endm
3636

3737
.macro WAIT9
38-
pha ; 3
39-
pla ; 4
40-
nop ; 2
38+
WAIT6
39+
WAIT3
4140
.endm
4241

4342
.macro WAIT10
44-
pha ; 3
45-
pla ; 4
46-
cmp 0 ; 3
43+
WAIT7
44+
WAIT3
4745
.endm
4846
4947
.macro WAIT11
50-
pha ; 3
51-
pla ; 4
52-
nop ; 2
53-
nop ; 2
48+
WAIT7
49+
WAIT4
5450
.endm
5551
5652
.macro WAIT12
57-
cmp (0, x) ; 6
58-
cmp (0, x) ; 6
53+
WAIT6
54+
WAIT6
55+
.endm
56+
57+
.macro WAIT13
58+
WAIT6
59+
WAIT7
60+
.endm
61+
62+
.macro WAIT14
63+
WAIT7
64+
WAIT7
5965
.endm
6066

6167
; vim: filetype=asm sw=4 ts=4 et

include/zif.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010
.set zloopsp, 0
1111
.set zifsp, 0
1212

13+
; Skip the next instruction byte by turning them into the argument of a BIT
14+
; zp instruction. Trashes flags.
15+
16+
.macro SKIP1
17+
.byte 0x24
18+
.endm
19+
20+
; Skip the next two instruction bytes by turning them into the argument of a BIT
21+
; abs instruction. Trashes flags.
22+
23+
.macro SKIP2
24+
.byte 0x2c
25+
.endm
26+
1327
.macro blt label
1428
bcc \label
1529
.endm

src/arch/commodore/build.py

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def mkusr(self, name, src: Target):
119119
llvmrawprogram(
120120
name="vic20_yload_loader",
121121
srcs=[
122-
"./vic20/vic20loader.S",
122+
"./vic20/vic20loader_yload.S",
123123
"./diskaccess/io_yload_vic20.S",
124124
"./diskaccess/io_yload_common.S",
125125
"./vic20/vic20.inc",
@@ -129,10 +129,24 @@ def mkusr(self, name, src: Target):
129129
linkscript="./vic20/vic20loader.ld",
130130
)
131131

132+
llvmrawprogram(
133+
name="vic20_jiffy_loader",
134+
srcs=[
135+
"./vic20/vic20loader_ieee488.S",
136+
"./diskaccess/io_jiffy_vic20.S",
137+
"./vic20/vic20.inc",
138+
],
139+
deps=["src/lib+bioslib", "include", ".+commodore_lib"],
140+
cflags=["-DVIC20"],
141+
linkscript="./vic20/vic20loader.ld",
142+
)
143+
132144
llvmrawprogram(
133145
name="vic20_iec_loader",
134146
srcs=[
135-
"./vic20/vic20loader_iec.S",
147+
"./vic20/vic20loader_ieee488.S",
148+
"./diskaccess/io_ieee488_vic20.S",
149+
"./diskaccess/io_ieee488.S",
136150
"./vic20/vic20.inc",
137151
],
138152
deps=["src/lib+bioslib", "include", ".+commodore_lib"],
@@ -182,12 +196,31 @@ def mkusr(self, name, src: Target):
182196
)
183197

184198
llvmrawprogram(
185-
name="vic20_iec_fd2000_bios",
199+
name="vic20_jiffy_1541_bios",
200+
srcs=[
201+
"./vic20/vic20.S",
202+
"./diskaccess/bios_1541.S",
203+
"./diskaccess/io_jiffy_vic20.S",
204+
"./diskaccess/rw_ieee488.S",
205+
"./vic20/vic20.inc",
206+
],
207+
deps=[
208+
"include",
209+
"src/lib+bioslib",
210+
"third_party/tomsfonts+4x8",
211+
".+commodore_lib",
212+
],
213+
cflags=["-DVIC20"],
214+
ldflags=["--gc-sections"],
215+
linkscript="./vic20/vic20.ld",
216+
)
217+
218+
llvmrawprogram(
219+
name="vic20_jiffy_fd2000_bios",
186220
srcs=[
187221
"./vic20/vic20.S",
188222
"./diskaccess/bios_fd2000.S",
189-
"./diskaccess/io_ieee488.S",
190-
"./diskaccess/io_ieee488_vic20.S",
223+
"./diskaccess/io_jiffy_vic20.S",
191224
"./diskaccess/rw_ieee488.S",
192225
"./vic20/vic20.inc",
193226
],
@@ -207,8 +240,8 @@ def mkusr(self, name, src: Target):
207240
title="cp/m-65: c64",
208241
items={
209242
"cpm": ".+c64_loader",
210-
"&yload1541": ".+usr_yload1541",
211-
"bios": ".+c64_bios",
243+
"yload1541,u": ".+usr_yload1541",
244+
"bios,s": ".+c64_bios",
212245
},
213246
)
214247

@@ -217,8 +250,8 @@ def mkusr(self, name, src: Target):
217250
title="cp/m-65: vic20",
218251
items={
219252
"cpm": ".+vic20_yload_loader",
220-
"&yload1541": ".+usr_yload1541",
221-
"bios": ".+vic20_yload_1541_bios",
253+
"yload1541,u": ".+usr_yload1541",
254+
"bios,s": ".+vic20_yload_1541_bios",
222255
},
223256
)
224257

@@ -227,17 +260,26 @@ def mkusr(self, name, src: Target):
227260
title="cp/m-65: vic20",
228261
items={
229262
"cpm": ".+vic20_iec_loader",
230-
"bios": ".+vic20_iec_1541_bios",
263+
"bios,s": ".+vic20_iec_1541_bios",
231264
},
232265
)
233266

234267
mkcbmfs(
235-
name="vic20_iec_fd2000_cbmfs",
268+
name="vic20_jiffy_1541_cbmfs",
269+
title="cp/m-65: vic20",
270+
items={
271+
"cpm": ".+vic20_jiffy_loader",
272+
"bios,s": ".+vic20_jiffy_1541_bios",
273+
},
274+
)
275+
276+
mkcbmfs(
277+
name="vic20_jiffy_fd2000_cbmfs",
236278
title="cp/m-65: vic20",
237279
type="d2m",
238280
items={
239-
"cpm": ".+vic20_iec_loader",
240-
"bios": ".+vic20_iec_fd2000_bios",
281+
"cpm": ".+vic20_jiffy_loader",
282+
"bios,s": ".+vic20_jiffy_fd2000_bios",
241283
},
242284
)
243285

@@ -255,6 +297,7 @@ def mkusr(self, name, src: Target):
255297
"c64",
256298
"vic20_yload_1541",
257299
"vic20_iec_1541",
300+
"vic20_jiffy_1541",
258301
]:
259302
mkcpmfs(
260303
name=target + "_diskimage",
@@ -263,12 +306,13 @@ def mkusr(self, name, src: Target):
263306
items=COMMODORE_ITEMS_WITH_SCREEN,
264307
)
265308

266-
mkcpmfs(
267-
name="vic20_iec_fd2000_diskimage",
268-
format="fd2000",
269-
template=".+vic20_iec_fd2000_cbmfs",
270-
items=COMMODORE_ITEMS_WITH_SCREEN,
271-
)
309+
for target in ["vic20_jiffy_fd2000"]:
310+
mkcpmfs(
311+
name=f"{target}_diskimage",
312+
format="fd2000",
313+
template=f".+{target}_cbmfs",
314+
items=COMMODORE_ITEMS_WITH_SCREEN,
315+
)
272316

273317
mametest(
274318
name="c64_mametest",

src/arch/commodore/diskaccess/bios_1541.S

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,56 @@
1010
.global dph
1111
.global dpb_1541
1212

13+
NUM_ZONES = 4
14+
15+
.zeropage ptr
16+
1317
.data
1418
define_dpb dpb_1541, 136*10, 1024, 64, 0
1519
define_dph dph, dpb_1541
1620

1721
; Converts an LBA sector number in XA to track/sector in Y, A.
1822

1923
zproc convert_to_ts, .text.tsconvert, weak
20-
ldy #0
24+
ldy #0 ; zone number
25+
sta ptr+1 ; low byte of sector number
26+
sty ptr+0 ; track number
2127
zloop
2228
cpx #0
2329
zif eq
24-
cmp track_size_table, y
25-
zif cc
26-
iny ; tracks are one-based.
30+
lda ptr+1
31+
cmp zone_size_table, y
32+
zif lt ; does this sector fit in this track?
33+
ldy ptr+0 ; yes
34+
iny ; ...but tracks are one-based.
2735
rts
2836
zendif
2937
zendif
3038

39+
; Move to the next track, advancing the zone if necessary.
40+
41+
inc ptr+0
42+
lda ptr+0
43+
cmp zone_boundary_table, y
44+
zif ge ; need to move to the next zone?
45+
iny
46+
cpy #NUM_ZONES
47+
zif eq
48+
dey
49+
zendif
50+
zendif
51+
3152
sec
32-
sbc track_size_table, y
53+
lda ptr+1
54+
sbc zone_size_table, y
3355
zif cc
3456
dex
3557
zendif
36-
iny
58+
sta ptr+1
3759
zendloop
3860

39-
track_size_table:
40-
.fill 17, 1, 21
41-
.fill 7, 1, 19
42-
.fill 6, 1, 18
43-
.fill 10, 1, 17
44-
zendproc
61+
zone_boundary_table:
62+
.byte 18, 25, 31, 36 ; highest track number +1
63+
zone_size_table:
64+
.byte 21, 19, 18, 17 ; number of sectors in each zone
65+
zendproc

src/arch/commodore/diskaccess/bios_fd2000.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
.global dph
1111

1212
.data
13-
define_dpb dpb_fd2000, 157*80, 4096, 128, 3*80
13+
define_dpb dpb_fd2000, 155*80, 4096, 128, 3*80
1414
define_dph dph, dpb_fd2000
1515

1616
; Converts an LBA sector number in XA to track/sector in Y, A.

0 commit comments

Comments
 (0)