I am trying to code this program, similar to game: "The Typing of The Dead" in Amstrad CPC 464 using Assembly language for the Z80 processor.
The program consists in when you see a string of characters like a word in the screen in yellow, you have to typing exactly as shown. If you type right, the string changes to light blue and continues the game. If you type wrong, the string changes to red hyphens and appears "game over".
I am using the firmware from Amstrad CPC 464 such as this link:
http://www.cantrell.org.uk/david/tech/cpc/cpc-firmware/firmware.pdf
I have some code painting the characters pixel by pixel in the screen but I want to use the firmware to write the characters. There is a way to do this?
I guess that is possible using video modes, pen and inks instructions from firmware but I don't understand enough to use.
this is my code painting pixel by pixel (using WinApe):
org &4000
run &4000
readkey equ &BB1E
;; START PROGRAM
;; cls
call &bc14
;; initial position video mem.
ld hl, #c000
;; paint char_a_yellow
ld bc, char_a_yellow
;; times to follow rows
ld e,#08
call looph
call wait_typing
jr $
;; END PROGRAM
;;
;; ROUTINES
looph:
;; Times to inc l (cols)
ld d, #02
;; save memory video position to stack
push hl
call paintpix
;; fetch memory video position from stack
pop hl
ld a, h
;; adds #08 to next row
add a,#08
ld h,a
dec e
jr nz,looph
ret
;;
paintpix:
ld a, (bc)
ld (hl),a
inc l
inc c
dec d
jr nz, paintpix
ret
;;
wait_typing:
;; loads in a value of 'a' character
call &bb18
;;and a ;;Reset flag carry
ld b, #61
sub b
jp z,typing_right
;;and a ;;Reset flag carry
ld b, #61
sub b
jp nz,typing_wrong
ret
;;
typing_right:
ld hl, #c000
ld bc, char_a_blue
;; times to follow rows
ld e,#08
call looph
ret
;;
typing_wrong:
ld hl, #c000
ld bc, hyphen_red
;; times to follow rows
ld e,#08
call looph
ret
;;
;; CHARS BY PIXELS
;; left to right, two columns for letter
;; row by row
char_a_blue:
db #00, #00
db #00, #00
db #07, #08
db #00, #0c
db #07, #0c
db #0c, #0c
db #07, #06
db #00, #00
ret
;;
char_a_yellow:
db #00, #00
db #00, #00
db #70, #80
db #00, #c0
db #70, #c0
db #c0, #c0
db #70, #60
db #00, #00
ret
;;
hyphen_red:
db #00, #00
db #00, #00
db #00, #00
db #ff, #ff
db #ff, #ff
db #00, #00
db #00, #00
db #00, #00
ret