RTerm P1 for R16K1S60

  • LBPHacker
    11th Jul 2016 Developer 0 Permalink

    @cmk20:

    Nobody Understands It

     

    Ehrm. Let's see my train of thought. You see 0x1ppp, you already know it's hexadecimal and that it's a 16-bit value, so each "p" must represent a 4-bit value (a nibble). Reading them as a whole, you get [ppp], which is a 12-bit value. But then I mention that it's actually a 10-bit value which means its highest two bits are ignored. I also mention that the X component of the cursor position make up the low 5 bits and the Y component the high 5 bits. There's literally nothing more to do than shifting the Y component to the left by 5 bits, ORing it with the X component and ORing the result with 0x1000.

     

    I mean, come on, we're talking assembler here.

    Edited 6 times by LBPHacker. Last: 11th Jul 2016
  • cmk20
    11th Jul 2016 Member 0 Permalink

    @LBPHacker (View Post)

     Well Your Train Of THought Is What I Spent 3 Hours Yesterday Trying To Figure Out... I Mean It's A Really Good Idea However For People Like Me Who Have Littile To No Knowlage With Asm It's Slightly Confusing. I Started Codeing With C++ (On The Arduino Microcontroller Platform) About 3 Years Ago But I Rarely Ever Had To Use Hex Values :P

    Edited once by cmk20. Last: 11th Jul 2016
  • Cool4Cool
    12th Jul 2016 Member 0 Permalink

    @cmk20, so, in order to convert your screen coordinates: e.g. (5, 5) to the format for the screen:

    Take the Y (5), convert it to binary, shift it to the left by 5 bits, OR it with the X (5), and OR this result with 0x1000, or 0001000000000000. So, the coordinates (5, 5) become 0x10A5.

  • LBPHacker
    12th Jul 2016 Developer 0 Permalink

    Uhm.

    1. cmk already figured it out
    2. next time you use binary, postfix it with b. 0001000000000000b is the way.
  • Synergy
    12th Jul 2016 Member 0 Permalink

    Looks amazing. I think you should package the everything in just one save so people always know where to look, and maybe write a couple default programs for it that show off the screen/60hz capabilities more.

  • LBPHacker
    12th Jul 2016 Developer 0 Permalink

    But all these things don't really fit into a single save ... I feel lucky to have managed to shove a computer and a terminal into a single save. As for default programs ...well, just you wait.

    Edited once by LBPHacker. Last: 12th Jul 2016
  • Cool4Cool
    19th Jul 2016 Member 0 Permalink

    I wrote a very useful function to print a newline (top to bottom). It automatically calculates the cursor position in order to do its job, and requires the DX register to count lines:

     

    ;printNl: Advances cursor to the next line, requires DX register as a line counter
    printNl:
                add dx, 0x0002             ;Adds 2 lines to the counter (configure) 
                cmp dx, 0x0016            ;If there are more than 16 lines, jump to
                jge scrollUp                   ;the scroll up function (configure)
    printNlEntryPoint:
                push dx                        ;Save the data held in DX
                shl dx, 0x0005              ;Generate/send exact cursor location by shifting
                or dx, 0x0001               ;the Y (stored in DX) to the left by 5 bits and
                or dx, 0x1000               ;performing a bitwise OR on it and the X
                send 0, dx                    ;(configure), before ORing it with 0x1000
                pop dx                         ;Restore value of DX
                ret

    scrollUp:
                push ex                         ;Save the data held in EX
                mov ex, 0                      ;Configure EX for serial port 0 of the RTERM
                send ex, 0x3000           ;Send the RTERM two downward line scroll commands
                send ex, 0x3000
                mov dx, 0x0015           ;Change value of DX to 15 lines (configure)
                pop ex                          ;Restore value of EX
                jmp printNlEntryPoint   ;Jump the entry point in the main part of function

    Edited 3 times by Cool4Cool. Last: 19th Jul 2016