[ASM] Display Datas routine.

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
XavSnap
Posts: 890
Joined: Sat May 10, 2008 4:23 pm

[ASM] Display Datas routine.

Post by XavSnap »

Hi,

In Basic, you had to use this routine
Message 1= display the line in 7010... 2= 7020...
Like:

Code: Select all

4310 GOSUB 7000+N*10
(…)
7010 PRINT "LA GENERATRICE VIENT D EXPLOSER","LA MAISON N EXISTE PLUS,VOUS NONPLUS."
7015 RETURN
7020 PRINT "L ASCENSSEUR NE BOUGE PAS.","IL FAUT PEUT ETRE DU COURANT?"
7025 RETURN
7030 PRINT "LA PORTE VIENT DE CE FERMER","IMPOSSIBLE DE L OUVRIR"
7035 RETURN
7040 PRINT "VOUS AVEZ RAISON.LA CURIOSITE","EST UN VILAIN DEFAUT..."
7045 RETURN
But, this code need to type a new RETURN, how take room in the Basic program.

Just use this small routine: (All datas are in a single line, split by a reversed character at the end of the line !)

Code: Select all

     1  REM [HEX:\
2A,16,40,ED,4B,7B,40,23,\
7E,FE,76,CA,5B,00,CB,7F,\
28,F5,0B,78,B1,20,F0,23,\
7E,CB,7F,20,03,D7,18,F7,\
CB,BF,D7,C3,5B,00 ]

    10 FOR A=1 TO 6
    20 POKE 16507,A
    30 PRINT USR 16514;"«\
IL FAUDRAIT PEUT ETRE DU FEU..–\
AH,AH...VOUS ETES PRISONNIEr\
LA GENERATRICE VIENT D·EXPLOSER LA MAISON N·EXISTE PLUS,VOUS NONPLUS–\
L·ASCENSSEUR NE BOUGE PAS.      IL FAUT PEUT ETRE DU COURANTŠ\
LA PORTE VIENT DE CE FERMER     IMPOSSIBLE DE L·OUVRIr\
VOUS AVEZ RAISON.LA CURIOSITE   EST UN VILAIN DEFAUT..–\
"
    40 PRINT
    50 PRINT
    60 NEXT A

Code: Select all

EXTERR .equ $005B ; Basic Break function ! Ignore line instructions.

.Org 16514
	LD HL,($4016)
	LD BC,($407B)
NEXTCHAR:
	INC HL
	LD A,(HL)
	CP $76
	JP Z,EXTERR
	BIT 7,A
	JR Z,NEXTCHAR
	DEC BC
	LD A,B
	OR C
	JR NZ,NEXTCHAR
DISPLAY:
	INC HL
	LD A,(HL)
	BIT 7,A
	JR NZ,DISPLAY2
	RST 10H
	JR DISPLAY
DISPLAY2:
	RES 7,A
	RST 10H
	JP EXTERR
	.end
DISPLAY.P
(1.32 KiB) Downloaded 50 times
Xavier

User avatar
XavSnap
Posts: 890
Joined: Sat May 10, 2008 4:23 pm

Re: [ASM] Display Datas routine.

Post by XavSnap »

10 PRINT USR 16514;"(start inv. char/not displayed)Hello(End/displayed in regular char)..."
CODE 1 = bracket.
CODE 12 (£) = go to the next line.

Code: Select all

EXTERR .equ $005B ; Basic Break function ! Ignore line instructions.
CURSEUR .equ $8F5 ; Point to PRINT AT DEST.(BC=X,Y)
CHAINE .equ $B6B ; PRINT A CHAINE (BC=LEN;DE=TEXT LOC)


.Org +16514

	LD HL,($4016)
	LD BC,($407B)
NEXTCHAR:
	INC HL
	LD A,(HL)
	CP $76
	JP Z,EXTERR
	BIT 7,A
	JR Z,NEXTCHAR ; Display the current char.
	DEC BC
	LD A,B
	OR C
	JR NZ,NEXTCHAR ; BC = 0
DISPLAY:
	INC HL
	LD A,(HL)
	BIT 7,A
	JR NZ,DISPLAY2 ; End of massage.
	CP $0C
	JR Z,NEXTLINE ; "£" go to the next line.
	CP $01
	JR NZ,DISPLAY3 ; If CODE 1, then display the CHR$ 11.
	LD A,11
DISPLAY3:
	RST 10H
	JR DISPLAY
DISPLAY2:
	RES 7,A
	RST 10H
	JP $005B
NEXTLINE:
	LD DE,($400E)
NEXTCHR:  ; 
	LD A,(DE)
	CP $76
	JR Z,DISPLAY
	;EX DE,HL
	;LD (HL),0
	;EX DE,HL
	LD A,0
	RST 10h
	INC DE
	JR NEXTCHR

Code: Select all

    0  REM [HEX:\
2A,16,40,ED,4B,7B,40,\
23,7E,FE,76,CA,5B,00,CB,\
7F,28,F5,0B,78,B1,20,F0,\
23,7E,CB,7F,20,0D,FE,0C,\
28,0F,FE,01,20,02,3E,0B,\
D7,18,ED,CB,BF,D7,C3,5B,\
00,ED,5B,0E,40,1A,FE,76,\
28,DE,3E,00,D7,13,18,F5 ]
100 POKE 16507,1
200 PRINT USR 16514;"«\
        WELCOME TO ALZAN££YOU MUST SCALE THE WALLS IF£YOU WISH 10 ESCAPE FROM THIS£CITY OF THIEVES AND CUT-THROATS–\
YOU ARE IN THE MAIN STREET OUT-£SIDE A HARDWARE SHOP. THE STREETSTRETCHES EAST/WEST AND A SMALL£ALLEY LEADS NORTH BESIDE THE£SHOP–\
YOU ARE INSIDE THE SHOP. THE£SHOPKEEPER LOOKS SHIFTY, BUT HE£HAS MANY FINE GOODS ON DISPLAY–\
YOU ARE IN AN ALLEY BEHIND THE£TALL BUILDINGS. THERE ARE MANY£FULL DUSTBINS UNDER THE FIRE£ESCAPE–\ 
YOU ARE ON THE FIRE ESCAPE,£WHICH LEADS PAST A DOOR IN THE£BUILDINGS–\
YOU HAVE COME DOWN A SECRET£STAIRCASE INTO THE SHOP–\
YOU ARE ON SOME CATWALKS BETWEENTHE BUILDINGS–\
THIS IS PART OF THE CITY WALLS.£THERE IS AN UNUSED DOOR IN THE£WALL HERE–\
YOU ARE AT A CROSSROADS–\
HERE IS PART OF THE CITY WALLS.£THE SEA MIST IS QUITE THICK,£MAKING IT HARD TO SEE FAR–"

Xavier

Post Reply