manage the HI-SCORE in assembler

By gasparrini

Champion (335)

gasparrini さんの画像

04-03-2022, 13:45

Hello to all you USER'S MSX of the world,

Request? How I can manage the HI-SCORE in assembler ??

Fortunatey, in this forum I found a old post di Danysoft, whose there is a source in
assembler that makes the SCORE work in assembler and I was very interested.

The source I'm talking about is below and it works very well:

; [YOUR GROUP] MSX Z80 source file.
;
; Prog: 
; Code: [YOUR HANDLE]
; Date:
;
; cmnt:
;
; Coded in TeddyWareZ' Chaos Assembler 3
;
; (C) 2001 [YOUR GROUP]!



	.org $C000 - 7

	.db $fe
	.dw startProgram,endProgram,startProgram

startProgram:
       
BEGIN:
        LD    HL,$00
        LD    (SCORE),HL
        LD    (SCORE+2),HL
        CALL  SEE
LOOP:
        CALL  $9F
        CP    ' '   ; exit if flag " " is set
        RET   Z
        CP    'W'
        JR    NZ,SKIP   ; skip if flag ch. "W" not set
        LD    DE,$15    ; add $15 pnt now! (ehm, that's 150000 points, right?)
        LD    BC,0
        JR    K00
SKIP:
        LD    DE,0
        LD    BC,$1000     ; add 1000$ pnt
K00:
        CALL  ADDSC
        CALL  SEE
        JR    LOOP
SEE:
        LD    HL,(SCORE+2)
        LD    DE,0
        CALL  ASCI
        LD    HL,(SCORE)
        LD    DE,4
        JP    ASCI

SCORE:  .DB    0,0,0,0

ADDSC:
        LD    IX,SCORE
        LD    A,(IX+0)
        ADD   A,C
        DAA
        LD    (IX+0),A
        LD    A,(IX+1)
        ADC   A,B
        DAA
        LD    (IX+1),A
        LD    A,(IX+2)
        ADC   A,E
        DAA
        LD    (IX+2),A
        LD    A,(IX+3)
        ADC   A,D
        DAA
        LD    (IX+3),A
        RET

ASCI:
        LD    A,E
        DI
        OUT   ($99),A
        LD    A,D
        OR    64
        OUT   ($99),A
        EI

        LD    A,H
        CALL  NUM1
        LD    A,H
        CALL  NUM2
        LD    A,L
        CALL  NUM1
        LD    A,L
        JR    NUM2

NUM1:
        RRA
        RRA
        RRA
        RRA
NUM2:
        AND   $0F
        ADD   A,'0'
        OUT   ($98),A
        RET


endProgram:

.end

How could i do to add HI-SCORE, to this important source in assembler?
I wait your good news
Thanks in advance
Regards
(^_^)
AG.

ログイン/登録して投稿

By PingPong

Enlighted (4156)

PingPong さんの画像

04-03-2022, 19:12

引用:

How could i do to add HI-SCORE, to this important source in assembler?

By learning how to code in assembler instead of continously asking your desk mate to do your homework for you

By ARTRAG

Enlighted (6977)

ARTRAG さんの画像

04-03-2022, 21:29

+1

By gdx

Enlighted (6438)

gdx さんの画像

05-03-2022, 11:08

Gasparrini, I do not see how to help you. You come with an example you found somewhere and ask why it does not work for me. So we can only answer: What's wrong? What screen mode do you use? What environment? And many other questions. The example you give seems planned for text modes.

It happens sometimes that we do not find a bug in a program as it is something stupid. Ask for help for this is understandable but you do it systematically and without any detail. Don't you understand how integrate an assembler routine? Do you know how to use a debugger? If so, I invite you to follow PingPong's advice and dig in the wiki with a translator. You seem to have big gaps on the MSX computers system, you must first know a minimum the environment on which you want to work. All systems have rules.

By mcolom

Champion (321)

mcolom さんの画像

05-03-2022, 11:31

I guess the goal is to add a "hiscore" variable from the existing SCORE. In that case, it's just a comparison of the two BCD numbers and copying hiscore <- score if score is over hiscore.

By gdx

Enlighted (6438)

gdx さんの画像

05-03-2022, 11:52

Probably, but he better say exactly what he wants. The example he gives does more than just that. He doesn't seem to know assembler so I guess he wants a machine routine to call it from the BASIC but if so what kind of score? A program in assembler can vary enormously depending on what he is trying to do. He can't give some routine and say cope on with it.

By mcolom

Champion (321)

mcolom さんの画像

05-03-2022, 11:53

Indeed, specific short questions are more likely to get answers.

By thegeps

Paragon (1259)

thegeps さんの画像

05-03-2022, 12:50

I wrote him in Italian. He need only to implement the highscore. I've sent him the code (fully commented) to do so. Maybe it will help him improving.

By MsxKun

Paragon (1134)

MsxKun さんの画像

05-03-2022, 13:50

thegeps wrote:

I wrote him in Italian. He need only to implement the highscore. I've sent him the code (fully commented) to do so. Maybe it will help him improving.

No. Cause you did the job for him, he will just copy paste that code without trying to learn and understand it. And next time he will ask again expecting that you fix another random copy pasted code for him one more time.

By ARTRAG

Enlighted (6977)

ARTRAG さんの画像

05-03-2022, 15:00

@thegeps
You are wasting time and energies. Moreover the guy rips everything he can without understanding what is doing nor crediting his sources. You are warned.

By PingPong

Enlighted (4156)

PingPong さんの画像

05-03-2022, 16:24

引用:
引用:

thegeps wrote:
I wrote him in Italian. He need only to implement the highscore. I've sent him the code (fully commented) to do so. Maybe it will help him improving.

No. Cause you did the job for him, he will just copy paste that code without trying to learn and understand it. And next time he will ask again expecting that you fix another random copy pasted code for him one more time.

Exactly!!! It is not the first time he does ask questions like this.
He does not want to learn anything. He simply do a copy paste operation without trying to learn anything.

Sometimes he show us, entirely copied , chunks of code that he ask to adapt to everyone. For example, he borrow from other games sw sprite definitions and he does not take the minimum effort to change a single pixel from the sprite shape...
Periodically he does came up to us with those code chunks borrowed from anywhere and ask someone to fix them for its needings . He does not even try to do the work by itself, asking help if this fail or get stuck, he simply forward to MRC the source code and ask someone to do something.

And it is a bit boring.