mirror of
https://github.com/a2-4am/4live.git
synced 2024-12-21 11:29:20 +00:00
refactor for smaller code, back under 2kb
This commit is contained in:
parent
e8002eb5f8
commit
282d890abd
116
src/4live.a
116
src/4live.a
@ -21,7 +21,6 @@
|
||||
!addr DOSBASE = $3D2
|
||||
!addr FILEMAN = $3D6
|
||||
!addr GETPARM = $3DC
|
||||
!addr RECONNECTDOS = $3EA
|
||||
!addr KBD = $C000
|
||||
!addr STROBE = $C010
|
||||
!addr LCBANK2 = $C083
|
||||
@ -92,6 +91,7 @@ LdrStart
|
||||
;set slot and drive in MLI request packet
|
||||
|
||||
jsr GETIOB
|
||||
pha ;save for later
|
||||
sty OPSRC1L
|
||||
sta OPSRC1H
|
||||
ldy #IOBDRIVE
|
||||
@ -243,8 +243,8 @@ GetKey
|
||||
lda ROMIN1
|
||||
|
||||
;lather, rinse, repeat
|
||||
jsr RDCHAR
|
||||
jmp GetKey
|
||||
jsr RDCHAR ;returns non-zero
|
||||
bne GetKey
|
||||
|
||||
ReadFile
|
||||
WriteFile
|
||||
@ -310,7 +310,7 @@ InstallStart
|
||||
!pseudopc INSTALLBUFFER {
|
||||
;check for DiversiDOS
|
||||
|
||||
jsr GETIOB
|
||||
pla
|
||||
eor #$BF
|
||||
bne + ;regular DOS
|
||||
sta ReadBuffer
|
||||
@ -327,24 +327,7 @@ InstallStart
|
||||
|
||||
;read second overlay to banked RAM
|
||||
|
||||
jsr ExchangeSwapBanked2
|
||||
lda #$20
|
||||
sta SwapFILEMAN
|
||||
jsr DOSMLI
|
||||
!byte InstallReadMLI_e - InstallReadMLI_b
|
||||
InstallReadMLI_b
|
||||
!byte CMDREAD
|
||||
!byte POSREADRANGE
|
||||
!word 0 ;record number
|
||||
!word BankedCopyStart - LdrHeader
|
||||
;offset
|
||||
!word BankedCopyEnd - BankedCopyStart
|
||||
;number of bytes
|
||||
InstallReadBuffer
|
||||
!word $D000 ;buffer
|
||||
InstallReadMLI_e
|
||||
|
||||
jsr ExchangeSwapBanked2
|
||||
jsr ReadEditor
|
||||
|
||||
;open source file and read it if available
|
||||
|
||||
@ -398,9 +381,27 @@ CharMap1
|
||||
sta KSWL
|
||||
lda #>GlobalKeyboardHook
|
||||
sta KSWH
|
||||
jsr RECONNECTDOS
|
||||
jmp WARMDOS
|
||||
|
||||
ReadEditor
|
||||
jsr ExchangeSwapBanked2
|
||||
lda #$20
|
||||
sta SwapFILEMAN
|
||||
jsr DOSMLI
|
||||
!byte InstallReadMLI_e - InstallReadMLI_b
|
||||
InstallReadMLI_b
|
||||
!byte CMDREAD
|
||||
!byte POSREADRANGE
|
||||
!word 0 ;record number
|
||||
!word BankedCopyStart - LdrHeader
|
||||
;offset
|
||||
!word BankedCopyEnd - BankedCopyStart
|
||||
;number of bytes
|
||||
InstallReadBuffer
|
||||
!word $D000 ;buffer
|
||||
InstallReadMLI_e
|
||||
;fall through to ExchangeBanked2
|
||||
|
||||
ExchangeSwapBanked2
|
||||
rts ;self-modified to LDA in DiversiDOS environment
|
||||
!byte ((>$D000) - >((<(BankedCopyEnd - BankedCopyStart)) + 255))
|
||||
@ -457,17 +458,8 @@ IsDirty
|
||||
rts
|
||||
|
||||
ScrollEditBufferIn
|
||||
lda #<LastLine
|
||||
sta OPSRC1L
|
||||
lda #>LastLine
|
||||
sta OPSRC1H
|
||||
lda #<(LastLine - WIDTH)
|
||||
sta OPDST1L
|
||||
lda #>(LastLine - WIDTH)
|
||||
sta OPDST1H
|
||||
|
||||
lda #HEIGHT
|
||||
sta SCROLLLINE
|
||||
ldy #(<(ScrollParms2 - ScrollParms1) - 1)
|
||||
jsr SetScrollLines
|
||||
|
||||
;copy last line on screen to temporary buffer
|
||||
-- ldy #(WIDTH - 1)
|
||||
@ -493,31 +485,21 @@ CharMap2
|
||||
bpl -
|
||||
|
||||
;animation delay
|
||||
jsr Delay ;returns carry set
|
||||
jsr Delay
|
||||
|
||||
lda #-WIDTH
|
||||
ldy #$FF
|
||||
jsr UpdateVirtualOff
|
||||
dec SCROLLLINE
|
||||
jsr UpdateVirtualOff ;returns zr/nz state of SCROLLLINE
|
||||
bne --
|
||||
rts
|
||||
|
||||
ScrollEditBufferOut
|
||||
lda #<FirstLine
|
||||
sta OPSRC1L
|
||||
lda #>FirstLine
|
||||
sta OPSRC1H
|
||||
lda #<(FirstLine + WIDTH)
|
||||
sta OPDST1L
|
||||
lda #>(FirstLine + WIDTH)
|
||||
sta OPDST1H
|
||||
|
||||
lda #HEIGHT
|
||||
sta SCROLLLINE
|
||||
ldy #((<(ScrollParms2 - ScrollParms1) * 2) - 1)
|
||||
jsr SetScrollLines
|
||||
|
||||
;copy first line on screen to temporary buffer
|
||||
-- ldy #(WIDTH - 1)
|
||||
- lda $0400, y ;self-modified
|
||||
- lda $0400, y
|
||||
sta (OPSRC1L), y
|
||||
dey
|
||||
bpl -
|
||||
@ -533,15 +515,31 @@ ScrollEditBufferOut
|
||||
bpl -
|
||||
|
||||
;animation delay
|
||||
jsr Delay ;returns carry set
|
||||
jsr Delay ;returns A=0
|
||||
|
||||
tay
|
||||
lda #WIDTH
|
||||
jsr UpdateVirtualOff
|
||||
dec SCROLLLINE
|
||||
jsr UpdateVirtualOff ;returns zr/nz state of SCROLLLINE
|
||||
bne --
|
||||
rts
|
||||
|
||||
SetScrollLines
|
||||
ldx #3
|
||||
- lda ScrollParms1, y
|
||||
sta OPSRC1L, x
|
||||
dey
|
||||
dex
|
||||
bpl -
|
||||
lda #HEIGHT
|
||||
sta SCROLLLINE
|
||||
rts
|
||||
|
||||
ScrollParms1
|
||||
!word LastLine, LastLine - WIDTH
|
||||
|
||||
ScrollParms2
|
||||
!word FirstLine, FirstLine + WIDTH
|
||||
|
||||
UpdateVirtualOff
|
||||
;set up copy addresses for next line
|
||||
|
||||
@ -557,6 +555,7 @@ UpdateVirtualOff
|
||||
dex
|
||||
dex
|
||||
bpl -
|
||||
dec SCROLLLINE
|
||||
rts
|
||||
|
||||
ScrollTextScreenDown
|
||||
@ -579,7 +578,7 @@ SetTextCalc
|
||||
rts
|
||||
|
||||
ScrollTextScreenUp
|
||||
ldx #1 - HEIGHT
|
||||
ldx #(1 - HEIGHT)
|
||||
- lda (TextCalcLo + HEIGHT - $101) +1, x
|
||||
sta OPSRC2L
|
||||
lda TextCalcLo + HEIGHT - $101, x
|
||||
@ -617,24 +616,23 @@ MyWAIT
|
||||
ClearScreen ; does not clear status line
|
||||
pha
|
||||
clc
|
||||
bcc +
|
||||
|
||||
HandleKeyImportScreen
|
||||
HandleKeyImportScreen ;called with carry set
|
||||
lda #<(LastLine - WIDTH)
|
||||
sta OPSRC1L
|
||||
lda #>(LastLine - WIDTH)
|
||||
sta OPSRC1H
|
||||
|
||||
+ ldx #(HEIGHT - 2)
|
||||
ldx #(HEIGHT - 2)
|
||||
-- jsr SetTextCalc
|
||||
ldy #(WIDTH - 1)
|
||||
lda #$A0
|
||||
- bcc +
|
||||
- bcc + ;ClearScreen path
|
||||
lda (OPSRC1L), y
|
||||
+ sta (OPSRC2L), y
|
||||
dey
|
||||
bpl -
|
||||
bcc +
|
||||
bcc + ;ClearScreen path
|
||||
sec
|
||||
lda OPSRC1L
|
||||
sbc #WIDTH
|
||||
@ -644,7 +642,7 @@ HandleKeyImportScreen
|
||||
sec
|
||||
+ dex
|
||||
bpl --
|
||||
bcc ClearScreenRet
|
||||
bcc ClearScreenRet ;ClearScreen path
|
||||
|
||||
;print anything that isn't a special key
|
||||
;wrap around screen position when we hit edges
|
||||
|
Loading…
Reference in New Issue
Block a user