bcallnz _vputs call nz,getkey call nz,bell_sync ret nz
call bell_connect ret nz bcall _cleargbuf call ionFastCopy DEFINE_PLACE: ld b,$FF call ionRandom ld hl,my_x ld (hl),a ld de,my_y ld b,1 call bell_swapBlock ret nz ld a,(my_x) ld b,a ld a,(my_y) cp a jr z,DEFINE_PLACE jp m,DEFINE_PLACE2 ld a,1 jr DEFINE_PLACE3 DEFINE_PLACE2: xor a DEFINE_PLACE3: ld (SAVE_NUM),a
call bell_connect ret nz call cleargbuf call ionFastCopy DEFINE_PLACE: ld b,$FF call ionRandom ld hl,my_x ld (hl),a ld de,my_y ld b,1 call bell_swapBlock ret nz ld a,(my_x) ld b,a ld a,(my_y) cp b jr z,DEFINE_PLACE ld a,0 ; (ne modifie pas les flags comme 'xor a') call m,DEFINE_PLACE2 ld (SAVE_NUM),a [...] DEFINE_PLACE2: inc a ret cleargbuf: ld hl,gbuf ld de,gbuf+1 ld (hl),0 ld bc,767 ldir ret
chickendude (./108) :
mathieu41, je peux t'aider aussi à faire des traductions à l'anglais si tu veux
_vdispa: bcall _setxxop1 ld a,3 ; (ou plus) bjump _dispop1a
_vdispa: ld h,0 ld l,a _vdisphl: push de push hl ld de,op1+5 xor a ld (de),a _vdisphl_loop: bcall _divhlby10 add a,'0' dec de ld (de),a ld a,h or l jr nz,_vdisphl_loop ex de,hl bcall _vputs pop hl pop de ret
DispOP1A
Category: Display
Description: Displays a floating-point number using either small variable width or large
5x7 font. The value is rounded to the current “fix” setting (on the mode
screen) before it is displayed.
Inputs:
Registers: ACC = maximum number of digits to format for displaying
Flags: textInverse, (IY + textFlags) = 1 for reverse video
textEraseBelow, (IY + textFlags) = 1 to erase line below character
textWrite, (IY + sGrFlags) = 1 to write to graph buffer not display
fracDrawLFont, (IY + fontFlags) = 1 to use large font, not small font
Others: (penCol) = pen column to display at
(penRow) = pen row to display at
Outputs:
Registers: None
Flags: None
Others: None
Registers All
destroyed:
RAM used: OP1, OP2, OP3, OP4
Remarks: Displaying stops if the right edge of the screen is reached.
14) B_JUMP is to B_CALL as jp is to call... sort of. A better question would be "what's a B_CALL?" When you perform a B_CALL or B_JUMP, the OS uses the address provided to look up the absolute address (a 16-bit logical address, X, plus an 8-bit page number, Y) for the routine you're looking for. To "jump", then, simply means to output Y to port 6 and jump to X. To "call", however, means that we have to return to the same place we started. That means we have to save the current port-6 value (let's call it Z) on the stack, output Y to port 6, call X, pop Z off the stack, output Z to port 6, and return to the address following the B_CALL.Bcall est tout de même plus rapide est plus petit :P
In practical terms, modern structured programming conventions mean that you will almost never need or want to use B_JUMP; B_CALL is far more useful. That's why the B_CALL macro is implemented with an RST, so each B_CALL takes only three bytes, while each B_JUMP takes five.
bell_swapByte: ; Store data to be sent (a=registre à envoyer) push af ; Should we send first or receive first? ld a,(bell_calcId) or a jp z,_bell_sendFirst _bell_recvFirst: ; Receive data call bell_recvByte ; Exit on receive error ret nz ;<- 1.S'il y a eut une erreur, on ret, mais sans pop avant... ; Store the received byte ld b,a ; Get the byte to send pop af ; Store the received byte even safer push bc ; Send data call bell_sendByte ; Retrieve the stored data pop af ret ;<- 2.Le code est censé renvoyer z s'il a réussi... _bell_sendFirst: ; Get the byte to send pop af ; Send data call bell_sendByte ; Exit on send error ret nz ;<-Là c'est ok ; Receive data call bell_recvByte ret ;Là aussi
bell_swapByte: ; Store data to be sent ld (bell_swapByte_save_a),a ld (bell_swapByte_save_a_3),a ; Should we send first or receive first? ld a,(bell_calcId) or a jp z,_bell_sendFirst _bell_recvFirst: ; Receive data call bell_recvByte ; Exit on receive error ret nz ; Store the received byte ld (bell_swapByte_save_a_2),a ; Get the byte to send bell_swapByte_save_a = $+1 ld a,0 ; Send data call bell_sendByte ; Retrieve the stored data bell_swapByte_save_a_2 = $+1 ld a,0 ret _bell_sendFirst: ; Get the byte to send bell_swapByte_save_a_3 = $+1 ld a,0 ; Send data call bell_sendByte ; Exit on send error ret nz ; Receive data call bell_recvByte ret
Contra (./112) :
Bon courage Matthieu41 pour ton jeu, c'est déjà très bien bravo
mathieu41 (./117) :
" _dispop1a" est une romcall faite pour afficher un flottant, donc pouvant aller jusqu'à 14 chiffre, donc quand il y a des virgules, c'est pratique de pouvoir donner la précision de l'affichage avec a
mathieu41 (./117) :
(Au passage, j'ai remarqué que la routine que j'ai créé pour savoir où on commence est inutile: quand on utilise bell_connect, ça appelle bell_sync, et le numéro de la calto (0 ou 1) est stocké dans bell_calcId, il suffit donc de faire ld a,(bell_calcId) )
bell_swapByte: push af ld a,(bell_calcId) or a jp z,_bell_sendFirst _bell_recvFirst: call bell_recvByte jp nz,_bell_recvFirst_skip ; on vide la pile avant de quitter ld b,a pop af push bc call bell_sendByte _bell_recvFirst_skip: pop af ret _bell_sendFirst: pop af call bell_sendByte ret nz jp bell_recvByte ; petite optimisation
push bc call bell_sendByte _bell_recvFirst_skip: pop af
deeph (./118) :
Oui en lisant le sdk ça a tout de suite plus de sens. Du coup vérifie bien que a > 2 (au minimum), si c'est pour afficher des scores, autrement ça peut expliquer certains "ram clear".