antoine-source/graforth/editor.s
Antoine Vignau 0498bcc0c9 Mass upload
of a couple of (working) disassemblies
2020-11-10 11:31:13 +01:00

1101 lines
11 KiB
ArmAsm

*
* GraForth - Editor
*
* (c) 1981, Paul Lutus
* (s) 2020, LoGo
*
xc
xc
mx %11
typ bin
org $9000
lst off
*----------------------------
VTAB EQU $FC22
RDCHAR EQU $FD35
COUT EQU $FDED
L6000 = $6000 ; return to Forth
L6006 = L6000+6 ; read line of chars
L8600 = $8600 ; buffer
L8800 = $8800 ; buffer
*----------------------------
L9000 LDA #$4C
LDA $03D2
CLC
ADC #$09
STA L9018+2
STA L901D+2
STA L9022+2
ADC #$03
STA L9052+2
LDA #$4C
L9018 STA $A6E1
LDA #<L9056
L901D STA $A6E2
LDA #>L9056
L9022 STA $A6E3
LDA L909D
STA $80
LDA L909D+1
STA $81
BIT L990C
BMI L909F
LDA #<L8800
STA L909D
STA $80
LDA #>L8800
STA L909D+1
STA $81
JSR L92A0
LDA #$FF
STA L990C
LDA #$23
JSR L9052
JMP L909F
L9052 STA $A923
RTS
L9056 JSR $03EA
LDA #$23
JSR L9052
LDY #$00
BIT L943E
BPL L906E
STY L943E
JSR L9257
JMP L90E1
L906E LDA L907F,Y
BEQ L9079
JSR COUT
INY
BNE L906E
L9079 JSR L6006
JMP L909F
L907F ASC 878D8D
ASC "Disk Error (Press Return) "00
L909D DA L8600 ; buffer
L909F JSR L98C3
JSR L97FA
JSR $03EA
JSR L97AD
JSR L97D7
LDY #$00
L90B0 LDA L90BB,Y
BEQ L90E1
JSR COUT
INY
BNE L90B0
L90BB ASC "GraFORTH ][ Editor (C) P. Lutus 1981"8D00
L90E1 LDA #$FF
STA $33
LDA #$80
STA $D9
STA $76
JSR L9656
LDA #$00
STA $10
LDA #$8D
JSR COUT
BIT L943E
BPL L9105
L90FC JSR L6006
JSR L9832
JMP L90FC
L9105 BIT $10
BPL L9111
JSR L96E6
LDA #$A0
JSR COUT
L9111 JSR L6006
LDA $0200
CMP #$8C
BEQ L9105
BIT $10
BMI L912A
CMP #$C1
BNE L912A
LDA #$FF
STA $10
JMP L9105
L912A CMP #$8D
BNE L9134
LDY #$00
STY $10
BEQ L9105
L9134 BIT $10
BMI L9140
CMP #$B0
BCC L9177
CMP #$BA
BCS L9177
L9140 BIT $10
BMI L9171
LDY #$00
JSR L9759
BIT $8F
BPL L9177
LDA $8A
STA $86
LDA $8B
STA $87
TYA
PHA
JSR L96A3
LDA $84
CMP $86
BNE L9169
LDA $85
CMP $87
BNE L9169
JSR L9688
L9169 PLA
TAX
JSR L9834
JMP L9105
L9171 JSR L9832
JMP L9105
L9177 CMP #$E0
BCC L917D
SBC #$20
L917D STA $8E
JSR L91A9
JMP L90E1
L9185 LDY #$00
L9187 LDA #$8D
JSR COUT
L918C LDA L91EB,Y
CMP #$84
BEQ L91A0
CMP #$00
BMI L919D
CMP #$01
BEQ L91A7
BNE L91A0
L919D JSR COUT
L91A0 INY
CMP #$A0
BEQ L9187
BNE L918C
L91A7 RTS
DB $00
L91A9 CMP #$BF
BNE L91B0
JMP L9185
L91B0 JSR L98C3
JSR L97FA
LDA $8E
LDX #$00
LDY #$00
L91BC LDA L91EB,Y
BEQ L91D0
CMP $8E
BEQ L91D5
INX
L91C6 LDA L91EB,Y
INY
CMP #$A0
BNE L91C6
BEQ L91BC
L91D0 LDA #$BF
JMP COUT
L91D5 TXA
ASL
TAX
LDA L923F,X
STA $8A
LDA L923F+1,X
STA $8B
JSR L91E8
JMP L9257
L91E8 JMP ($008A)
L91EB ASC "Save "
ASC "Get "
ASC "Insert "
ASC "Delete "
ASC "Program "
ASC "Memory "
ASC "List "
ASC "Write "
ASC "Erase "
ASC "Autonum "
ASC "Bye "
ASC 8400
ASC "ConTRoL-D=DOS "
HEX 01
L923F DA L9372
DA L93B1
DA L961A
DA L944F
DA L94CF
DA L9598
DA L95C9
DA L95C6
DA L9271
DA L9401
DA L94CC
DA L92BE
L9257 BIT L943E
BMI L9269
LDY #$00
L925E LDA L926A,Y
BEQ L9269
JSR COUT
INY
BNE L925E
L9269 RTS
L926A ASC 8D
ASC "Done"8D00
L9271 LDY #$00
L9273 LDA L928B,Y
BEQ L927E
JSR COUT
INY
BNE L9273
L927E JSR L6006
LDA $0200
CMP #$D9
BEQ L92A0
PLA
PLA
RTS
L928B ASC 8D
ASC "Erase File (Y/N) : "00
L92A0 LDA L909D
STA $80
LDA L909D+1
STA $81
LDA #$FF
STA $82
LDA #$8F
STA $83
LDA #$00
LDY #$01
STA ($80),Y
STA $8FFE
JMP L98C3
L92BE LDA #$02
STA $8E
L92C2 LDY #$00
L92C4 LDA L9303,Y
BEQ L92CF
JSR COUT
INY
BNE L92C4
L92CF JSR L6006
LDA $0200
CMP #$8D
BNE L92DE
DEC $8E
BNE L92C2
RTS
L92DE LDY #$00
L92E0 LDA $0200,Y
STA $0300,Y
INY
CMP #$8D
BNE L92E0
JSR COUT
LDA #$84
JSR COUT
LDY #$00
L92F5 LDA $0300,Y
JSR COUT
INY
CMP #$8D
BNE L92F5
JMP L92BE
L9303 ASC 8D
ASC "Enter DOS Command : "00
L9319 LDY #$00
L931B LDA L9364,Y
BEQ L9326
JSR COUT
INY
BNE L931B
L9326 LDA $24
PHA
LDY #$00
L932B LDA L990D,Y
CMP #$8D
BEQ L9338
JSR COUT
INY
BNE L932B
L9338 PLA
STA $24
JSR L6006
LDY #$00
LDA $0200
CMP #$8D
BNE L934A
PLA
PLA
RTS
L934A LDY #$FF
L934C INY
LDA $0200,Y
STA L990D,Y
CMP #$AF
BEQ L935C
CMP #$8D
BNE L934C
RTS
L935C PHA
LDA #$8D
STA L990D,Y
PLA
RTS
L9364 ASC "(Filename) : "00
L9372 LDY #$FF
STY $88
STY $89
INY
STY $86
STY $87
JSR L9319
CMP #$AF ; /
BNE L9388
INY
JSR L948F
L9388 JSR L93C8
JSR L965C
L938E JSR L9645
CMP #$00
BEQ L93A9
JSR L987B
LDA $84
SEC
SBC $88
STA $8E
LDA $85
SBC $89
ORA $8E
BEQ L938E
BCC L938E
L93A9 LDA #$00
JSR COUT
JMP L97AD
L93B1 LDA #$00
STA $86
STA $87
JSR L9319
CMP #$AF ; /
BNE L93C5
INY
JSR L948F
JSR L96A3
L93C5 JMP L9413
L93C8 LDA #$8D
STA $8E
LDY #$FF
L93CE INY
LDA L9402,Y
BEQ L93E7
CMP #$A0
BNE L93E1
JSR L93E8
LDA #$AC
STA $8E
BNE L93CE
L93E1 JSR COUT
JMP L93CE
L93E7 RTS
L93E8 TYA
PHA
LDY #$00
L93EC LDA L990D,Y
BEQ L93FF
CMP #$8D
BEQ L93FF
CMP $8E
BEQ L93FF
JSR COUT
INY
BNE L93EC
L93FF PLA
TAY
L9401 RTS
L9402 ASC 8D
ASC 84
ASC "OPEN "8D
ASC 84
ASC "WRITE "8D00
L9413 LDA #$8D
STA $8E
LDA #$22
JSR L9052
LDY #$FF
L941E INY
LDA L943F,Y
BEQ L9435
JSR COUT
CMP #$A0
BNE L941E
JSR L93E8
LDA #$AC
STA $8E
JMP L941E
L9435 LDA #$23
JSR L9052
DEC L943E
RTS
L943E HEX 00
L943F ASC 8D
ASC 84
ASC "OPEN "8D
ASC 84
ASC "READ "8D00
L944F JSR L948C
BIT $8E
BPL L9486
JSR L96A3
LDA $88
ORA $89
BNE L946B
LDA $84
CMP $86
BNE L9486
LDA $85
CMP $87
BNE L9486
L946B JSR L9688
CMP #$FF
BEQ L9486
JSR L987B
LDA $84
SEC
SBC $88
STA $8E
LDA $85
SBC $89
ORA $8E
BEQ L946B
BCC L946B
L9486 JSR L98C3
JMP L97FA
L948C JSR L9742
L948F LDA #$00
STA $8E
STA $86
STA $87
STA $88
STA $89
JSR L9722
BIT $8F
BPL L94AC
DEC $8E
LDA $8A
STA $86
LDA $8B
STA $87
L94AC LDA $0200,Y
CMP #$8D
BEQ L94CB
LDA #$FF
STA $88
STA $89
INY
JSR L9722
BIT $8F
BPL L94CB
DEC $8E
LDA $8A
STA $88
LDA $8B
STA $89
L94CB RTS
L94CC JMP L6000
L94CF LDY #$FF
STY $8E
JSR L9536
LDA $80
CLC
SBC L909D
STA $8A
LDA $81
SBC L909D+1
STA $8B
JSR L96EE
JSR L9536
CLC
LDA L909D
ADC #$01
STA $8A
LDA L909D+1
ADC #$00
STA $8B
JSR L96EE
JSR L9598
JSR L9536
JSR L6006
LDA $0200
CMP #$D9
BNE L9544
JSR L9536
JSR L6006
LDY #$00
JSR L9759
BIT $8F
BPL L9544
JSR L97DC
LDA $8A
STA L909D
STA $80
LDA $8B
STA L909D+1
STA $81
LDY #$01
LDA #$00
STA ($80),Y
JMP L98C3
L9536 LDY $8E
L9538 INY
LDA L9547,Y
BEQ L9544
JSR COUT
JMP L9538
L9544 STY $8E
RTS
L9547 ASC 8D8D
ASC "Program Length "00
ASC 8D
ASC "Position "00
ASC 8D
ASC "Change Position (Y/N) : "00
ASC 8D
ASC "Enter New Position : "00
L9598 LDY #$00
L959A LDA L95B8,Y
BEQ L95A5
JSR COUT
INY
BNE L959A
L95A5 LDA $82
SEC
SBC $80
STA $8A
LDA $83
SBC $81
STA $8B
JSR L96EE
LDA #$FF
RTS
L95B8 ASC 8D
ASC "Free Memory "00
L95C6 LDA #$00
DB $2C
L95C9 LDA #$FF
STA L9619
JSR L948C
BIT $8E
BMI L95DB
LDA #$FF
STA $88
STA $89
L95DB JSR L965C
L95DE LDA #$10
STA $8E
L95E2 LDY #$00
LDA ($8C),Y
BEQ L9604
INY
LDA ($8C),Y
BEQ L9604
JSR L9635
JSR L987B
LDA $84
SEC
SBC $88
STA $10
LDA $85
SBC $89
ORA $10
BEQ L9607
BCC L9607
L9604 JMP L9656
L9607 DEC $8E
BNE L95E2
BIT L9619
BPL L95DE
JSR RDCHAR
CMP #$83
BEQ L9604
BNE L95DE
L9619 DB $00
L961A LDA #$FF
STA $86
STA $87
JSR L9742
JSR L9759
BIT $8F
BPL L9632
LDA $8A
STA $86
LDA $8B
STA $87
L9632 JMP L96A3
L9635 JSR L96E6
LDY #$01
LDA ($8C),Y
CMP #$A0
BEQ L9645
LDA #$A0
JSR COUT
L9645 LDY #$00
JSR L98A1
LDA ($8C),Y
BEQ L9655
JSR COUT
CMP #$8D
BNE L9645
L9655 RTS
L9656 LDA #$FF
STA $86
STA $87
L965C LDA L909D
STA $8C
LDA L909D+1
STA $8D
JSR L9872
LDY #$00
L966B LDA $84
SEC
SBC $86
LDA $85
SBC $87
BCS L9687
L9676 JSR L98A1
LDA ($8C),Y
BEQ L9687
CMP #$8D
BNE L9676
JSR L987B
JMP L966B
L9687 RTS
L9688 LDY #$00
L968A JSR L989A
LDA ($82),Y
CMP #$FF
BEQ L969D
PHA
TYA
STA ($82),Y
PLA
CMP #$8D
BNE L968A
RTS
L969D JSR L98B1
LDA #$FF
RTS
L96A3 JSR L97DC
JSR L9872
L96A9 SEC
LDA $84
SBC $86
LDA $85
SBC $87
BCS L96C5
L96B4 JSR L96C6
CMP #$FF
BEQ L96C5
CMP #$8D
BNE L96B4
JSR L987B
JMP L96A9
L96C5 RTS
L96C6 JSR L989A
LDY #$00
LDA ($82),Y
CMP #$FF
BEQ L96DE
STA ($80),Y
JSR L9893
L96D6 PHA
TYA
STA ($80),Y
STA ($82),Y
PLA
RTS
L96DE JSR L98B1
LDA #$FF
JMP L96D6
L96E6 LDA $84
STA $8A
LDA $85
STA $8B
L96EE JSR L96FB
L96F1 LDA $02F0,Y
JSR COUT
DEY
BPL L96F1
RTS
L96FB LDY #$FF
L96FD INY
JSR L970D
EOR #$B0
STA $02F0,Y
LDA $8A
ORA $8B
BNE L96FD
RTS
L970D LDX #$10
LDA #$00
L9711 ASL $8A
ROL $8B
ROL
CMP #$0A
BCC L971E
SBC #$0A
INC $8A
L971E DEX
BNE L9711
RTS
L9722 LDA #$00
STA $8F
STA $8A
STA $8B
DEY
L972B INY
LDA $0200,Y
CMP #$A0
BEQ L972B
CMP #$B0
BCC L9741
CMP #$BA
BCS L9741
JSR L977E
JMP L972B
L9741 RTS
L9742 LDY #$FF
L9744 INY
LDA $0200,Y
CMP #$8D
BEQ L9758
CMP #$A0
BEQ L9758
CMP #$B0
BCC L9744
CMP #$BA
BCS L9744
L9758 RTS
L9759 LDA #$00
STA $8F
STA $8A
STA $8B
DEY
L9762 INY
LDA $0200,Y
CMP #$A0
BEQ L9762
DEY
L976B INY
LDA $0200,Y
CMP #$B0
BCC L977D
CMP #$BA
BCS L977D
JSR L977E
JMP L976B
L977D RTS
L977E DEC $8F
PHA
JSR L97A8
LDA $8B
PHA
LDA $8A
PHA
JSR L97A8
JSR L97A8
PLA
CLC
ADC $8A
STA $8A
PLA
ADC $8B
STA $8B
PLA
EOR #$B0
CLC
ADC $8A
STA $8A
BCC L97AC
INC $8B
RTS
L97A8 ASL $8A
ROL $8B
L97AC RTS
L97AD LDA $25
PHA
LDY #$00
L97B2 LDA L97C3,Y
BEQ L97BD
JSR COUT
INY
BNE L97B2
L97BD PLA
STA $25
JMP VTAB
L97C3 ASC 8D
ASC 84
ASC "CLOSE"8D
ASC 84
ASC "MAXFILES1"8D00
L97D7 LDA #$8C
JMP COUT
L97DC LDY #$00
JSR L98A8
L97E1 LDA ($80),Y
CMP #$FF
BNE L97ED
JSR L9893
JMP L9816
L97ED STA ($82),Y
TYA
BNE L97F6
DEC $83
DEC $81
L97F6 DEY
JMP L97E1
L97FA LDY #$00
JSR L989A
L97FF LDA ($82),Y
CMP #$FF
BNE L980B
JSR L98B1
JMP L9816
L980B STA ($80),Y
INY
BNE L97FF
INC $81
INC $83
BNE L97FF
L9816 TYA
CLC
ADC $80
STA $80
BCC L9820
INC $81
L9820 TYA
CLC
ADC $82
STA $82
BCC L982A
INC $83
L982A LDY #$00
TYA
STA ($80),Y
STA ($82),Y
RTS
L9832 LDX #$00
L9834 LDA $0200,X
JSR L9846
CMP #$FF
BEQ L9843
INX
CMP #$8D
BNE L9834
L9843 JMP L987B
L9846 LDY $81
CPY $83
BNE L9855
LDY $80
CPY $82
BNE L9855
JMP L9598
L9855 LDY #$00
CMP #$00
BEQ L9871
CMP #$FF
BEQ L9871
CMP #$8D
BEQ L9867
CMP #$A0
BCC L9871
L9867 STA ($80),Y
JSR L9893
PHA
TYA
STA ($80),Y
PLA
L9871 RTS
L9872 LDA #$0A
STA $84
LDA #$00
STA $85
RTS
L987B LDA $84
CLC
ADC #$0A
STA $84
BCC L9886
INC $85
L9886 RTS
LDA $84
SEC
SBC #$0A
STA $84
BCS L9892
DEC $85
L9892 RTS
L9893 INC $80
BNE L9899
INC $81
L9899 RTS
L989A INC $82
BNE L98A0
INC $83
L98A0 RTS
L98A1 INC $8C
BNE L98A7
INC $8D
L98A7 RTS
L98A8 LDA $80
BNE L98AE
DEC $81
L98AE DEC $80
RTS
L98B1 LDA $82
BNE L98B7
DEC $83
L98B7 DEC $82
RTS
LDA $8C
BNE L98C0
DEC $8D
L98C0 DEC $8C
RTS
L98C3 LDA L909D
STA $80
LDA L909D+1
STA $81
LDA #$FF
STA $82
LDA #$8F
STA $83
LDY #$00
LDA #$FF
STA ($80),Y
STA ($82),Y
L98DD LDA ($82),Y
BEQ L98EA
TYA
BNE L98E6
DEC $83
L98E6 DEY
JMP L98DD
L98EA TYA
CLC
ADC $82
STA $82
BCC L98F4
INC $83
L98F4 LDY #$00
L98F6 LDA ($80),Y
BEQ L9901
INY
BNE L98F6
INC $81
BNE L98F6
L9901 TYA
CLC
ADC $80
STA $80
BCC L990B
INC $81
L990B RTS
L990C DB $00
L990D ASC 8D
ASC " "
ASC " "