From 89bb91a19c28499e7ee70266841b754d685b6d21 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Mon, 7 Nov 2016 20:53:07 -0800 Subject: [PATCH 1/3] start work on v2, add lowercase support must build lcase.a once first to produce lcase.ct --- src/4live.a | 16 +++++++++++++--- src/lcase.a | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 src/lcase.a diff --git a/src/4live.a b/src/4live.a index 2a6b67a..668a47d 100644 --- a/src/4live.a +++ b/src/4live.a @@ -199,6 +199,8 @@ Install beq + lda #INVSPACE sta CharDel + 1 + lda #$DF + sta CharMap + 1 + ;display the welcome message, now that we're finally done @@ -305,6 +307,12 @@ VirtualBuff1 VirtualBuff2 - lda $34f3, y ;self-modified + cmp #("a" + $80) + bcc + + cmp #("z" + 1 + $80) + bcs + +CharMap + and #$FF ;self-modified sta $0400, y dey bpl - @@ -769,14 +777,16 @@ SaveCH SaveCV !byte 0 ;loaded from file if exists +!ct "lcase.ct" FirstLine ;lines are stored sequentially, not like text page in memory !fill WIDTH * 8, $A0 - !scrxor $80, " 4LIVE by 4am && qkumba " + !text " 4LIVE by 4am && qkumba " !fill WIDTH, $A0 - !scrxor $80, " Revision 01 / Serial number 161103 " + !text " Revision 02 / Serial number 161107 " !fill WIDTH * 2, $A0 - !scrxor $80, " https://github.com/a2-4am/4live " + !text " https://github.com/a2-4am/4live " !fill WIDTH * 9, $A0 +!ct raw LoadSaveEnd ;in the current version, the status line is not saved diff --git a/src/lcase.a b/src/lcase.a new file mode 100644 index 0000000..0005c6a --- /dev/null +++ b/src/lcase.a @@ -0,0 +1,4 @@ +!to "lcase.ct", plain +*=0 +!for i, 128 {!byte i+127} +!for i, 256-128 {!byte i+127} From b55382049e597e047b0bcd19033da35a8ed3b3b0 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Thu, 10 Nov 2016 15:35:25 -0800 Subject: [PATCH 2/3] run from banked RAM --- src/4live.a | 172 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 134 insertions(+), 38 deletions(-) diff --git a/src/4live.a b/src/4live.a index 668a47d..51e377e 100644 --- a/src/4live.a +++ b/src/4live.a @@ -20,6 +20,8 @@ !addr KBD = $C000 !addr STROBE = $C010 !addr LCBANK2 = $C083 +!addr ROMIN1 = $C089 +!addr LCBANK1 = $C08B !addr APLDETECT = $FBB3 ;#06 if IIe or later !addr KEYIN = $FD1B !addr RDCHAR = $FD35 @@ -42,6 +44,9 @@ SAVEKEY = $93 ; CTRL-S ;constants + SWAPCOPY = $368 + SWAPBUFFER = $800 ; (LoadSaveEnd - LoadSaveStart) size + ; currently $39A bytes! A2E = $06 INVSPACE = $20 LTARROW = $88 @@ -72,6 +77,17 @@ ; Install + ;switch cursor type depending on Apple revision + ;can't delay in case ROM is banked out because Diversi-DOS + + lda APLDETECT + cmp #A2E + beq + + lda #INVSPACE + sta CharDel + 1 + BankedCopyStart - $D000 + lda #("z" + 1 + $80) + sta CharMap + 1 + BankedCopyStart - $D000 ++ ;find a free DOS buffer @@ -101,8 +117,8 @@ Install ;set filename pointer in MLI request packet - stx FileName - sta FileName + 1 + stx FileName + BankedCopyStart - $D000 + sta FileName + 1 + BankedCopyStart - $D000 ;check for empty filename (indicates free buffer) @@ -115,8 +131,8 @@ Install jsr GETPARM sty MANPARML sta MANPARMH - sty MANPARM + 1 - sta MANPARM + 2 + sty MANPARM + 1 + BankedCopyStart - $D000 + sta MANPARM + 2 + BankedCopyStart - $D000 ;copy DOS buffer pointers to file manager parameter list @@ -156,11 +172,35 @@ Install lsr lsr lsr - sta FileSlot + sta FileSlot + BankedCopyStart - $D000 iny ;ldy #IOBDRIVE lda (OPSRCL), y - sta FileDrive - ldx #OPENEXISTING + sta FileDrive + BankedCopyStart - $D000 + + ;copy to swap space + + ldy #(SWAPCOPYEnd - SWAPCOPYStart) +- lda SWAPCOPYStart - 1, y + sta SWAPCOPY - 1, y + dey + bne - + + ;copy to banked RAM + + jsr BankInRAM1 + ldx #>(BankedCopyEnd + 255 - BankedCopyStart) + +CopyMod +- lda BankedCopyStart, y + sta $D000, y + iny + bne - + inc CopyMod + 2 + inc CopyMod + 5 + dex + bne - + + inx ;ldx #OPENEXISTING jsr OpenFile bcs + @@ -192,16 +232,8 @@ Install inc ReadWriteCmd ;lda WRITECMD / sta ReadWriteCmd - ;switch cursor type depending on Apple revision + lda ROMIN1 - lda APLDETECT - cmp #A2E - beq + - lda #INVSPACE - sta CharDel + 1 - lda #$DF - sta CharMap + 1 -+ ;display the welcome message, now that we're finally done ldy #0 @@ -224,6 +256,8 @@ FileName_b !scrxor $80, $DF, "4LIVE DATA" FileName_e +SWAPCOPYStart +!pseudopc SWAPCOPY { ;support enhanced flashing cursor while waiting for key, if available. ;it works by passing to the routine the character under the cursor. ;the ROM toggles between that character and the Delete character. @@ -237,16 +271,77 @@ GetKey ;are we on? cmp #HOTKEY - ;yes -> branch - beq + - ;no -> return to DOS + bne ReuseRts + + jsr BankInRAM1 + jsr RunFromBankedRAM + lda ROMIN1 + + ;lather, rinse, repeat + jsr RDCHAR + jmp GetKey + +SwapFILEMAN + lda ROMIN1 + jsr FILEMAN + +BankInRAM1 + bit LCBANK1 + bit LCBANK1 + +ReuseRts rts + ;sorry, I couldn't find a simpler way... + +ExchangeSwapBanked + lda #<(SWAPBUFFER + LoadSaveEnd - LoadSaveStart) + sta ExchangeSwapSource1 + 1 + sta ExchangeSwapTarget1 + 1 + lda #((>SWAPBUFFER) - >((<(LoadSaveEnd - LoadSaveStart)) + 255)) + sta ExchangeSwapSource1 + 2 + sta ExchangeSwapTarget1 + 2 + lda #<(LoadSaveStart + LoadSaveEnd - LoadSaveStart) + sta ExchangeSwapSource2 + 1 + sta ExchangeSwapTarget2 + 1 + lda #((>LoadSaveStart) - >((<(LoadSaveEnd - LoadSaveStart)) + 255)) + sta ExchangeSwapSource2 + 2 + sta ExchangeSwapTarget2 + 2 + ldx #>(LoadSaveEnd - LoadSaveStart) + ldy #<(LoadSaveStart - LoadSaveEnd) +ExchangeSwapSource1 + lda $34f3, y ;self-modified + pha +ExchangeSwapSource2 + lda $34f3, y ;self-modified +ExchangeSwapTarget1 + sta $34f3, y ;self-modified + pla +ExchangeSwapTarget2 + sta $34f3, y ;self-modified + iny + bne ExchangeSwapSource1 + inc ExchangeSwapSource1 + 2 + inc ExchangeSwapSource2 + 2 + inc ExchangeSwapTarget1 + 2 + inc ExchangeSwapTarget2 + 2 + dex + bpl ExchangeSwapSource1 + rts +} +SWAPCOPYEnd +!if ((SWAPCOPYEnd + SWAPCOPY - SWAPCOPYStart) > $3d0) { + !error "swap code too large, ends at ",SWAPCOPYEnd + SWAPCOPY - SWAPCOPYStart +} + +BankedCopyStart +!pseudopc $D000 { +RunFromBankedRAM ;preserve X across calls ;it's important for DOS -+ txa + txa pha ;first, scroll the edit buffer onto the screen @@ -272,10 +367,7 @@ IsDirty + pla tax - - ;lather, rinse, repeat - jsr RDCHAR - jmp GetKey + rts ScrollEditBufferIn lda # Date: Thu, 10 Nov 2016 16:19:41 -0800 Subject: [PATCH 3/3] only use swap region in DiversiDOS --- src/4live.a | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/4live.a b/src/4live.a index 51e377e..5b267c2 100644 --- a/src/4live.a +++ b/src/4live.a @@ -47,6 +47,7 @@ SWAPCOPY = $368 SWAPBUFFER = $800 ; (LoadSaveEnd - LoadSaveStart) size ; currently $39A bytes! + ; needed by DiversiDOS A2E = $06 INVSPACE = $20 LTARROW = $88 @@ -78,7 +79,7 @@ Install ;switch cursor type depending on Apple revision - ;can't delay in case ROM is banked out because Diversi-DOS + ;can't delay in case ROM is banked out because DiversiDOS lda APLDETECT cmp #A2E @@ -99,6 +100,14 @@ Install cmp #$BF bne + +!if SWAPBUFFER + sta ReadBuffer + 1 + BankedCopyStart - $D000 + lda #$A9 + sta ExchangeSwapBanked + SWAPCOPYStart - SWAPCOPY lda LCBANK2 lda LCBANK2 lda #$DD @@ -283,7 +292,6 @@ GetKey jmp GetKey SwapFILEMAN - lda ROMIN1 jsr FILEMAN BankInRAM1 @@ -296,7 +304,8 @@ ReuseRts ;sorry, I couldn't find a simpler way... ExchangeSwapBanked - lda #<(SWAPBUFFER + LoadSaveEnd - LoadSaveStart) + rts ;self-modified to LDA in DiversiDOS environment + !byte <(SWAPBUFFER + LoadSaveEnd - LoadSaveStart) sta ExchangeSwapSource1 + 1 sta ExchangeSwapTarget1 + 1 lda #((>SWAPBUFFER) - >((<(LoadSaveEnd - LoadSaveStart)) + 255)) @@ -808,7 +817,7 @@ WriteSize ;number of bytes ReadBuffer WriteBuffer - !word SWAPBUFFER ;buffer + !word LoadSaveStart ;buffer, self-modified in DiversiDOS ReadMLI_e jmp ExchangeSwapBanked