[Tuto ASM-BASIC] Display messages DATA-READ.

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

[Tuto ASM-BASIC] Display messages DATA-READ.

Post by XavSnap »

Hi,

A little demo to host several messages in a single line.
PRN0026b.jpg
PRN0026a.jpg

Code: Select all

# REM _______________________ _       
#     ______ DATA DEMO ______  _     
     1  REM [HEX:\
85,89,89,89,89,89,89,89,\
89,89,89,89,89,89,89,89,\
89,89,89,89,89,89,05,00,\
82,00,00,00,00,00,00,00,\
88,05,88,88,88,88,00,29,\
26,39,26,00,29,2A,32,34,\
00,88,88,88,88,85,88,00,\
80,82,00,00,00,00,00,00,\
88,05,88,88,00,3A,38,2A,\
00,39,2D,2E,38,00,26,38,\
32,00,00,88,88,85,88,00,\
80,80,82,00,00,00,00,00,\
88,05,88,88,88,88,88,00,\
37,34,3A,39,2E,33,2A,00,\
88,88,88,88,88,85,88,00,\
80,80,80,05,00,00,00,00,\
85,8A,8A,8A,8A,8A,8A,8A,\
8A,8A,8A,8A,8A,8A,8A,8A,\
8A,8A,8A,8A,8A,8A,05,00,\
80,80,07,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
80,07,00,00,00,00,00,00,\
00,00,00,00,00,00,27,3E,\
00,3D,26,3B,38,33,26,35,\
1B,00,00,00,00,00,00,00,\
07,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,76,\
76,E7,CD,92,0D,CD,F5,0B,\
48,06,00,E7,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,11,82,40,01,\
06,06,ED,43,7B,40,D5,CD,\
F5,08,D1,62,6B,01,17,00,\
D5,CD,6B,0B,D1,EB,01,20,\
00,09,EB,ED,4B,7B,40,04,\
ED,43,7B,40,78,FE,0E,28,\
02,18,DB,01,07,06,ED,43,\
7B,40,C9 ]

    2 RAND USR 16830
    3 PAUSE 1000
    4 SCROLL
    5 SCROLL
    6 SCROLL
    7 SCROLL
    8 PRINT AT 10,0;
    10 FOR A=4 TO 1 STEP -1
    30 PRINT USR 16763,A,"«VOUS ETES DEVANT UNE MAISON£LA PORTE EST OUVERTE–VOUS ETES DANS UN COULOIR,IL Y AUNE PORTE A L¶EST ET UNE PORTE£A L¶OUEST–VOUS ETES DANS UN SALON,IL Y A£UNE PORTE A L¶OUEST–IL Y A UNE DROLE D¶ODEUR–"
    36 PRINT 
    37 PRINT "--------------------------------"
    38 PAUSE 1000
    40 NEXT A
Only normal characters will be displayed in this code.
Up right square character (/ ') = one quote.
£=New-Line.

Le display will be added at the actual cursor pointer TAB or PRINT AT...
Note:
- The first REM had to be change to display the new program header, but the line had to be POKEd to avoid to delete the ASM codes after it !
- Alway put an inverted character at the first character location.
- An inverted character clase the (cluster) message line(s) in the PRINT string.
- You will be able to type many lines to store DATAs like :
For example:
100 PRINT USR 16763;"«\
SCREW DRIVEr\
DOOr\
MESSAGE 1«"
- Was designed to replace GOSUB/RETURN Basic routines:
10 GOSUB 1000+((A-1)*2)
1000 PRINT "MESSAGE1"
1001 RETURN
1002 PRINT "MESSAGE2"
1003 RETURN
1004 PRINT
1005 RETURN
... How use 6 bytes per option/line. (12 bytes saved)
READDATA.P
(1.67 KiB) Downloaded 70 times
P/ASM & Basic text listings:
Databas.zip
(2.32 KiB) Downloaded 70 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: [Tuto ASM-BASIC] Display messages DATA-READ.

Post by XavSnap »

Hi,
Another way to call a message is to enter the message line number...
PRN0029.jpg
PRN0029.jpg (25.06 KiB) Viewed 939 times
Where : 30 PRINT USR 16763,50

...Display the message in the line 50.
Note: The screen had to be expend to the full size (CLS) to allow the New/line tag ("£").

Code: Select all


# REM _______________________ _       
#     ______ DATA DEMO ______  _     
     1  REM [HEX:\
85,89,89,89,89,89,89,89,\
89,89,89,89,89,89,89,89,\
89,89,89,89,89,89,05,00,\
82,00,00,00,00,00,00,00,\
88,05,88,88,88,88,00,29,\
26,39,26,00,29,2A,32,34,\
00,88,88,88,88,85,88,00,\
80,82,00,00,00,00,00,00,\
88,05,88,88,00,3A,38,2A,\
00,39,2D,2E,38,00,26,38,\
32,00,00,88,88,85,88,00,\
80,80,82,00,00,00,00,00,\
88,05,88,88,88,88,88,00,\
37,34,3A,39,2E,33,2A,00,\
88,88,88,88,88,85,88,00,\
80,80,80,05,00,00,00,00,\
85,8A,8A,8A,8A,8A,8A,8A,\
8A,8A,8A,8A,8A,8A,8A,8A,\
8A,8A,8A,8A,8A,8A,05,00,\
80,80,07,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
80,07,00,00,00,00,00,00,\
00,00,00,00,00,00,27,3E,\
00,3D,26,3B,38,33,26,35,\
1B,00,00,00,00,00,00,00,\
07,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,76,\
76,E7,CD,92,0D,CD,F5,0B,\
68,61,CD,D8,09,01,04,00,\
09,23,7E,FE,76,CA,5B,00,\
FE,0C,28,09,FE,01,20,02,\
3E,0B,D7,18,EC,ED,5B,0E,\
40,1A,FE,76,CA,8B,41,3E,\
00,D7,13,18,F4,11,82,40,\
01,06,06,ED,43,7B,40,D5,\
CD,F5,08,D1,62,6B,01,17,\
00,D5,CD,6B,0B,D1,EB,01,\
20,00,09,EB,ED,4B,7B,40,\
04,ED,43,7B,40,78,FE,0E,\
28,02,18,DB,01,07,06,ED,\
43,7B,40,C9,06,ED,43,7B,\
40,C9 ]

     2 RAND USR 16815
     3 PAUSE 500
     4 SCROLL 
     5 SCROLL 
     6 SCROLL 
     7 SCROLL 
     8 CLS
     9 PRINT AT 10,0;
    10 FOR A=53 TO 50 STEP -1
    30 PRINT USR 16763,A
    36 PRINT 
    37 PRINT "--------------------------------"
    38 PAUSE 500
    40 NEXT A

# REM VOUS ETES DEVANT UNE MAISON£LA P
#     ORTE EST OUVERTE
    50  REM [HEX:\
3B,34,3A,38,00,2A,39,2A,\
38,00,29,2A,3B,26,33,39,\
00,3A,33,2A,00,32,26,2E,\
38,34,33,0C,31,26,00,35,\
34,37,39,2A,00,2A,38,39,\
00,34,3A,3B,2A,37,39,2A,1B ]


# REM VOUS ETES DANS UN COULOIR,IL Y A
#     £UNE PORTE A L_EST ET UNE PORTE
    51  REM [HEX:\
3B,34,3A,38,00,2A,39,2A,\
38,00,29,26,33,38,00,3A,\
33,00,28,34,3A,31,34,2E,\
37,1A,2E,31,00,3E,00,26,\
0C,3A,33,2A,00,35,34,37,\
39,2A,00,26,00,31,01,2A,\
38,39,00,2A,39,00,3A,33,\
2A,00,35,34,37,39,2A,0C,\
26,00,31,01,34,3A,2A,38,\
39,1B ]

# REM VOUS ETES DANS UN SALON,IL Y A£U
#     NE PORTE A L_OUEST
    52  REM [HEX:\
3B,34,3A,38,00,2A,39,2A,\
38,00,29,26,33,38,00,3A,\
33,00,38,26,31,34,33,1A,\
2E,31,00,3E,00,26,0C,3A,\
33,2A,00,35,34,37,39,2A,\
00,26,00,31,01,34,3A,2A,\
38,39,1B ]

# REM IL Y A UNE DROLE D_ODEUR.
    53  REM [HEX:\
2E,31,00,3E,00,26,00,3A,\
33,2A,00,29,37,34,31,2A,\
00,29,01,34,29,2A,3A,37,\
1B ]

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)
DFCC .equ $400E

.Org $417B
	RST 20H
	CALL $0D92
	CALL $0BF5
	LD L,B
	LD H,C
	CALL $09D8 ; offset to HL
	LD BC,4
	ADD HL,BC

DISPLAY:
	INC HL
	LD A,(HL)
	CP $76
	JP Z,EXTERR
	CP $0C ; "£"
	JR Z,NEXTLINE
	CP $01 ; Quote
	JR NZ,DISPLAY3
	LD A,11
DISPLAY3:
	RST 10H
	JR DISPLAY
NEXTLINE:
	LD DE,(DFCC)
NEXTCHR:
	LD A,(DE)
	CP $76
	JP Z,DISPLAY
	LD A,0
	RST 10h
	INC DE
	JR NEXTCHR

;TITRE REM TO SCREEN

	LD DE,16514 ; FROM REM LINE
	LD BC,$0606
	LD ($407B),BC

NXTLINE:
	PUSH DE
	CALL CURSEUR
	POP DE
	LD H,D
	LD L,E
	LD BC,23
	PUSH DE
	CALL CHAINE
	POP DE
	EX DE,HL
	LD BC,32
	ADD HL,BC
	EX DE,HL

	LD BC,($407B)
	INC B
	LD ($407B),BC
	LD A,B
	CP 14
	JR Z,EXIT
	JR NXTLINE
EXIT:
	LD BC,$0607
	LD ($407B),BC
	RET

.end
DATA2.P
(1.69 KiB) Downloaded 68 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply