Actually there was a good chunk of space left over.

Attaching the hardware scroll binary and the patch ASM.
I think there is space from 7603 to 763F.

If you were interested to try out the rom, you can edit this binary with
your mods.

On Mon, Nov 27, 2023 at 12:27 AM runrin <[email protected]> wrote:

> Ack! It was a silly mistake. I needed JZ not RZ. Everything is working
> perfectly now.
>
> Stephen, off hand, do you know if there is any extra space left over
> after your hardware scrolling patch? I'd like to use it, but I'm not
> sure if it will fit anymore with the extra 11 bytes I added in the space
> the base patch freed up.
>
> Thanks again for your help with this!
>
> On Sun, Nov 26, 2023 at 05:09:21AM -0500, Stephen Adolph wrote:
> >    Both tests should modify carry flag?
> >
> >    On Sunday, November 26, 2023, runrin <[email protected]> wrote:
> >
> >      Here's the patch I wrote after applying your base patch. I must be
> >      making a silly mistake here, since it doesn't seem to work correcly.
> >      Semi-colon is no longer shifted as expected, but it's not catching
> >      the
> >      `o' for some reason.
> >
> >                      .org    0722CH
> >                      MOV     A,C     ; unchanged
> >                      JMP     extra   ; go to patch   [C3 AB 75]
> >      back(7230):     MVI     E,2CH   ; unchanged
> >                      RET             ; unchanged
> >
> >                      .org    075ABH
> >      extra:          CPI 1BH         ; check for `o' [FE 1B]
> >                      RZ              ;               [C8]
> >                      CPI 19H         ; > 25 ?        [FE 19]
> >                      RNC             ;               [D0]
> >                      JMP back        ;               [C3 30 72]
> >
> >      On Sat, Nov 25, 2023 at 04:48:40PM -0500, Stephen Adolph wrote:
> >      >    here is a file "base_patch" that describes 4 changes to the
> >      Main ROM to
> >      >    create a hole from
> >      >    75AB to 7640
> >      >    which is free to use.
> >      >
> >      >    "... Base patch, which provides about 150 free bytes to use for
> >      >    modifications to the M100 ROM.  The basis of this patch is the
> >      >    observation that the PIO data table could be reduced from 240
> >      bytes to
> >      >    80 bytes.  This change forces a rewrite of a short section of a
> >      >    routine."
> >      >
> >      >    Good luck with it; I used it to implement the hardware scroll
> >      patch for
> >      >    the M100.
> >      >    The hardware scroll patch document has a section that details
> >      how the
> >      >    base patch works.
> >      >    cheers
> >      >    Steve
> >      >
> >      >    On Sat, Nov 25, 2023 at 1:05 PM runrin <[email protected]>
> wrote:
> >      >
> >      >      Wow, Stephen! Of course you know exactly where it is!
> >      >
> >      >      Thanks so much! If you could share your character printing
> >      patch I'd
> >      >      appreciate it.
> >      >
> >      >      Looks like the simplest way to get `o' to work with caps lock
> >      would
> >      >      be
> >      >      to just accept that `;' and `[' will also be shifted, and
> >      change the
> >      >      27
> >      >      to a 29.
> >      >
> >      >      It'll be fun to rewrite the routine though. It looks like
> >      there are
> >      >      5 or
> >      >      6 bytes free at the end of the ROM, so being able to squeeze
> >      the
> >      >      patch
> >      >      in there would be pretty nice.
> >      >
> >      >      On Sat, Nov 25, 2023 at 08:34:30AM -0500, Stephen Adolph
> >      wrote:
> >      >      >    Since you are modifying the ROM, you may find to get
> >      what you
> >      >      want you
> >      >      >    need more space.
> >      >      >
> >      >      >    I have a patch that rewrites some routines for character
> >      >      printing that
> >      >      >    frees up about 180 bytes if I recall correctly.  I've
> >      used this
> >      >      to fix
> >      >      >    things I don't like in the Main ROM.
> >      >      >
> >      >      >    I'm happy to share that patch, should your hacking
> >      require some
> >      >      bytes.
> >      >      >
> >      >      >    to your question.
> >      >      >
> >      >      >    722CH (79H) MOV A,C   Handle CAPS LOCK key during key
> >      decoding
> >      >      >    722DH (FEH) CPI 1AH
> >      >      >    722FH (D0H) RNC
> >      >      >    7230H (1EH) MVI E,2CH
> >      >      >    7232H (C9H) RET
> >      >      >
> >      >      >    if the "regular key" is > 26 the key is not modified.
> >      >      >    because the key # for o is 27, no upper case.
> >      >      >
> >      >      >    So you need a more complicated routine at 722Ch
> >      >      >
> >      >      >    On Sat, Nov 25, 2023 at 1:08 AM runrin <[email protected]
> >
> >      wrote:
> >      >      >
> >      >      >      Hey all!
> >      >      >
> >      >      >      I just finished building my FlexROM and patching the
> >      system
> >      >      rom for
> >      >      >      my
> >      >      >      keyboard layout of choice (colemak). I'm super excited
> >      about
> >      >      it
> >      >      >      because
> >      >      >      it will make my m100 much more usable for me.
> >      >      >
> >      >      >      Here are the relevant lines of the rom that were
> >      patched if
> >      >      anyone
> >      >      >      is
> >      >      >      interested:
> >      >      >
> >      >      >      00007BF0   AA 7A 78 63  76 62 6B 6D  69 61 72 73  74
> >      64 68 6E
> >      >      >      .zxcvbkmiarstdhn
> >      >      >      00007C00   65 71 77 66  70 67 6A 6C  75 79 3B 5B  6F
> >      27 2C 2E
> >      >      >      eqwfpgjluy;[o',.
> >      >      >      00007C10   2F 31 32 33  34 35 36 37  38 39 30 2D  3D
> >      5A 58 43
> >      >      >      /1234567890-=ZXC
> >      >      >      00007C20   56 42 4B 4D  49 41 52 53  54 44 48 4E  45
> >      51 57 46
> >      >      >      VBKMIARSTDHNEQWF
> >      >      >      00007C30   50 47 4A 4C  55 59 3A 5D  4F 22 3C 3E  3F
> >      21 40 23
> >      >      >      PGJLUY:]O"<>?!@#
> >      >      >      ...
> >      >      >      00007CF0   00 00 00 D4  D2 D3 A6 A7  A8 6D 30 6E  31
> >      65 32 69
> >      >      >      .........m0n1e2i
> >      >      >      00007D00   33 6C 34 75  35 79 36 01  06 14 02 20  7F
> >      09 1B 8B
> >      >      >      3l4u5y6.... ....
> >      >      >
> >      >      >      The last two lines makes the number pad work correctly
> >      (an
> >      >      extremely
> >      >      >      easy fix!)
> >      >      >
> >      >      >      There is just one small bug with my patch, and that is
> >      caps
> >      >      lock not
> >      >      >      working correctly. When caps lock is enabled, `o'
> >      remains
> >      >      lowercase
> >      >      >      and
> >      >      >      `;' types a `:'. I presume this is due to the way caps
> >      lock
> >      >      works
> >      >      >      with
> >      >      >      the keyboard matrix. The letter `o' has been moved out
> >      of the
> >      >      letter
> >      >      >      rows of the keyboard matrix, and is now in one of the
> >      symbol
> >      >      >      rows. The opposite is true of the semi-colon, now
> >      being part
> >      >      of the
> >      >      >      letter matrix replacing `p'.
> >      >      >
> >      >      >      Does anyone know if caps lock is done in software, or
> >      if it's
> >      >      >      modifying
> >      >      >      which characters are being selected by pulling a bit
> >      high or
> >      >      >      something?
> >      >      >
> >      >      >      This is a really small issue, but I would like to get
> >      it
> >      >      working
> >      >      >      correctly. I'll dive into the schematic when I have
> >      some time
> >      >      and
> >      >      >      see if
> >      >      >      I can find a hint about how caps lock works. If not
> >      I'll
> >      >      start
> >      >      >      messing
> >      >      >      around with Virtual-T and see what I can find there.
> >      >      >
> >      >      >      If I dig anything interesting up, I'll update this
> >      thread
> >      >      with what
> >      >      >      I
> >      >      >      learn.
> >
> >      > ; patch #1 for M100/T102 rom
> >      > ; this patch reduced the amount of space needed in the LCD
> >      patterns table, enabling room for future changes
> >      >
> >      > ; blocks:
> >      >
> >      > ;             7467 - 746E checked
> >      > ;             74BB - 74EA checked
> >      > ;             7551 - 75AA checked
> >      > ;             75AB - 763F hole created
> >      >
> >      >
> >      >
> >      >
> >      > ;-----------------------------------------------------------
> >      ---------------------------
> >      >
> >      > ;PATCH2
> >      > ; Proposed replacement code 7467 to 746E
> >      > ;checked
> >      >
> >      >       .org    07467H
> >      >
> >      > p2:   LXI     H,7643H
> >      >       CALL    p5
> >      >       NOP
> >      >       NOP
> >      >
> >      >
> >      > ;-----------------------------------------------------------
> >      ---------------------------
> >      > ;PATCH3
> >      > ; Proposed replacement code 74BB to 74EA
> >      > ; checked
> >      >
> >      >       .org    074BBH
> >      >
> >      > p3:   RLC
> >      >       MOV C,A
> >      >       MVI B,00H
> >      >       LXI H,7551H
> >      >       DAD B
> >      >       MOV C,M
> >      >       INX H
> >      >       MOV A,M
> >      >       PUSH PSW
> >      >       LDA 0FFF4H
> >      >       RAR
> >      >       RAR
> >      >       RAR
> >      >       LXI H,7643H
> >      >       CALL p5
> >      >       CALL 753BH
> >      >       SHLD 0FFF6H
> >      >       POP PSW
> >      >       ORA B
> >      >       MOV B,A
> >      >       POP H
> >      >       DCR D
> >      >       CALL 74F7H
> >      >       INR D
> >      >       MVI A,06H
> >      >       SUB E
> >      >       RZ
> >      >       MOV E,A
> >      >       PUSH H
> >      >       LHLD 0FFF6H
> >      >
> >      >
> >      > ;-----------------------------------------------------------
> >      ---------------------------
> >      > ;PATCH4
> >      > ; this is the corrected LCD table  7551 to 75A0  240 bytes
> >      > ; 75A1 to 7640 is free to use, 160 bytes total
> >      > ; checked
> >      >
> >      >       .org    07551H  ; 80 bytes
> >      > p4:   .db     00H,00H,00H,06H,00H,0CH,00H,
> >      12H,00H,18H,00H,1EH,00H,24H,00H,2AH
> >      >       .db     00H,30H
> >      >       .db     02H,04H,02H,0AH,02H,10H,02H,
> >      16H,02H,1CH,02H,22H,02H,28H,02H,2EH
> >      >       .db     04H,02H,04H,08H,04H,0EH,04H,
> >      14H,04H,1AH,04H,20H,04H,26H,04H,2CH
> >      >       .db     06H,00H,06H,06H,06H,0CH,06H,
> >      12H,06H,18H,06H,1EH,06H,24H,06H,2AH
> >      >       .db     06H,30H
> >      >       .db     08H,04H,08H,0AH,08H,10H,08H,16H,08H,1CH,08H,22H
> >      >
> >      >
> >      >
> >      >
> >      > ;-----------------------------------------------------------
> >      ---------------------------
> >      > ;PATCH5
> >      > ; Proposed subroutine at 75A1H to 75AA
> >      > ; checked
> >      >       .org    075A1H
> >      >
> >      > p5:   JNC ahead1
> >      >       MVI L,4DH
> >      > ahead1:       MVI B,00H
> >      >       DAD B
> >      >       MOV B,A
> >      >       RET
> >      >
> >      >
> >      > ; 75A1 to 75AA is used
> >      > ; 75AB to 7640 free to use
> >      >
> >      > ;-----------------------------------------------------------
> >      ---------------------------
> >      >
> >      >       .org    075ABh
> >      >       .db     00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00,00,00,00,00,00,00,00
> >      >       .db     00
> >      >
> >      > .end
> >      >
> >      >
> >      >
> >      >
>
; changes to M100 rom for hardware scrolling patch

; applies on top of base patch
; there are 5 main patches to apply
;       1.  hook into scroll up
;       2.  scroll up
;       3.  hook into scroll down
;       4.  scroll down
;       5.  hook into set page
;       6.  set page
;       7.  change to Hayashi
;       8.  hook into byte plotting
;       9.  byte plotting

; space is from 75A1 to 763F.  160 bytes
; 10 bytes are used at 75A1
; hole is 150 bytes starting at 75AB
; 13+15+6+14+6+22+10 = 86 bytes

;---------------------------------------------------------------------
; Hardware Scroll Patch
; adjusted to avoid TS-DOS conflict
;---------------------------------------------------------------------

page_loc:       .equ    0F9ADH
scroll_active:  .equ    0F9AEH

        .org    0000

;---------------------------------------------------------------------
; hook into Scroll down
;---------------------------------------------------------------------
        .org    044CFH
        call    TRAP_M
        .org    44E7H
        jmp     RET_M

;---------------------------------------------------------------------
; hook into Scroll up
;---------------------------------------------------------------------
        .org    044F6H
        call    TRAP_L
        .org    0450FH
        jmp     RET_L
        
;---------------------------------------------------------------------
; hook into 4566 routine
;---------------------------------------------------------------------
        .org    4573H
        call    stop_access     

;---------------------------------------------------------------------
; change to Hayashi default value
;---------------------------------------------------------------------
        .org    06C3CH  
        .db     00h             ; page_loc data 6C3C -->F9AD
        .db     00h             ; scroll status 6C3D -->F9AE
        
;---------------------------------------------------------------------
; hook into byte plotting
;---------------------------------------------------------------------
        .org    74F7H
        jmp     correct_b

;---------------------------------------------------------------------
; hook into set page
;---------------------------------------------------------------------
        .org    0752BH
        call    set_page
        ori     3EH             ; called from set_page
        out     0FEH
        ret
        
;---------------------------------------------------------------------
; Patch code  - place in hole at 75AB - 763F 
;---------------------------------------------------------------------
        .org    75ABH
        
;---------------------------------------------------------------------
; TRAP_M (10 bytes)
;---------------------------------------------------------------------
TRAP_M:                         ; A holds # of scrolls, L is the line number to 
process first
                                ; return vector on stack
        pop     d
        jz      4535H           ; if zero set, erase current line and done.. 
return to caller
  
        push    d
        
        lxi     d,0C028h        ; d= C0h, e = 40d, 28H
                
        jmp     TRAP_C

;---------------------------------------------------------------------
; TRAP_L  (22 bytes)
;---------------------------------------------------------------------
TRAP_L:                         ; A holds # of scrolls, L is the line number to 
process first
                                ; return vector on stack
        pop     d
        jz      4535H           ; if zero set, erase current line and done.. 
return to caller

        push    d
 
        lxi     d,04027h        ; d= 40h, e = 39d, 27H
        
;       jmp     TRAP_C  

TRAP_C: 
        cpi     07d
        rnz                     ; if a <>7 then return and process normally
        
        push    psw
        mov     a,e
        sta     scroll_active
        push    h
        call    set_new_page
        pop     h
        pop     psw
        ret

;---------------------------------------------------------------------
; RET_M  RET_L (6 bytes)
;---------------------------------------------------------------------
                ; a is always zero on jump in.
                ; use this to just clear the scroll active flag
RET_M:  
RET_L:  ;xra    a       
        sta     scroll_active   ; disable scroll active
        jmp     4535H
                
;---------------------------------------------------------------------
;  stop_access  (14 bytes)
;---------------------------------------------------------------------
; prevent character plotting level 7 when hardware scrolling
stop_access:
        lda     scroll_active
        ora     a
        jz      073EEh          ; if scroll not active then continue with 
character plotting
                                ; scroll is active
        add     e               ; sum of e and a
        cpi     44d             ; some number out of normal range but same for 
both 
        jz      073EEh          ; process the line if we are in the copy 
condition

        ret                     ; if scroll not active then continue with 
character plotting

;---------------------------------------------------------------------
; set_new_page (6 bytes)
;---------------------------------------------------------------------  
set_new_page:                   ; d holds subtract amount, 40 for down and C0 
for up
        lxi     h, page_loc             ; set location
        mov     a,m
        sub     d
        mov     m,a

;---------------------------------------------------------------------
; set_page  (15 bytes) 
;---------------------------------------------------------------------
set_page:       ;  752EH is on stack
        mvi     c,03d
        call    7657H           ; short delay
        
        lxi     h,7641H 
        call    0753BH          ; enable LCD drivers
        
        lda     page_loc        ; load page data
        ret

;---------------------------------------------------------------------
; correct_b   (13 bytes)
;---------------------------------------------------------------------
correct_b:              ; all registers in use  
        push    d
        push    psw             ; store PSW
        lda     page_loc        ; ok to just use the one page value as they 
should be the same
        Add     b               ; EXCEPT during a page scroll
        mov     c,a             ; temp store
        
        pop     psw
        push    psw             ; make sure flags are the same as initial
        mov     a,c             ; restore, hopefully C is not used

        jmp     074FAH          ; jump back into routine
        ; just leave B as is; manipulate A to be the corrected page
        
        .end

Attachment: M102_hs.bin
Description: Binary data

Reply via email to