A86: The Strangest Problem...


[Prev][Next][Index][Thread]

A86: The Strangest Problem...




OK, I wrote this program a long time ago, and it didn't work. Yesterday, I had
Stephen Hicks look at it and he told me what I did wrong, which was, a lot.
After about 2 hours of fixing the program, I finally was able to assemble it
again. I loaded it into my 86 emulator (if I load it on my calculator, I have
to restart the calculator and I can't use the mouse) and it crashed. No matter
what I do to the program, whenever it reaches the first _puts, it crashes. I
am using Assembly Studio 2.0 and I haven't modified any of the include files.
Here is the code, please help me! Thanks!

#include "ti86asm.inc"
#include "asm86.h"

.org _asm_exec_ram

; jp Start
; .dw $0000
; .dw Title
;Title:
; .db "Mogsoft Adventure",0


Start:
 call ClearScn 
 ld hl,S0
 call _puts   ;PROBLEM LINE!!! EVIL! EVIL!
 ld hl,S1
 call Line2
 ld hl,S2
 call Line3
 call Press_Enter_R
 jp Area1

ClearScn:
 call _clrLCD
 ld hl,$0000
 ld (_curRow),hl
 ret

Press_Enter_R:
 call _getkey
 cp kEnter
 jp nz,Press_Enter_R
 ret

Area1:
 call ClearScn
 ld hl,S3
 call _puts
 ld hl,S4
 jp Line2
 ld hl,S5
 jp Line3
 call _puts
A1:
 call _getkey
 cp kF1
 jp z,Area2
 cp kF2
 jp z,Area3
 jp A1

Line2:
 ld de,$0001
 ld (_curRow),de
 call _puts
 ret

Line3:
 ld de,$0002
 ld (_curRow),de
 call _puts
 ret

Line4:
 ld de,$0003
 ld (_curRow),de
 call _puts
 ret

Line5:
 ld de,$0004
 ld (_curRow),de
 call _puts
 ret

Line6:
 ld de,$0005
 ld (_curRow),de
 call _puts
 ret

Line7:
 ld de,$0006
 ld (_curRow),de
 call _puts
 ret

Line8:
 ld de,$0007
 ld (_curRow),de
 call _puts
 ret

Area2:
 call ClearScn
 ld hl,S6
 call _puts
 ld hl,S7
 jp Line2
A2:
 call _getkey
 cp kF1
 jp z,Area4
 cp kF2
 jp z,Area5
 jp A2

Area4:
 call ClearScn
 ld hl,S8
 call _puts
 ld hl,S9
 call Line2
 ld hl,S10
 call Line3
 ld hl,S11
 call Line4
A4:
 call _getkey
 cp kF1
 jp z,Area6
 cp kF2
 jp z,Area7
 jp A4

Area6:
 call ClearScn
 ld hl,S12
 call _puts
 ld hl,S13
 call Line2
 ld hl,S14
 call Line3
A6:
 call _getkey
 cp kF1
 jp z,Area8
 cp kF2
 jp z,Area9
 jp A6

Area8:
 call ClearScn
 ld hl,S15
 call _puts
 ld hl,S16
 call Line2
 ld hl,S17
 call Line3
 ld hl,S18
 call Line4
 ld hl,Press_Enter
 call Line5
 call Press_Enter_R
 ret

Area9:
 call ClearScn
 ld hl,S19
 call _puts
 ld hl,S20
 call Line2
 ld hl,S21
 call Line3
A9:
 call _getkey
 cp kF1
 jp z,Area10
 cp kF2
 jp z,Area11
 jp A9

Area10:
 call ClearScn
 ld hl,S22
 call _puts
 ld hl,S23
 call Line2
 ld hl,S24
 call Line3
 ld hl,S25
 call Line4
 ld hl,Press_Enter
 call Line5
 call Press_Enter_R
 ret

Area11:
 call ClearScn
 ld hl,S26
 call _puts
 ld hl,S27
 call Line2
 ld hl,S28
 call Line3
 ld hl,S29
 call Line4
 ld hl,S30
 call Line5
 ld hl,Press_Enter
 call Line6
 call Press_Enter_R
 call ClearScn
 ld hl,S31
 call _puts
 ld hl,S32
 call Line2
 ld hl,S33
 call Line3
 ld hl, S34
 call Line4
 ld hl,S35
 call Line5
 ld hl,Press_Enter
 call Line6
 call Press_Enter_R
 ret

Area7:
 call ClearScn
 ld hl,S36
 call _puts
 ld hl,S37
 call Line2
 ld hl,S38
 call Line3
A7:
 call _getkey
 cp kF1
 jp z,Area12
 cp kF2
 jp z,Area13
 jp A7

Area12:
 call ClearScn
 ld hl,S39
 call _puts
 ld hl,S40
 call Line2
 ld hl,S41
 call Line3
 ld hl,Press_Enter
 call Line4
 call Press_Enter_R
 ret

Area13:
 call ClearScn
 ld hl,S42
 call _puts
 ld hl,S43
 call Line2
 ld hl,S44
 call Line3
 ld hl,S45
 call Line4
 ld hl,S46
 call Line5
 ld hl,Press_Enter
 call Line6
 call Press_Enter_R
 ret

Area3:
 call ClearScn
 ld hl,47
 call _puts
 ld hl,48
 call Line2
 ld hl,49
 call Line3
 ld hl,50
 call Line4
 ld hl,51
 call Line5
A3:
 call _getkey
 cp kF1
 jp z,Area14
 cp kF2
 jp z,Area15
 jp A3

Area14:
 call ClearScn
 ld hl,S52
 call _puts
 ld hl,S53
 call Line2
 ld hl,S54
 call Line3
 ld hl,S55
 call Line4
 ld hl,S56
 call Line5
A14:
 call _getkey
 cp kF1
 jp z,Area16
 cp kF2
 jp z,Area17
 jp A14

Area16:
 call ClearScn
 ld hl,S57
 call _puts
 ld hl,S58
 call Line2
 ld hl,S59
 call Line3
 ld hl,S60
 call Line4
 ld hl,S61
 call Line5
A16:
 call _getkey
 cp kF1
 jp z,Area18
 cp kF2
 jp z,Area19
 jp A16

Area18:
 call ClearScn
 ld hl,S62
 call _puts
 ld hl,S63
 call Line2
 ld hl,S64
 call Line3
 ld hl,S65
 call Line4
 ld hl,S66
 call Line5
 ld hl,S67
 call Line6
 ld hl,S68
 call Line7
 ld hl,Press_Enter
 call Line8
 call Press_Enter_R
 ret

Area19:
 call ClearScn
 ld hl,S69
 call _puts
 ld hl,S70
 call Line2
 ld hl,S71
 call Line3
 ld hl,S72
 call Line4
 ld hl,S73
 call Line6
 ld hl,S74
 call Line7
 ld hl,Press_Enter
 call Line8
 call Press_Enter_R
 ret

Area15:
 call ClearScn
 ld hl,S75
 call _puts
 ld hl,S76
 call Line2
 ld hl,S77
 call Line3
 ld hl,S78
 call Line4
 ld hl,S79
 call Line5
 ld hl,S80
 call Line6
 ld hl,S81
 call Line7
 ld hl,S82
 call Line8
 call Press_Enter_R
 ret

Area17:
 call ClearScn
 ld hl,S83
 call _puts
 ld hl,S84
 call Line2
 ld hl,S85
 call Line3
 ld hl,S86
 call Line4
 ld hl,S87
A17:
 call _getkey
 cp kF1
 jp z,Area20
 cp kF2
 jp z,Area21
 jp A17

Area20:
 call ClearScn
 ld hl,S88
 call _puts
 ld hl,S89
 call Line2
 ld hl,S90
 call Line3
 ld hl,S91
 call Line4
 ld hl,Press_Enter
 call Line5
 call Press_Enter_R
 ret

Area21:
 call ClearScn
 ld hl,S92
 call _puts
 ld hl,S93
 call Line2
 ld hl,S94
 call Line3
 ld hl,S95
 call Line4
 ld hl,S96
 call Line5
 ld hl,Press_Enter
 call Line6
 call Press_Enter_R
 ret

Area5:
 call ClearScn
 ld hl,S97
 call _puts
 ld hl,S98
 call Line2
 ld hl,S99
 call Line3
 ld hl,S100
 call Line4
A5:
 call _getkey
 cp kF1
 jp z,Area22
 cp kF2
 jp z,Area23
 jp A5

Area22:
 call ClearScn
 ld hl,S101
 call _puts
 ld hl,S102
 call Line2
 ld hl,S103
 call Line3
 ld hl,S104
 call Line4
 ld hl,S105
 call Line5
 ld hl,S106
 call Line6
A22:
 call _getkey
 cp kF1
 jp z,Area24
 cp kF2
 jp z,Area25
 jp A22

Area24:
 call ClearScn
 ld hl,S107
 call _puts
 ld hl,S108
 call Line2
 ld hl,S109
 call Line3
 ld hl,S110
 call Line4
 ld hl,Press_Enter
 call Line5
 call Press_Enter_R
 jp Area9

Area25:
 call ClearScn
 ld hl,S111
 call _puts
 ld hl,S112
 call Line2
 ld hl,S113
 call Line3
 ld hl,S114
 call Line4
 ld hl,S115
 call Line5
 ld hl,S116
 call Line6
 ld hl,S117
 call Line7
 ld hl,Press_Enter
 call Line8
 call Press_Enter_R
 ret

Area23:
 call ClearScn
 ld hl,S119
 call _puts
 ld hl,S120
 call Line2
 ld hl,S121
 call Line3
 ld hl,S122
 call Line4
 ld hl,S123
 call Line5
 ld hl,Press_Enter
 call Line6
 call Press_Enter_R
 ret

Press_Enter: .db "<Press ENTER>",0
S0: .db "  Mogsoft Adventure  ",0
S1: .db "Press F1 for YES and ",0
S2: .db "F2 for NO.",0
S3: .db "You are standing in a",0
S4: .db "forest. Press F1 for ",0
S5: .db "left, F2 for right.  ",0
S6: .db "You come across a    ",0
S7: .db "sewer gate. Enter it?",0
S8: .db "It is dark and damp  ",0
S9: .db "down here. Press F1  ",0
S10: .db "for left, F2 for     ",0
S11: .db "right.",0
S12: .db "You see a sewer gate ",0
S13: .db "ahead. Exit the      ",0
S14: .db "sewer?",0
S15: .db "You go outside only  ",0
S16: .db "to be met by a rabid ",0
S17: .db "bobcat. You go crazy ",0
S18: .db "and die. THE END.",0
S19: .db "You see a giant      ",0
S20: .db "treasure box. Open   ",0
S21: .db "it?",0
S22: .db "The treasure box is  ",0
S23: .db "rigged! You die      ",0
S24: .db "spread all over the  ",0
S25: .db "sewer. THE END.",0
S26: .db "You start to walk    ",0
S27: .db "away, but are stopped",0
S28: .db "by a figure. It makes",0
S29: .db "the treasure box     ",0
S30: .db "disappear.",0
S31: .db "A new, larger box    ",0
S32: .db "appears in the other ",0
S33: .db "box's place. You open",0
S34: .db "it and find untold   ",0
S35: .db "riches! THE END.",0
S36: .db "You see a huge rat   ",0
S37: .db "hoarding treasure.   ",0
S38: .db "fight it?",0
S39: .db "The rat bites you and",0
S40: .db "claws you to death.  ",0
S41: .db "      THE END        ",0
S42: .db "The rat, greatful    ",0
S43: .db "that you did not harm",0
S44: .db "him, shows you out of",0
S45: .db "the sewer and you go ",0
S46: .db "home. THE END.",0
S47: .db "There is an abandoned",0
S48: .db "building and a hermit",0
S49: .db "shack.               ",0
S50: .db "F1-Building          ",0
S51: .db "F2-Shack",0
S52: .db "Do you want to go in ",0
S53: .db "to the rear room or  ",0
S54: .db "the bottom floor?    ",0
S55: .db "F1-Rear              ",0
S56: .db "F2-Floor",0
S57: .db "You are inside a     ",0
S58: .db "spooky kitchen. Which",0
S59: .db "drawer do you want to",0
S60: .db "open? F1 for left and",0
S61: .db "F2 for right.",0
S62: .db "Sharp knives leap out",0
S63: .db "of the drawer and    ",0
S64: .db "attack you! Your     ",0
S65: .db "bloody body is found ",0
S66: .db "by another adventurer",0
S67: .db "in another game.",0
S68: .db "       THE END       ",0
S69: .db "You find a magical   ",0
S70: .db "ring inside the      ",0
S71: .db "drawer. You put it on",0
S72: .db "and you are magically",0
S73: .db "transported home!    ",0
S74: .db "       THE END       ",0
S75: .db "The old hermit in the",0
S76: .db "the shack is very    ",0
S77: .db "greatful to see you, ",0
S78: .db "as he has not seen   ",0
S79: .db "anyone in a long     ",0
S80: .db "time! You stay there ",0
S81: .db "and learn the ways of",0
S82: .db "the hermit. THE END.",0
S83: .db "It sure is dark and  ",0
S84: .db "damp down here. You  ",0
S85: .db "go down the stairs.  ",0
S86: .db "F1 for left and F2   ",0
S87: .db "for right.",0
S88: .db "OOPS! You tripped and",0
S89: .db "fell into the furnace",0
S90: .db "and you die a fiery  ",0
S91: .db "death. THE END.",0
S92: .db "You find a friendly  ",0
S93: .db "phantasm who shows   ",0
S94: .db "you the way home. You",0
S95: .db "live happily ever    ",0
S96: .db "after!",0
S97: .db "The path splits      ",0
S98: .db "again. Press F1 for  ",0
S99: .db "left and F2 for      ",0
S100: .db "right.",0
S101: .db "You come across a    ",0
S102: .db "large toad. He asks  ",0
S103: .db "that you take a huge ",0
S104: .db "log up the road. It  ",0
S105: .db "looks awfully heavy! ",0
S106: .db "Do it?",0
S107: .db "The toad, greatful   ",0
S108: .db "for your deed, warps ",0
S109: .db "you to a special     ",0
S110: .db "place. Hang on!",0
S111: .db "Oh no! The toad, who ",0
S112: .db "is really a wizard,  ",0
S113: .db "turns you into a frog",0
S114: .db "for all time! You    ",0
S115: .db "must get a princess  ",0
S116: .db "to kiss you to escape",0
S117: .db "your fate.",0
S118: .db "Oh, no! A very bad   ",0
S119: .db "person has left a    ",0
S120: .db "trap in the ground!  ",0
S121: .db "Various wild animals ",0
S122: .db "eat your guts out.   ",0
S123: .db "Ouch. THE END.",0

.end
END


Follow-Ups: