80-Bus News

  

April–June 1982, Volume 1, Issue 2











Page 32 of 55











SIMPLE HANGMAN

oDic oD20 op24 oD28 op2c OD30 0D33 OD37 OD3B OD3F OD43 OD47 OD4

OD4

B Y OD53 OD57 OD5B ODSF ODe3 oDe65 OD69 OD6D OD71 OD75 ODT9 OD7D ope OD83 OD87 OD8B ODSF oD91 OD95 oDneg oDgD ODA1 ODAS ODA9 ODAD ODB1 ODBS ODB9 -ODBD opel oDes oDceg opcD ODDO

50 v6) 75 20 65 72 59 76 13 74 20 T4 61

61

54 6E 65 20 20 53 719 6F 65 6E TA 20 73 54 TT 20 20 44 6P 61

61

68 67 59 20 45 Te 6C 6F 79 16 6F 21

oD

6c 65 65 61 74 20 6F 65 65 68 60 65 6C 64 72

65 20 73 20 74 00 15 20 64 69 65 72 72 19 719 6D 20 20

T2 20 27 Te 6F 6F T2

65 72 64

20 20 74 6F 72 20 4E

6E T4 74 13 75 20 20

00

61 67 73 6C 65

27 15 20 13 74 20 65 00 20 62 00

T2 19 16 75 715 66 79

20 64 13

719 77 20 74 20 28 29 00 67 15 69 20 27 TT ai

MACRO-80 3.43

MSG2:

MSG3:

MSG4:

MSG5:

MSG6:

MSG7:

MSG8:

MSG9:

CRMSG:

PAGE 1-3

DEFB "Please guess a letter ",0

DEFB "You’ve used this letter already",0

DEFB "Try number ",0

DEFB " ",0

DEFB "Sorry, you’ve run out of trys",0

DEFB “The word was ",0

DEFB "Do you want another go (Y/N)

DEFB "Congratulations you’ve won !!!",0

DEFB CR,LF,O

SIMPLE HANGMAN

ODD3

ODD6 ODD? ODDA

ODDD ODEO ODE3

ODE6 ODES ODEC ODED

ODER ODF ODF2 ODF3 ODF4 ODF6

ODFS ODFB ODFC ODFD ODFE ODFF OEOO OO1

OEO3

OBO5 OE06

QEO9 QEOC OEOF

OE12 OB15 0817

31

AF 32 32

21 cD cD

3A cD

1 TE 12 23 13

BT 20

3B

32 2i cD 3A

FE 20

ocDs OCB3 OCB4 ocDs OEE OEDF

OF31 OFO7

OF32

FB F9

OCA9

F8

ODOE OCF5 OEE9 OEDF OCB3

32

MACRO-80 3.43 PAGE {a4

JHIBHIE HEHE EEIEIHEHEHEEIHEBHEHBRHEHHHEHHEEEE Hit steeaeeeee START OF THE PROGRAM svensennenee

en em en

START: LD SP,STACK 3; Initialize the TRYS counter and the letters tried buffer XOR A 3; Clear A LD (TRYS),A ; Save it in TRYS LD (CHRTRD),A ; Save it in CHRTRD as well ; Put up the title message LD HL, TTLMSG ; CALL SNDTXT ; CALL CRLF2 ; 3; Get a random number LD A, (NOWRDS) CALL RANDOM

Point to message Send it Send two newlines

Get the number of words Think of a random number INC A INC by 1 as it can never be 0 LD B,A Put the number in B

; Select the word from the table

LD HL, WORDS Point to start of words

LD A, (HL) Get a character

INC HL Point to next character

OR A Test it for 0

JR NZ, LOOPI It isn’t 0 so get next

DINZ LOOP It is 0 so DEC B and get next ..

eos until Bis 0

Copy the word to the buffer

HL already points to it, DE points to buffer,

count the letters in B. (B is now 0)

LD DE, WBUF 3 Point DE to WBUF

LD A, (HL) ; Get the character

LD (DE),A ; Put it in WBUF

INC HL ; Point to next character

INC DE ; Point to next in WBUF ,

+n en om

LOOP1:

aA be em em em en ee

+n em am

LOOP2:

INC B Count it OR A Test it for 0 JR NZ,LOOP2 It isn’t O so get next Convert the count in B to an ASCII character and stuff it in the message. (Self modifying code ... ++. naughty naughty.) LD A,30H-1 3; Put 30H – 1 in A... 3 «s+ because B’s one too big ADD A,B ; Adding B to A gives the number LD (CHRCNT),A ; Put it in the message ; Send the message LD HL,MSG1 ; Point to the message CALL SNDTXT CALL CRLF2 3; Send two newlines This is the start of the main loop Test to see if maximum number of trys have been made LOOP3: LD A,(TRYS) ; Get the number of trys so far CP NTRYS ; Compare with the maximum JR NZ, CONT? 3; Not there yet, so skip the lose

tn om on

en om


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











Page 32 of 55