6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu May 09, 2024 4:08 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Oct 09, 2003 9:22 am 
Offline

Joined: Thu Oct 09, 2003 9:07 am
Posts: 1
Im using a 6502 emulator to work on a project for university. We use a set area of memory which correlates to displaying an 'output' on a simulated display.

Currently I have an array of alphabetic characters which I wish to display onto this 'screen'. This is not the problem - i have done this and it works.
Ive done this by using a LDA array,X in a loop and it produces the out put i desire.

My question is that I now have an array that exceeds 255 characters and as the offset just revolves back to 0 it wont display what i want on the screen.

Without being able to modify the array or use additional variables (like having 2 variable names nested within the array), is there a way I can display more than this?

Or should i be looking at an alternative way of displaying this data..
What the data is isnt important - im just interested in how I can show the entire block without it reverting back to the start.

Any suggestions?

(Pls note the code below is a shell i what i used to achieve the basic functionality of the display to the 'screen', there are more lines to it - but omitted)

Im thinking I have to use 16 bit some how but I dont know where to begin in attempting that.

Code:
   LDX #$ff
   LDY #11      ;lines in the array
.show
   INX      ;i want x=0 for the first element
   LDA array, x   ;A becomes the item i want to display
   BEQ .doneline   ;if A=0 then next line
   STA io_putc   ;io_putc is the output screen
   JMP .show
.doneline
   DEY
   ;display cr/lf here
   BNE .show
   BRK

array:   .db "123456789012345678901234567890",0
   .db "123456789012345678901234567890",0
   .db "123456789...........................
   ;assume there are about 400 elements here and it doesnt
   ;repeat in any fixed pattern


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Oct 09, 2003 10:07 am 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 298
I would suggest using the indirect addressing modes. Instead of keeping the pointer to the data in the code, store it in zero page somewhere, then use LDA (ptr),Y to read it. You can increment Y to access up to 256 bytes, then when it wraps around to zero just increment the high byte of the pointer.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron