Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 269
» Latest member: Josephcew
» Forum threads: 1,075
» Forum posts: 6,435

Full Statistics

Online Users
There are currently 174 online users.
» 1 Member(s) | 170 Guest(s)
Applebot, Bing, Google, boriel

Latest Threads
Strange Happenings
Forum: Bug Reports
Last Post: zedex82
05-07-2025, 09:05 AM
» Replies: 0
» Views: 40
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 416
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 331
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,658
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 602
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 934
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 371
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,131
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,919
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 437

 
  Error Undefined label 'None' (!)
Posted by: programandala.net - 05-16-2014, 03:01 PM - Forum: Help & Support - Replies (2)

Any clue what could cause the error "Undefined label 'None'"? It seems something missing is misinterpreted as a missing label?! I tried to find the wrong line with #line, but there are several #include and the error line changed without logic depending on the zones I commented out. Then I've created a debug version of the code, pasting all modules into their places instead of using #include. The same error happens, and also in different lines depending on the zones I comment out. So far I see no logic: the error line can be an "end asm" or a BASIC comment, an assembler comment or whatever.

Thank you

Print this item

  #INCBIN not working in 1.4 and 1.3
Posted by: programandala.net - 05-14-2014, 08:33 PM - Forum: Help & Support - Replies (3)

Hi all,

I'm back with some ZX BASIC projects.

The Z80 #INCBIN doesn't work for me. I never tried it before, but I think it's implemented (it's mentioned in the Syntax page of the wiki, and in a post by Boriel about graphics (2011)).

Code:
asm
#incbin "file.bin"
end asm

I use 1.4, but a symbolic link lets me switch to 1.3. Both versions show the same error: "invalid directive #incbin".

Is it a bug?

Thank you.

Print this item

  Another string related problem (*solved*)
Posted by: LCD - 05-10-2014, 01:00 AM - Forum: Bug Reports - Replies (5)

Let me demonstrate this nasty bug...

Code:
sub printerPutString(x as ubyte,y as ubyte,attribute as ubyte,char$ as string)
    print at y,x;char$
end sub

sub Frame(x1 as ubyte,y1 as ubyte,width as ubyte,height as ubyte)
printerPutString(x1,y1,6,chr(35))
printerPutString(x1,y1+height,6,chr(35))
printerPutString(x1+width,y1,6,chr(35))
printerPutString(x1+width,y1+height,6,chr(35))
strg$=""
    for old=1 to width-1
        strg$=strg$+chr(33)
    next old
    printerPutString(x1+1,y1,7,strg$)
    printerPutString(x1+1,y1+height,7,strg$)
    for old=y1+1 to y1+height-1
        printerPutString(x1,old,7,chr(34))
        printerPutString(x1+width,old,7,chr(34))
    next old
end sub

Frame(15,0,16,5)

This does not work correctly, but it *should* work.
print len strg$ is 15, but in procedure the char$ length is calculated with 0 lchars.
It works if I change the code to this:

Code:
sub printerPutString(x as ubyte,y as ubyte,attribute as ubyte,char$ as string)
    print at y,x;char$
end sub

sub Frame(x1 as ubyte,y1 as ubyte,width as ubyte,height as ubyte)
    printerPutString(x1,y1,6,chr(35))
    printerPutString(x1,y1+height,6,chr(35))
    printerPutString(x1+width,y1,6,chr(35))
    printerPutString(x1+width,y1+height,6,chr(35))

    for old=x1+1 to x1+width-1
        printerPutString(old,y1,7,chr(33))
        printerPutString(old,y1+height,7,chr(33))
    next old
    for old=y1+1 to y1+height-1
        printerPutString(x1,old,7,chr(34))
        printerPutString(x1+width,old,7,chr(34))
    next old
end sub

Frame(15,0,16,5)

Print this item

  Variable corruption?
Posted by: britlion - 03-23-2014, 02:13 AM - Forum: Help & Support - Replies (1)

Code:
SUB FZXPrintAt(Y as uByte, X as uByte, printData as String)
DIM FZXi as uInteger=0
PRINT INK 0;FZXi: PAUSE 0
FZXPrintAChar(22) 'at
PRINT INK 1;FZXi: PAUSE 0

FZXPrintAChar(Y)
PRINT INK 2;FZXi: PAUSE 0

FZXPrintAChar(X)
PRINT INK 3;FZXi: PAUSE 0

PRINT LEN printData
FOR FZXi=0 to LEN printData-1
PRINT INK 4;FZXi: PAUSE 0
   FZXPrintAChar(CODE printData(FZXi))
PRINT INK 5;FZXi: PAUSE 0
NEXT FZXi  
END SUB

The first 3 calls to FZXPrintAChar work perfectly. Then we get to the loop part. It prints out 0 for FZXi and then prints the first letter of the string. Next time around the loop, FZXi becomes 33633!
But I'm not sure where?

Should I assume FZXPrintAChar does some stack corruption? This is just FZX from Einar Saukas (and friends) - and seems to work perfectly when called to print a single character. Even multiple times. But when looping, strange things happen.

The odd thing is it just seems to happen once. If I change the code to FZXPrintAChar(65) - it happily prints out letter A's in sequence beautifully. Except the first time through the loop, FZXi is set to 33633. It then proceeds to count upwards through 33634 33635 etc, as you'd expect for a loop variable.

Investigating as I type:
If I set the variable type to be a uByte, it gets set to 131 in the loop. (Which makes some sense, as the high byte of 33633 is 131 ) - but it isn't reset each time to 131, but is allowed to count upwards.

2 AM.

Time to quit for the night. Code dumped to <deleted> for the moment. - I fully accept the issue might be with the assembly module from someone else I've used!

EDIT: I think I see it. It's using IX in the routine. That will have to be changed!

Print this item

  Weird problem with strings / arrays (*solved*)
Posted by: Mousey - 03-10-2014, 07:35 PM - Forum: Bug Reports - Replies (16)

Hopefully my example listing makes it clear!

Code:
' using version 1.4.0s1864

paper 0
border 0
ink 7
cls

dim textArray(1) as string
dim text as string
dim i as UBYTE

text = "This is a string."

i = 0

textArray(i) = text ' doesn't work - generates "Out of Memory" error if compiled with --debug-memory

textArray(i) = "" + text ' works fine

textArray(0) = text ' works fine

print textArray(0)
pause 0
end

' why does the first method not work?

Print this item

  SPECTRA Blitz
Posted by: LCD - 02-25-2014, 12:39 AM - Forum: Gallery - Replies (13)

First ZXBC game supporting SPECTRA Interface was released now:
<!-- m --><a class="postlink" href="http://members.inode.at/838331/zx/SPECTRA-Blitz2014.zip">http://members.inode.at/838331/zx/SPECTRA-Blitz2014.zip</a><!-- m -->
No screenshots as no Windows Emulator supports SPECTRA yet.

Print this item

  Error: Syntax error. Unexpected end of line [NEWLINE]
Posted by: cheveron - 02-20-2014, 10:03 AM - Forum: Help & Support - Replies (4)

I've searched the forum for this report and I've checked the obvious stuff. My source file is plain text. I've only used accepted hex encoding. I only have one data type in a defb. The error reports line 123 but that's spurious as commenting it out changes the report to line 122 which is virtually the same. I suspect I've just hit a limitation of the inline assembler, but I'm not sure. Here's the source:

Code:
' -----------------------------------------------------------------------------
' ZXodus][Engine - Example Character Generator
' Copyright (c) 2014 Andrew Owen. All Rights Reserved.
' -----------------------------------------------------------------------------

' bank 0 = font / text
' bank 1 = gfx 1
' bank 2 = code / music
' bank 3 = gfx 2 / cards

goto start

ASM
        org        80ffh

vectr:
        defw    intrpt

intrpt:
        push     af                ; save registers
        push     bc
        push     de
        push     hl
        ex        af, af'            ;'
        exx
        push     af
        push     bc
        push     de
        push     hl
        call    play            ; play music
        pop        hl
        pop        de
        pop        bc
        pop        af
        ex        af, af'            ;'
        exx
        pop        hl
        pop        de
        pop        bc
        pop        af
        jp        $0038

; ------------------------------------------------------------------------------
; PROTRACKER 3 EXTREME II (P3X) AY PLAYER
; For ZX81 (Zon-X), TC2068, and Spectrum 128.

; Copyright (c) 2004, 2007 S.V.Bulba <vorobey@mail.khstu.ru>

; http://bulba.untergrund.net (http://bulba.at.kz)
; Formatted by Gasman for Pasmo and optimized by Cheveron

; variables are 541 bytes long and follow the player
; music is in ProTracker3.6 format (minus the 100 byte header)

setup:
        defb    0                        ; used by ProTracker 3 Extreme II

checklp:
        ld        hl, setup
        set        7, (hl)
        bit        0, (hl)
        ret        z
        pop        hl
        ld        hl, delycnt
        inc        (hl)
        ld        hl, chana + chp_ntskcn
        inc        (hl)

mute:
        xor        a
        ld        h, a
        ld        l, a        
        ld        (ayregs + ar_ampla), a
        ld        (ayregs + ar_amplb), hl
        jp        rout_a0

p3x_init:
        ld        hl, music - 100            ; music address
        ld        (modaddr + 1), hl
        ld        (mdaddr2 + 1), hl
        push    hl
        ld        de, 100
        add        hl, de
        ld        a, (hl)
        ld        (p3x_delay + 1), a
        push    hl
        pop        ix
        add        hl, de
        ld        (crpsptr), hl
        ld        e, (ix + 2)
        add        hl, de
        inc        hl
        ld        (lposptr + 1), hl
        pop        de
        ld        l, (ix + 3)
        ld        h, (ix + 4)
        add        hl, de
        ld        (patsptr + 1), hl
        ld        hl, 169
        add        hl, de
        ld        (ornptrs + 1), hl
        ld        hl, 105
        add        hl, de
        ld        (samptrs + 1), hl
        ld        hl, setup
        res        7, (hl)
        xor        a
        ld        hl, vars
        ld        (hl), a
        ld        de, vars + 1
        ld        bc, var0end - vars - 1
        ldir
        inc        a
        ld        (delycnt), a
        ld        hl, $f001
        ld        (chana + chp_ntskcn), hl
        ld        (chanb + chp_ntskcn), hl
        ld        (chanc + chp_ntskcn), hl
        ld        hl, emptysamorn
        ld        (adinpta + 1), hl
        ld        (chana + chp_ornptr), hl
        ld        (chanb + chp_ornptr), hl
        ld        (chanc + chp_ornptr), hl
        jp        rout_a0

pd_orsm:
        ld        (ix + 8), 0                ; pattern decoder
        call    setorn
        ld        a, (bc)
        inc        bc
        rrca
        
pd_sam:
        add        a, a

pd_sam_:
        ld        e, a
        ld        d, 0

samptrs:
        ld        hl, 8481
        add        hl, de
        ld        e, (hl)
        inc        hl
        ld        d, (hl)

modaddr
        ld        hl, 8481
        add        hl, de
        ld        (ix + 3), l
        ld        (ix + 4), h
        jr        pd_loop

pd_vol:
        rlca
        rlca
        rlca
        rlca
        ld        (ix + 16), a
        jr        pd_lp2

pd_eoff:
        ld        (ix + 8), a
        ld        (ix - 12), a
        jr        pd_lp2

pd_sore:
        dec        a
        jr        nz, pd_env
        ld        a, (bc)
        inc        bc
        ld        (ix + 5), a
        jr        pd_lp2

pd_env:
        call    setenv
        jr        pd_lp2

pd_orn:
        call    setorn
        jr        pd_loop

pd_esam:
        ld        (ix + 8), a
        ld        (ix - 12), a
        call    nz, setenv
        ld        a, (bc)
        inc        bc
        jr        pd_sam_

ptdecod:
        ld        a, (ix + 6)
        ld        (prnote + 1), a
        ld        l, (ix - 6)
        ld        h, (ix - 5)
        ld        (prslide + 1), hl

pd_loop:
        ld        de, 8208

pd_lp2:
        ld        a, (bc)
        inc        bc
        add        a, e
        jr        c, pd_orsm
        add        a, d
        jr        z, pd_fin
        jr        c, pd_sam
        add        a, e
        jr        z, pd_rel
        jr        c, pd_vol
        add        a, e
        jr        z, pd_eoff
        jr        c, pd_sore
        add        a, 060h
        jr        c, pd_note
        add        a, e
        jr        c, pd_orn
        add        a, d
        jr        c, pd_nois
        add        a, e
        jr        c, pd_esam
        add        a, a
        ld        e, a
        ld        hl, spccoms + 57120
        add        hl, de
        ld        e, (hl)
        inc        hl
        ld        d, (hl)
        push    de
        jr        pd_loop

pd_nois:
        ld        (ns_base), a
        jr        pd_lp2

pd_rel:
        res        0, (ix + 9)
        jr        pd_res

pd_note:
        ld        (ix + 6), a
        set        0, (ix + 9)
        xor        a

pd_res:
        ld        (pdsp_ + 1), sp
        ld        sp, ix
        ld        h, a
        ld        l, a
        push    hl
        push    hl
        push    hl
        push    hl
        push    hl
        push    hl

pdsp_
        ld        sp, 12593

pd_fin:
        ld        a, (ix + 5)
        ld        (ix + 15), a
        ret

c_portm:
        res        2, (ix + 9)
        ld        a, (bc)
        inc        bc
        inc        bc
        inc        bc
        ld        (ix + 10), a
        ld        (ix - 7), a
        ld        de, nt_
        ld        a, (ix + 6)
        ld        (ix + 7), a
        add        a, a
        ld        l, a
        ld        h, 0
        add        hl, de
        ld        a, (hl)
        inc        hl
        ld        h, (hl)
        ld        l, a
        push    hl

prnote:
        ld        a, 62
        ld        (ix + 6), a
        add        a, a
        ld        l, a
        ld        h, 0
        add        hl, de
        ld        e, (hl)
        inc        hl
        ld        d, (hl)
        pop        hl
        sbc        hl, de
        ld        (ix + 13), l
        ld        (ix + 14), h
        ld        e, (ix - 6)
        ld        d, (ix - 5)

prslide:
        ld        de, 4369
        ld        (ix - 6), e
        ld        (ix - 5), d
        ld        a, (bc)
        inc        bc
        ex        af, af'                    ;'
        ld        a, (bc)
        inc        bc
        and        a
        jr        z, nosig
        ex        de, hl

nosig:
        sbc        hl, de
        jp        p, set_stp
        cpl
        ex        af, af'                    ;'
        neg
        ex        af, af'                    ;'

set_stp:
        ld        (ix + 12), a
        ex        af, af'        ;'
        ld        (ix + 11), a
        ld        (ix - 2), 0
        ret

c_gliss:
        set        2, (ix + 9)
        ld        a, (bc)
        inc        bc
        ld        (ix + 10), a
        and        a
        jr        nz, gl36
        ld        a, 6                    ; P3X version is always PT3.6
        cp        7
        sbc        a, a
        inc        a

gl36:
        ld        (ix - 7), a
        ld        a, (bc)
        inc        bc
        ex        af, af'                ;'
        ld        a, (bc)
        inc        bc
        jr        set_stp

c_smpos:
        ld        a, (bc)
        inc        bc
        ld        (ix - 11), a
        ret

c_orpos:
        ld        a, (bc)
        inc        bc
        ld        (ix - 12), a
        ret

c_vibrt:
        ld        a, (bc)
        inc        bc
        ld        (ix - 1), a
        ld        (ix - 2), a
        ld        a, (bc)
        inc        bc
        ld        (ix + 0), a
        xor        a
        ld        (ix - 7), a
        ld        (ix - 6), a
        ld        (ix - 5), a
        ret

c_engls
        ld        a, (bc)
        inc        bc
        ld        (env_del + 1), a
        ld        (curedel), a
        ld        a, (bc)
        inc        bc
        ld        l, a
        ld        a, (bc)
        inc        bc
        ld        h, a
        ld        (esldadd + 1), hl
        ret

c_p3x_delay:
        ld        a, (bc)
        inc        bc
        ld        (p3x_delay + 1), a
        ld        (delycnt), a                ; bugfix by Lee du Caine
        ret

setenv:
        ld        (ix + 8), e
        ld        (ayregs + ar_envtp), a
        ld        a, (bc)
        inc        bc
        ld        h, a
        ld        a, (bc)
        inc        bc
        ld        l, a
        ld        (envbase), hl
        xor        a
        ld        (ix - 12), a
        ld        (curedel), a
        ld        h, a
        ld        l, a
        ld        (curesld), hl
c_nop:
        ret

setorn:
        add        a, a
        ld        e, a
        ld        d, 0
        ld        (ix - 12), d

ornptrs:
        ld        hl, 8481
        add        hl, de
        ld        e, (hl)
        inc        hl
        ld        d, (hl)

mdaddr2:
        ld        hl, 8481
        add        hl, de
        ld        (ix + 1), l
        ld        (ix + 2), h
        ret

; all 16 addresses to protect from broken pt3 modules

spccoms:
        defw    c_nop
        defw    c_gliss
        defw    c_portm
        defw    c_smpos
        defw    c_orpos
        defw    c_vibrt
        defw    c_nop
        defw    c_nop
        defw    c_engls
        defw    c_p3x_delay
        defw    c_nop
        defw    c_nop
        defw    c_nop
        defw    c_nop
        defw    c_nop
        defw    c_nop

chregs:
        xor        a
        ld        (ampl), a
        bit        0, (ix + 21)
        push    hl
        jp        z, ch_exit
        ld        (csp_ + 1), sp
        ld        l, (ix + 13)
        ld        h, (ix + 14)
        ld        sp, hl
        pop        de
        ld        h, a
        ld        a, (ix + 0)
        ld        l, a
        add        hl, sp
        inc        a
        cp        d
        jr        c, ch_orps
        ld        a, e

ch_orps:
        ld        (ix + 0), a
        ld        a, (ix + 18)
        add        a, (hl)
        jp        p, ch_ntp
        xor        a

ch_ntp:
        cp        96
        jr        c, ch_nok
        ld        a, 95

ch_nok:
        add        a, a
        ex        af, af'                    ;'
        ld        l, (ix + 15)
        ld        h, (ix + 16)
        ld        sp, hl
        pop        de
        ld        h, 0
        ld        a, (ix + 1)
        ld        b, a
        add        a, a
        add        a, a
        ld        l, a
        add        hl, sp
        ld        sp, hl
        ld        a, b
        inc        a
        cp        d
        jr        c, ch_smps
        ld        a, e

ch_smps:
        ld        (ix + 1), a
        pop        bc
        pop        hl
        ld        e, (ix + 8)
        ld        d, (ix + 9)
        add        hl, de
        bit        6, b
        jr        z, ch_noac
        ld        (ix + 8), l
        ld        (ix + 9), h

ch_noac:
        ex        de, hl
        ex        af, af'                    ;'
        ld        l, a
        ld        h, 0
        ld        sp, nt_
        add        hl, sp
        ld        sp, hl
        pop        hl
        add        hl, de
        ld        e, (ix + 6)
        ld        d, (ix + 7)
        add        hl, de

csp_:
        ld        sp, 03131h
        ex        (sp), hl
        xor        a
        or        (ix + 5)
        jr        z, ch_amp
        dec        (ix + 5)
        jr        nz, ch_amp
        ld        a, (ix + 22)
        ld        (ix + 5), a
        ld        l, (ix + 23)
        ld        h, (ix + 24)
        ld        a, h
        add        hl, de
        ld        (ix + 6), l
        ld        (ix + 7), h
        bit        2, (ix + 21)
        jr        nz, ch_amp
        ld        e, (ix + 25)
        ld        d, (ix + 26)
        and        a
        jr        z, ch_stpp
        ex        de, hl

ch_stpp:
        sbc        hl, de
        jp        m, ch_amp
        ld        a, (ix + 19)
        ld        (ix + 18), a
        xor        a
        ld        (ix + 5), a
        ld        (ix + 6), a
        ld        (ix + 7), a

ch_amp:
        ld        a, (ix + 2)
        bit        7, c
        jr        z, ch_noam
        bit        6, c
        jr        z, ch_amin
        cp        15
        jr        z, ch_noam
        inc        a
        jr        ch_svam

ch_amin:
        cp        241
        jr        z, ch_noam
        dec        a

ch_svam:
        ld        (ix + 2), a

ch_noam:
        ld        l, a
        ld        a, b
        and        15
        add        a, l
        jp        p, ch_apos
        xor        a

ch_apos:
        cp        16
        jr        c, ch_vol
        ld        a, 15

ch_vol:
        or        (ix + 28)
        ld        l, a
        ld        h, 0
        ld        de, vt_
        add        hl, de
        ld        a, (hl)

ch_env:
        bit        0, c
        jr        nz, ch_noen
        or        (ix + 20)

ch_noen:
        ld        (ampl), a
        bit        7, b
        ld        a, c
        jr        z, no_ensl
        rla
        rla
        sra        a
        sra        a
        sra        a
        add        a, (ix + 4)
        bit        5, b
        jr        z, no_enac
        ld        (ix + 004h), a

no_enac:
        ld        hl, addtoen + 1
        add        a, (hl)
        ld        (hl), a
        jr        ch_mix

no_ensl:
        rra
        add        a, (ix + 3)
        ld        (addtons), a
        bit        5, b
        jr        z, ch_mix
        ld        (ix + 3), a

ch_mix:
        ld        a, b
        rra
        and        72

ch_exit:
        ld        hl, ayregs + ar_mixer
        or        (hl)
        rrca
        ld        (hl), a
        pop        hl
        xor        a
        or        (ix + 10)
        ret        z
        dec        (ix + 10)
        ret        nz
        xor        (ix + 21)
        ld        (ix + 21), a
        rra
        ld        a, (ix + 11)
        jr        c, ch_ondl
        ld        a, (ix + 12)

ch_ondl:
        ld        (ix + 10), a
        ret

play:
        xor        a
        ld        (addtoen + 1), a
        ld        (ayregs + ar_mixer), a
        dec        a
        ld        (ayregs + ar_envtp), a
        ld        hl, delycnt
        dec        (hl)
        jr        nz, pl2
        ld        hl, chana + chp_ntskcn
        dec        (hl)
        jr        nz, pl1b

adinpta:
        ld        bc, $0101
        ld        a, (bc)
        and        a
        jr        nz, pl1a
        ld        d, a
        ld        (ns_base), a

crpsptr        equ $+1

        ld        hl, 0
        inc        hl
        ld        a, (hl)
        inc        a
        jr        nz, plnlp
        call    checklp

lposptr:
        ld        hl, 8481
        ld        a, (hl)
        inc        a
plnlp:
        ld        (crpsptr), hl
        dec        a
        add        a, a
        ld        e, a
        rl        d

patsptr:
        ld        hl, 8481
        add        hl, de
        ld        de, (modaddr + 1)
        ld        (psp_ + 1), sp
        ld        sp, hl
        pop        hl
        add        hl, de
        ld        b, h
        ld        c, l
        pop        hl
        add        hl, de
        ld        (adinptb + 1), hl
        pop        hl
        add        hl, de
        ld        (adinptc + 1), hl

psp_:
        ld        sp, 12593

pl1a:
        ld        ix, chana + 12
        call    ptdecod
        ld        (adinpta + 1), bc

pl1b:
        ld        hl, chanb + chp_ntskcn
        dec        (hl)
        jr        nz, pl1c
        ld        ix, chanb + 12

adinptb:
        ld        bc, 257
        call    ptdecod
        ld        (adinptb + 1), bc

pl1c:
        ld        hl, chanc + chp_ntskcn
        dec        (hl)
        jr        nz, p3x_delay
        ld        ix, chanc + 12

adinptc:
        ld        bc, 257
        call    ptdecod
        ld        (adinptc + 1), bc

p3x_delay:
        ld        a, 62
        ld        (delycnt), a

pl2:
        ld        ix, chana
        ld        hl, (ayregs + ar_tona)
        call    chregs
        ld        (ayregs + ar_tona), hl
        ld        a, (ampl)
        ld        (ayregs + ar_ampla), a
        ld        ix, chanb
        ld        hl, (ayregs + ar_tonb)
        call    chregs
        ld        (ayregs + ar_tonb), hl
        ld        a, (ampl)
        ld        (ayregs + ar_amplb), a
        ld        ix, chanc
        ld        hl, (ayregs + ar_tonc)
        call    chregs
        ld        (ayregs + ar_tonc), hl
        ld        hl, (ns_base_addtons)
        ld        a, h
        add        a, l
        ld        (ayregs + ar_noise), a

addtoen:
        ld        a, 62
        ld        e, a
        add        a, a
        sbc        a, a
        ld        d, a
        ld        hl, (envbase)
        add        hl, de
        ld        de, (curesld)
        add        hl, de
        ld        (ayregs + ar_env), hl
        xor        a
        ld        hl, curedel
        or        (hl)
        jr        z, rout_a0
        dec        (hl)
        jr        nz, rout

env_del:
        ld        a, 62
        ld        (hl), a

esldadd:
        ld        hl, 8481
        add        hl, de
        ld        (curesld), hl

rout:
        xor        a

rout_a0:
;        ld        de, $df0f                ; Zon-X ports
;        ld        bc, $ffdf                ;

;        ld        de, $f5f6                ; TC2068 ports
;        ld        bc, $fff5                ;

        ld        de, $ffbf                ; 128 ports
        ld        bc, $fffd                ;

        ld        hl, ayregs

lout:
        out        (c), a
;        ld        c, e                    ; Zon-X / TC2068
        ld        b, e                    ; 128
        outi
;        ld        c, d                    ; Zon-X / TC2068
        ld        b, d                    ; 128
        inc        a
        cp        $0d
        jr        nz, lout
        out        (c), a
        ld        a, (hl)
        and        a
        ret        m
;        ld        c, e                    ; Zon-X / TC2068
        ld        b, e                    ; 128
        out        (c), a
        ret

t_:

tcold_0:
        defb    $00 + 1, $04 + 1, $08 + 1, $0a + 1, $0c + 1, $0e + 1
        defb    $12 + 1, $14 + 1, $18 + 1, $24 + 1, $3c + 1, 0
tcold_1:
        defb    $5c + 1, 0

tcold_2:
        defb    $30 + 1, $36 + 1, $4c + 1, $52 + 1, $5e + 1, $70 + 1
        defb    $82, $8c, $9c, $9e, $a0, $a6, $a8, $aa, $ac, $ae, $ae, 0

tcnew_3:
        defb    $56 + 1

tcold_3:
        defb    $1e + 1, $22 + 1, $24 + 1, $28 + 1, $2c + 1, $2e + 1
        defb    $32 + 1, $be + 1, 0

tcnew_0:
        defb    $1c + 1, $20 + 1, $22 + 1, $26 + 1, $2a + 1, $2c + 1
        defb    $30 + 1, $54 + 1, $bc + 1, $be + 1, 0

tcnew_1 equ tcold_1

tcnew_2:
        defb    $1a + 1, $20 + 1, $24 + 1, $28 + 1, $2a + 1, $3a + 1
        defb    $4c + 1, $5e + 1, $ba + 1, $bc + 1, $be + 1, 0

emptysamorn equ $ - 1

        defb    1, 0;, $90 ;delete $90 if you don't need default sample

; channel data offsets

chp_psinor    equ 0
chp_psinsm    equ 1
chp_cramsl    equ 2
chp_crnssl    equ 3
chp_crensl    equ 4
chp_tslcnt    equ 5
chp_crtnsl    equ 6
chp_tnacc    equ 8
chp_conoff    equ 10
chp_onoffd    equ 11                        ; ix for ptdecod here ( + 12)
chp_offond    equ 12
chp_ornptr    equ 13
chp_samptr    equ 15
chp_nntskp    equ 17
chp_note    equ 18
chp_sltont    equ 19
chp_env_en    equ 20
chp_flags    equ 21                        ; enabled - 0, simplegliss - 2
chp_tnsldl    equ 22
chp_tslstp    equ 23
chp_tndelt    equ 25
chp_ntskcn    equ 27
chp_volume    equ 28

vars:
chana:
    defs    29
chanb:
    defs    29
chanc:
    defs    29
delycnt:
    defb    0                            ; globalvars
curesld:
    defw    0
curedel:
    defb    0

ns_base_addtons:
ns_base:
    defb    0
addtons:
    defb    0

ar_tona        equ 0                        ; word 1
ar_tonb        equ 2                        ; word 1
ar_tonc        equ 4                        ; word 1
ar_noise    equ 6                        ; byte 1
ar_mixer    equ 7                        ; byte 1
ar_ampla    equ 8                        ; byte 1
ar_amplb    equ 9                        ; byte 1
ar_amplc    equ 10                        ; byte 1
ar_env        equ 11                        ; word 1
ar_envtp    equ 13                        ; byte 1
ar_size        equ 14                        ; byte 1

ayregs        equ $

vt_:
    incbin    "volume.p3v"

envbase        equ vt_ + 14

t1_            equ vt_ + 16                ; tone tables data depacked here

t_old_1        equ t1_
t_old_2        equ t_old_1 + 24
t_old_3        equ t_old_2 + 24
t_old_0        equ t_old_3 + 2
t_new_0        equ t_old_0
t_new_1        equ t_old_1
t_new_2        equ t_new_0 + 24
t_new_3        equ t_old_3

nt_:
    incbin    "notes.p3n"

;local vars
ampl        equ ayregs + ar_amplc
var0end        equ vt_ + 16                ; p3x_init zeroes from vars to
                                        ; var0end - 1
varsend        equ $
mdladdr        equ $

music:
    incbin    "stones.p3x"
END ASM

start:
        PRINT "HELLO"

ASM
        ld        a, 80h            ; high byte of vectr
        ld        i, a            ; store it in I
        call    p3x_init        ; initialize music
        im        2                ; music on
END ASM

Print this item

  A big D on my hat
Posted by: ardentcrest - 02-18-2014, 09:43 AM - Forum: Help & Support - Replies (10)

How do I do,

Code:
dim a$(3)
for f=1to 3
read a$(f)
data "text1","text2","text3"

Print this item

  ZX DESTROYER teaser
Posted by: Alxinho - 02-02-2014, 02:59 PM - Forum: Gallery - Replies (5)

He colgado en Youtube un teaser del juego por si alguien quiere verlo moverse un poco :lol:

Arrow ZX Destroyer teaser

Print this item

  Compile code modules/libraries?
Posted by: slenkar - 01-31-2014, 06:40 PM - Forum: Wishlist - No Replies

Is it possible with the new compiler to compile a .bas into a library?

Like .lib files in the C language

Once they are compiled they dont need to be compiled again unless changed.

Speeds up compilation a lot


-I compiled my speccywars game again and it worked perfectly
its the same size too

Print this item