Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 395 online users. » 0 Member(s) | 392 Guest(s) Applebot, Bing, Google
|
Latest Threads |
Printing with FZX
Forum: Help & Support
Last Post: boriel
07-17-2025, 09:08 PM
» Replies: 1
» Views: 111
|
Strange Happenings
Forum: Bug Reports
Last Post: boriel
05-23-2025, 09:15 AM
» Replies: 4
» Views: 2,183
|
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 2,390
|
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 2,019
|
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 4,754
|
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 3,298
|
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 3,105
|
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 1,708
|
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 4,216
|
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 5,070
|
|
|
Inequality (*solved*) |
Posted by: britlion - 06-06-2012, 09:24 PM - Forum: Bug Reports
- Replies (3)
|
 |
Am I doing something wrong here? I think the order of operations is messing up. This looks very odd. Is BAND a lower priority than = ?
Code: dim n as uInteger
cls
for n=0 to 65530
print at 10,10;n;" ";n BAND 7
print at 12,6;"n BAND 7 = 7 is ";
IF n BAND 7 = 7 then
print "TRUE "
else
print "FALSE"
END IF
pause 0
next n
I /think/ this is doing boolean logic of
( n BAND ( 7 = 7 ) )
Or, n BAND 1
Which can't be right, surely?
|
|
|
HOWTO: Put BeepFX Sound into ZXB code |
Posted by: britlion - 06-02-2012, 12:28 PM - Forum: How-To & Tutorials
- Replies (5)
|
 |
Shiru's Beepfx (http://shiru.untergrund.net/files/beepfx.zip) is quite an interesting tool for sound effects. He doesn't believe it can be used for tunes - but it can do different pitched "tones" and include pauses, and that spells tune to me. Beepola is probably a better choice for real tune making, though.
Anyway - the asm it produces is not compatible with zxb's assembler. So I did the working out of how to tweak it to work.
So the sound calling routine would look like this:
Code: SUB sound(soundNum as uByte)
asm
#include "BeepFXPlayer.asm"
#include "SoundData.asm"
SoundEnd:
pop IX
end asm
end sub
And BeepFXPlayer would always be the same tweaks, so I present my version here:
Code: playBasic:
play:
ld hl,soundEffectsData ;address of sound effects data
di
push ix
push iy
ld b,0
ld c,a
add hl,bc
add hl,bc
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
push hl
pop ix ;put it into ix
ld a,(23624) ;get border color from BASIC vars to keep it unchanged
rra
rra
rra
and 7
ld (sfxRoutineToneborder+1),a
ld (sfxRoutineNoiseborder+1),a
readData:
ld a,(ix+0) ;read block type
or a
jr nz,readDatasound
pop iy
ei
jp SoundEnd
readDatasound:
ld c,(ix+1) ;read duration 1
ld b,(ix+2)
ld e,(ix+3) ;read duration 2
ld d,(ix+4)
push de
pop iy
dec a
jr nz,sfxRoutineNoise
;this routine generate tone with many parameters
sfxRoutineTone:
ld e,(ix+5) ;freq
ld d,(ix+6)
ld a,(ix+9) ;duty
ld (sfxRoutineToneduty+1),a
ld hl,0
sfxRoutineTonel0:
push bc
push iy
pop bc
sfxRoutineTonel1:
add hl,de
ld a,h
sfxRoutineToneduty:
cp 0
sbc a,a
and 16
sfxRoutineToneborder:
or 0
out ($fe),a
#line 78
dec bc
ld a,b
or c
jr nz,sfxRoutineTonel1
ld a,(sfxRoutineToneduty+1)
add a,(ix+10) ;duty change
ld (sfxRoutineToneduty+1),a
ld c,(ix+7) ;slide
ld b,(ix+8)
ex de,hl
add hl,bc
ex de,hl
pop bc
dec bc
ld a,b
or c
jr nz,sfxRoutineTonel0
ld c,11
nextData:
add ix,bc ;skip to the next block
jr readData
;this routine generate noise with two parameters
sfxRoutineNoise:
ld e,(ix+5) ;pitch
ld d,1
ld h,d
ld l,d
sfxRoutineNoisel0:
push bc
push iy
pop bc
sfxRoutineNoisel1:
ld a,(hl)
and 16
sfxRoutineNoiseborder:
or 0
out ($fe),a
dec d
jr nz,sfxRoutineNoisel2
ld d,e
inc hl
ld a,h
and $1f
ld h,a
sfxRoutineNoisel2:
dec bc
ld a,b
or c
jr nz,sfxRoutineNoisel1
ld a,e
add a,(ix+6) ;slide
ld e,a
pop bc
dec bc
ld a,b
or c
jr nz,sfxRoutineNoisel0
ld c,7
jr nextData
Finally, you need to run beepfx, and compile just the sound data to asm.
You'll get something like this:
Code: soundEffectsData
dw .sfx0
.sfx0
db #01
dw #0032,#0064,#01f4,#ffec,#0080
db #00
This needs some massaging to work. Change "soundEffectsData" to "soundEffectsData:"
Change "." to "soundEffectsData" And make labels have a : on the end.
Search and replace "db" with "defb"
Search and replace "dw" with "defw"
Replace # with $
All done!
Worked example:
Code: soundEffectsData:
defw soundEffectsDatasfx0
defw soundEffectsDatasfx1
soundEffectsDatasfx0:
defb $01
defw $0032,$0064,$01f4,$ffec,$0080
defb $00
soundEffectsDatasfx1:
defb $01
defw $0014,$0190,$00c8,$0005,$0110
defb $01
defw $001e,$0190,$00c8,$0008,$0110
defb $00
you can then save this as something lime soundata.asm and #'include this file into the sound routine listed above. Call with sound (n) for the sound number.
|
|
|
Question about the Heap |
Posted by: LCD - 05-30-2012, 08:19 AM - Forum: Help & Support
- Replies (4)
|
 |
Hi Boriel, just following easy question:
If I use a heap of 256 bytes, where it is put into memory? I want to know where I cannot put any binary data.
Is this 65535-heapsize?
Edit: May this be problematic if I page the heap out? Is there a possibility that we can put the heap at a selected memory area (e.g. a buffer created with DEFB's) at program start (I know that changing it may crash the program).
|
|
|
Pac Man Project |
Posted by: britlion - 05-27-2012, 05:13 PM - Forum: Gallery
- Replies (17)
|
 |
Clearly not finished, but I wanted feedback on how it feels. I spent /ages/ getting complex ghost behaviour right. Compare with CDS gobble a ghost, for example.
<!-- m --><a class="postlink" href="http://dl.dropbox.com/u/4903664/DemoMan.tzx">http://dl.dropbox.com/u/4903664/DemoMan.tzx</a><!-- m -->
(Yes, I know you can't die. Or eat ghosts. Yes, I know it breaks on level 2)
|
|
|
output ASM |
Posted by: britlion - 05-02-2012, 10:02 AM - Forum: Bug Reports
- Replies (7)
|
 |
Not sure if this is a bug, per se - but it is certainly a bit ugly.
This even survived the peephole optimizer.
Input Basic:
IF myCurrentVector = %1000 then
Output assembly:
ld a, (ix+9)
sub 8
sub 1
jp nc, __LABEL56
Two subs in a row? And worse "Sub 1" instead of a dec?
It later tests:
IF myCurrentVector = %0001 then
as:
ld a, (ix+9)
dec a
sub 1
jp nc, __LABEL63
And I'm not even convinced that's the same test as "equal to x" Surely that's testing "If myCurrentVector>x" anyway?
|
|
|
Bool |
Posted by: slenkar - 04-30-2012, 09:31 PM - Forum: Wishlist
- Replies (11)
|
 |
Are bools supported by zxbasic?
If so, would an array of bools take up only 1/8 of the room as an array of Bytes?
|
|
|
BlitzMax |
Posted by: slenkar - 04-30-2012, 03:42 PM - Forum: Wishlist
- No Replies
|
 |
If you (boriel) ever feel you want to re-write the compiler blitzmax would be a good choice, it has similar syntax to python but is a lot faster. It has a regular expressions module too and is crossplatform.
|
|
|
|