From: stiggity on
Ive always done all of my tasks on a 64, or a 128 in 64mode. Well,
today i broke out the 128 PRM and decided to write a small routine
that will print the contents of a$ to the screen. Well after an hour
or so of trying to get this to work... im here. I know nothing about
"banking" but owning the 128 PRM im trying to learn. If anyone can
tell me why this routine will not work on the 128, but once pointers
have been switched back to 64 code, it works fine.. any help would be
greatly appreciated.

-Steve

*=$1300



start jsr getstr

ldy #0
sty starty
start1 ldy starty
cpy uplen
bcs startd

lda ($fd),y
jsr $ffd2
inc starty
jmp start1


startd rts


GETSTR LDA $2f
STA $BB
LDA $30
STA $BC
OO LDY #$00
LDA ($BB),Y
CMP #65
BNE OO2
INY
LDA ($BB),Y
CMP #128
BEQ OO3
OO2 CLC
LDA $BB
ADC #$07
STA $BB
LDA $BC
ADC #$00
STA $BC
JMP OO
OO3 INY
LDA ($BB),Y
STA UPLEN
INY
LDA ($BB),Y
STA $FD
INY
LDA ($BB),Y
STA $FE
STA $BC
RTS






starty .byte 0
uplen .byte 0
From: xlar54 on
I dont have time at the moment to go over your code, but here's some
code that I did have that kind of did the same thing for the 128:

;C-128 ML Find and Display A$, by Tech E
;Merlin128 src file

STAVEC = $02B9 ;interbank STA vector (not used here)
FETVEC = $02AA ;interbank LDA vector (not used here)
LENGTH = $0B20 ;var length stored in tape buffer
INDFET = $FF74
INDSTA = $FF77
CHROUT = $FFD2

*= $3000 ; sys 12288

AFIND LDY #$04 ; FINDS A$ AND SETS $FF-$FE
STY $FF ; zero page location for interbank LDA
LDY #$00
STY $FE ; " " "
SEARCH1 JSR FETCH1
CMP #$41 ; search for 'a'
BEQ FOUND1
INY
CPY #$00
BNE SEARCH1
INC $FF ; increment zero page high byte
LDA $FF
CMP #$16 ; arbitrary search limit
BNE SEARCH1
RTS
FOUND1 STY $FE ; found A, now verify for marker
LDY #$01
JSR FETCH1
CMP #$80 ; if marker is $80, then we got a$
BNE SEARCH1
INY
JSR FETCH1
STA LENGTH ; save variable length
INY
JSR FETCH1
STA $0B21
INY
JSR FETCH1
STA $FF ; set zp with mem location of a$ data
LDA $0B21
STA $FE

PRINT1 LDY #$00 ; print to screen
GETNEXT CPY LENGTH
BEQ END1
JSR FETCH1
JSR $FFD2
INY
JMP GETNEXT
END1 RTS ; return to basic

FETCH1 LDA #$FE ; set A to zero page pointer addr
STY $0B22 ; store Y for safekeeping
LDX #$01 ; Set X to bank#
JSR INDFET ; LDA(A),Y bank X
LDY $0B22 ; re-load Y
RTS