Bell release v0.2!

A forum where you can announce your awesome project(s).

Moderator: MaxCoderz Staff

User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Glad to see this project is progressing nicely. :) Keep up the good work!
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Thanks Ben! :)

I think I should post a cry for help in the Programming Help section, because I can't come up with a plausible reason for my weird bug :( I have a few couldbe's and maybe's but no serious theory... Which is annoying because it's pretty much the only thing keeping me from releasing at the moment.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
GuillaumeH
Regular Member
Posts: 143
Joined: Fri 17 Dec, 2004 8:30 pm
Contact:

Post by GuillaumeH »

Nice routines, I may use them in a future version of zDoom :) Are you still working on it ?
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Thanks! :) And sorry for the late reply.

The project is pretty much on halt, though I'm still available to answer questions and take suggestions. My version only differs from the latest release in that it reports errors back in a nicer way and it solves a few small compiler compatibility problems, but you can safely use the current release (it's more stable anyway).

If people would actually be using it, that might give me a reason to work on it a bit more ;)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Re: Bell release v0.2!

Post by Timendus »

For old time's sake: The Bell website is up again at http://bell.timendus.com/
Huzzah! :mrgreen:
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
M@thieu41
New Member
Posts: 12
Joined: Mon 10 Sep, 2012 7:19 pm

Re: Bell release v0.2!

Post by M@thieu41 »

Hi! (sorry for my bad English, but i am French, so i don't speak English very well :roll: )

I have begun to program not long ago in ASM z80, and i want to do a game for 2 calculators. We recommended to me the bell library for this, and i have downloaded it (v0.1). I have tried the first program of your manual, and i have had lot of errors witch i don't understand, at the compilation. (I use TASM, and i program for a TI 83/82stats(.fr).)

I hope you can help me to resolve them.
I pust here my code and the file list:
My code:

Code: Select all

.NOLIST
#include "TI83asm.inc"

.LIST
	call _clrlcdfull
	call bell_sync
	ret nz
	or a
	jp nz,receive

send:	ld hl,string
	call bell_sendString
	ret

receive:ld hl,grbuf
	call bell_recvString
	ret nz
	call clrLCDFull
	ld hl,grbuf
	call _puts
	call _getkey
	ret
string: .db "Hello world!",0


#include "bell.inc"

end
Last edited by M@thieu41 on Thu 04 Oct, 2012 12:46 pm, edited 1 time in total.
M@thieu41
New Member
Posts: 12
Joined: Mon 10 Sep, 2012 7:19 pm

Re: Bell release v0.2!

Post by M@thieu41 »

Like you can see, i have 312 errors :o
If you can help me, thinks for yours answers!

PS: i don't understand something: in the manual, i have take the v0.2, but in the file, there is written v0.1...
Last edited by M@thieu41 on Thu 04 Oct, 2012 12:46 pm, edited 1 time in total.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Bell release v0.2!

Post by benryves »

Welcome to MaxCoderz, M@thieu41! You may wish to send Timendus an email to alert him to this thread as I'm not sure if he's following it - there hasn't been too much traffic here of late.

That said, I believe Timedus used Brass, so you may need to download Brass and use that instead of TASM (complaints about label length indicates that TASM - at least the version you're using - may not be up to the job).
M@thieu41
New Member
Posts: 12
Joined: Mon 10 Sep, 2012 7:19 pm

Re: Bell release v0.2!

Post by M@thieu41 »

Thinks for your answer :)

I ll try to compile with BRASS tomorrow, and i ll send an email to him if it doesn't work.

thank again for your help ^^
Last edited by M@thieu41 on Sat 15 Sep, 2012 5:12 pm, edited 1 time in total.
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Re: Bell release v0.2!

Post by Timendus »

Hello M@thieu41, Ben is right. I used Brass, which has a few more features than TASM. I made v0.3 compatible with TASM but I lost that version, sorry! :)

About the version number not matching: that's probably just because I forgot to update it. There is a difference between the files.

Good to see you working on multiplayer games! Good luck with it and it you have any more questions I'm sure Ben will answer those too :mrgreen:
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
M@thieu41
New Member
Posts: 12
Joined: Mon 10 Sep, 2012 7:19 pm

Re: Bell release v0.2!

Post by M@thieu41 »

Thank you for your answers! :)
I have a little problem when i use Brass: "Error: Command-line syntax incorrect". :? I don't understand why...

PS: Sorry for my late answer, i was in a school trip, at the mountain :cowboy: (and sorry for my grammatical mistakes in English)

EDIT: We said to me to use Spasm, and it work now! :D
Thank you for your help, and have a nice day!
M@thieu41
New Member
Posts: 12
Joined: Mon 10 Sep, 2012 7:19 pm

Re: Bell release v0.2!

Post by M@thieu41 »

Hi! :D
First of all, sorry for my bad english: i’m french
I don’t know if you remember to me i use since a short time the bell library. ;)
I’ve done a game for 2 players, with 2 caltos, and it work perfectly on the emulator (wabbittemu, v1.6.2.21), but with 2 “real” calculators (TI82stats.fr), , it bugs when the game start (after the rectangle’s drawing): one calculator leave the game, and the other stand blocked. :cry:
I don’t understand why it work with the emulator, and not in “right”, so I hope you can help me (i think the problem come than a bad utilisation of your labrary, in the GET_EVENT: routine, but i'm not sure, because i work with the emulator).

Thank you in advance :)

My game (a 83P)
A screen:
Image

I pust here my code (i use the shell ion for this game, and compile it with SPASM):

Code: Select all

    .nolist
#include "ion.inc"
    .list
 
my_x         =    savesscreen
my_y        =    savesscreen+1
my_last_x    =    savesscreen+2
my_last_y    =    savesscreen+3
my_score    =    savesscreen+4
my_event    =    savesscreen+5
obj_x        =    savesscreen+6
obj_y        =    savesscreen+7
 
his_x         =    savesscreen+8
his_y        =    savesscreen+9
his_last_x    =    savesscreen+10
his_last_y    =    savesscreen+11
his_score    =    savesscreen+12
his_event    =    savesscreen+13
his_obj_x    =    savesscreen+14
his_obj_y    =    savesscreen+15
 
direction    =    savesscreen+16
taille        =    savesscreen+17
 
snake_x        =    saferam2
snake_y        =    saferam2+250
 
#ifdef TI83P
    .org progstart-2
    .db $bb,$6d
#else 
    .org progstart
#endif
    ret
    jr nc,start
    .db "SNAKE",0
 
start:    
    ld hl,start
    push hl
 
    ld hl,S_SNAKE        ;Menu
    ld de,CRMTITRE
    ld bc,$44
    ldir
    ld a,3
    ld (nbSel),a
    call RMENU
    ld a,(origine)
    dec a
    pop hl
    cp 3
    jp z,EXIT
    push hl
    cp 2
    jp z,R_REGLES
 
 
    bcall _indicatorOff    ;On connecte les 2 caltos                (sorry, the comments are in french)
    bcall _clrlcdfull
    ld hl,$0302
    ld (currow),hl
    ld hl,S_RECHERCHE
    bcall _puts
    ld a,$03
    ld (snake_x),a
    ld (direction),a
    inc a
    ld (snake_x+1),a
    inc a
    ld (snake_x+2),a
    ld a,$1D
    ld (snake_y),a
    ld (snake_y+1),a
    ld (snake_y+2),a
    call bell_connect
    ret nz
 
    bcall _clrlcdfull    ;On affiche tout
    bcall _cleargbuf
    bcall _copygbuf
    ld hl,$0503
    ld (currow),hl
    ld hl,S_ENTRER
    bcall _puts
    ld b,$70
RALENTIR3:
    push bc
    call RALENTIR
    pop bc
    djnz RALENTIR3
    call _clrlcdfull
    xor a
    inc a
    ld hl,$5E35
    ld de,$0101
    call AFFRECT
    dec h
    dec h
    dec l
    dec l
    inc e
    inc e
    inc d
    inc d
    call FULLRECT
    ld c,$1D
    ld b,$03
    ld d,$02
    bcall _ipoint
    inc b
    bcall _ipoint
    inc b
    bcall _ipoint
    ld b,$5C
    bcall _ipoint
    dec b
    bcall _ipoint
    dec b
    bcall _ipoint
    ld hl,$27
    xor a
    ld (pencol),hl
    bcall _setxxop1
    inc a
    bcall _dispop1a
    ld a,1
    ld hl,S_
    bcall _vputs
    bcall _dispop1a
    ld a,2
    ld (taille),a
    ld hl,0
    ld (my_score),hl
    ld (his_x),hl
    ld (his_x+2),hl
    ld (his_x+4),hl
 
    call OBJ_ALEAT
    call bell_sync        ;On définit les places
    or a
    jr z,POS1
    ld a,$5C
    ld (snake_x),a
    dec a
    ld (snake_x+1),a
    dec a
    ld (snake_x+2),a
    ld a,1
    ld (direction),a
    ld hl,obj_x
    ld b,2
    call bell_sendBlock
    ld b,88
    jr POS2
POS1:
    ld bc,2
    ld hl,obj_x
    call bell_recvBlock
    ld b,6
POS2:
    ld c,58
    ld d,2
    bcall _ipoint
    inc c
    bcall _ipoint
    dec b
    bcall _ipoint
    dec c
    bcall _ipoint
 
    ld a,(obj_x)
    ld b,a
    ld a,(obj_y)
    ld c,a
    ld d,2
    bcall _ipoint
    
    set textInverse,(iy+textflags)
    
GAME:    call CALC_COORD        ;on calcule les nouvelles coordonnées, et on met à jour les évennements
    call RALENTIR        ;on ralenti le programme (enfin, pour l'instant, c'est inutile, vu qu'il marche pas ;)
    call GET_EVENT        ;on teste si l'autre calto a un évennement (bloc mange/perdu/quitter...)
    call DRAW        ;on dessine les nouveaux serpents
    jr GAME
 
OBJ_ALEAT:        ;On génère 2 nb aléatoires pour les coordonnées d'un bloc objectif
    ld b,$2C
    call ionRandom
    ld c,5
    add a,c
    ld h,a
 
    ld b,$57
    call ionRandom
    add a,c
    ld l,a
    ld (obj_x),hl
    call _homeup
 
    ld b,l
    ld c,h
    ld d,3
    bcall _ipoint
    ret nz
    jr OBJ_ALEAT
 
RALENTIR:
    ld b,$30
RALENTIR2:
    push bc
    ld b,$FF
RALENTIR1:
    djnz RALENTIR1
    pop bc
    djnz RALENTIR2
    ret
 
CALC_COORD:
    ld a,(snake_x)        ;On sauve les coordonnées de la queue
    ld (my_last_x),a
    ld a,(snake_y)
    ld (my_last_y),a
    ld a,0            ;on teste un changement de direction
    ld (my_event),a
    ld a,Fleches
    out (1),a
    in a,(1)
    cp KpGauche
    jr z,CALC_COORD1
    cp KpHaut
    jr z,CALC_COORD2
    cp KpDroit
    jr z,CALC_COORD3
    cp KpBas
    jr nz,CALC_COORD0
    ld a,4
    jr CALC_COORD4
CALC_COORD1:
    ld a,1
    jr CALC_COORD4
CALC_COORD2:
    ld a,2
    jr CALC_COORD4
CALC_COORD3:
    ld a,3
CALC_COORD4:
    ld (direction),a
CALC_COORD0:
 
    ld hl,snake_x        ;On calcule la nouvelle absice
    ld b,0
    ld a,(taille)
    ld c,a
    add hl,bc
    ld a,(hl)
    ld (CALC_COORD_sav1),hl
    ld hl,snake_x
    ld d,h
    ld e,l
    inc hl
    ldir
    ld b,a
    ld a,(direction)
    cp 2
    jp z,CALC_COORDP
    cp 4
    jp z,CALC_COORDP
    dec a
    dec a
    add a,b
    jr CALC_COORDI
CALC_COORDP:
    ld a,b
CALC_COORDI:
CALC_COORD_sav1 = $+1
    ld hl,0
    ld (hl),a
    ld (my_x),a
 
    ld hl,snake_y        ;On calcule la nouvelle ordonnée
    ld b,0
    ld a,(taille)
    ld c,a
    add hl,bc
    ld a,(hl)
    ld (CALC_COORD_sav2),hl
    ld hl,snake_y
    ld d,h
    ld e,l
    inc hl
    ldir
    ld b,a
    ld a,(direction)
    cp 1
    jp z,CALC_COORDI2
    cp 3
    jp z,CALC_COORDI2
    dec a
    dec a
    dec a
    neg
    add a,b
    jr CALC_COORDP2
CALC_COORDI2:
    ld a,b
CALC_COORDP2:
CALC_COORD_sav2 = $+1
    ld hl,0
    ld (hl),a
    ld (my_y),a
 
                ;On teste les évennements type colision
    ld b,a
    ld a,(obj_y)
    cp b
    jr nz,CALC_COORD6
 
    ld a,(my_x)
    ld b,a
    ld a,(obj_x)
    cp b
    jr nz,CALC_COORD6
    
    ld a,1            ;score+1!
    ld (my_event),a
    ld a,(my_score)
    inc a
    ld (my_score),a
    ld a,(taille)
    inc a
    ld (taille),a
 
    ld hl,snake_x        ;au prochain affichage, le serpent aura 1 case en plus
    ld b,0
    ld a,(taille)
    ld c,a
    add hl,bc
    ld d,h
    ld e,l
    inc de
    inc bc
    lddr
    ld a,(my_last_x)
    inc hl
    ld (hl),a
    ld a,(obj_x)
    ld (my_last_x),a
 
    ld hl,snake_y        ;au prochain affichage, le serpent aura 1 case en plus
    ld b,0
    ld a,(taille)
    ld c,a
    add hl,bc
    ld d,h
    ld e,l
    inc de
    inc bc
    lddr
    ld a,(my_last_y)
    inc hl
    ld (hl),a
    ld a,(obj_y)
    ld (my_last_y),a
 
    call OBJ_ALEAT
    
    ld hl,(obj_x)        ;On affiche le nouvel objectif
    ld b,l
    ld c,h 
    ld d,2 
    bjump _ipoint
    
    jr CALC_COORD7
    
CALC_COORD6:
    ld a,(my_x)
    ld b,a
    ld a,(my_y)
    ld c,a
    ld d,3
    bcall _ipoint
    jr nz,CALC_COORD7
    ld a,2            ;Perdu
    ld (my_event),a
    ld a,(my_score)        ;score-5
    ld b,5
    or a
CALC_COORD6bis:
    ret z
    dec a
    djnz CALC_COORD6bis
    ret
    
CALC_COORD7:
    ld a,%10111111        ;On teste les évennements type clavier (pression de touches)
    out (1),a
    in a,(1)
    cp %1111110        ;Quitter
    jr nz,CALC_COORD5
    ld a,(my_event)
    set 2,a
    ld (my_event),a
    ret
 
CALC_COORD5:
    cp Kpenter
    ret nz
    ld a,(my_event)
    set 3,a
    ld (my_event),a
    ret
 
GET_EVENT:
    pop hl            ;On échange les évennements
    ld (GET_EVENT_SAV_HL),hl
    ld hl,$0103
    ld (pencol),hl
    ld hl,my_x
    ld de,his_x
    ld b,8
    call bell_swapBlock
    ret nz
 
    ld a,(my_event)        ;On teste les évennements
    and %1010
    ld b,a
    ld a,(his_event)
    and %1011
    or b
    bit 3,a
    ret nz
    bit 1,a
    jp nz,EXIT_GAME
    bit 2,a
    ld hl,S_PAUSE
    bcallnz _vputs
    bcallnz _getkey
    call nz,bell_sync
    ret nz
 
    ld a,(his_event) 
    bit 0,a 
    call nz,GET_EVENT_AFF
GET_EVENT_SAV_HL = $+1 
    ld hl,0 
    push hl 
    ret 
 
GET_EVENT_AFF:         ;On affiche le nouveau objectif
    ld de,obj_x
    ld hl,his_obj_x
    ld bc,2
    ldir
 
    ld hl,(obj_x)
    ld b,l
    ld c,h 
    ld d,2 
    bjump _ipoint
 
DRAW:
    ld d,2        ;On affiche la tête du serpent, et on efface sa queue
    ld a,(my_x)
    ld b,a
    ld a,(my_y)
    ld c,a
    bcall _ipoint
    ld a,(my_last_x)
    ld b,a
    ld a,(my_last_y)
    ld c,a
    bcall _ipoint
    ld a,(his_x)
    ld b,a
    ld a,(his_y)
    ld c,a
    bcall _ipoint
    ld a,(his_last_x)
    ld b,a
    ld a,(his_last_y)
    ld c,a
    bcall _ipoint
 
    ld hl,$27
    ld (pencol),hl
 
    ld hl,S_2
    bcall _vputs
    ld a,(my_score)
    bcall _setxxop1
    ld a,3
    bcall _dispop1a
    ld hl,S_
    bcall _vputs
    ld a,(his_score)
    bcall _setxxop1
    ld a,3
    bjump _dispop1a
 
EXIT:    
    res textInverse,(iy+textflags)
    call _clrlcdfull
    ld hl,$0503
    ld (currow),hl
    ld hl,S_FIN
    bcall _puts
    ld hl,$0107
    ld (currow),hl
    ld hl,S_AUTOR
    bcall _puts
    call RALENTIR
    bjump _getkey
 
R_REGLES:
    bcall _clrlcdfull
    ld hl,$0300
    ld (currow),hl
    ld hl,S_REGLES_TEXTE
    set textInverse,(iy+textflags)
    bcall _puts
    bcall _newline
    ld hl,S_REGLES_TEXTE_SUITE1
    bcall _puts
    res textInverse,(iy+textflags)
    bcall _newline
    ld hl,S_REGLES_TEXTE_SUITE2
    bcall _puts
    call RALENTIR
    bjump _getkey
    
EXIT_GAME:
    bcall _clrlcdfull    ;On affiche le score
    ld a,$FF
    ld hl,grbuf
    ld b,$FF
EXIT_GAME1:
    ld (hl),a
    inc hl
    djnz EXIT_GAME1
    ld b,$FF
EXIT_GAME2:
    ld (hl),a
    inc hl
    djnz EXIT_GAME2
    ld b,$FF
EXIT_GAME3:
    ld (hl),a
    inc hl
    djnz EXIT_GAME3
    ld (hl),a
    inc hl
    ld (hl),a
    inc hl
    ld (hl),a
    bcall _copygbuf
    set textInverse,(iy+textflags)
    ld hl,$1D2B
    ld (pencol),hl
    ld a,(my_score)
    bcall _setxxop1
    ld a,3
    bcall _dispop1a
    ld hl,S_SCORE2
    bcall _vputs
    ld a,(his_score)
    bcall _setxxop1
    ld a,3
    bcall _dispop1a
    
    ld h,2
    ld bc,$0F08
    ld de,$0F18
    bcall _iline
    ld b,$50
    ld d,$50
    bcall _iline
    ld bc,$4618
    bcall _iline
    ld b,$1A
    ld d,$F
    bcall _iline
    ld de,$1A20
    bcall _iline
    ld b,$46
    ld d,$46
    bcall _iline
    ld c,$22
    ld d,2
    bcall _ipoint
    ld b,$1A
    bcall _ipoint
    ld bc,$1A30
    ld de,$F30
    bcall _iline
    ld b,$46
    ld d,$50
    bcall _iline
    ld bc,$C34
    ld de,$C3E
    bcall _iline
    ld b,$54
    ld d,$54
    bcall _iline
 
    ld d,2
    ld hl,$04
    ld c,$33
EXIT_GAME4:
    dec l
    push hl
    ld b,$25
    bcall _ipoint
    dec c
    bcall _ipoint
    dec c
    dec c
    pop hl
    ld b,l
    djnz EXIT_GAME4
    ld b,$26
    inc c
 
    ld hl,$08
    push bc
EXIT_GAME5:
    pop bc
    dec l
    push hl
    bcall _ipoint
    inc b
    bcall _ipoint
    inc b
    inc b
    pop hl
    push bc
    ld b,l
    djnz EXIT_GAME5
    pop bc
 
    ld hl,$04
EXIT_GAME6:
    dec l
    push hl
    ld b,$3B
    bcall _ipoint
    inc c
    bcall _ipoint
    inc c
    inc c
    pop hl
    ld b,l
    djnz EXIT_GAME6
    ld b,$3A
    dec c
 
    ld hl,$08
    push bc
EXIT_GAME7:
    pop bc
    dec l
    push hl
    bcall _ipoint
    dec b
    bcall _ipoint
    dec b
    dec b
    pop hl
    push bc
    ld b,l
    djnz EXIT_GAME7
    pop bc
    
    ld hl,$0D27
    ld (pencol),hl
    ld hl,S_SCORE
    bcall _vputs
    ld hl,$2D27
    ld (pencol),hl
    ld a,(my_score)
    ld b,a
    ld a,(his_score)
    cp b
    jr z,SCORE_EGALITE
    jp m,SCORE_GAGNE
    ld hl,S_PERDU
    jr SCORE_SUITE
SCORE_GAGNE:
    ld hl,S_GAGNE
    jr SCORE_SUITE
SCORE_EGALITE:
    ld hl,$2D23
    ld (pencol),hl
    ld hl,S_EGALITE
SCORE_SUITE:
    bcall _vputs
    call RALENTIR
    bjump _getkey
    
    
;------------------------------------------
;------------------------------------------
;-----------BORDURES DU-----------
;------------RECTANGLE--------------
;------------------------------------------
;------------------------------------------
;
;Entrées:        l=ordonnée du 1er point            (repère graphique)
;            h=absice du 2ème point
;            e=ordonnée du 2ème point
;            d=absice du 2ème point
;            a=mode (0:éteint;1:allume;2:inverse)
;Sortie:        Le rectangle est tracé
;registres affectés:    Aucun
 
AFFRECT:
    push de
    push bc
    ld (AFFRECTSAVA1),a    ;On change a et h
    ld a,h
AFFRECTSAVA1 =$+1
    ld h,0
    ld b,d
    ld c,l
    bcall _iline
    ld b,a
    ld c,e
    bcall _iline
    ld c,l
    ld (AFFRECTSAVA2),a
    ld (AFFRECTSAVA3),a
    ld a,d
AFFRECTSAVA3 = $+1
    ld d,0
    bcall _iline
    ld e,c
    ld d,a
    bcall _iline
    pop bc
    pop de
    ld a,h
AFFRECTSAVA2 =$+1
    ld h,0
    ret;
 
;----------------------------------------
;----------------------------------------
;------------RECTANGLE------------
;--------------PLEIN-------------------
;----------------------------------------
;----------------------------------------
;
;Entrées:        e=ordonnée du pixel à gauche         (repère graphique)
;            d=absice du pixel à gauche
;            l=ordonnée du pixel à droite
;            h=absice du pixel à droite
;            a=mode (0:éteint;1:allume;2:inverse)
;Sortie:        Le rectangle est tracé
;registres affectés:    Aucun
 
FULLRECT:
    push bc
    ld (FULLRECTSAVA1),a    ;On change a et h
    ld a,h
FULLRECTSAVA1 =$+1
    ld h,0
    ld (FULLRECTSAVA3),a
    sub d
    ld b,a
    inc b
FULLRECTSAVA3 =$+1
    ld a,0
    ld c,l
    ld d,a
FULLRECT1:
    push bc
    ld b,d
    bcall _iline
    dec d
    pop bc
    djnz FULLRECT1
    pop bc
    inc d
    ld (FULLRECTSAVA2),a    ;On change a et h
    ld a,h
FULLRECTSAVA2 =$+1
    ld h,0
    ret
 
 
;--------------------------------------------
;--------------------------------------------
;---------ROUTINE DE MENU----------
;--------------------------------------------
;--------------------------------------------
 
;ENTREES:
;        CRMTITRE: Titre
;        CRMSELx: Nom de la selection x
;        nbSel
;
;DETRUIT:
;        tous les registres
;
;SORTIE:
;origine - min: choix
 
 
origine = saferam5
destination = saferam5+1
nbSel = saferam5+2
test = saferam5+3
min = saferam5+5
max = saferam5+4
 
RMENU:    
    bcall _clrlcdfull
    xor a
    ld (test),a
    inc a
    ld (min),a
    ld a,(nbSel)
    cp 2
    jr z,FTEST
    cp 3
    jr z,FTEST
    cp 4
    jr z,FTEST
    cp 5
    jr z,FTEST
    cp 6
    jr z,FTEST2
    xor a
    ld (test),a
    ret
FTEST:    
    ld a,2
    ld (min),a
FTEST2:    
    ld hl,0
    ld (currow),hl
    ld hl,CRMTITRE
    set textInverse,(iy+textflags)
    bcall _puts
    res textInverse,(iy+textflags)
    ld a,(min)
    cp 1
    jr z,TESTN
    bcall _newline
TESTN:    
    ld a,(nbSel)
    ld hl,CRMSEL1
    set textInverse,(iy+textflags)
    bcall _puts
    res textInverse,(iy+textflags)
    ld hl,CRMSEL2
    bcall _puts
    cp 2
    jr z,TESTS
    ld hl,CRMSEL3
    bcall _puts
    cp 3
    jr z,TESTS
    ld hl,CRMSEL4
    bcall _puts
    cp 4
    jr z,TESTS
    ld hl,CRMSEL5
    bcall _puts
    cp 5
    jr z,TESTS
    ld hl,CRMSEL6
    bcall _puts
TESTS:    
    ld a,(min)
    ld (origine),a
    push af
    ld a,(nbSel)
    ld b,a
    pop af
    add a,b
    dec a
    ld (max),a
 
M1GET:    
    bcall _getkey
    cp khaut
    jr z,M1HAUT
    cp kbas
    jr z,M1BAS
    cp kenter
    ret z
    jr M1GET
 
M1HAUT:    
    ld a,(min)
    dec a
    ld b,a
    ld a,(origine)
    dec a
    ld (destination),a
    cp b
    jr nz,MCHANGE
    ld a,(max)
    ld (destination),a
    jr MCHANGE
 
M1BAS:    
    ld a,(max)
    inc a
    ld b,a
    ld a,(origine)
    inc a
    ld (destination),a
    cp b
    jr nz,MCHANGE
    ld a,(min)
    ld (destination),a
 
MCHANGE:
    ld a,(origine)
    ld b,2
MCHARGE:
    ld h,0
    ld l,a
    ld (currow),hl
    push af
    ld a,(min)
    ld c,a
    pop af
    dec c
    sub c
    ld hl,CRMSEL1
    cp 1
    jr z,MAFF
    ld hl,CRMSEL2
    cp 2
    jr z,MAFF
    ld hl,CRMSEL3
    cp 3
    jr z,MAFF
    ld hl,CRMSEL4
    cp 4
    jr z,MAFF
    ld hl,CRMSEL5
    cp 5
    jr z,MAFF
    ld hl,CRMSEL6
MAFF:    
    bcall _puts
    res textInverse,(iy+textflags)
    djnz MSUITE
    ld a,(destination)
    ld (origine),a
    jp M1GET
MSUITE:    
    ld a,(destination)
    set textInverse,(iy+textflags)
    jr MCHARGE
 
CRMTITRE:
    .db "                ",0
CRMSEL1:
    .db "                ",0
CRMSEL2:
    .db "                ",0
CRMSEL3:
    .db "                ",0
CRMSEL4:
    .db "                ",0
CRMSEL5:
    .db "                ",0
CRMSEL6:
    .db "                ",0
 
 
 
#include "bell_snake.inc"
 
S_RECHERCHE:
    .db "Recherche    d",$27,"un adversaire                    patientez          ...",0
S_ENTRER:
    .db "Pr",$98,"t?",0
S_FIN:
    .db "Merci          d",$27,"avoir          jou",$96,"!",0
S_:
    .db "-  ",0
S_2:
    .db "  ",0
S_PAUSE:
    .db $D3,"Pause",$D3,0
S_EFFACER:
    .db "                       ",0
S_SNAKE:
    .db $20,$F1,$F1,$F1,$20,"Snake",$21,$20,$F1,$F1,$F1,$20,0
S_LE_JEU:
    .db "     LE JEU     ",0
S_REGLES:
    .db "   LES REGLES   ",0
S_SORTIR:
    .db "     SORTIR     ",0
S_AUTOR:
    .db "Mathieu41",0
S_REGLES_TEXTE:
    .db " UN SNAKE ",0
S_REGLES_TEXTE_SUITE1:
    .db " A DEUX JOUEURS ",0
S_REGLES_TEXTE_SUITE2:
    .db " Mangez plus de "
    .db "   pommes que   "
    .db "  l",$27,"adversaire",0
S_GAGNE:
    .db "GAGNE",0
S_PERDU:
    .db "PERDU",0
S_EGALITE:
    .db "EGALITE",0
S_SCORE:
    .db "SCORE",0
S_SCORE2:
    .db $2F,0

.end
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Re: Bell release v0.2!

Post by Timendus »

Bonjour M@thieu41,

How very cool to see your multiplayer game in action, you've written this really quite fast! And it looks like fun :)

About your bug, I think the problem is here:

Code: Select all

call bell_connect
    ret nz

    bcall _clrlcdfull    ;On affiche tout
    bcall _cleargbuf
    bcall _copygbuf
    ld hl,$0503
    ld (currow),hl
    ld hl,S_ENTRER
    bcall _puts
    ld b,$70
RALENTIR3:
    [...]

    call OBJ_ALEAT
    call bell_sync        ;On définit les places
    or a
    jr z,POS1
Immediately after bell_connect, you use a routine from the TI-OS. TI-OS routines have the nasty habit of enabling (linkport) interrupts and messing with ports. Probably this messes up the connect which causes one calculator to return (ret nz) and the other to get stuck in bell_sync.

By the way, bell_connect already does bell_sync if I'm not mistaken, so if both calculators waste the same amount of clockcycles it shouldn't be neccessary to use bell_sync. Then again, if it works for you that's fine, it doesn't mess anything up either :)

Are you testing the .83p with a Ti-83(+) ROM in the emulator, and testing on two Ti-82's on hardware? That could explain the difference; the ROMs of calculator models are different, so maybe you're just lucky with the ROM calls for one model, and not so lucky for the other model.

Good luck with your bug hunting! :)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
M@thieu41
New Member
Posts: 12
Joined: Mon 10 Sep, 2012 7:19 pm

Re: Bell release v0.2!

Post by M@thieu41 »

Thank you for your answer :)

The rom call witch were causing the problem is _getkey
TI-OS Interference

One thing to keep in mind when writing link port related software is that the Ti-OS checks for silent transfers in the background of input routines. When two calculators are connected and one pulls a line low, the other calculator will respond by pulling the other line low to acknowledge that it has received a bit. Even when the other calculator is running an assembly program that uses the getkey romcall. This phenomenon is known to cause severe headaches for programmers who attempt to write synchronization routines :) .
For the emulator, i used a 83 rom, and it's the same thing of my TI 82stats.fr (i think you don't have this in English, but their rom are nearly identical)

I used bell_sync after bell_connect to know who start left, and who right, and i don't know do that with bell_connect

EDIT: i use bell_swapBlock in an aleatory byte instead of bell_sync, and it work perfectly (on the emulator, i'll test on calc Monday ^^)
chickendude
Extreme Poster
Posts: 340
Joined: Fri 07 Jul, 2006 2:39 pm

Re: Bell release v0.2!

Post by chickendude »

Yeah, in France they have the TI-82 Stats.fr which is essentially a French-localized 83 (do they even sell 83s anymore?), i don't think there's any other difference.
Post Reply