The second example is very easy, just relies on simply writing out where you want stuff and almost building the screens in text in front of your very eyes as shown in the third block. I am sure there are many many benefits of the first routine, but are there real world uses for the second?
Just think of the letter a as a UDG
Hard Code (for me)
Code: Select all
;PROJECT AIMS
;
;looking to set up a screen line by line with the aim of
;then scrolling it continuously like car track or tiger
;heli screen etc..
;
;
ORG 32768
JP start
;#########################################################
;#
;# pr_screen uses HL,BC,DE and A
;#
;#
;#########################################################
pr_screen PUSH HL
LD B,#08
;loop - the address DE is a letter 8x8 so DJNZ 8 times
;HL is screen print address start 4000,4100,4200...4800
;Then we add 32d to L DE #0020 for next line
;HL = 4020 then 4120,4220...4820 and on for 8 rows.
loop LD A,(DE)
LD (HL),A ;Printing to screen
INC H
INC DE
DJNZ loop
LD DE,#0020
POP HL
LD A,C
;Compare to see if we are at the 8th row - before the
;boundary If we are, we do not want to ADD as DEC C
;will eq 0 and we do the boundary crossing code.
CP #01
JR Z, setChar
ADD HL,DE
setChar LD DE,#3F08
DEC C
JP NZ,pr_screen
RET
;#
;#########################################################
;#
start LD HL,#4000 ;16384 - 22528
LD DE,#3F08
LD C,#08
CALL pr_screen
;The code below simply moves the character across
;the 1/3rd boundary
RR H
RR H
RR H
LD BC,#0020
ADD HL,BC
RL H
RL H
RL H
;end code move
LD DE,#3F08
LD C,#08
CALL pr_screen
RET
Code: Select all
ORG 32768
JP start
;#########################################################
;#
;# s_print is from a book
;#
;#########################################################
s_print POP HL ;pulls address off stack
LD A,(HL) ;this refers to first byte of defm
INC HL ;alter +1 return byte address
PUSH HL
AND A ;Reset Carry and Set Zero if 0
RET Z ;when we reach defb #00 return
RST #10 ;else print message to screen
JR s_print
start XOR A
LD (#5C3C),A
CALL s_print
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFM "a",#0D
DEFB #00
RET
Code: Select all
ORG 32768
JP start
;#########################################################
;#
;# s_print is from a book
;#
;#########################################################
s_print POP HL ;pulls address off stack
LD A,(HL) ;this refers to first byte of defm
INC HL ;alter +1 return byte address
PUSH HL
AND A ;Reset Carry and Set Zero if 0
RET Z ;when we reach defb #00 return
RST #10 ;else print message to screen
JR s_print
start XOR A
LD (#5C3C),A
CALL s_print
DEFM "a b c d",#0D
DEFM "a bcd",#0D
DEFM "a bcd",#0D
DEFM "abcd",#0D
DEFM "aaaaa",#0D
DEFM "aaa",#0D
DEFM "aaaaa",#0D
DEFM "aa",#0D
DEFM "aaaaaaa",#0D
DEFM "aa",#0D
DEFM "aa",#0D
DEFM "aaaaaaaaaaaa",#0D
DEFM "aa",#0D
DEFM "aaaa",#0D
DEFM "aa",#0D
DEFM "abbbbbcccccdddddd",#0D
DEFB #00
RET