80-Bus News

  

April–June 1982, Volume 1, Issue 2











Page 33 of 55











SIMPLE HANGMAN

OEI9 OBC OBIF OE22 OH25

OE28 OE2B OB2C OE2D OB2F OE30 OE32 OE35 OE37

OEZA OESD OE40 OB43 OE45 OE48

OE4B OE4E

ORS

OE54 OE56

OE59 OESA

OESD OE6O O61 OB62 OB64 O65 OB66 OE68 OE6B OR6E OE71

OET3 OET4 OET5 OET6

OET8 OETB OB7C OE7D

21 cD eD 21 cD

ai TE BT 28 23 E6 cD 18 cD

21

cep oD FE CA C3

ai cD

cD

FE cA

47 cD

21

TE BT 28 23 Ba 20 24

cD cD 18

78 77 23 36

BA 3C 27 32

OD65 OBEQ OEE2 OD83 OBEQ

OCAD

08 TF 0C93 F4 OBDF op91 OEE9 Oc8s 59 ODD3. OCAS

oDic ORES

0C83 03

OCA3 OBE2

OCB4

00

OCB3

OCB3

MACRO--80 3.43

LD HL,MSG6 CALL SNDTAT CALL CRLF1 RSTART: LD HL,MSG7 CALL SNDTXT ; Display the word LD HL,WBUF LD A, CHL) OR A JR Z,CONT INC HL AND 7FH CALL OUTCHR JR LOOPS CALL CRLF2

LOOP4:

CONTI:

3; Ask if the game is to

LD HL, MSes CALL SNDTXT CALL GETCHR cp wee JP Z,START JP EXIT Ask for a letter cONT2: CALL SNDTXT Get a letter CALL GETCHR

7

CP CTRLC JP Z,EXIT

LD B,A CALL CRLM

LD HL, CHRTRD LD A, (HL) OR A

IR Z,CONTS INC HL

cP B

JR NZ, LOOPS LD HL,MSG3 CALL SNDTXT CALL CRLF1 JR LOOPS

LOOPS:

eR en em om ne em em em en

PAGE 1-5 \ Point to ‘Lose’ message Send a newline : Point to ‘The word was’ message

Point to the word

Get a character

Test for end of word

If it is, skip the rest Point to next character Strip off any flags Send the character

Go and get the next Send two newlines

continue

. ,

. s

OR a eR a em a tm om

. : .

,

Send the ‘More?’ message

Get an input

Compare against ‘Y’

If ‘Y’ start again ... oes @lse exit.

LD HL,MSG2 3 Point to the message

Test the character for an exit

Test against ‘exit character’

Save the letter and send a newline

Send a new line

Now check to see if this letter has been used before

Point to the store of tried letters Get a letter from CHRTRD

Test it for end

It is end so skip the rest

Point to next if CHRTRD

Test it against B

Its not the same so get the next

It is the same so tell ‘em...

see Send a newline ... «++ and go round again

;} Save the letter in CHRTRD and stick a new 0 on the end

CONTS: LD A,B LD (HL),A INC HL

LD (HL),0

aR eR ee

Put the letter in A Save it in CHRTRD Point to next in CHRTRD Stick a 0 there

; Count the try in the TRYS counter

LD A, (TRYS) INC A

DAA

LD (PRYS),A

:

3 ; * z $

Get the trys in A Count up one

Convert to packed BCD Save it again

SIMPLE HANGMAN

OESO OE83 OES4 OE85 OE87 0888 OBBA OESC OE8D OBESE

O90 O93 OB94 O95 O97 O99 OEQA

OE9C OEOF OEA2 ORAS

OBAS OBAB OBAE OEBt OEB4 OEB7

OEBA OEBD OEBE OEBF OECO OEC2 ORC4 OECE OECB OECB OECD OECF OED2 OBD4 OED7 OED9 OEDC

24

TE BT 28 BS 20 C6 TT 23 18

21 TE 25 FE 30 BT 20

21 cD cD C3

2i cD 3A cD ai cD

24

TE 23 BT 28 FE 38 B6 cD 18 3E cD 3E cD 18 eD C3

OCAg

09

03 80

Y3 OCAD

80 FA

oc

ODB1 OBEQ OEE2 OB22

OD53 OBES OCB3 OBF2 OD5F ORES

OCAS

MACRO-80 3.43 PAGE 1-6

; Scan through the word to see if the character is there LD HL,WBUF Point to the word

LD A, (HL) Get a character

OR A Test it for end

JR Z,CONTS Is end, so skip the rest

cP B Compare with the letter

JR NZ, CONTS4 No compare, so skip flagging it ADD A,80H Set bit 7 to flag it...

LD (HL),A «+e and put it back

INC HL Point to next character

; LOOP6: ; ; ; ; ; ; 3 ; JR LOOPG 3; Go round again f 5 ; } j ; ; 5

CONT4:

5 Test the word to see if all characters flagged (win) CONTS: Point to the word LOOP7: Get a character Point to next Test if greater than 7FH It is, so get next

OR A \ It’s not so test for end

IR NZ, CONT6 It’s not end, so skip the rest ; All flagged, so tell ‘em you’ve won

LD HL, MSG9 ; Send ‘Win’ message

CALL SNDTXT

CALL CRLF ; Send a newline

JP RSTART ; Go back to ‘The word was’ message 3; Not all flagged yet, so report results CONTG6: LD HL,MSG4 ; Send ‘Trys’ message

CALL SNDTXT

LD A, (TRYS) ; Send the number of trys

CALL BOHEX

LD HL,MSG5 ; Send ‘Spaces’ message

CALL SNDTXT ; Print the word double spaced with dashes where not flagged LD HL, WBUF Point to the word LD A, CHL) Get a character INC HL Point to next character OR A Test for end JR Z,CONTS Is end, so skip rest CP 80H Isn’t end, so test if flagged JR C,CONTT Isn’t flagged, so skip display AND 7FH Strip the flag... CALL OUTCHR +++ and display it JR conts Skip round ‘unflagged’ case LD A,"-" Not flagged, so send a ‘-’ instead CALL OUTCHR ED A," " CALL OUTCHR JR LOOPS CALL CRLF2 JP LOOPS

LD HL, WBUF LD A, (HL) INC HL

CP 80H

JR NC,LOOP7

LOOPS:

CONT7:

BR ER eR eR eR em oe em om em am

cONTS: Send a space to double space it

on

Go and get the next Send two newlines Go back to start of main loop

CONTS:

33


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 33 of 55