I need of routine only scroll left for SCREEN1

By gasparrini

Champion (287)

gasparrini's picture

16-09-2017, 15:37

Hello Dear all Guys,

How are you? All rights...?? (^_^)

Since the last time we heard about this forum, it's been a long time, and in the meantime I made a long pause for MSX.
But now I'm back with so much enthusiasm to get back to schedule with you in this great MSX community!

I am writing to you because I need your kindness, a scroll routine only in the left direction,
keeping the SCORE and HI-SCORE chart stand-up, basically, I do not have to shake the first two
lines of the screen in SCREEN1.

Here under there is a source in BASIC and Machine Code, to shake the screen
in all 4 directions in SCREEN1, but I repeat, I just need to scroll in
left direction, this is why to save memory on BASIC RAM.

If it is possible, if I could I have a source in assembler.
Thanks in advance.

Rest awaiting your positive response
Best Regards
(^_^)
Andrea Gasparrini from Italy

10 SCREEN1:WIDTH32:KEY OFF
20 CLEAR300,&HD4FF
30 DEFINTA-Z
40 PRINT "poke the address:":FOR F=&HD500 TO &HD8F4:READ A$:POKE F,VAL("&h"+A$):LOCATE 18,0:PRINT HEX$(F);" ":NEXTF
50 DEFUSR=&HD500:A=USR(0):CLS
60 LOCATE 0,0:PRINT "HI-SCORE"
70 LOCATE 0,1:PRINT "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
80 FOR F=1 TO 40
90 X=32*RND(1)
100 LOCATE X,20:PRINT ".";
110 X=USR(0)
120 NEXT F
130 FOR F=1 TO 40
140 X=32*RND(1)
150 LOCATE X,2:PRINT ".";
160 X=USR1(0)
170 NEXT F
180 FOR F=1 TO 40
190 X=21*RND(1)+2
200 LOCATE 31,X:PRINT ".";
210 X=USR2(0)
220 NEXT F
230 FOR F=1 TO 40
240 X=21*RND(1)+2
250 LOCATE 0,X:PRINT ".";
260 X=USR3(0)
270 NEXT F
280 END
290 DATA 21,19,D5,22,9A,F3,21,4B
300 DATA D5,22,9C,F3,21,7D,D5,22
310 DATA 9E,F3,21,BD,D5,22,A0,F3
320 DATA C9,21,40,18,11,F4,D5,01
330 DATA C0,02,CD,59,00,21,14,D6
340 DATA 11,40,18,01,A0,02,CD,5C
350 DATA 00,21,F4,D5,36,20,11,F5
360 DATA D5,01,20,00,ED,B0,21,F4
370 DATA D5,11,E0,1A,01,20,00,CD
380 DATA 5C,00,C9,21,40,18,11,F4
390 DATA D5,01,C0,02,CD,59,00,21
400 DATA F4,D5,11,60,18,01,A0,02
410 DATA CD,5C,00,21,F4,D5,36,20
420 DATA 11,F5,D5,01,20,00,ED,B0
430 DATA 21,F4,D5,11,40,18,01,20
440 DATA 00,CD,5C,00,C9,21,40,18
450 DATA 22,F2,D5,06,17,C5,01,20
460 DATA 00,2A,F2,D5,11,F4,D5,CD
470 DATA 59,00,21,F5,D5,11,F4,D5
480 DATA 01,1F,00,ED,B0,21,13,D6
490 DATA 36,20,21,F4,D5,ED,5B,F2
500 DATA D5,01,20,00,CD,5C,00,2A
510 DATA F2,D5,11,20,00,19,22,F2
520 DATA D5,C1,10,C9,C9,21,40,18
530 DATA 22,F2,D5,06,17,C5,01,20
540 DATA 00,2A,F2,D5,11,F5,D5,CD
550 DATA 59,00,21,F4,D5,36,20,21
560 DATA F4,D5,ED,5B,F2,D5,01,20
570 DATA 00,CD,5C,00,2A,F2,D5,11
580 DATA 20,00,19,22,F2,D5,C1,10
590 DATA D4,C9,00,00,00,00,00,00
600 DATA 00,00,00,00,00,00,00,00
610 DATA 00,00,00,00,00,00,00,00
620 DATA 00,00,00,00,00,00,00,00
630 DATA 00,00,00,00,00,00,00,00
640 DATA 00,00,00,00,00,00,00,00
650 DATA 00,00,00,00,00,00,00,00
660 DATA 00,00,00,00,00,00,00,00
670 DATA 00,00,00,00,00,00,00,00
680 DATA 00,00,00,00,00,00,00,00
690 DATA 00,00,00,00,00,00,00,00
700 DATA 00,00,00,00,00,00,00,00
710 DATA 00,00,00,00,00,00,00,00
720 DATA 00,00,00,00,00,00,00,00
730 DATA 00,00,00,00,00,00,00,00
740 DATA 00,00,00,00,00,00,00,00
750 DATA 00,00,00,00,00,00,00,00
760 DATA 00,00,00,00,00,00,00,00
770 DATA 00,00,00,00,00,00,00,00
780 DATA 00,00,00,00,00,00,00,00
790 DATA 00,00,00,00,00,00,00,00
800 DATA 00,00,00,00,00,00,00,00
810 DATA 00,00,00,00,00,00,00,00
820 DATA 00,00,00,00,00,00,00,00
830 DATA 00,00,00,00,00,00,00,00
840 DATA 00,00,00,00,00,00,00,00
850 DATA 00,00,00,00,00,00,00,00
860 DATA 00,00,00,00,00,00,00,00
870 DATA 00,00,00,00,00,00,00,00
880 DATA 00,00,00,00,00,00,00,00
890 DATA 00,00,00,00,00,00,00,00
900 DATA 00,00,00,00,00,00,00,00
910 DATA 00,00,00,00,00,00,00,00
920 DATA 00,00,00,00,00,00,00,00
930 DATA 00,00,00,00,00,00,00,00
940 DATA 00,00,00,00,00,00,00,00
950 DATA 00,00,00,00,00,00,00,00
960 DATA 00,00,00,00,00,00,00,00
970 DATA 00,00,00,00,00,00,00,00
980 DATA 00,00,00,00,00,00,00,00
990 DATA 00,00,00,00,00,00,00,00
1000 DATA 00,00,00,00,00,00,00,00
1010 DATA 00,00,00,00,00,00,00,00
1020 DATA 00,00,00,00,00,00,00,00
1030 DATA 00,00,00,00,00,00,00,00
1040 DATA 00,00,00,00,00,00,00,00
1050 DATA 00,00,00,00,00,00,00,00
1060 DATA 00,00,00,00,00,00,00,00
1070 DATA 00,00,00,00,00,00,00,00
1080 DATA 00,00,00,00,00,00,00,00
1090 DATA 00,00,00,00,00,00,00,00
1100 DATA 00,00,00,00,00,00,00,00
1110 DATA 00,00,00,00,00,00,00,00
1120 DATA 00,00,00,00,00,00,00,00
1130 DATA 00,00,00,00,00,00,00,00
1140 DATA 00,00,00,00,00,00,00,00
1150 DATA 00,00,00,00,00,00,00,00
1160 DATA 00,00,00,00,00,00,00,00
1170 DATA 00,00,00,00,00,00,00,00
1180 DATA 00,00,00,00,00,00,00,00
1190 DATA 00,00,00,00,00,00,00,00
1200 DATA 00,00,00,00,00,00,00,00
1210 DATA 00,00,00,00,00,00,00,00
1220 DATA 00,00,00,00,00,00,00,00
1230 DATA 00,00,00,00,00,00,00,00
1240 DATA 00,00,00,00,00,00,00,00
1250 DATA 00,00,00,00,00,00,00,00
1260 DATA 00,00,00,00,00,00,00,00
1270 DATA 00,00,00,00,00,00,00,00
1280 DATA 00,00,00,00,00,00,00,00
1290 DATA 00,00,00,00,00,00,00,00
1300 DATA 00,00,00,00,00,00,00,00
1310 DATA 00,00,00,00,00,00,00,00
1320 DATA 00,00,00,00,00,00,00,00
1330 DATA 00,00,00,00,00,00,00,00
1340 DATA 00,00,00,00,00,00,00,00
1350 DATA 00,00,00,00,00,00,00,00
1360 DATA 00,00,00,00,00,00,00,00
1370 DATA 00,00,00,00,00,00,00,00
1380 DATA 00,00,00,00,00,00,00,00
1390 DATA 00,00,00,00,00,00,00,00
1400 DATA 00,00,00,00,00,00,00,00
1410 DATA 00,00,00,00,00,00,00,00
1420 DATA 00,00,00,00,00,00,00,00
1430 DATA 00,00,00,00,00,00,00,00
1440 DATA 00,00,00,00,00,00,00,00
1450 DATA 00,00,00,00,00,00,00,00
1460 DATA 00,00,00,00,00,00,00,00
1470 DATA 00,00,00,00,00,00,00,00
1480 DATA 00,00,00,00,00,00,00,00
1490 DATA 00,00,00,00,00,00,00,00
1500 DATA 00,00,00,00,00,00,00,00
1510 DATA 00,00,00,00,00,00,00,00
1520 DATA 00,00,00,00,00,00,00,00
1530 DATA 00,00,00,00,00,00,00,00
1540 DATA 00,00,00,00,00,00,00,00
1550 DATA 00,00,00,00,0E
Login or register to post comments

By Jipe

Paragon (1269)

Jipe's picture

16-09-2017, 17:25

kill the lines 600 to 1550 and change the end adress to &HD600
BSAVE the datas directly : Line 45 BSAVE "DATA.BIN" ,&H500,&HD600:END
kill lines 40 , 290 to 590
you have the code only

By Manuel

Ascended (13565)

Manuel's picture

16-09-2017, 18:32

gasparinni: didn't you notice all these zeroes from line 600 onwards?

By gasparrini

Champion (287)

gasparrini's picture

16-09-2017, 20:54

Hello Jipe,

I have do your instructions, but the scroll work is in UP only and not in LEFT,
maybe you're wrong!

thank you very much for your kind help of always,
but the program to get the scroll well
must be correct !!

I still look forward to your news
Best Regards
(^_^)
Andrea

By gasparrini

Champion (287)

gasparrini's picture

17-09-2017, 00:33

There is that saying, "WHO IS ONLY ON THREE TIMES!"

I managed to disassemble part of the routine I was interested in left-clicking.
However thanks the same !!

Here is the BASIC routine under !!

10 REM SCROLL LEFT
20 REM by Andrea Gasparrni
30 REM
40 '** CODE MACHINE
50 '**
60 '
70 DATA FE,00,D5,00,D6,00,D5,21
80 DATA 0E,D5,22,9E,F3,C9,21,40
90 DATA 18,22,F2,D5,06,17,C5,01
100 DATA 20,00,2A,F2,D5,11,F4,D5
110 DATA CD,59,00,21,F5,D5,11,F4
120 DATA D5,01,1F,00,ED,B0,21,13
130 DATA D6,36,20,21,F4,D5,ED,5B
140 DATA F2,D5,01,20,00,CD,5C,00
150 DATA 2A,F2,D5,11,20,00,19,22
160 DATA F2,D5,C1,10,C9,C9,FF
170 DATA 9215
180 '
190 '** LOADER L/M
200 '
210 CLEAR300,54527!:RESTORE 70
220 FOR X=54528! TO 54606!
230 READ A$:Y=VAL("&H"+A$)
240 POKE X,Y:CK=CK+Y
250 NEXT X
260 READ X:IF X<>CK THEN BEEP:PRINT"ERRORE NEI DATA: RICONTROLLA!":LIST 70-170:END
270 DEFUSR=&HD500:A=USR(0)
280 REM A=USR2(0) FOR SCROLL LEFT
290 SCREEN1,2:KEYOFF
300 WIDTH32:END

Insted, here under there is the routine that I have to assembler,
but I think that it must to be made better.

; DreamQuick Studio MSX Z80 source file.
;
; Prog: SCROLL LEFT
; Code: Assembler Z80 MSX1
; Date: 16/9/2017
;
; cmnt: Andrea Gasparrini
;
; Coded in TeddyWareZ' Chaos Assembler 3
;
; (C) 2017 DreamQuick Studio
;

	.org $D500 - 7

	.db $fe
	.dw startProgram,endProgram,startProgram

startProgram:

   CP      $00
   PUSH    DE
   NOP     
   SUB     $00
   PUSH    DE
  ; LD      HL,$D519
  ; LD      ($F39A),HL    ; A=USR0(0)
  ; LD      HL,$D54B
  ; LD      ($F39C),HL    ; A=USR1(0)
   LD      HL,SCROLL_LEFT
   LD      ($F39E),HL     ; A=USR2(0)
 ;  LD      HL,$D5BD
 ;  LD      ($F3A0),HL    ; A=USR3(0)
   RET     

SCROLL_LEFT:
   LD      HL,$1840
   LD      ($D5F2),HL
   LD      B,$17
LOOP: 
   PUSH    BC
   LD      BC,$20
   LD      HL,($D5F2)
   LD      DE,$D5F4
   CALL    $59
   LD      HL,$D5F5
   LD      DE,$D5F4
   LD      BC,$1F
   LDIR    
   LD      HL,$D613
   LD      (HL),$20
   LD      HL,$D5F4
   LD      DE,($D5F2)
   LD      BC,$20
   CALL    $5C
   LD      HL,($D5F2)
   LD      DE,$20
   ADD     HL,DE
   LD      ($D5F2),HL
   POP     BC
   DJNZ    LOOP ;0D58CH           ; (-37h)
   RET     

endProgram:

.end

I wait however a best souce in assembler of this routine scroll left in SCREEN1
For now is all....
Best Regards
AG.

By gasparrini

Champion (287)

gasparrini's picture

17-09-2017, 00:36

Quote:

gasparinni: didn't you notice all these zeroes from line 600 onwards?

Messagge for Manuel:

The BASIC LIST from line 600 to 1550 ;
are required for buffer memory !!!

By Chaom

Rookie (21)

Chaom's picture

17-09-2017, 02:56

startProgram:

--> CP $00
--> PUSH DE
--> NOP
--> SUB $00
--> PUSH DE

this code is BLOAD file header (FE 00 D5 00 D6 00 D5) and not need, you can delete it.

By Vampier

Prophet (2113)

Vampier's picture

17-09-2017, 16:13

gasparrini wrote:
Quote:

gasparinni: didn't you notice all these zeroes from line 600 onwards?

Messagge for Manuel:

The BASIC LIST from line 600 to 1550 ;
are required for buffer memory !!!

not sure why... but there are more efficient ways to do this Smile

By DanySoft

Champion (394)

DanySoft's picture

06-12-2017, 21:12

Problem? oO

By DanySoft

Champion (394)

DanySoft's picture

07-12-2017, 22:26

I have examined this source, but on the line there is an instruction at ($d5A0) that perhaps you have moved forward and I do not know if it is correct.

$D592   LD    HL,$D5F5
$D595   LD    DE,$D5F4
$D598   LD    BC,$1F
$D59B   LDIR
$D59D   LD    HL,$D613
$D5A0   LD    (HL),$20  ;?
$D5A2   LD    HL,$D5F4
$D5A55  LD    DE,($D5F2)
$D5A9   LD    BC,$20
$D5AC   CALL  $5C       ;!

It should be corrected with this:

$D592   LD    HL,$D5F5
$D595   LD    DE,$D5F4
$D598   LD    BC,$1F
$------   LD    (HL),$20  ;<==
$D59B   LDIR
$D59D   LD    HL,$D613
$D5A2   LD    HL,$D5F4
$D5A5  LD    DE,($D5F2)
$D5A9   LD    BC,$20
$D5AC   CALL  $5C       ;!

Original sources:

Address: $D500-$D600

$D500   LD    HL,$D519    ;PARTE1
$D503   LD    ($F39A),HL  ;usr0
$D506   LD    HL,$D54B    ;PARTE2
$D509   LD    ($F39C),HL  ;usr1
$D50C   LD    HL,$D57D    ;PARTE3
$D50F   LD    ($F39E),HL  ;usr2
$D512   LD    HL,$D5BD    ;PARTE4
$D515   LD    ($F3A0),HL  ;usr3
$D518   RET

;PARTE 1
$D519   LD    HL,$1840  ;Display Address Vram
$D51C   LD    DE,$D5F4  ;start
$D51F   LD    BC,$02C0  ; 02C0h 
$D522   CALL  $59
$D525   LD    HL,$D614
$D528   LD    DE,$1840
$D52B   LD    BC,$02A0  
$D52E   CALL  $5C
$D531   LD    HL,$D5F4  ;start
$D534   LD    (HL),$20
$D536   LD    DE,$D5F5
$D539   LD    BC,$20
$D53C   LDIR
$D53E   LD    HL,$D5F4  ;start
$D541   LD    DE,$1AE0
$D544   LD    BC,$20
$D547   CALL  $5C
$D54A   RET

;PARTE2
$D54B   LD    HL,$1840  ;Display Address Vram
$D54E   LD    DE,$D5F4  ;start
$D551   LD    BC,$02C0
$D554   CALL  $59
$D557   LD    HL,$D5F4  ;start
$D55A   LD    DE,$1860
$D55D   LD    BC,$02A0
$D560   CALL  $5C
$D563   LD    HL,$D5F4  ;start
$D566   LD    (HL),$20
$D568   LD    DE,$D5F5
$D56B   LD    BC,$20
$D56E   LDIR
$D570   LD    HL,$D5F4  ;start
$D573   LD    DE,$1840
$D576   LD    BC,$20
$D579   CALL  $5C
$D57C   RET

;PARTE3
$D57D   LD    HL,$1840  ;Display Address Vram
$D580   LD    ($D5F2),HL
$D583   LD    B,$17
$D585   PUSH  BC
$D586   LD    BC,$20
$D589   LD    HL,($D5F2)
$D58C   LD    DE,$D5F4
$D58F   CALL  $59
$D592   LD    HL,$D5F5
$D595   LD    DE,$D5F4
$D598   LD    BC,$1F
$D59B   LDIR
$D59D   LD    HL,$D613
$D5A0   LD    (HL),$20  ;?
$D5A2   LD    HL,$D5F4
$D5A5  LD    DE,($D5F2)
$D5A9   LD    BC,$20
$D5AC   CALL  $5C       ;!
$D5AF   LD    HL,($D5F2)
$D5B2   LD    DE,$20
$D5B5   ADD   HL,DE
$D5B6   LD    ($D5F2),HL
$D5B9   POP   BC
$D5BA   DJNZ  $D585
$D5BC   RET

;PARTE4
$D5BD   LD    HL,$1840
$D5C0   LD    ($D5F2),HL

$D5C3   LD    B,$17
$D5C5   PUSH  BC
$D5C6   LD    BC,$20
$D5C9   LD    HL,($D5F2)
$D5CC   LD    DE,$D5F5
$D5CF   CALL  $59
$D5D2   LD    HL,$D5F4
$D5D5   LD    (HL),$20
$D5D7   LD    HL,$D5F4
$D5DA   LD    DE,($D5F2)
$D5DE   LD    BC,$20
$D5E1   CALL  $5C
$D5E4   LD    HL,($D5F2)
$D5E7   LD    DE,$20
$D5EA   ADD   HL,DE
$D5EB   LD    ($D5F2),HL
$D5EE   POP   BC
$D5EF   DJNZ  $D5C5
$D5F1   RET

$D5F2   dw 0


$D5F4   NOP ;Addres

$D600   NOP

$D613       ;Addres

Good luck!!
DanySoft

By DanySoft

Champion (394)

DanySoft's picture

08-12-2017, 22:30

Hello
I thought of a solution for the scroll.
Here it is:

        .org $d500-7
        .db $FE
        .dw begin
        .dw fine
        .dw begin
begin:
      jp su
      jp giu
      jp des
      jp sin

start: .equ 6144+64
size: .equ 768-64

copy:
    ld hl,start
    ld de,buf
    ld bc,size
    call $59
    ld hl,buf
    ld (mhl),hl
    ret

;sinistra
sin:
    call copy
    ld b,22
sin00:
      push bc
    ld hl,(mhl)
    ld de,temp
    ld bc,32
    ldir

    ld hl,temp+1
    ld de,(mhl)
    ld bc,31
    ldir
    ld a,(temp)
    ld hl,(mhl)
    ld bc,31
    add hl,bc
    ld (hl),a


    ld hl,(mhl)
    ld bc,32
    add hl,bc
    ld (mhl),hl
    pop bc
    djnz sin00
    jp view

;destra
des:
    call copy
    ld b,22
des00:
      push bc
    ld hl,(mhl)
    ld de,temp
    ld bc,32
    ldir

    ld hl,temp
    ld de,(mhl)
    inc de
    ld bc,31
    ldir
    ld a,(temp+31)
    ld hl,(mhl)
    ld (hl),a
    ld hl,(mhl)
    ld bc,32
    add hl,bc
    ld (mhl),hl
    pop bc
    djnz des00
    jp view




su:
   ld hl,start+32
   ld de,buf
   ld bc,size
   call $59
   ld hl,start
   ld de,buf+size-32
   ld bc,32
   call $59
   jp view
giu:
    ld hl,start
    ld de,buf+32
    ld bc,size-32
    call $59
    ld hl,start+size-32
    ld de,buf
    ld bc,32
    call $59
    jp view
view:
     ld hl,buf
     ld de,start
     ld bc,size
     call $5c
     ret
mhl:  .dw 0
buf:  .ds 768
temp: .ds 32
     
fine:
	.end

And finally the BASIC for an example:

10 SCREEN 1,2
20 BLOAD "ca3.obj"
30 DEFUSR1=&HD500 :REM Up
31 DEFUSR2=&HD503 :REM Down
32 DEFUSR3=&HD506 :REM Right
33 DEFUSR4=&HD509 :REM Left
40 FORJ=0TO20
50 X=RND(TIME)*31
60 Y=RND(TIME)*20
70 LOCATE X,2+Y:PRINT"."
80 NEXTJ
81 LOCATE 14,2:PRINT "MSX"
85 D=STICK(0)
90 IF D=1 THEN A=USR1(0)
91 IF D=5 THEN A=USR2(0)
92 IF D=3 THEN A=USR3(0)
93 IF D=7 THEN A=USR4(0)
100 GOTO 85

As you can see, the scroll was a success!
DanySoft

My MSX profile