Thelen #1 Posted September 8, 2002 I'm learning to program on the atari 800 in assembler. and I want to load a custum character set.but now i have a little problem, i need to load 1024 bytes, how can i do this. with my routine now i can't get passed 256 bytes. who can help ? LDX #$00 KARLOO1 LDA KARAK,X STA $2400,X INX TXA CMP #255 BNE KARLOO1 thanks for your help, Thelen Quote Share this post Link to post Share on other sites
Heaven/TQA #2 Posted September 8, 2002 LDX #$00 KARLOO1 LDA KARAK,X STA $2400,X INX TXA CMP #255 BNE KARLOO1 this does just copy 255 bytes not 256... can be written as ldx #0 loop1 lda karak,x sta $2400,x inx bne loop1 this copies 256 bytes to copy 1024...you can do this loop 4 times...1024/256=4 ldx #0 loop1 lda karak,x sta $2400,x inx bne loop1 loop2 lda karak+256,x sta $2400+256,x inx bne loop2 loop3 lda karak+256+256,x sta $2400+256+256,x inx bne loop3 loop4 lda karak+256+256+256,x sta $2400+256+256+256,x inx bne loop4 ... bne checks the zero flag... so when a,x,y registers contain zero this flag is set...therefore when the x register is going from 255 back to zero the loop is left... what i have written is called unrolled loop... but you can combine x+y register to copy more than 256 bytes ldy #4 ; copy 4x256 bytes=1024 loop1 ldx #0 loop2 lda chardata,x ad sta $2400,x inx bne loop2 ;256 bytes copied? inc loop2+2 ; add #1 to highadress inc ad+2 ;add #1 to destination adress $2400 = $2500 dey bne loop1 this is called selfmodified code...and works just when executed in RAM not from ROM (depends if you code on 5200 f.e.) or you take zero pages: lda #<source ; lo byte of source adress sta $b0 lda #>source ; hi byte of source sta $b1 lda #<destin sta $b2 lda #>destin sta $b3 ldx #4 ;now x register!!! loop1 ldy #0 loop2 lda ($b0),y sta ($b2),y iny bne loop2 inc $b1 inc $b3 dex bne loop1 you see...thouthands of roads lead to rome... hve Quote Share this post Link to post Share on other sites
Thelen #3 Posted September 8, 2002 thanks !! thelen Quote Share this post Link to post Share on other sites