; 6502bench SourceGen v1.7.3
TXTPTR .eq $03 {addr/2} ;current tile position on text page 1
MAPPOS .eq $1b ; playfield position
MAPHALF .eq $1c ; playfield half (top/bottom); like top bit of MAPPOS
doorNeshom .eq $35 ; FF = door goes to Neshom house, 01 = Neshom realm
MON_CSWL .eq $36 ;character output hook (lo)
spokeTo .eq $37 ; spoke to or bought from NPC while on this screen
GAME1_BITTAB5 .eq $1dbd
GAME1_BITTAB6 .eq $1dbe
GAME2_PRNTSTR .eq $600c
GAME2_message_wait .eq $7706
itemStatePos .eq $b300 {addr/256} ; 256 map positions, one per item
itemState .eq $b500 {addr/256} ; 7=mappos high bit, 6=in world, 5=in inv, 4..0=map row
.org $0100
NOTE: Looks like some bytes are corrupt. Using any spirit action other than
PENSE when you have insufficient spirit energy results in "I HAVE NOTHING MORE
TO GIVE" instead of "YOU NEED MORE SPIRIT ENERGY", and then locks up. That code
jumps to $0103, an illegal opcode. PENSE works because it does not use $0103,
but its own copy of that code. Jump to $0100 should work, because it will
execute harmless instructions on its way to $010E.
Either the source disk was corrupt, there was some unhandled copy protection, or
this version actually has a bug.
$0100: JMP $010E ?? ; STACK_npc_offer
$0103: JMP $0160 ?? ; STACK_need_energy
0100: 31 36 and (MON_CSWL),y
0102: 34 03 bit TXTPTR,x
0104: 34 35 bit doorNeshom,x
0106: 36 37 rol spokeTo,x
0108: 38 sec
0109: 39 10 d0 and $d010,y
010c: 01 60 ora ($60,x)
010e: a2 ff npc_offer ldx #$ff
0110: ca @next_item dex
0111: e0 ff cpx #$ff ;check item = 00..FE
0113: d0 25 bne @valid_item_num
0115: 68 pla ;cycled thru all item numbers
0116: 68 pla ;discard caller return address (speak module)
0117: 20 0c 60 jsr GAME2_PRNTSTR
011a: 01 .dd1 $01
011b: c9 a0 c8 c1+ .str ↑“I HAVE NOTHING MORE TO GIVE”
0136: ff .dd1 $ff
0137: 4c 06 77 jmp GAME2_message_wait ;return to game
013a: bd 00 b3 @valid_item_num lda itemStatePos,x
013d: c5 1b cmp MAPPOS
013f: d0 cf bne @next_item
0141: bd 00 b5 lda itemState,x
0144: 29 80 and #$80 ;check if mapside is same as item's (bit 7)
0146: d0 06 bne @side0
0148: a5 1c lda MAPHALF
014a: d0 c4 bne @next_item
014c: f0 04 beq @check_state
014e: a5 1c @side0 lda MAPHALF
0150: f0 be beq @next_item
0152: bd 00 b5 @check_state lda itemState,x
0155: 2c be 1d bit GAME1_BITTAB6 ;bit 6 must be set
0158: f0 b6 beq @next_item
015a: 2c bd 1d bit GAME1_BITTAB5 ;bit 5 must be clear
015d: d0 b1 bne @next_item
015f: 60 rts
0160: 20 0c 60 need_more_energy jsr GAME2_PRNTSTR
0163: 01 .dd1 $01
0164: d9 cf d5 a0+ .str ↑“YOU NEED MORE SPIRIT ENERGY”
017f: ff .dd1 $ff
0180: 4c 06 77 jmp GAME2_message_wait
0183: e3 20 60 a0+ .junk 45
No exported symbols found.