I ask help for handle routine assembler for PAINT from BASIC

Страница 1/2
| 2

By gasparrini

Champion (335)

Аватар пользователя gasparrini

14-02-2021, 13:59

Hello to all USER'S MSX of the World,

I ask help for handle routine assembler for PAINT from BASIC,
unfortunately this routine does not work, because there is an
error in this part:

;---- WORK AREA ----

COL     .DS 1
BORD   .DS 1
Q.TOP  .DS 2
Q.BTM  .DS 2
Q.BUF  .DS Q.LENGTH  <-------- ERROR in compiler from CHAOS ASSEMBLER 3!

Here under there is all the complete routine for PAINT as from BASIC:

; -------------------------------------------
; AGsoftware MSX Z80 source file.
;
; Prog: PAINT in ASSEMBLER
; Code: AG. Italy
; Date: 14/02/2021
;
;  INCLUDE ROUTINE: PSET+POINT
;
; Coded in TeddyWareZ' Chaos Assembler 3
;
; -------------------------------------------


	.org $C000 - 7

	.db $fe
	.dw startProgram,endProgram,startProgram

startProgram:

;     EXTERNAL ROUTINE  PSET
;     EXTERNAL ROUTINE  POINT

Q.LEGTH  .EQU 256*2*2
MAX.Y      .EQU 211

RDVDP     .EQU $06   ; POINT and PSET ROUTINE
WRVDP    .EQU $07   ; POINT and PSET ROUTINE

; ---- PAINT MAIN ROUTINE ----

PAINT: 

 CALL POINT
 CP D
 RET Z
 CALL INIT.Q
 LD (COL),DE
 CALL PUT.Q
 LD A,(COL)
 LD E,A
 XOR A     ; LOG I-OP: PSET
 CALL PSET
PAINT0:
 CALL GET.Q
 RET C
 INC H
 CALL NZ,PAINT.SUB
 DEC H
 JP Z,PAINT1
PAINT1:
 DEC L
 LD A,-1
 CP L
 CALL NZ,PAINT.SUB
 INC L
 INC L
 LD A,MAX.Y
 CP L
 CALL NC,PAINT.SUB

; ---- CHECK POINT AND PSET ----

PAINT.SUB:
 CALL POINT
 LD D,A
 LD A,(BORD)
 CP D
 RET Z
 LD A,(COL)
 CP D
 RET Z
 LD E,A
 XOR A
 ;CALL PSET
 CALL PUT.Q
 RET
 
; ---- INIT Q.BUFFER POINTER ----

INIT.Q:
 PUSH HL
 LD HL,Q.BUF
 LD (Q.TOP),HL
 LD (Q.BTM),HL
 POP HL
 RET

; ---- PUT, POINT TO Q.BUF (X:H, Y:L) ----

PUT.Q:
 EX DE,HL
 LD HL,(Q.TOP)
 LD BC,Q.BUF+Q.LENGTH+1
 OR A        ; CLEAR CARRY
 PUSH HL
 SBC HL,BC                
 POP HL
 JP C,PUT.Q1 
 LD HL,Q.BUF
PUT.Q1:
 LD (HL),D
 INC HL
 LD (HL),E
 INC HL
 LD (Q.TOP),HL
 EX DE,HL
 RET

; ---- TAKE POINT DATA TO D,E ----
;      RETURNS:  NC  H:x, L:y
;                C   BUFFER EMPTY

GET.Q:
 LD HL,(Q.BTM)
 LD BC,(Q.TOP)
 OR A
 SBC HL,BC
 JP NZ,GET.Q0
 SCF
 RET

GET.Q0:
 LD HL,(Q.BTM)
 LD BC,Q.BUF+Q.LENGTH+1
 OR A
 PUSH HL
 SBC HL,BC
 POP HL
 JP C,GET.Q1
 LD HL,Q.BUF
 
GET.Q1:
 LD D,(HL)
 INC HL
 LD E,(HL)
 INC HL
 LD (Q.BTM),HL
 OR A
 EX DE,HL
 RET    


; ---- PUBLIC PSET ----

PSET:
 DI
 PUSH AF
 CALL WAIT.VDP
 LD BC,(WRVDP)
 INC C
 LD A,36
 OUT (C),A
 LD A,$80+17
 OUT (C),A
 PUSH BC
 INC C
 INC C
 OUT (C),H
 OUT (C),A
 OUT (C),L
 OUT (C),A   
 POP BC
 LD A,44
 OUT (C),A
 LD A,$80+17
 OUT (C),A
 INC C
 INC C
 OUT (C),E
 XOR A
 OUT (C),A
 LD E,01010000B
 POP AF
 OR E
 OUT (C),A
 EI
 RET
 
 
; ---- PUBLIC POINT ----

POINT:
 DI
 CALL WAIT.VDP
 LD A,(WRVDP)
 LD C,A
 INC C
 LD A,32
 OUT (C),A
 LD A,$80+17
 OUT (C),A
 INC C
 INC C
 XOR A
 OUT (C),H
 OUT (C),A
 OUT (C),L
 OUT (C),A
 DEC C
 DEC C
 OUT (C),A
 LD A,$80+45
 OUT (C),A
 LD A,01000000B
 OUT (C),A
 LD A,$80+46
 OUT (C),A
 CALL WAIT.VDP
 LD A,7
 CALL GET.STATUS
 PUSH AF         
 XOR A
 CALL GET.STATUS
 POP AF
 EI
 RET
 
GET.STATUS:
 PUSH BC
 LD BC,(WRVDP)
 INC C
 OUT (C),A
 LD A,$8F
 OUT (C),A
 LD BC,(RDVDP)
 INC C
 IN A,(C)
 POP BC
 RET
 
WAIT.VDP:
 LD A,2
 CALL GET.STATUS
 AND 1
 JP NZ,WAIT.VDP
 XOR A
 CALL GET.STATUS
 RET  
 


;---- WORK AREA ----

COL      .DS 1
BORD    .DS 1
Q.TOP   .DS 2
Q.BTM   .DS 2
Q.BUF   .DS Q.LENGTH
 
endProgram:

.end

I hope some of you can help me solve this little programming problem in assembler.
Thanks in advance
Best Regards
(^_^)
AG.

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By Metalion

Paragon (1628)

Аватар пользователя Metalion

14-02-2021, 14:24

Looks like it should be, quite logically :

;---- WORK AREA ----

COL     .DS 1
BORD   .DS 1
Q.TOP  .DS 2
Q.BTM  .DS 2
Q.BUF  .DS 2
Q.LENGTH  .DS 2

This is not a problem of assembler, it's a problem of source !

By PingPong

Enlighted (4156)

Аватар пользователя PingPong

14-02-2021, 15:26

this guy borrow asm listing simply by copying pasting somewhere around the internet without trying to understand anything of we he got. Then, after the first small problem post tons of listings on MRC asking help without doing the minimum effort in trying to understood the problem.

If one would improve its tech skills and knownledge i think this is more worth to TRY to UNDERSTAND SOMETHING instead of blindly use without understand absolutely nothing.

instead of posting source code and asking help for any little problem you get, TRY to ASK YOU:
"What does Q.BUF .DS Q.LENGTH" mean ? What his use ? Why the assembler give me error ?

By gasparrini

Champion (335)

Аватар пользователя gasparrini

14-02-2021, 17:22

Salve PING PONG!!

Vedo che Lei è italiano! Lei è certamente un insolente!! Si prega di farsi gli affari suoi!!
Grazie!!

TEXT IN ENGLISH:

Hello PING PONG!!
I see that you are Italian! She is certainly insolent !! Please mind her !!
Thank you!!

By DanySoft

Champion (452)

Аватар пользователя DanySoft

14-02-2021, 17:58

gasparrini wrote:

Salve PING PONG!!

Vedo che Lei è italiano! Lei è certamente un insolente!! Si prega di farsi gli affari suoi!!
Grazie!!

TEXT IN ENGLISH:

Hello PING PONG!!
I see that you are Italian! She is certainly insolent !! Please mind her !!
Thank you!!

Do not worry. You are very good at programming with your MSX-Basic.
DanySoft

By gasparrini

Champion (335)

Аватар пользователя gasparrini

14-02-2021, 18:19

Dear Danysoft,

Thank you very much Dany my dear friend...... ;-)

By PingPong

Enlighted (4156)

Аватар пользователя PingPong

19-02-2021, 21:10

gasparrini wrote:

Salve PING PONG!!

Vedo che Lei è italiano! Lei è certamente un insolente!! Si prega di farsi gli affari suoi!!
Grazie!!

TEXT IN ENGLISH:

Hello PING PONG!!
I see that you are Italian! She is certainly insolent !! Please mind her !!
Thank you!!

I suggest you to try to learn a bit of english instead of relying on google translate.
you take the same approach with english language as you did with asm programming.
we are little bored to see a lot of code list borrowed somewhere in which you ask to patch various issues.

Just grab a good z80 asm book and invest your time in learning something instead of filling MRC pages of code listing you do not even try to understand

By DanySoft

Champion (452)

Аватар пользователя DanySoft

19-02-2021, 22:32

PingPong wrote:
gasparrini wrote:

Salve PING PONG!!

Vedo che Lei è italiano! Lei è certamente un insolente!! Si prega di farsi gli affari suoi!!
Grazie!!

TEXT IN ENGLISH:

Hello PING PONG!!
I see that you are Italian! She is certainly insolent !! Please mind her !!
Thank you!!

I suggest you to try to learn a bit of english instead of relying on google translate.
you take the same approach with english language as you did with asm programming.
we are little bored to see a lot of code list borrowed somewhere in which you ask to patch various issues.

Just grab a good z80 asm book and invest your time in learning something instead of filling MRC pages of code listing you do not even try to understand

The only small detail is that of not programming the codes with DATA and POKE by MSX-BASIC.
They are too difficult to correct this data, I prefer to use a small compiler.
This is how I solve the problem.

DanySoft Smile

By santiontanon

Paragon (1832)

Аватар пользователя santiontanon

20-02-2021, 05:20

wait!?!? how come DanySoft answered to a direct question to Gasparrini? are you the same user with two accounts? Wink

By Amaury Carvalho

Resident (41)

Аватар пользователя Amaury Carvalho

20-02-2021, 17:05

You can use the code below to access PAINT statement from BASIC interpreter itself.

;----------------------------------------------------------------------------
; PAINT ROUTINE (FROM BASIC KUN)
; IN: hl=y, de=x, b=filling color, a=border color
;----------------------------------------------------------------------------

BRDATR equ 0xFCB2
ATRBYT equ 0xFCB2
SCRMOD equ 0xFCAF
EXTROM equ 0x015F
CALBAS equ 0x0159

PAINT:
LD (BRDATR),A
LD A,B
LD (ATRBYT),A
LD C,E
LD B,D
EX DE,HL
LD A,(SCRMOD)
CP 5
JP C, PAINT.1
LD IX, 0x266E
JP EXTROM

PAINT.1:
LD IX, 0x59E3
JP CALBAS

By PingPong

Enlighted (4156)

Аватар пользователя PingPong

20-02-2021, 17:26

santiontanon wrote:

wait!?!? how come DanySoft answered to a direct question to Gasparrini? are you the same user with two accounts? Wink

Have a look at its english language structure and the kind of questions he ask... it is clear that there is the same people behind two accounts. This guy thinks to be smart, i'm not of the same idea

Страница 1/2
| 2