Poster un nouveau sujet Poster une réponse
[ASM] Portage d'une routine de son ZX Spectrum
Auteur Message
non
Invité
Posté le : Jeu 02 Aoû 2012, 17:27   Citer 

Salut,

Permettez-moi de me présenter, je suis un musicien qui fait la musique 1-bit avec le ZX Spectrum. Excusez mon français, j'utilise google translate winkle.gif

Récemment, j'ai trouvé mon vieil TI-82. Depuis ZX Spectrum et TI-82 sont des machines très similaires, il pourrait être possible de porter certaines routines de son avec des multiples canaux.

Malheureusement, je ne sais pas très bien l'Assembler. Alors, quelqu'un pourrait-il s'il vous plaît m'aider adapter la routine ci-dessous (pas écrit par moi, bien sûr)?

Je pense que les principaux problèmes sera:

-Data Out et Key Input sont différents, bien sûr.
-ZX Spectrum Z80 est plus lent (3,5 MHz), de sorte que la routine doit être ralentie.
-Bit 7 de la sortie sur ZX définit la couleur de la bordure d'ecran, devrait probablement être désactivé.

Toutes les idées comment cela peut être réalisé?


Code

;Huby beeper music engine by Shiru (shiru@mail.ru) 04'11
;Two channels of tone, no volume, global speed
;One drum, replaces note on the first channel
;The main feature of this engine is the size, just 100 bytes
;Feel free to do whatever you want with the code, it is PD


OP_INCL      equ #2c

   module huby
   
play
   ld e,(hl)         ;read speed word
   inc hl
   ld d,(hl)
   inc hl
   ld (readRow.speed),de      ;store it
   ld e,(hl)         ;read patterns offset
   inc hl
   ld d,(hl)         ;it will be always in DE, and HL is order list pointer now

readPos
   inc hl
   ld a,(hl)         ;read first byte of order list
   or a
   ret z            ;if it is zero, it is end of the song
   inc hl
   push hl            ;store order list pointer
   push de            ;store patterns offset
   ld l,(hl)         ;read second byte of order list
   ld bc,2*256         ;calculate addresses of two patterns
.read
   ld h,c            ;pattern number*8
   add hl,hl
   add hl,hl
   add hl,hl
   add hl,de         ;add patterns offset
   push hl            ;store pattern address
   ld l,a            ;now second address
   djnz .read
   exx
   pop hl            ;restore pattern addressed in alternative set
   pop de

   ld b,8            ;play 8 rows
readRow
   ld a,(hl)         ;read first note
   inc hl            ;increase first pattern pointer
   exa
   ld a,(de)         ;read second note
   inc de            ;increase second pattern pointer
   exx
   ld h,a
   exa
   ld l,a
   cp OP_INCL         ;if first note is #2c, it is drum sound
   jr z,$+3
   xor a
   ld (soundLoop.slide),a
.speed=$+1
   ld bc,0
   di

soundLoop
   xor a            ;clear carry and set A to zero
   dec e            ;counter of first channel
   jr nz,.l1
   ld e,l            ;reload if overflow
   sub l            ;and set carry if note is not zero (mute)
.slide=$
   nop            ;slide for drum
.l1
   dec d            ;counter of second channel
   jr nz,.l2
   ld d,h            ;reload if overflow
   sub h            ;and set carry if note is not zero (mute)
.l2
   sbc a,a            ;if carry, A=255, otherwise A=0
   and 16
   out (#fe),a

   in a,(#fe)         ;read keyboard
   cpl
   and #1f
   jr nz,.l3         ;if any key is pressed, exit loop

   dec bc
   ld a,b
   or c
   jr nz,soundLoop         ;113/123t

.l3
   ld hl,#2758         ;restore alternative HL to default value
   exx
   ei
   
   jr nz,$+4         ;if any key was pressed, break loop
   djnz readRow

   pop de
   pop hl
   jr z,readPos         ;if no key was pressed, continue
   ret

   endmodule



  Haut de page Bas de page 
 
The K



Autorisation : Membre
Nb de messages : 850
Inscrit le : Sam 15 Oct 2011, 11:07
Posté le : Jeu 02 Aoû 2012, 19:27   Citer 

If you want we can write in english winkle.gif

I personally do not know assembly for TI-82, but maybe some people like Matrefeytontias can help you. (or Linkakro, M@thieu41 ... dunno ^^)

But now, I will ask a question for them : is it and old TI-82, or a TI-82 STATS ?

----------------------
La la la ...

Avez-vous pensé à regarder le manuel avant de demander conseil ? Un manuel est fait avant tout pour être consulté : MANUEL

Vous avez un problème avec l'ordinateur avec votre calculatrice ? SOLUTION EN VIDEO

Mes programmes sur le site : Produit scalaire KMorpion Puissance 4 Mastermind

Mes nouveaux programmes de calcul formel : FCarré FPrime

Projet base de données : ici mais abandonné. Trop de travail ...
 Adresse email Haut de page Bas de page 
 
Google_AdSense



Publicité    



 
utz



Autorisation : Membre
Nb de messages : 11
Inscrit le : Jeu 02 Aoû 2012, 16:20
Posté le : Jeu 02 Aoû 2012, 19:40   Citer 

Oh good, English will be easier for sure.

To answer your question, I have the old TI-82, with ROM 19.0

M@thieu41? That wouldn't happen to be the Mathieu who wrote BeatBox and such?

 Adresse email Haut de page Bas de page 
 
The K



Autorisation : Membre
Nb de messages : 850
Inscrit le : Sam 15 Oct 2011, 11:07
Posté le : Jeu 02 Aoû 2012, 21:17   Citer 

I dont think it is that Mathieu ^^

(but if it's him ... ahh.gif )

Old TI-82 ? Hum.

This makes the difference, that, for the TI-82 STATS / stats.fr (french version we almost all have), we use a TI-83 assembly, which may not be the same as the TI-82 (non stats) one. So ... I don't know.

Let's see other's answers tongue.gif

----------------------
La la la ...

Avez-vous pensé à regarder le manuel avant de demander conseil ? Un manuel est fait avant tout pour être consulté : MANUEL

Vous avez un problème avec l'ordinateur avec votre calculatrice ? SOLUTION EN VIDEO

Mes programmes sur le site : Produit scalaire KMorpion Puissance 4 Mastermind

Mes nouveaux programmes de calcul formel : FCarré FPrime

Projet base de données : ici mais abandonné. Trop de travail ...
 Adresse email Haut de page Bas de page 
 
linkakro



Autorisation : Membre
Nb de messages : 3738
Inscrit le : Lun 19 Oct 2009, 21:25
Posté le : Jeu 02 Aoû 2012, 21:48   Citer 

ZX-Spectrum and Ti82/Ti82stat have indeed the same processor family.

However Ti82 is not designed to run assembly, contrary to ti82stat.
You may already know about it, but i want to explain it.
You must use a special program called shell to force your ti82 to run assembly programs.
The most recommended shell is Crash.
(But you must use a special version of Crash for 19.006 operating system of ti82.
Check your OS with mode+alpha+S without press enter)

Furthermore ti82 and ti82stat are quite different.
Ti82stat and ti82statfr are ti83 based systems.
(not mix up with ti83plus very different too)

Our forum is no longer a really good reference about ti82.
Today we are better treating ti82stat than ti82.
Furthermore few of us wrote in assembly, wether it is ti82/ti82stat.

I am not enough competent about assembly to help you alone, but i can search how your source works.

Please tell us which software you would use to compile this project to use it on your ZX.
That information can allow us to search more help about compiler instructions.

Have ZX an sound enclose peripheral or a sound external peripheral ?

You may find more help in Omnimaga : they are an english-speaking programming community.

I searched ti82 assembly sites but i did not find enough good stuff.

----------------------
ti82statfr: 2008, inscrit: 2009, ti84pocketfr: noël2011, ti30xbmultiview: iut 2012-2014
Perfectionniste, manque tact. Pas le temps de tout publier depuis 2011. Répond toujours aux questions. (rédigé juin 2014)

Pour tout le monde et surtout les débutants, quelques-uns des articles courants :
*Traductions Algorithmie/Ti-Basic.
*Caractères spéciaux sur Tout82
Les défauts du TI-Basic : Goto_versus_algo et DelVar/End/Lbl/guillemet/store
 Adresse email Haut de page Bas de page 
 
matrefeytontias



Autorisation : Membre
Nb de messages : 109
Inscrit le : Lun 25 Jui 2012, 15:51
Posté le : Jeu 02 Aoû 2012, 22:14   Citer 

Sounds with a TI works with outputs from the mini-jack port ; and I saw several instr (module, endmodule, exa ...) which I don't know as Z80 instr, so I doubt that you can port your ZX code to a TI-82 without rewriting it entirely.

----------------------
Apprenez l'hexadécimal z80 ! Nan, vous n'êtes pas obligés de vouloir mourir, mais ça peut aider : https://espace-ti.forumactif.com/t576-programmer-en-hexadecimal-c-est-possible
 Adresse email Haut de page Bas de page 
 
utz



Autorisation : Membre
Nb de messages : 11
Inscrit le : Jeu 02 Aoû 2012, 16:20
Posté le : Jeu 02 Aoû 2012, 23:26   Citer 

thank you all for your interest.

@matrefeytontias: the module/endmodule instructions can safely be ignored, they are only relevant for ZX assembly. On Crash there's no need to define the beginning/end of the code, as far as I understand. As for the OP_INCL, ignore it at the beginning and replace with $2c in the code. everything else should be either genuine Z80 instructions, or labels.


@linkakro: Yes, I have Crash installed. And luckily I have ROM 19.0, not 19.006.

This code is optimized for compilation with Sjasmplus - https://sourceforge.net/projects/sjasmplus/
However, ignoring the module/endmodule and OP_INCL pseudo-ops, it should work with nearly any Z80 assembler. It seems TASM is recommended for TI82 assembly.
Anyway, what I posted above is only the playback routine. If you want to try compiling it for ZX Spectrum, you will need some additional files, which can be found here: http://shiru.untergrund.net/files/zx/huby.zip (16kb) Documentation about compiling is included. Of course you will need a ZX Spectrum emulator too - try this one: https://fuse-emulator.sourceforge.net/

Sound on original ZX Spectrum works by sending a bitstream to the MIC (Data out) port (Port $FE). There is an internal beeper, too (similar to PC Speaker), but nobody uses it. The MIC port is a 3,5" mono jack one. There is a second one for input. So after all, a fairly similar principle like on TI. The difference seems to be however, that on TI the link port must be explicitly switched on and off, while on ZX there is a special transducer chip (ULA) which does that automatically depending on whether you send 0's or 1's through it. I don't really understand how it works on TI, though.

There's some sound related stuff at ticalc.org... tried implementing it, but just ended up crashing the calc instead maxiangry.gif

Thanks for pointing me to Omnimaga, I'll ask there, too. I didn't even know any English speaking TI forums existed, that's why I came here winkle.gif However they seem to be more focused on TI83 and later models...


@The K: yeah, TI-82 (non stats) is getting old, it seems. For me it's kind of retro, brings back high school memories and such clown.gif still, TI-83 asm shouldn't be too far away from TI-82. ROM calls will be different, of course, but this routine uses only one anyway, for reading the keyboard. And port numbers will be different, I suppose.

 Adresse email Haut de page Bas de page 
 
matrefeytontias



Autorisation : Membre
Nb de messages : 109
Inscrit le : Lun 25 Jui 2012, 15:51
Posté le : Ven 03 Aoû 2012, 8:59   Citer 

Theorically, you just have to adapt the port number and all things related to hardware, and it should work with your TI happy.gif

----------------------
Apprenez l'hexadécimal z80 ! Nan, vous n'êtes pas obligés de vouloir mourir, mais ça peut aider : https://espace-ti.forumactif.com/t576-programmer-en-hexadecimal-c-est-possible
 Adresse email Haut de page Bas de page 
 
Google_AdSense



Publicité    



 
linkakro



Autorisation : Membre
Nb de messages : 3738
Inscrit le : Lun 19 Oct 2009, 21:25
Posté le : Sam 04 Aoû 2012, 1:27   Citer 

Can someone explain me what mean " ld (soundLoop.slide),a " ?
I do not understand what mean two labels in a load instruction.

----------------------
ti82statfr: 2008, inscrit: 2009, ti84pocketfr: noël2011, ti30xbmultiview: iut 2012-2014
Perfectionniste, manque tact. Pas le temps de tout publier depuis 2011. Répond toujours aux questions. (rédigé juin 2014)

Pour tout le monde et surtout les débutants, quelques-uns des articles courants :
*Traductions Algorithmie/Ti-Basic.
*Caractères spéciaux sur Tout82
Les défauts du TI-Basic : Goto_versus_algo et DelVar/End/Lbl/guillemet/store
 Adresse email Haut de page Bas de page 
 
matrefeytontias



Autorisation : Membre
Nb de messages : 109
Inscrit le : Lun 25 Jui 2012, 15:51
Posté le : Sam 04 Aoû 2012, 1:50   Citer 

.slide is not a label but an equate (which equals to PC), or maybe there's a typo somewhere ? I must admit that I don't understand too.

----------------------
Apprenez l'hexadécimal z80 ! Nan, vous n'êtes pas obligés de vouloir mourir, mais ça peut aider : https://espace-ti.forumactif.com/t576-programmer-en-hexadecimal-c-est-possible
 Adresse email Haut de page Bas de page 
 
utz



Autorisation : Membre
Nb de messages : 11
Inscrit le : Jeu 02 Aoû 2012, 16:20
Posté le : Sam 04 Aoû 2012, 12:20   Citer 

not 100% sure what's going on there, but i think it's an equate for ld (pq),a, where pq = soundLoop, sub-label slide. definately not a typo, since the routine works fine on ZX.

exa is ex af,af', btw.


Citer

Theorically, you just have to adapt the port number and all things related to hardware, and it should work with your TI



Basically, yes. Sadly I don't know how, really. Especially the port numbers are a problem - on ZX you can do a direct "out ($fe),a", since only bit 4 gets sent anyway. On TI you must switch explicitly with $0c0 and $0fc, as far as I understand.

ed: typo fixed

 Adresse email Haut de page Bas de page 
 
matrefeytontias



Autorisation : Membre
Nb de messages : 109
Inscrit le : Lun 25 Jui 2012, 15:51
Posté le : Sam 04 Aoû 2012, 12:36   Citer 

On a TI, the keyboard is the port $01 and the link port is the port $00.

EXA doesn't exist on TIs.

I don't know if sound is working the same way with a ZX and a TI, but on a TI, you have to apply a transfer protocol to send the byte since the link port only can send 2 bits (on 2 subports : the first (high) is called "tip", and the second (middle) "ring").

----------------------
Apprenez l'hexadécimal z80 ! Nan, vous n'êtes pas obligés de vouloir mourir, mais ça peut aider : https://espace-ti.forumactif.com/t576-programmer-en-hexadecimal-c-est-possible
 Adresse email Haut de page Bas de page 
 
linkakro



Autorisation : Membre
Nb de messages : 3738
Inscrit le : Lun 19 Oct 2009, 21:25
Posté le : Sam 04 Aoû 2012, 14:02   Citer 

You can create EXA mnemonic by a directive since ex af,af' should exist.
It's a z80 instruction, it's not a TI instruction as far i know.
Except if the processor is restrained, that i do not believe.
.addinstr exa "" 08 1 NOP 1 ; 08 is opcode of "ex af,af'"
I hope it's right, otherwise we can replace directly exa by "ex af,af'".

I searched documentation about sjasmplus but i found nothing helping me understanding labels.


Citer
not 100% sure what's going on there, but i think it's an equate for ld (pq),a, where pq = soundLoop, sub-label slide. definately not a typo, since the routine works fine on ZX.

I do not know this kind of "sub-labels".
The ld instruction seems to write numbers in the program himself since labels are replaced by program address.
But "SoundLoop" is not followed by datas contrary to ".speed".
So it must overwrite instructions of program.
Furthermore ".speed=$+01" seems to be a compiler directive assigning a value to the label.

I will try to copy programs to adapt this one to the jack port then i will test it with my earpiece.

----------------------
ti82statfr: 2008, inscrit: 2009, ti84pocketfr: noël2011, ti30xbmultiview: iut 2012-2014
Perfectionniste, manque tact. Pas le temps de tout publier depuis 2011. Répond toujours aux questions. (rédigé juin 2014)

Pour tout le monde et surtout les débutants, quelques-uns des articles courants :
*Traductions Algorithmie/Ti-Basic.
*Caractères spéciaux sur Tout82
Les défauts du TI-Basic : Goto_versus_algo et DelVar/End/Lbl/guillemet/store
 Adresse email Haut de page Bas de page 
 
utz



Autorisation : Membre
Nb de messages : 11
Inscrit le : Jeu 02 Aoû 2012, 16:20
Posté le : Sam 04 Aoû 2012, 16:05   Citer 

Replacing exa with ex af,af' should work fine.

In this case the sub-label thing is mainly for improving readability of the code. so ld (soundLoop.slide),a should technically be the same as ld (.slide),a. Normally the reason for those, and the prefixing with ".", is to limit the label's validity to a certain part (module) of the code; so if a programmer wants to include the routine in a game/demo, there's no need to worry about duplicate label names.

In any case it seems TASM doesn't like labels that are prefixed with a ".", so probably all those need to be renamed.

As far as the ".speed=$+01" thing goes, I'm not sure. I think it means "add 1 to the program counter". So my guess it that the TASM equivalent would be

Code

      .byte $00
speed ..


Anyway I'll ask about this at ZX forums and come back with an answer later.

EDIT: Ok, so the guys at worldofspectrum.org suggested that

speed equ $+1

should work in TASM instead of .speed=$+1.

So, let me wrap up the changes to the code so far. I've also added some song data at the end.


Code

.INCLUDE CRASH82.INC
.DB "HUBY 1-BIT TI82", 0
#define db .byte
#define dw .word

;Huby beeper music engine by Shiru (shiru@mail.ru) 04'11
;Two channels of tone, no volume, global speed
;One drum, replaces note on the first channel
;The main feature of this engine is the size, just 100 bytes
;Feel free to do whatever you want with the code, it is PD


   ld hl,musicData
   call play
   
play
   ld e,(hl)         ;read speed word
   inc hl
   ld d,(hl)
   inc hl
   ld (speed),de         ;store it
   ld e,(hl)         ;read patterns offset
   inc hl
   ld d,(hl)         ;it will be always in DE, and HL is order list pointer now

readPos
   inc hl
   ld a,(hl)         ;read first byte of order list
   or a
   ret z            ;if it is zero, it is end of the song
   inc hl
   push hl            ;store order list pointer
   push de            ;store patterns offset
   ld l,(hl)         ;read second byte of order list
   ld bc,2*256         ;calculate addresses of two patterns
read
   ld h,c            ;pattern number*8
   add hl,hl
   add hl,hl
   add hl,hl
   add hl,de         ;add patterns offset
   push hl            ;store pattern address
   ld l,a            ;now second address
   djnz read
   exx
   pop hl            ;restore pattern addressed in alternative set
   pop de

   ld b,8            ;play 8 rows
readRow
   ld a,(hl)         ;read first note
   inc hl            ;increase first pattern pointer
   ex af,af'
   ld a,(de)         ;read second note
   inc de            ;increase second pattern pointer
   exx
   ld h,a
   ex af,af'
   ld l,a
   cp $2c            ;if first note is $2c, it is drum sound
   jr z,$+3
   xor a
   ld (slide),a
speed equ $+1
   ld bc,0
   di

soundLoop
   xor a            ;clear carry and set A to zero
   dec e            ;counter of first channel
   jr nz,l1
   ld e,l            ;reload if overflow
   sub l            ;and set carry if note is not zero (mute)
slide equ $
   nop            ;slide for drum
l1
   dec d            ;counter of second channel
   jr nz,l2
   ld d,h            ;reload if overflow
   sub h            ;and set carry if note is not zero (mute)
l2
   sbc a,a            ;if carry, A=255, otherwise A=0
   and 16            ;need a good way to ld a,$c0 / ld a,$fc here
   out (0),a

   in a,(1)         ;read keyboard
   cpl            ;this must probably be adapted
   and $1f
   jr nz,l3         ;if any key is pressed, exit loop

   dec bc
   ld a,b
   or c
   jr nz,soundLoop   ;113/123t

l3
   ld hl,$2758         ;restore alternative HL to default value
   exx
   ei
   
   jr nz,$+4         ;if any key was pressed, break loop
   djnz readRow

   pop de
   pop hl
   jr z,readPos         ;if no key was pressed, continue
   ret

musicData
   dw $06f3
   dw p-8
   db $01,$02
   db $01,$02
   db $03,$02
   db $04,$02
   db $05,$02
   db $06,$02
   db $07,$02
   db $01,$02
   db $01,$02
   db $03,$02
   db $04,$02
   db $05,$02
   db $06,$02
   db $07,$02
   db $08,$09
   db $01,$0a
   db $03,$0b
   db $04,$0c
   db $05,$0d
   db $06,$0d
   db $07,$0e
   db $01,$0a
   db $01,$0f
   db $03,$10
   db $04,$11
   db $05,$12
   db $06,$13
   db $07,$14
   db $08,$09
   db $01,$0a
   db $03,$0b
   db $04,$0c
   db $05,$0d
   db $06,$0d
   db $07,$0e
   db $01,$0a
   db $01,$0f
   db $03,$10
   db $04,$15
   db $05,$16
   db $06,$17
   db $07,$18
   db $01,$02
   db $01,$02
   db $03,$02
   db $04,$02
   db $05,$02
   db $06,$02
   db $07,$02
   db $01,$02
   db $01,$02
   db $03,$02
   db $04,$02
   db $05,$02
   db $06,$02
   db $07,$02
   db $19,$1a
   db $19,$1b
   db $1c,$1d
   db $1e,$1f
   db $20,$21
   db $22,$23
   db $24,$25
   db $19,$1a
   db $19,$1a
   db $1c,$1d
   db $1e,$1f
   db $20,$26
   db $27,$28
   db $02,$29
   db $19,$1a
   db $19,$1b
   db $1c,$1d
   db $1e,$1f
   db $20,$21
   db $22,$23
   db $24,$25
   db $19,$1a
   db $19,$1a
   db $1c,$1d
   db $1e,$1f
   db $20,$26
   db $22,$2a
   db $2b,$2c
   db $2d,$2e
   db $2f,$30
   db $31,$32
   db $33,$34
   db $35,$36
   db $37,$36
   db $38,$39
   db $2f,$30
   db $2f,$3a
   db $31,$3b
   db $33,$3c
   db $35,$3d
   db $37,$3e
   db $38,$3f
   db $40,$41
   db $19,$42
   db $1c,$43
   db $44,$45
   db $46,$47
   db $22,$47
   db $48,$49
   db $19,$42
   db $19,$0a
   db $1c,$4a
   db $44,$4b
   db $20,$4c
   db $4d,$4e
   db $07,$18
   db $01,$02
   db $01,$02
   db $03,$02
   db $04,$02
   db $05,$02
   db $06,$02
   db $07,$02
   db $19,$02
   db $19,$02
   db $1c,$02
   db $1e,$02
   db $20,$02
   db $4f,$02
   db $50,$02
   db $01,$02
   db $01,$02
   db $03,$02
   db $04,$02
   db $05,$02
   db $06,$02
   db $07,$02
   db $19,$02
   db $19,$02
   db $1c,$02
   db $51,$02
   db $02,$02
   db $52,$02
   db $50,$02
   db $00
p
   db $be,$be,$5f,$50,$3f,$00,$00,$00
   db $00,$00,$00,$00,$00,$00,$00,$00
   db $d6,$d6,$d6,$d6,$d6,$d6,$ca,$ca
   db $ca,$ca,$ca,$ca,$be,$be,$5f,$50
   db $3f,$00,$00,$00,$be,$be,$5f,$50
   db $3f,$00,$00,$00,$d6,$d6,$d6,$d6
   db $d6,$d6,$ca,$ca,$ca,$ca,$ca,$ca
   db $be,$be,$5f,$50,$00,$00,$00,$00
   db $5f,$5f,$5f,$5f,$3f,$3f,$00,$00
   db $3f,$3f,$3f,$3f,$47,$47,$00,$00
   db $47,$47,$47,$47,$50,$50,$54,$54
   db $00,$00,$00,$00,$50,$50,$50,$50
   db $54,$54,$00,$00,$50,$50,$50,$50
   db $47,$47,$3f,$3f,$00,$00,$00,$00
   db $47,$47,$47,$47,$50,$50,$00,$00
   db $50,$50,$50,$50,$54,$54,$5f,$5f
   db $5f,$00,$00,$00,$54,$54,$54,$54
   db $50,$50,$00,$00,$50,$50,$50,$50
   db $47,$47,$00,$00,$47,$47,$47,$47
   db $3f,$3f,$00,$00,$3f,$00,$3f,$00
   db $5f,$00,$00,$00,$54,$54,$50,$50
   db $47,$47,$00,$00,$3f,$3f,$47,$47
   db $50,$50,$00,$00,$3f,$3f,$3f,$47
   db $47,$47,$50,$50,$50,$00,$00,$00
   db $a9,$a9,$54,$47,$38,$00,$00,$00
   db $fe,$fe,$a9,$8e,$71,$00,$00,$00
   db $fe,$fe,$fe,$8e,$71,$00,$00,$00
   db $be,$be,$be,$be,$be,$be,$b3,$b3
   db $bd,$bd,$bd,$bd,$bd,$bd,$b2,$b2
   db $b3,$b3,$b3,$b3,$a9,$a9,$54,$47
   db $b2,$b2,$b2,$b2,$fe,$fe,$a9,$8e
   db $38,$00,$00,$00,$a9,$a9,$54,$47
   db $71,$00,$00,$00,$fe,$fe,$fe,$00
   db $38,$00,$00,$00,$be,$be,$be,$be
   db $00,$00,$00,$00,$71,$71,$71,$71
   db $be,$be,$be,$7f,$7f,$7f,$7f,$7f
   db $8e,$8e,$8e,$a9,$a9,$a9,$a9,$a9
   db $71,$00,$00,$00,$fe,$fe,$00,$00
   db $38,$00,$00,$00,$00,$00,$00,$00
   db $00,$00,$00,$00,$fe,$d6,$a9,$7f
   db $6b,$54,$47,$3f,$35,$2a,$23,$1c
   db $00,$00,$00,$00,$7f,$7f,$7f,$7f
   db $be,$be,$be,$b3,$b3,$b3,$b3,$b3
   db $78,$78,$78,$71,$71,$71,$71,$71
   db $a0,$a0,$50,$43,$00,$00,$00,$00
   db $50,$50,$50,$50,$35,$35,$00,$00
   db $a0,$a0,$50,$43,$35,$00,$00,$00
   db $35,$35,$35,$35,$3c,$3c,$00,$00
   db $b3,$b3,$b3,$b3,$b3,$b3,$a9,$a9
   db $3c,$3c,$3c,$3c,$43,$43,$47,$47
   db $a9,$a9,$a9,$a9,$a0,$a0,$50,$43
   db $00,$00,$00,$00,$43,$43,$43,$43
   db $35,$00,$00,$00,$a0,$a0,$50,$43
   db $47,$47,$00,$00,$43,$43,$43,$43
   db $35,$00,$00,$00,$b3,$b3,$b3,$b3
   db $b3,$b3,$a9,$a9,$a9,$a9,$a9,$a9
   db $3c,$3c,$35,$35,$00,$00,$00,$00
   db $3c,$3c,$3c,$3c,$43,$43,$00,$00
   db $43,$43,$43,$43,$47,$47,$50,$50
   db $50,$00,$00,$00,$47,$47,$47,$47
   db $43,$43,$00,$00,$43,$43,$43,$43
   db $3c,$3c,$00,$00,$3c,$3c,$3c,$3c
   db $35,$35,$00,$00,$35,$00,$35,$00
   db $a9,$a9,$54,$47,$00,$00,$00,$00
   db $54,$54,$54,$54,$38,$38,$00,$00
   db $38,$38,$38,$38,$3f,$3f,$00,$00
   db $3f,$3f,$3f,$3f,$47,$47,$4b,$4b
   db $b3,$b3,$b3,$b3,$a9,$a9,$54,$4b
   db $00,$00,$00,$00,$47,$47,$47,$47
   db $38,$00,$00,$00,$a9,$a9,$54,$4b
   db $4b,$4b,$00,$00,$47,$47,$47,$47
   db $be,$be,$b3,$b3,$b3,$b3,$b3,$b3
   db $3f,$3f,$38,$38,$00,$00,$00,$00
   db $47,$47,$47,$47,$4b,$4b,$54,$54
   db $54,$00,$00,$00,$4b,$4b,$47,$47
   db $3f,$3f,$00,$00,$38,$38,$3f,$3f
   db $38,$00,$00,$00,$d6,$d6,$d6,$d6
   db $47,$47,$00,$00,$3f,$3f,$3f,$47
   db $38,$00,$00,$00,$a9,$a9,$a9,$a9
   db $a9,$a9,$b3,$b3,$b3,$b3,$b3,$b3
   db $b3,$b3,$b3,$b3,$a9,$a9,$a9,$00
   db $00,$00,$00,$00,$a9,$a9,$a9,$a9




 Adresse email Haut de page Bas de page 
 
linkakro



Autorisation : Membre
Nb de messages : 3738
Inscrit le : Lun 19 Oct 2009, 21:25
Posté le : Sam 04 Aoû 2012, 23:01   Citer 

But "equ" directive is not written in compiled program ?! Why placing an equ in the middle of a program ?

Have you a compilation listing of the zx code ?
I want to compare hexadecimal and source to be sure about the working of speed and slide labels.
If you have not got it i will have only to download sjasmplus.

----------------------
ti82statfr: 2008, inscrit: 2009, ti84pocketfr: noël2011, ti30xbmultiview: iut 2012-2014
Perfectionniste, manque tact. Pas le temps de tout publier depuis 2011. Répond toujours aux questions. (rédigé juin 2014)

Pour tout le monde et surtout les débutants, quelques-uns des articles courants :
*Traductions Algorithmie/Ti-Basic.
*Caractères spéciaux sur Tout82
Les défauts du TI-Basic : Goto_versus_algo et DelVar/End/Lbl/guillemet/store
 Adresse email Haut de page Bas de page 
 
utz



Autorisation : Membre
Nb de messages : 11
Inscrit le : Jeu 02 Aoû 2012, 16:20
Posté le : Dim 05 Aoû 2012, 3:18   Citer 

Don't ask me, it doesn't make much sense to me either. I still think my original explanation with .byte $00 is better...

Anyway I don't have a proper hex listing, but I used bin2asm on the compiled binary. should be close enough, but possibly the byte at the location in question has been overwritten already.


Code


defb 021h,06Dh,0C0h,0CDh,009h,0C0h,0C3h,000h,0C0h,05Eh,023h,056h,023h,0EDh,053h,03Fh
defb 0C0h,05Eh,023h,056h,023h,07Eh,0B7h,0C8h,023h,0E5h,0D5h,06Eh,001h,000h,002h,061h
defb 029h,029h,029h,019h,0E5h,06Fh,010h,0F7h,0D9h,0E1h,0D1h,006h,008h,07Eh,023h,008h
defb 01Ah,013h,0D9h,067h,008h,06Fh,0FEh,02Ch,028h,001h,0AFh,032h,048h,0C0h,001h,000h
defb 000h,0F3h,0AFh,01Dh,020h,003h,05Dh,095h,000h,015h,020h,002h,054h,094h,09Fh,0E6h
defb 010h,0D3h,0FEh,0DBh,0FEh,02Fh,0E6h,01Fh,020h,005h,00Bh,078h,0B1h,020h,0E3h,021h
defb 058h,027h,0D9h,0FBh,020h,002h,010h,0C5h,0D1h,0E1h,028h,0A8h,0C9h,0F3h,006h,082h
defb 0C1h,001h,002h,001h,002h,003h,002h,004h,002h,005h,002h,006h,002h,007h,002h,001h
defb 002h,001h,002h,003h,002h,004h,002h,005h,002h,006h,002h,007h,002h,008h,009h,001h
defb 00Ah,003h,00Bh,004h,00Ch,005h,00Dh,006h,00Dh,007h,00Eh,001h,00Ah,001h,00Fh,003h
defb 010h,004h,011h,005h,012h,006h,013h,007h,014h,008h,009h,001h,00Ah,003h,00Bh,004h
defb 00Ch,005h,00Dh,006h,00Dh,007h,00Eh,001h,00Ah,001h,00Fh,003h,010h,004h,015h,005h
defb 016h,006h,017h,007h,018h,001h,002h,001h,002h,003h,002h,004h,002h,005h,002h,006h
defb 002h,007h,002h,001h,002h,001h,002h,003h,002h,004h,002h,005h,002h,006h,002h,007h
defb 002h,019h,01Ah,019h,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,019h
defb 01Ah,019h,01Ah,01Ch,01Dh,01Eh,01Fh,020h,026h,027h,028h,002h,029h,019h,01Ah,019h
defb 01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,019h,01Ah,019h,01Ah,01Ch
defb 01Dh,01Eh,01Fh,020h,026h,022h,02Ah,02Bh,02Ch,02Dh,02Eh,02Fh,030h,031h,032h,033h
defb 034h,035h,036h,037h,036h,038h,039h,02Fh,030h,02Fh,03Ah,031h,03Bh,033h,03Ch,035h
defb 03Dh,037h,03Eh,038h,03Fh,040h,041h,019h,042h,01Ch,043h,044h,045h,046h,047h,022h
defb 047h,048h,049h,019h,042h,019h,00Ah,01Ch,04Ah,044h,04Bh,020h,04Ch,04Dh,04Eh,007h
defb 018h,

;data section starts here
001h,002h,001h,002h,003h,002h,004h,002h,005h,002h,006h,002h,007h,002h,019h
defb 002h,019h,002h,01Ch,002h,01Eh,002h,020h,002h,04Fh,002h,050h,002h,001h,002h,001h
defb 002h,003h,002h,004h,002h,005h,002h,006h,002h,007h,002h,019h,002h,019h,002h,01Ch
defb 002h,051h,002h,002h,002h,052h,002h,050h,002h,000h,0BEh,0BEh,05Fh,050h,03Fh,000h
defb 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0D6h,0D6h,0D6h,0D6h,0D6h,0D6h
defb 0CAh,0CAh,0CAh,0CAh,0CAh,0CAh,0BEh,0BEh,05Fh,050h,03Fh,000h,000h,000h,0BEh,0BEh
defb 05Fh,050h,03Fh,000h,000h,000h,0D6h,0D6h,0D6h,0D6h,0D6h,0D6h,0CAh,0CAh,0CAh,0CAh
defb 0CAh,0CAh,0BEh,0BEh,05Fh,050h,000h,000h,000h,000h,05Fh,05Fh,05Fh,05Fh,03Fh,03Fh
defb 000h,000h,03Fh,03Fh,03Fh,03Fh,047h,047h,000h,000h,047h,047h,047h,047h,050h,050h
defb 054h,054h,000h,000h,000h,000h,050h,050h,050h,050h,054h,054h,000h,000h,050h,050h
defb 050h,050h,047h,047h,03Fh,03Fh,000h,000h,000h,000h,047h,047h,047h,047h,050h,050h
defb 000h,000h,050h,050h,050h,050h,054h,054h,05Fh,05Fh,05Fh,000h,000h,000h,054h,054h
defb 054h,054h,050h,050h,000h,000h,050h,050h,050h,050h,047h,047h,000h,000h,047h,047h
defb 047h,047h,03Fh,03Fh,000h,000h,03Fh,000h,03Fh,000h,05Fh,000h,000h,000h,054h,054h
defb 050h,050h,047h,047h,000h,000h,03Fh,03Fh,047h,047h,050h,050h,000h,000h,03Fh,03Fh
defb 03Fh,047h,047h,047h,050h,050h,050h,000h,000h,000h,0A9h,0A9h,054h,047h,038h,000h
defb 000h,000h,0FEh,0FEh,0A9h,08Eh,071h,000h,000h,000h,0FEh,0FEh,0FEh,08Eh,071h,000h
defb 000h,000h,0BEh,0BEh,0BEh,0BEh,0BEh,0BEh,0B3h,0B3h,0BDh,0BDh,0BDh,0BDh,0BDh,0BDh
defb 0B2h,0B2h,0B3h,0B3h,0B3h,0B3h,0A9h,0A9h,054h,047h,0B2h,0B2h,0B2h,0B2h,0FEh,0FEh
defb 0A9h,08Eh,038h,000h,000h,000h,0A9h,0A9h,054h,047h,071h,000h,000h,000h,0FEh,0FEh
defb 0FEh,000h,038h,000h,000h,000h,0BEh,0BEh,0BEh,0BEh,000h,000h,000h,000h,071h,071h
defb 071h,071h,0BEh,0BEh,0BEh,07Fh,07Fh,07Fh,07Fh,07Fh,08Eh,08Eh,08Eh,0A9h,0A9h,0A9h
defb 0A9h,0A9h,071h,000h,000h,000h,0FEh,0FEh,000h,000h,038h,000h,000h,000h,000h,000h
defb 000h,000h,000h,000h,000h,000h,0FEh,0D6h,0A9h,07Fh,06Bh,054h,047h,03Fh,035h,02Ah
defb 023h,01Ch,000h,000h,000h,000h,07Fh,07Fh,07Fh,07Fh,0BEh,0BEh,0BEh,0B3h,0B3h,0B3h
defb 0B3h,0B3h,078h,078h,078h,071h,071h,071h,071h,071h,0A0h,0A0h,050h,043h,000h,000h
defb 000h,000h,050h,050h,050h,050h,035h,035h,000h,000h,0A0h,0A0h,050h,043h,035h,000h
defb 000h,000h,035h,035h,035h,035h,03Ch,03Ch,000h,000h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h
defb 0A9h,0A9h,03Ch,03Ch,03Ch,03Ch,043h,043h,047h,047h,0A9h,0A9h,0A9h,0A9h,0A0h,0A0h
defb 050h,043h,000h,000h,000h,000h,043h,043h,043h,043h,035h,000h,000h,000h,0A0h,0A0h
defb 050h,043h,047h,047h,000h,000h,043h,043h,043h,043h,035h,000h,000h,000h,0B3h,0B3h
defb 0B3h,0B3h,0B3h,0B3h,0A9h,0A9h,0A9h,0A9h,0A9h,0A9h,03Ch,03Ch,035h,035h,000h,000h
defb 000h,000h,03Ch,03Ch,03Ch,03Ch,043h,043h,000h,000h,043h,043h,043h,043h,047h,047h
defb 050h,050h,050h,000h,000h,000h,047h,047h,047h,047h,043h,043h,000h,000h,043h,043h
defb 043h,043h,03Ch,03Ch,000h,000h,03Ch,03Ch,03Ch,03Ch,035h,035h,000h,000h,035h,000h
defb 035h,000h,0A9h,0A9h,054h,047h,000h,000h,000h,000h,054h,054h,054h,054h,038h,038h
defb 000h,000h,038h,038h,038h,038h,03Fh,03Fh,000h,000h,03Fh,03Fh,03Fh,03Fh,047h,047h
defb 04Bh,04Bh,0B3h,0B3h,0B3h,0B3h,0A9h,0A9h,054h,04Bh,000h,000h,000h,000h,047h,047h
defb 047h,047h,038h,000h,000h,000h,0A9h,0A9h,054h,04Bh,04Bh,04Bh,000h,000h,047h,047h
defb 047h,047h,0BEh,0BEh,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,03Fh,03Fh,038h,038h,000h,000h
defb 000h,000h,047h,047h,047h,047h,04Bh,04Bh,054h,054h,054h,000h,000h,000h,04Bh,04Bh
defb 047h,047h,03Fh,03Fh,000h,000h,038h,038h,03Fh,03Fh,038h,000h,000h,000h,0D6h,0D6h
defb 0D6h,0D6h,047h,047h,000h,000h,03Fh,03Fh,03Fh,047h,038h,000h,000h,000h,0A9h,0A9h
defb 0A9h,0A9h,0A9h,0A9h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0A9h,0A9h
defb 0A9h,000h,000h,000h,000h,000h,0A9h,0A9h,0A9h,0A9h



 Adresse email Haut de page Bas de page 
 
linkakro



Autorisation : Membre
Nb de messages : 3738
Inscrit le : Lun 19 Oct 2009, 21:25
Posté le : Dim 05 Aoû 2012, 11:05   Citer 


Citer
Don't ask me, it doesn't make much sense to me either. I still think my original explanation with .byte $00 is better...


Yes, it must be a ".byte", but i fear that datas be read by computer or machine as an instruction...
It could be a lack of knowledge since i am beginner.

Thank for the binary.
I searched remarkable bytes of instruction, such as xor a = $B7, but i found nothing.
The binary seems to not be structured as the source.

EDIT : now a know that $AF="xor a" but... there is a mistake in the zilog manual !
In the XOR section, there is OR chart.
(it's the fourth mistake i found)

----------------------
ti82statfr: 2008, inscrit: 2009, ti84pocketfr: noël2011, ti30xbmultiview: iut 2012-2014
Perfectionniste, manque tact. Pas le temps de tout publier depuis 2011. Répond toujours aux questions. (rédigé juin 2014)

Pour tout le monde et surtout les débutants, quelques-uns des articles courants :
*Traductions Algorithmie/Ti-Basic.
*Caractères spéciaux sur Tout82
Les défauts du TI-Basic : Goto_versus_algo et DelVar/End/Lbl/guillemet/store
 Adresse email Haut de page Bas de page 
 
The K



Autorisation : Membre
Nb de messages : 850
Inscrit le : Sam 15 Oct 2011, 11:07
Posté le : Dim 05 Aoû 2012, 14:50   Citer 

What a mess !

Seriously xD

----------------------
La la la ...

Avez-vous pensé à regarder le manuel avant de demander conseil ? Un manuel est fait avant tout pour être consulté : MANUEL

Vous avez un problème avec l'ordinateur avec votre calculatrice ? SOLUTION EN VIDEO

Mes programmes sur le site : Produit scalaire KMorpion Puissance 4 Mastermind

Mes nouveaux programmes de calcul formel : FCarré FPrime

Projet base de données : ici mais abandonné. Trop de travail ...
 Adresse email Haut de page Bas de page 
 
utz



Autorisation : Membre
Nb de messages : 11
Inscrit le : Jeu 02 Aoû 2012, 16:20
Posté le : Dim 05 Aoû 2012, 18:18   Citer 

ok, found a better listing tool. this is a direct disassembly from ZX, hence the direct addresses. excluded the data section from this one.

btw the code for xor a is AF, not B7.


Code

   org $8000
l_8000: ld hl, l_806d       ; 8000 21 6d 80 $0ats
   call l_8009       ; 8003 cd 09 80 $11ts
   jp l_8000       ; 8006 c3 00 80 $0ats
l_8009: ld e, (hl)       ; 8009 5e $07ts
   inc hl          ; 800a 23 $06ts
   ld d, (hl)       ; 800b 56 $07ts
   inc hl          ; 800c 23 $06ts
   ld ($803f), de       ; 800d ed 53 3f 80 $14ts
   ld e, (hl)       ; 8011 5e $07ts
   inc hl          ; 8012 23 $06ts
   ld d, (hl)       ; 8013 56 $07ts
l_8014: inc hl          ; 8014 23 $06ts
   ld a, (hl)       ; 8015 7e $07ts
   or a          ; 8016 b7 $04ts
   ret z          ; 8017 c8 $0b/$05ts
   inc hl          ; 8018 23 $06ts
   push hl          ; 8019 e5 $0bts
   push de          ; 801a d5 $0bts
   ld l, (hl)       ; 801b 6e $07ts
   ld bc, $0200       ; 801c 01 00 02 $0ats
l_801f: ld h, c          ; 801f 61 $04ts
   add hl, hl       ; 8020 29 $0bts
   add hl, hl       ; 8021 29 $0bts
   add hl, hl       ; 8022 29 $0bts
   add hl, de       ; 8023 19 $0bts
   push hl          ; 8024 e5 $0bts
   ld l, a          ; 8025 6f $04ts
   djnz l_801f       ; 8026 10 f7 $08/$0dts
   exx          ; 8028 d9 $04ts
   pop hl          ; 8029 e1 $0ats
   pop de          ; 802a d1 $0ats
   ld b, $08       ; 802b 06 08 $07ts
l_802d: ld a, (hl)       ; 802d 7e $07ts
   inc hl          ; 802e 23 $06ts
   ex af, af'       ; 802f 08 $04ts
   ld a, (de)       ; 8030 1a $07ts
   inc de          ; 8031 13 $06ts
   exx          ; 8032 d9 $04ts
   ld h, a          ; 8033 67 $04ts
   ex af, af'       ; 8034 08 $04ts
   ld l, a          ; 8035 6f $04ts
   cp $2c          ; 8036 fe 2c $07ts
   jr z, l_803b       ; 8038 28 01 $0c/$07ts
   xor a          ; 803a af $04ts
l_803b: ld (l_8048), a       ; 803b 32 48 80 $0dts
   ld bc, $06f3       ; 803e 01 f3 06 $0ats
   di          ; 8041 f3 $04ts
l_8042: xor a          ; 8042 af $04ts
   dec e          ; 8043 1d $04ts
   jr nz, l_8049       ; 8044 20 03 $07/$0cts
   ld e, l          ; 8046 5d $04ts
   sub l          ; 8047 95 $04ts
l_8048: nop          ; 8048 00 $04ts
l_8049: dec d          ; 8049 15 $04ts
   jr nz, l_804e       ; 804a 20 02 $07/$0cts
   ld d, h          ; 804c 54 $04ts
   sub h          ; 804d 94 $04ts
l_804e: sbc a, a       ; 804e 9f $04ts
   and $10          ; 804f e6 10 $07ts
   out ($fe), a       ; 8051 d3 fe $0bts
   in a, ($fe)       ; 8053 db fe $0bts
   cpl          ; 8055 2f $04ts
   and $1f          ; 8056 e6 1f $07ts
   jr nz, l_805f       ; 8058 20 05 $07/$0cts
   dec bc          ; 805a 0b $06ts
   ld a, b          ; 805b 78 $04ts
   or c          ; 805c b1 $04ts
   jr nz, l_8042       ; 805d 20 e3 $07/$0cts
l_805f: ld hl, $2758       ; 805f 21 58 27 $0ats
   exx          ; 8062 d9 $04ts
   ei          ; 8063 fb $04ts
   jr nz, l_8068       ; 8064 20 02 $07/$0cts
   djnz l_802d       ; 8066 10 c5 $08/$0dts
l_8068: pop de          ; 8068 d1 $0ats
   pop hl          ; 8069 e1 $0ats
   jr z, l_8014       ; 806a 28 a8 $0c/$07ts
   ret          ; 806c c9 $0ats




 Adresse email Haut de page Bas de page 
 
utz



Autorisation : Membre
Nb de messages : 11
Inscrit le : Jeu 02 Aoû 2012, 16:20
Posté le : Lun 08 Oct 2012, 1:02   Citer 

salut folks, it's been a while... so finally I got the sound working, but sadly only in VTI, not on real hardware. plus the sound output is not very stable, but i'm guessing that's partly VTI's fault.
anyway, if anybody has any ideas as to why there's no sound on real hardware with this, let me know.


Code

.INCLUDE CRASH82.INC
.DB "HUBY 1-BIT TI82 0.5", 0
#define db .byte
#define dw .word

;Huby beeper music engine by Shiru (shiru@mail.ru) 04'11
;Two channels of tone, no volume, global speed
;One drum, replaces note on the first channel
;The main feature of this engine is the size, just 100 bytes
;Feel free to do whatever you want with the code, it is PD


   ld hl,musicData
   ld a,%00010000         ;+ set interrupts to

fastest mode
   out (4),a
   call play
   
play
   ld e,(hl)         ;read speed word
   inc hl
   ld d,(hl)
   inc hl
   ld (speed),de         ;store it
   ld e,(hl)         ;read patterns offset
   inc hl
   ld d,(hl)         ;it will be always in

DE, and HL is order list pointer now

readPos
   inc hl
   ld a,(hl)         ;read first byte of

order list
   or a
   ret z            ;if it is zero, it is

end of the song
   inc hl
   push hl            ;store order list

pointer
   push de            ;store patterns offset
   ld l,(hl)         ;read second byte of

order list
   ld bc,2*256         ;calculate addresses

of two patterns
read
   ld h,c            ;pattern number*8
   add hl,hl
   add hl,hl
   add hl,hl
   add hl,de         ;add patterns offset
   push hl            ;store pattern address
   ld l,a            ;now second address
   djnz read
   exx
   pop hl            ;restore pattern

addressed in alternative set
   pop de

   ld b,8            ;play 8 rows
readRow
   ld a,(hl)         ;read first note
   inc hl            ;increase first

pattern pointer
   ex af,af'
   ld a,(de)         ;read second note
   inc de            ;increase second

pattern pointer
   exx
   ld h,a
   ex af,af'
   ld l,a
   cp $2c            ;if first note is $2c,

it is drum sound
   jr z,$+3
   xor a
   ld (slide),a
speed .EQU $+1
   ld bc,0
   di

soundLoop
   xor a            ;clear carry and set A

to zero
   dec e            ;counter of first

channel
   jr nz,l1
   ld e,l            ;reload if overflow
   sub l            ;and set carry if note

is not zero (mute)
slide .EQU $
   nop            ;slide for drum
l1
   dec d            ;counter of second

channel
   jr nz,l2
   ld d,h            ;reload if overflow
   sub h            ;and set carry if note

is not zero (mute)
l2
   sbc a,a            ;if carry, A=255,

otherwise A=0
   xor %11111100         ;+ $ff -> $c0, $0 ->

$fc
   and %00111100
   add a,12
   out (0),a
   out (0),a
   out (0),a
   out (0),a         ;+ 4x to compensate

higher cpu speed

   ld a,%10111111         ;+ new keyhandler
   out (1),a
   in a,(1)         ;read keyboard
   cpl
   bit 6,a
   jr nz,l3         ;if any key is

pressed, exit loop
   
   dec bc
   ld a,b
   or c
   jr nz,soundLoop         ;113/123t + not

anymore i think

l3
   ld hl,$2758         ;restore alternative

HL to default value
   exx
   ei
   
   jr nz,$+4         ;if any key was

pressed, break loop
   djnz readRow

   pop de
   pop hl
   jr z,readPos         ;if no key was

pressed, continue
   ld a,%00010110         ;+ set interrupts back

to normal
   out (4),a
   ;ret
   jp EXIT_2_TIOS         ;use CrASH syscall to

return properly

musicData
   dw $06f3
   dw p-8
   db $01,$02
   db $01,$03
   db $04,$05
   db $06,$07
   db $08,$09
   db $0a,$0b
   db $0c,$0d
   db $0e,$0f
   db $01,$02
   db $01,$03
   db $04,$05
   db $06,$07
   db $08,$09
   db $0a,$0b
   db $0c,$0d
   db $0e,$0f
   db $10,$02
   db $11,$03
   db $12,$05
   db $13,$07
   db $14,$09
   db $15,$0b
   db $16,$0d
   db $17,$0f
   db $18,$02
   db $18,$03
   db $19,$05
   db $19,$07
   db $1a,$09
   db $1a,$0b
   db $1b,$0d
   db $1c,$0f
   db $01,$02
   db $01,$03
   db $04,$05
   db $06,$07
   db $08,$09
   db $0a,$0b
   db $0c,$0d
   db $0e,$0f
   db $1d,$02
   db $1d,$03
   db $1e,$05
   db $1e,$07
   db $1f,$09
   db $1f,$0b
   db $20,$0d
   db $21,$0f
   db $10,$02
   db $11,$03
   db $12,$05
   db $13,$07
   db $14,$09
   db $15,$0b
   db $16,$0d
   db $17,$0f
   db $18,$02
   db $18,$03
   db $19,$05
   db $19,$07
   db $1a,$09
   db $1a,$0b
   db $1b,$0d
   db $1c,$0f
   db $00
p
   db $2c,$3c,$b3,$3c,$b3,$3c,$b3,$3c
   db $59,$59,$50,$50,$4b,$4b,$4b,$4b
   db $4b,$4b,$4b,$4b,$59,$59,$59,$59
   db $2c,$38,$b3,$38,$b3,$38,$b3,$38
   db $43,$43,$43,$43,$43,$43,$43,$43
   db $2c,$38,$b3,$38,$2c,$38,$2c,$38
   db $43,$43,$43,$43,$4b,$4b,$50,$50
   db $b3,$32,$b3,$32,$2c,$32,$b3,$32
   db $4b,$4b,$50,$50,$59,$59,$59,$59
   db $2c,$32,$b3,$32,$b3,$32,$b3,$32
   db $59,$59,$59,$59,$4b,$4b,$4b,$4b
   db $2c,$43,$b3,$43,$b3,$43,$b3,$43
   db $50,$50,$50,$50,$50,$50,$50,$50
   db $2c,$43,$b3,$43,$2c,$a0,$2c,$86
   db $50,$50,$50,$50,$43,$43,$3c,$3c
   db $2c,$3c,$e2,$3c,$e2,$3c,$2c,$3c
   db $2c,$3c,$e2,$3c,$2c,$3c,$2c,$3c
   db $2c,$38,$e2,$38,$e2,$38,$e2,$38
   db $e2,$38,$2c,$38,$2c,$38,$e2,$38
   db $2c,$32,$e2,$32,$2c,$32,$e2,$32
   db $e2,$32,$e2,$32,$2c,$32,$e2,$32
   db $2c,$43,$e2,$43,$e2,$43,$e2,$43
   db $2c,$43,$2c,$43,$2c,$2c,$2c,$2c
   db $f0,$3c,$f0,$3c,$f0,$3c,$f0,$3c
   db $f0,$38,$f0,$38,$f0,$38,$f0,$38
   db $f0,$32,$f0,$32,$f0,$32,$f0,$32
   db $f0,$43,$f0,$43,$f0,$43,$f0,$43
   db $f0,$43,$f0,$43,$f0,$a0,$f0,$86
   db $78,$3c,$78,$3c,$78,$3c,$78,$3c
   db $78,$38,$78,$38,$78,$38,$78,$38
   db $78,$32,$78,$32,$78,$32,$78,$32
   db $78,$43,$78,$43,$78,$43,$78,$43
   db $78,$43,$78,$43,$78,$a0,$78,$86




 Adresse email Haut de page Bas de page 
 
matrefeytontias



Autorisation : Membre
Nb de messages : 109
Inscrit le : Lun 25 Jui 2012, 15:51
Posté le : Sam 13 Oct 2012, 13:34   Citer 

Hey, glad to see you again happy.gif

You know, emulators are hard to compare with real hardware, so you should base your tests on a real calc only.

Right now, I don't see any errors, but I'm far of be familiar with sound and data transimission using the port 0.

----------------------
Apprenez l'hexadécimal z80 ! Nan, vous n'êtes pas obligés de vouloir mourir, mais ça peut aider : https://espace-ti.forumactif.com/t576-programmer-en-hexadecimal-c-est-possible
 Adresse email Haut de page Bas de page 
 
Poster un nouveau sujet Poster une réponse





  Page générée en 9 requêtes