Make a LINE BOX in ASSEMBLER

By gasparrini

Champion (329)

gasparrini's picture

16-12-2013, 00:50

Hello Guys,

I have here my source for make un LINE BOX PAINT and not a LINE BOX without paint !!

	.org $C000 - 7

	.db $fe
	.dw startProgram,endProgram,startProgram

startProgram:

;----------------------------
bios_lineboxpaint       .equ $058C1   ; BOX PAINT
bios_linebox              .equ ??????   ; BOX
bios_line                   .equ $058fc   ; LINE
bios_basic                 .equ $00159
gxpos                       .equ $0fcb3
gypos                       .equ $0fcb5
chgmod                    .equ $005F
setatr                      .equ $011A




init:
   ld a,2
   call chgmod

   ld a,9
   call setatr

   ld hl,12
   ld (gxpos),hl
   ld hl,30
   ld (gypos),hl
   ld bc,130
   ld de,160
   call bios_lineboxpaint

hold:
   jr hold

endProgram:

.end

I ask to you, what is the address for bios_linebox .equ ?????? ; BOX
without the paint ??

I wait your good news
Best Regards
(^_^)
AG.

Login or register to post comments

By jltursan

Prophet (2619)

jltursan's picture

16-12-2013, 01:03

$05912 Smile

By gasparrini

Champion (329)

gasparrini's picture

16-12-2013, 09:43

Hello Jltursan,

Unfortunately this address $05912 doesn't work well.......

Look this image of your address of as work:

Therefore I need of a other address right !!
I wait your good new....
See yoo later....
(^_^) AG.

By jltursan

Prophet (2619)

jltursan's picture

16-12-2013, 13:44

The MSX Red Book states that the following is the LINE command handler:

Address... 58A7H
    This is the "LINE" statement handler. The first coordinate
pair (X1,Y1) is evaluated (579CH) and placed in register pairs
BC,DE. After checking for the "-" token (F2H) the second
coordinate pair (X2,Y2) is evaluated (57ABH) and left in
GRPACX, GRPACY and GXPOS, GYPOS. After setting the ink colour
(584DH) the program text is checked for a following "B" or "BF"
option and either the box (5912H), boxfill (58BFH) or linedraw
(58FCH) operation performed. None of these operations affects
the current graphics coordinates in GRPACX and GRPACY, these
are left at X2,Y2.

And you can see that the "box" handler is 5912H:

Address... 5912H
    This routine performs the box operation. The box is produced
by drawing a line (58FCH) between each of the four corner
points. The coordinates of each corner are derived from the
initial operands by interchanging the relevant component of the
pair. The drawing sequence is:
  (1) X1,Y2 to X2,Y2
  (2) X1,Y1 to X2,Y1
  (3) X2,Y1 to X2,Y2
  (4) X1,Y1 to X1,Y2

Check your code, I'm not sure if it matters or not (probably not); but the first pair of coordinates are parsed to BC,DE and the second one to GXPOS,GYPOS. You have reversed the pairs.

The MSX Red Book is an excellent MSX1 info resource, give it a look!

EDIT: Right, it doesn't works as is now; but is mandatory to fill also GXPACX and GXPACY. Do it so and your routine will work fine.

By gasparrini

Champion (329)

gasparrini's picture

17-12-2013, 00:02

Ok, Here there is the correct routine for LINE, LINEBOX e LINEBOX PAINT.

; [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:

;----------------------------
  ; RST $30
  .db 0
  .dw 05912h
bios_lineboxpaint   .equ $058C1   ; BOX PAINT
bios_linebox        .equ $05912   ; BOX  
bios_line           .equ $058fc   ; LINE
bios_basic          .equ $00159
gxpos               .equ $0fcb3
gypos               .equ $0fcb5
grpacx:	.equ $Fcb7
grpacy:	.equ $FCb9
chgmod              .equ $005F
setatr              .equ $011A

mix:	.equ $f000
miy:	.equ mix+2

init:
   ld a,2      ; SET SCREEN 2
   call chgmod

	;set X,Y,X2,X2 e A=colore, BOX
   ld ix,32
   ld iy,20	
   ld bc,64
   ld de,120
   ld a,15
   call BOX

	;set X,Y,X2,X2 e A=colore, LINE
   ld ix,100    
   ld iy,100    
   ld bc,125    
   ld de,125
   ld a,10
   call LINE

	;set X,Y,X2,X2 e A=colore, PAINT
   ld ix,120
   ld iy,90
   ld bc,170
   ld de,105
   ld a,6
   call PAINT

hold:
   jr hold

PAINT:
	call attrib
   RST 30h
   .db 0
   .dw bios_lineboxpaint
	ret

BOX:
	call attrib
   RST 30h
   .db 0
   .dw bios_linebox
	ret

LINE:
	call attrib
   RST 30h
   .db 0
   .dw bios_line
	ret

attrib:
	;ix= x1 iy = y1
	;bc = x2 de = y2
	; a=colore
   call setatr

   ld (grpacx),ix ; x1
   ld (gxpos),ix	; x1

   ld (grpacy),iy	; y1
   ld (gypos),iy	; y1
	ret

endProgram:
	.end

Best Regards
(^_^)
AG.