Help! SC/MP Programming Question

river river at zip.com.au
Mon Mar 28 17:52:31 CST 2005


Hi,

I have a small issue with printing out the ASCII char set, from $20 to $7E inclusive.

The 8251 initialisation is okay 'cos I ran a small program to print a single char to the
TTY and it worked fine. So, I thought I'd expand on this to transmit the printable ASCII
char set to the TTY (actually, Hyperterm). However, it jusat transmits spaces. I've
tried a few variations and it never prints the chars properly.

I'm figuring that there is a problem with my logic, but as I don't have a SC/MP programming
manual and I can't see the forest due to the trees, I'm hoping someone here on this list
with some SC/MP programming knowledge maybe able to offer some assistance.

The P1 register is pointing to the 8251 data port, and 1(1) points it to the control/status port.

ktest:
          ldi   $20             ;First char is ASCII 'space'
kt1:
          xae                   ;temp save in E-reg/exchange the A and E regs
kt2:
          ld    1(1)            ;get UART status
          ani   $01             ;Tx Ready?
          jz    kt2             ;No, keep checking
          lde                   ;Yes, get char
          st    (1)             ;Tx the char
          scl                   ;carry = 1
          adi   $00             ;add 0 + carry
          xae                   ;save to E reg
          lde                   ;move back to A reg
          xri   $7f             ;gone too far?
          jz    ktest           ;yes, start at SPACE again
          jmp   kt1             ;no, print it


Basically, I load the A reg with ASCII $20 (SPACE) and save it to the E reg.
Then I check the 8251 TX Ready flag and when ready I get the ASCII char from the
E reg and transmit it. The char is still in the A reg after the transmission, so I set
the carry bit and add $00 (ie incrementing the A reg). I then save this value in the
E reg and then load it back to the A reg - thereby both A and E regs have the same
value. I then check if I have hit the end by destroying the A reg with the XRI instruction.
If I haven't hit the end ($7F) yet, I go back to "kt1", whcih relaods the A reg with the
char and then it goes on to print this char. If it's at the end then it goes back to "ktest"
to start back at ASCII $20 and does it over again.

I've done this heaps of time with the 8080 processors and don't know why it's not doing
it with the SC/MP.

Also, I have some SC/MP listings about and one of them has "LD @0(P2)" instruction.
>From what I know, and this maybe totally wrong, the "@" is an auto-increment/auto-
decrement bit and you must specify the displacement for the inc/dec. If this is the case,
then what does the "0" that immediately follows the "@" do? I would expect to see a
value other than "0" to ensure the P2 register is inc/dec by the appropriate amount.

Please, old SC/MP dudes, any help would be greatly appreciated.

river



More information about the cctalk mailing list