Put a Graphic bloc on a screen...[ASM]

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

Put a Graphic bloc on a screen...[ASM]

Post by XavSnap »

Hi,

In BASIC, you had to place the bloc at the right raw for each line:

Code: Select all

 10 FOR A=0 TO 17
 20 PRINT AT A,10;"   ";\
 AT A+1,10;"(I)";\
 AT A+2,10;"¬¿ª";\
 AT A+3,10;"ºL°";\
 AT A+4,10;"ᨦ"
  30 NEXT A
 50 FOR A=17 TO 0 STEP -1
 60 PRINT AT A,10;"²¸¹";\
 AT A+1,10;"º7°";\
 AT A+2,10;"¯¾¼";\
 AT A+3,10;"(I)";\
 AT A+4,10;"   "
 70 NEXT A
 80 RUN
BLOCBAS.P
(1.21 KiB) Downloaded 74 times

This little ASM code save memory and boost the display !

Code: Select all

1 REM [HEX:\
2A,16,40,23,23,7E,D6,1C,32,21,40,ED,5B,0E,40,\
4F,3E,21,91,4F,06,00,ED,43,7B,40,23,7E,FE,0B,28,\
0F,3A,21,40,4F,ED,B0,E5,2A,7B,40,19,EB,E1,18,EC,\
CD,5B,00 ]
 10 FOR A=0 TO 17
 20 PRINT AT A,10;USR 16514;"3   (I)¬¿ªºL°·®¶"
 30 NEXT A
 50 FOR A=17 TO 0 STEP -1
 60 PRINT AT A,10;USR 16514;"3²¸¹º7°¯¾¼(I)   "
 70 NEXT A
 80 RUN

Code: Select all

 # VB81 XuR [BLOCASM.P] 
 # 
 # 1 REM:    50 Bytes@4082-40B3
1 REM [DEC:\
 42, 22, 64, 35, 35,126,214, 28, 50, 33, 64,237, 91, 14, 64, 79,\
 62, 33,145, 79,  6,  0,237, 67,123, 64, 35,126,254, 11, 40, 15,\
 58, 33, 64, 79,237,176,229, 42,123, 64, 25,235,225, 24,236,205,\
 91,  0 ]

Code: Select all

;------- TASM ASM mnemonics. -------
; Compile this file using:
; Set TASMOPTS = -b
; tasm -80 ThisCode.tas MyBinary.BIN
;-----------------------------------
; Zx81 Program name: VB81 XuR [BLOCASM.P] :
; REM   line   name: 1 REM:    50 Bytes@4082-40B3

#define ORG  .org       ; TASM cross-assembler definitions
#define equ  .equ
;-----------------------------------

;------------------------------------
;-BASIC sub-routine entry.          -
;+----------------------------------+
; Lb4082  ;  <- USR BASIC Enty.
;+----------------------------------+

;------- ROM and RAM Symbols -------
RAM_CH_ADD equ $4016
RAM_SPARE1 equ $4021
RAM_DF_CC equ $400E
RAM_SPARE2 equ $407B
ERROR_3 equ $0058

ORG $4082 ; [@16514/@h4082]
Lb4082:
	LD HL,(RAM_CH_ADD) ; GET CH-ADD
	INC HL 
	INC HL 
	LD A,(HL) 
	SUB $1C 
	LD (RAM_SPARE1),A ; SET UNUSED-8
	LD DE,(RAM_DF_CC) ; GET DF-CC
	LD C,A 
	LD A,$21 
	SUB C 
	LD C,A 
	LD B,$00 
	LD (RAM_SPARE2),BC ; SET UNUSED-16
	INC HL 
Lb409D:
	LD A,(HL) 
	CP $0B ; [11-"""]
	JR Z, Lb40B1 ; [$40B1:16561]
	LD A,(RAM_SPARE1) ; GET UNUSED-8
	LD C,A 
	LDIR 
	PUSH HL 
	LD HL,(RAM_SPARE2) ; GET UNUSED-16
	ADD HL,DE 
	EX DE,HL 
	POP HL 
	JR Lb409D ; [$409D:16541]
Lb40B1:
	CALL ERROR_3+3 ; []*BIOS ROM*
.end
BLOCASM.P
(1.14 KiB) Downloaded 66 times
It display the bloc "3111222333444..." on the PRINT AT or PLOT y,x location.the first "3" is the blocs length.
"1"= 1 character to "V"=32 characters length ... "B"=12 ... "D"=14 characters.
Can't be used above the last screen line ! It can jam the VARS memory segment.
All values or graphics after the bloc data are ignored. The BASIC will continue to the next line after the display process.

Have fun !
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Put a Graphic bloc on a screen...[ASM]

Post by XavSnap »

Another way to display a bloc...
Download the Greg's game here
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply