Commodore 128 Alive!

Commodore 128 => 128 programmers => Assembly => Topic started by: MIRKOSOFT on August 08, 2010, 03:23 PM

Title: LIST of BASIC program stored in BANK1
Post by: MIRKOSOFT on August 08, 2010, 03:23 PM
Hi!


I want to ask if is possible to LIST basic program stored in BANK1 at the same address like in BANK0 - but BANK0 is empty ????


Many thanks for every help.


Miro
Title: Re: LIST of BASIC program stored in BANK1 - works
Post by: MIRKOSOFT on August 08, 2010, 07:12 PM
I used my new routina and works correctly:


.var toscreen = $ffd2
.var detoken = $5149
.var digit = $8e32


.pc=$0c00 "Detoken"

detokenize:
lda beginlo
ldx beginhi
sta $fa
stx $fb
line: ldy #$00
rag: lda #$fa
ldx #$01
jsr $ff74
sta $0d00,y
iny
cmp #00
bne rag
cpy #05
bmi rag
lda $0d00
ldx $0d01
cmp #00
bne cont
cpx #00
beq end
cont: lda #$00
ldx #$0d
sta $fa
stx $fb
ldy #02

lda #146
jsr toscreen
lda $0d02
tax
iny
lda $0d03
jsr digit
iny
lda #32
jsr toscreen
ldy #04
lda #<$0d04
sta $61
iny
lda #>$0d04
sta $62
ldy #0
jsr detoken
lda #00
sta $ff00
lda #$0d
jsr toscreen
lda $0d00
ldx $0d01
sta $fa
stx $fb
jmp line
end: rts

beginlo:
.byte $01

beginhi:
.byte $1c

nextlo:
.byte 0

nexthi:
.byte 0


Miro
Title: Re: LIST of BASIC program stored in BANK1
Post by: LokalHorst on August 09, 2010, 07:19 AM
What was wrong with this one ?
http://www.commodore128.org/index.php?topic=3462.msg16977#msg16977

I don't see a major difference or advantage, but some useless code in your new version.
for ex. this:
lda $0d00
   ldx $0d01
   cmp #00
   bne cont
   cpx #00
   beq end
can be shortened to:
LDA $0d01
BEQ end
- the Z and N flags are set by loading a value, there's no need for an extra CMP#0, unless something in between had changed the flags.
And here:
lda #146
   jsr toscreen
   lda $0d02 ;why not LDX $0d02
   tax
   iny ;not used anywhere
   lda $0d03
   jsr digit

why not enter the basic here?:
; List Subroutine

5123: A0 03   LDY #$03
5125: 84 4B   STY $4B
5127: 84 11   STY $11
5129: 20 32 8E   JSR $8E32   ; Print Integer
512C: A9 20   LDA #$20

512E: A4 4B   LDY $4B
5130: 29 7F   AND #$7F

5132: 20 0C 56   JSR $560C
5135: C9 22   CMP #$22
5137: D0 06   BNE $513F
5139: A5 11   LDA $11
513B: 49 FF   EOR #$FF
513D: 85 11   STA $11

513F: C8   INY
5140: F0 DE   BEQ $5120
5142: 24 55   BIT $55
5144: 10 03   BPL $5149
5146: 20 AC 59   JSR $59AC   ; Insert Help Marker

5149: 20 EC 42   JSR $42EC   ; Get From ($61) Bank0
514C: F0 3D   BEQ $518B
514E: 6C 06 03   JMP ($0306)   ; Print Tokens Link [5151]
Title: Re: LIST of BASIC program stored in BANK1
Post by: MIRKOSOFT on August 09, 2010, 07:29 AM
Yes, sure it can be shorten...


I did it and let it be... I'm creating BUGSLIST.txt already, I must notice...


Many thanks.


Miro
EhPortal 1.34 © 2026, WebDev