Skip to content

Commit

Permalink
Merge pull request #2576 from zx70/master
Browse files Browse the repository at this point in the history
playzb4() on TS2068 and X1 / games.h in many targets
  • Loading branch information
zx70 committed Jun 21, 2024
2 parents c88c8fd + 8dc6991 commit 0f67f68
Show file tree
Hide file tree
Showing 19 changed files with 435 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/config/cpm.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ SUBTYPE einstein -Cz+cpmdisk -Cz-f -Czeinstein -leinstein -pragma-define:CON
SUBTYPE einstein256 -Cz+cpmdisk -Cz-f -Czeinstein -leinstein -pragma-define:CONSOLE_COLUMNS=40 -pragma-define:CONSOLE_ROWS=24 -D__EINSTEIN__ -D__EINSTEIN256__ -pragma-define:__HAVE_TMS99X8=1 -leinstein256
SUBTYPE excali64 -Cz+cpmdisk -Cz-f -Czexcali64 -Cz--container=raw -D__EXCALI64__ -pragma-define:CRT_ORG_GRAPHICS=50000 -pragma-define:CONSOLE_ROWS=24 -pragma-define:CONSOLE_COLUMNS=80 -lexcali64_cpm
SUBTYPE fmgcpm -Cz+cpmdisk -Cz-f -Czfmgcpm -Cz--container=imd -ltrs80_cpm -D__TRS80__ -D__TRS80II__
SUBTYPE fp1100 -Cz+cpmdisk -Cz-f -Czfp1100 -Cz--container=d88 -D__FP1100__ -pragma-define:CONSOLE_ROWS=24 -pragma-define:CONSOLE_COLUMNS=40
SUBTYPE fp1100 -Cz+cpmdisk -Cz-f -Czfp1100 -Cz--container=d88 -D__FP1100__ -lfp1100_cpm -pragma-define:CONSOLE_ROWS=24 -pragma-define:CONSOLE_COLUMNS=40
SUBTYPE gemini -Cz+cpmdisk -Cz-f -Czgemini -Cz--container=imd -lgemini -D__GEMINI__
SUBTYPE gnat10 -Cz+cpmdisk -Cz-f -Czgnat10 -Cz--container=d88 -D__GNAT__
SUBTYPE holmes -Cz+cpmdisk -Cz-f -Czholmes -Cz--container=imd -ltrs80_cpm -D__TRS80__
Expand Down
14 changes: 13 additions & 1 deletion libsrc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Problems? Contact the person to blame(!) above the section
# for the library
#
# $Id: Makefile,v 1.265+ ...now on GIT $
# $Id: Makefile $


include Make.config
Expand Down Expand Up @@ -453,6 +453,7 @@ px4.lib: cpm_clib.lib
@echo ''
@echo '--- Building PX-4/HC-40 Library ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=px4
$(MAKE) -C gfx TARGET=cpm SUBTYPE=px4 FLAVOUR="narrow"
TARGET=px4 TYPE=z80 $(LIBLINKER) -DFORpx4 -x$(OUTPUT_DIRECTORY)/px4 @$(TARGET_DIRECTORY)/px4/px4.lst

Expand All @@ -461,6 +462,7 @@ px8.lib: cpm_clib.lib
@echo ''
@echo '--- Building PX-8/Geneva Library ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=px8
$(MAKE) -C gfx TARGET=cpm SUBTYPE=px8 FLAVOUR="wide"
TARGET=px8 TYPE=z80 $(LIBLINKER) -DFORpx8 -x$(OUTPUT_DIRECTORY)/px8 @$(TARGET_DIRECTORY)/px8/px8.lst

Expand All @@ -469,6 +471,7 @@ v1050.lib: cpm_clib.lib
@echo ''
@echo '--- Building Visual 1050 Library (CP/M) ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=v1050
$(MAKE) -C gfx TARGET=cpm FLAVOUR="wide" SUBTYPE=v1050
TARGET=v1050 TYPE=z80 $(LIBLINKER) -DFORv1050 -DSTANDARDESCAPECHARS -x$(OUTPUT_DIRECTORY)/v1050.lib @$(TARGET_DIRECTORY)/v1050/v1050.lst

Expand Down Expand Up @@ -744,6 +747,7 @@ rc700.lib: cpm_clib.lib
@echo ''
@echo '--- Building RC-700 Library ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=rc700
$(MAKE) -C gfx TARGET=cpm FLAVOUR="gencon narrow" SUBTYPE=rc700
TARGET=rc700 TYPE=z80 $(LIBLINKER) -DFORrc700 -x$(OUTPUT_DIRECTORY)/rc700 @$(TARGET_DIRECTORY)/rc700/rc700.lst

Expand Down Expand Up @@ -851,6 +855,7 @@ mz2500_clib.lib: $(TARGET_CLIB_OBJS)
@echo ''
@echo '--- Building Sharp MZ-2500 Library ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=mz2500
$(call buildgeneric,mz2500)
TARGET=mz2500 TYPE=z80 $(LIBLINKER) -DSTANDARDESCAPECHARS -DFORmz2500 -x$(OUTPUT_DIRECTORY)/mz2500_clib @$(TARGET_DIRECTORY)/mz2500/mz2500.lst

Expand Down Expand Up @@ -960,6 +965,7 @@ gemini.lib: cpm_clib.lib
@echo ''
@echo '--- Building Gemini Galaxy Library (CP/M & graphics) ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=gemini
$(MAKE) -C gfx TARGET=cpm FLAVOUR="narrow" SUBTYPE=gemini
TARGET=gemini TYPE=z80 $(LIBLINKER) -DFORgemini -DSTANDARDESCAPECHARS -x$(OUTPUT_DIRECTORY)/gemini.lib @$(TARGET_DIRECTORY)/gemini/gemini.lst

Expand Down Expand Up @@ -1114,6 +1120,7 @@ excali64_clib.lib: $(TARGET_CLIB_OBJS)
@echo '--- Building Excalibur 64 Library ---'
@echo ''
$(call buildgeneric,excali64,"gencon narrow")
$(MAKE) -C games TARGET=excali64
$(MAKE) -C video/mc6845 TARGET=excali64
TARGET=excali64 TYPE=z80 $(LIBLINKER) -DSTANDARDESCAPECHARS -DFORexcali64 -x$(OUTPUT_DIRECTORY)/excali64_clib @$(TARGET_DIRECTORY)/excali64/excali64.lst
TARGET=excali64 TYPE=z80 $(LIBLINKER) -DSTANDARDESCAPECHARS -DFORexcali64 -x$(OUTPUT_DIRECTORY)/excali64_cpm @$(TARGET_DIRECTORY)/excali64/excali64_cpm.lst
Expand Down Expand Up @@ -1144,6 +1151,7 @@ bic.lib: cpm_clib.lib
@echo ''
@echo '--- Building A5105 Library ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=bic
$(MAKE) -C video/upd7220 TARGET=bic
$(MAKE) -C psg TARGET=cpm SUBTYPE=bic
TARGET=bic TYPE=z80 $(LIBLINKER) -DSTANDARDESCAPECHARS -DFORbic -x$(OUTPUT_DIRECTORY)/bic @$(TARGET_DIRECTORY)/bic/bic.lst
Expand Down Expand Up @@ -1350,8 +1358,10 @@ fp1100_clib.lib: $(TARGET_CLIB_OBJS)
@echo ''
@echo '--- Building Casio FP-1100 Library ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=fp1100
$(call buildgeneric,fp1100,wide)
TARGET=fp1100 TYPE=z80 $(LIBLINKER) -DSTANDARDESCAPECHARS -DFORfp1100 -x$(OUTPUT_DIRECTORY)/fp1100_clib @$(TARGET_DIRECTORY)/fp1100/fp1100.lst
TARGET=fp1100 TYPE=z80 $(LIBLINKER) -DSTANDARDESCAPECHARS -DFORfp1100 -x$(OUTPUT_DIRECTORY)/fp1100_cpm @$(TARGET_DIRECTORY)/fp1100/fp1100_cpm.lst

# Z80 TV Game
z80tvgame_clib.lib: $(TARGET_CLIB_OBJS)
Expand Down Expand Up @@ -1633,6 +1643,7 @@ pcw.lib: cpm_clib.lib
@echo ''
@echo '--- Building Amstrad PCW Library ---'
@echo ''
$(MAKE) -C games TARGET=cpm SUBTYPE=pcw
$(MAKE) -C gfx TARGET=cpm FLAVOUR=wide SUBTYPE=pcw
TARGET=pcw TYPE=z80 $(LIBLINKER) -DFORpcw -x$(OUTPUT_DIRECTORY)/pcw @$(TARGET_DIRECTORY)/pcw/pcw.lst

Expand Down Expand Up @@ -1952,6 +1963,7 @@ sos_clib.lib: $(TARGET_CLIB_OBJS)
@echo '--- Building S-OS (The Sentinel) Library ---'
@echo ''
$(call buildgeneric,sos)
$(MAKE) -C games TARGET=sos
$(MAKE) -C target/sos
TARGET=sos TYPE=z80 $(LIBLINKER) -DFORsos -DSTANDARDESCAPECHARS -x$(OUTPUT_DIRECTORY)/sos_clib.lib @$(TARGET_DIRECTORY)/sos/sos.lst

Expand Down
1 change: 1 addition & 0 deletions libsrc/target/bic/bic.lst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ target/bic/psg/asm_vt2_hardware_out
@psg/ay/psg.lst
@psg/ay/wyz/psg_wyz.lst
@psg/ay/vt2/psg_vt2.lst
@games/games.lst
1 change: 1 addition & 0 deletions libsrc/target/excali64/excali64.lst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ target/excali64/stdio/loadudg6
@gfx/gencon/gfx_gencon6.lst
@video/mc6845/mc6845.lst
@stdio/stdio.lst
@games/games.lst
1 change: 1 addition & 0 deletions libsrc/target/excali64/excali64_cpm.lst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ target/excali64/stdio/loadudg6
@input/input_keyboard.lst
@gfx/gencon/gfx_gencon6.lst
@video/mc6845/mc6845.lst
@games/games.lst
3 changes: 1 addition & 2 deletions libsrc/target/fp1100/fp1100.lst
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ target/fp1100/graphics/w_respixl
target/fp1100/graphics/w_xorpixl
target/fp1100/graphics/w_pointxy
@gfx/wide/gfx_wide.lst


@games/games.lst
17 changes: 17 additions & 0 deletions libsrc/target/fp1100/fp1100_cpm.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
target/fp1100/stdio/generic_console
target/fp1100/stdio/generic_console_ioctl
target/fp1100/stdio/conio_vars
target/fp1100/stdio/CRT_FONT
target/fp1100/stdio/conio_map_colour
target/fp1100/stdio/fputc_cons_native
target/fp1100/graphics/clg
target/fp1100/graphics/textpixl
target/fp1100/graphics/getmaxx
target/fp1100/graphics/getmaxy
target/fp1100/graphics/w_pixladdr
target/fp1100/graphics/w_plotpixl
target/fp1100/graphics/w_respixl
target/fp1100/graphics/w_xorpixl
target/fp1100/graphics/w_pointxy
@gfx/wide/gfx_wide.lst
@games/games.lst
1 change: 1 addition & 0 deletions libsrc/target/gemini/gemini.lst
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ target/gemini/graphics/xorpixl
target/gemini/graphics/pointxy
target/gemini/graphics/swapgfxbk
@gfx/narrow/gfx_narrow.lst
@games/games.lst
2 changes: 1 addition & 1 deletion libsrc/target/mz2500/mz2500.lst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ target/mz2500/stdio/getk
target/mz2500/stdio/conio_map_colour
target/mz2500/stdio/generic_console
@stdio/stdio.lst

@games/games.lst
1 change: 1 addition & 0 deletions libsrc/target/pcw/pcw.lst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ target/pcw/psg/psg_init
target/pcw/far/__far_misc
target/pcw/far/__far_page
@psg/ay/psg.lst
@games/games.lst
1 change: 1 addition & 0 deletions libsrc/target/px4/px4.lst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ target/px4/stdio/ansi/f_ansi_char
target/px4/stdio/ansi/f_ansi_cls
target/px4/stdio/ansi/f_ansi_dline
target/px4/stdio/ansi/f_ansi_scrollup
@games/games.lst
1 change: 1 addition & 0 deletions libsrc/target/px8/px8.lst
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ target/px8/stdio/ansi/f_ansi_cls
stdio/obj/${TYPE}/ansi/generic/f_ansi_dline
target/px8/stdio/ansi/f_ansi_scrollup
target/px8/stdio/ansi/_font_8x6_px
@games/games.lst
1 change: 1 addition & 0 deletions libsrc/target/rc700/rc700.lst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target/rc700/generic_console
@gfx/gencon/gfx_gencon1.lst
@games/games.lst
1 change: 1 addition & 0 deletions libsrc/target/sos/sos.lst
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ target/sos/tape/tape_save
target/sos/tape/tape_save_block
target/sos/tape/tape_load
target/sos/tape/tape_load_block
@games/games.lst
195 changes: 195 additions & 0 deletions libsrc/target/ts2068/psg/playzb4.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
;
; Based on an article by
; Laurens Holst, Ricardo Bittencourt, Arturo Ragozini
;

; TS2068 PSG version
; calibrated for a fixed 8khz bitrate
; The way the PSG is driven is not emulated by EightyOne
; It works on FUSE, hopefully it will on the original hardware too !

;
;$Id: playzb4.asm $
;

; extern void __LIB__ playzb4(uchar *SamStart, ushort SamLen);
; play 4 bit pulse wave encoded data using sid master volume

SECTION code_clib

PUBLIC playzb4
PUBLIC _playzb4
EXTERN psg_init
EXTERN asm_set_psg

playzb4:
_playzb4:

;call csv
;ld l,(ix+6) ;sample start addr
;ld h,(ix+7)
;ld e,(ix+8) ;sample length
;ld d,(ix+9)

;-------------------------------------
; Resets the PSG (Tiki100 $16,$17. MSX=$A0,$A1)
;-------------------------------------

call psg_init

ld l,0
ld e,$ff

call asm_set_psg
inc l

call asm_set_psg
inc l

call asm_set_psg
inc l

call asm_set_psg
inc l

call asm_set_psg
inc l

call asm_set_psg
inc l

call asm_set_psg
inc l

ld e,$bf
call asm_set_psg

pop bc
pop de ;sample length
pop hl ;sample start addr
push hl
push de
push bc

rep1:

ld a, (hl) ; a = sample byte
and $f0 ; 4 bit nibble

call play_sample

ld a, (hl) ; a = sample byte
rlca ; a = a div 16
rlca ;
rlca ;
rlca ;
and $f0 ; 4 bit nibble

call play_sample

inc hl ; hl = hl+1
dec e ;
jr nz, rep1 ;
dec d ; de = de-1
jr nz, rep1 ;until de = 0

ret



;
play_sample:

; Tuned for a 4mhz CPU
ld b, 20
rep1b: ;repeat
djnz rep1b

exx
ld d,0
ld e,a
ld hl,PSG_SAMPLE_TABLE
add hl,de
ld e,(hl)
inc h
ld d,(hl)
inc h
ld h,(hl)


ld a,8
ld bc, $f5
out (c), a
inc c
out (c), e

inc a
dec c
out (c), a
inc c
out (c), d

inc a
dec c
out (c), a
inc c
out (c), h

exx
ret


PSG_SAMPLE_TABLE:
defb 00,01,02,03,04,03,05,03,04,05,06,06,05,06,06,06
defb 06,06,07,06,07,08,08,08,07,07,09,07,09,09,08,08
defb 09,09,08,09,09,09,09,09,10,10,10,10,09,09,10,10
defb 10,10,09,10,11,11,11,11,11,11,11,11,10,10,10,11
defb 11,11,11,11,11,11,11,12,11,11,12,12,11,12,11,12
defb 12,12,12,11,12,11,12,12,12,12,11,12,12,12,12,11
defb 12,13,12,13,11,13,13,13,13,13,13,11,13,13,13,13
defb 13,13,13,12,13,13,13,12,12,13,12,13,13,13,13,13
defb 13,12,13,13,13,13,13,13,13,14,13,13,14,14,14,14
defb 14,14,13,14,14,13,14,14,14,14,14,14,13,14,14,14
defb 14,14,14,13,14,14,13,14,14,13,13,14,14,14,14,14
defb 14,14,14,14,13,14,14,13,14,14,14,14,14,14,13,14
defb 14,14,15,14,15,15,15,15,15,15,15,15,15,15,15,15
defb 14,15,15,15,15,15,15,14,15,15,15,15,15,15,15,15
defb 15,15,15,15,15,15,15,15,15,15,15,14,15,14,14,14
defb 14,14,15,15,14,15,15,14,15,15,15,15,15,15,15,14

defb 00,00,00,00,00,02,00,02,02,03,01,02,04,04,03,04
defb 04,05,04,05,05,02,03,04,06,06,01,06,02,03,06,07
defb 05,06,07,06,06,06,07,06,04,04,05,06,08,07,06,06
defb 07,06,08,07,03,04,03,04,04,05,05,05,08,09,09,07
defb 07,07,08,07,08,08,08,02,08,09,03,05,09,05,08,06
defb 06,07,06,10,07,09,08,07,08,08,09,08,08,09,08,10
defb 09,00,08,01,10,02,03,04,04,05,06,10,06,06,06,07
defb 06,07,07,10,08,08,07,11,11,08,11,08,09,09,09,08
defb 09,11,09,09,10,10,10,10,10,00,10,09,02,02,04,03
defb 04,04,11,05,05,11,07,07,07,07,07,08,10,08,08,08
defb 08,08,09,11,09,09,12,08,09,12,11,09,10,10,09,10
defb 10,10,10,09,11,10,10,12,10,10,11,11,11,10,12,11
defb 11,11,00,11,01,02,03,04,03,04,04,05,05,05,06,07
defb 12,07,07,07,08,07,08,12,08,08,08,09,08,09,09,09
defb 08,09,09,09,09,10,10,09,10,10,10,13,09,13,13,13
defb 13,13,10,11,13,11,10,13,11,11,11,11,11,10,10,12

defb 00,00,00,00,00,00,00,01,01,00,00,00,01,00,02,02
defb 03,02,01,04,01,01,01,01,03,04,00,05,01,01,04,01
defb 01,00,04,02,03,04,01,05,01,02,01,00,02,06,03,04
defb 01,05,06,04,00,00,02,02,03,02,03,04,06,02,03,02
defb 03,04,00,05,02,03,04,00,05,00,02,00,03,02,07,01
defb 02,00,04,00,03,07,00,05,02,03,08,04,05,00,06,07
defb 03,00,07,00,08,01,01,01,02,01,00,09,02,03,04,01
defb 05,03,04,07,01,02,06,01,02,05,04,06,02,03,04,07
defb 05,07,06,06,00,01,02,03,04,00,05,08,00,01,00,02
defb 02,03,00,03,04,03,00,01,02,03,04,00,09,02,03,04
defb 04,05,00,08,02,03,00,07,05,03,09,06,00,01,07,03
defb 04,04,05,08,10,06,06,08,07,07,00,00,01,08,09,04
defb 05,05,00,06,00,00,00,00,02,02,03,02,03,04,03,00
defb 01,02,03,04,00,05,02,06,04,04,05,00,06,02,03,04
defb 07,05,05,06,06,00,01,07,03,04,04,00,08,02,03,04
defb 04,05,07,00,06,01,08,07,04,05,05,06,06,09,09,11

Loading

0 comments on commit 0f67f68

Please sign in to comment.