I ASK HELP FOR ROUTINE IN ASSEMBLER FOR RESET ALL KEYS FUNCTIONS FROM F1 UNTIL F5

Por gasparrini

Champion (331)

Imagen del gasparrini

31-05-2018, 09:51

Hello to all we user of MSX world,

After much time, I am got back to write on this forum, and I must to say
that for me is a real pleasure, but now I would like talk of the my little
problem of code assembler for MSX1.

I tried to program myself one
small routine to reset all keys functions from F1 until F5, but unfortunately
it is not vey good, in the sense that the 5 keys are not reset well
with my code done.

That's why I kindly ask for your help,
and I hope that my request will be accepted as much as possible
as soon as possible.

Here under there is my assembler code for CHAOS
ASSEMBLER 3. but must be adjusted well!

; REDAZIONE DATAPRINT MAGAZINE
;
; Prog: RESET ALL KEYS FUNCTIONS FROM F1 UNTIL F5
; Code: DATAPRINT MAGAZINE
; Date: 29/5/2018
;
; cmnt: (C) 2018 EDIZIONI DATAPRINT MAGAZINE
;
; Coded in TeddyWareZ' Chaos Assembler 3
;
; (C) 2018 DATAPRINT MAGAZINE


	.org $D000 - 7

	.db $fe
	.dw startProgram,endProgram,startProgram

startProgram:

; RESET ALL KEYS FUNCTIONS FROM F1 UNTIL F5

 CALL KEY_DELETE     
 CALL KEY_RESET
 RET  ; Return BASIC

KEY_DELETE:

  POP HL
  PUSH HL 
  
; DEFINE DELETE KEY1

 ld hl,$F87F
 ld hl,KEYTEXT1
 ld de,$F87F
 ld bc,$5
 ldir
; DEFINE DELETE KEY2

 ld hl,$F88F
 ld hl,KEYTEXT2
 ld de,$F88F
 ld bc,$4
 ldir
; DEFINE DELETE KEY3

 ld hl,$F89F
 ld hl,KEYTEXT3
 ld de,$F89F
 ld bc,$4
 ldir
; DEFINE DELETE KEY4

 ld hl,$F8AF
 ld hl,KEYTEXT4
 ld de,$F8AF
 ld bc,$4
 ldir
; DEFINE DELETE KEY5

 ld hl,$F8BF
 ld hl,KEYTEXT5
 ld de,$F8BF
 ld bc,$3
 ldir

  POP HL
  XOR A 
  RET        
  
  
KEY_RESET:

  POP HL
  PUSH HL 
  
; DEFINE RESET KEY1

 ld hl,$F87F
 ld hl,KEYTEXT_RESET1
 ld de,$F87F
 ld bc,$1
 ldir
; DEFINE RESET KEY2

 ld hl,$F88F
 ld hl,KEYTEXT_RESET2
 ld de,$F88F
 ld bc,$1
 ldir
; DEFINE RESET KEY3

 ld hl,$F89F
 ld hl,KEYTEXT_RESET3
 ld de,$F89F
 ld bc,$1
 ldir
; DEFINE RESET KEY4

 ld hl,$F8AF
 ld hl,KEYTEXT_RESET4
 ld de,$F8AF
 ld bc,$1
 ldir
; DEFINE RESET KEY5

 ld hl,$F8BF
 ld hl,KEYTEXT_RESET5
 ld de,$F8BF
 ld bc,$1
 ldir

  POP HL
  XOR A 
  RET  


KEYTEXT1:
  .DB "     " 
KEYTEXT2:
  .DB "    "
KEYTEXT3:
  .DB "    "                     
KEYTEXT4:
  .DB "    " 
KEYTEXT5:
  .DB "   "    
  
; ==================================
; KEY RESET ALL KEYS: F1,F2,F3,F4,F5
; ==================================
  
KEYTEXT_RESET1:
  .DB " " 
KEYTEXT_RESET2:
  .DB " "
KEYTEXT_RESET3:
  .DB " "                     
KEYTEXT_RESET4:
  .DB " " 
KEYTEXT_RESET5:
  .DB " "

endProgram:

.end

For now is all.....
Best Regards
(^_^)
Andrea Gasparrini from Italy

Login sesión o register para postear comentarios

Por ro

Scribe (4964)

Imagen del ro

31-05-2018, 10:19

Greeting earthling, that's mean code there. But, let us not get wasted on spaghetti, or any other pasta.
If you remove the "pop HL" at the end of your routine, you'll save yourself a lot of trouble. See, by popping that 16bit adr yer essentially killing the CALL/RET loop. Pop HL will get the return adres (SP) of the CALL and drop it, so "RET" will not return to the original CALLING address.

And, while we are at it, drop the "pop hl, push hl" at the beginning as well. Why'd ye copy the SP in HL while loading HL with new value (twice!)?

Clearing all keys would be easy, like:

LD HL,start adres of key1
LD DE,start adres of key1 +1
LD BC,5keys * keylength
XOR A
LD (HL),A
LDIR

(if my memory serves me well, been too long since I wrote some descent Z80 stuff)

Por ghost_jp

Master (136)

Imagen del ghost_jp

31-05-2018, 10:49

I wonder what gasparrini actually wants is to make indicators of function key under the screen disappear.

call $00CC ; call ERAFNK

Por gasparrini

Champion (331)

Imagen del gasparrini

31-05-2018, 14:27

Quote:

I wonder what gasparrini actually wants is to make indicators of function key under the screen disappear.

call $00CC ; call ERAFNK

Hello Ghost_jp,

No! I don't want do KEYOFF with CALL $00CC or DEFUSR=&HCC:A=USR(0) in BASIC

But I would like do in this mode:

10 REM RESET ALL KEYS FROM F1 UNTIL F5
20 KEY1,"":KEY2,"":KEY3,""
30 KEY4,"":KEY5,""
40 END

Por NYYRIKKI

Enlighted (6067)

Imagen del NYYRIKKI

31-05-2018, 14:51

ro is correct here... The routine with real addresses goes like this:

KEY_DELETE:
	LD HL,#F87F
	LD DE,#F880
	LD BC,79 ; 5*16-1
	XOR A
	LD (HL),A
	LDIR
	RET

Por gasparrini

Champion (331)

Imagen del gasparrini

31-05-2018, 15:25

Hello Dear Nyyrikki,

Thanks very much for your help of always !!
I tried soon and tested your routine in assembler
and it WORK VERY WELL !!!

I think that you are a true force of nature with the MSX standard !!
Therefore I ask still thank you of heart (^_^)

It was still a pleasure for me to talk with you........

For now is all.....
See you to soon and happy MSX !!!
(^_^)
Andrea Gasparrini from Italy

Por evulopah

Paladin (669)

Imagen del evulopah

01-06-2018, 06:57

I think Shadow did his own force of nature in this topic too Tongue