Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mist64 committed Oct 16, 2008
1 parent 1cb253d commit 166063e
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 50 deletions.
1 change: 0 additions & 1 deletion TODO.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
* use linker magic to compile files separately
* convert messy init code into completely different
files without ifdefs (not much in common!)
* move all machine specific code into separate files
Expand Down
2 changes: 2 additions & 0 deletions defines_cbm.s
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ CBM2_APPLE := 1
CBM2_KIM_APPLE := 1 ; OUTDO difference
CBM_APPLE := 1
CONFIG_DATAFLAG := 1
CONFIG_EASTER_EGG := 1
; CONFIG_SMALL := 1 ; test :-)
; INPUTBUFFER > $0100
.endif

Expand Down
3 changes: 3 additions & 0 deletions defines_kbd.s
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Z14 := $000F;64 ; Ctrl+O flag

JMPADRS := $0093;A1
LOWTRX := $0094;AA ; $AB also EXPSGN?
Z96 := $0096

L06FE := $06FE

L0207 := $0207
L020A := $020A
Expand Down
2 changes: 1 addition & 1 deletion float.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FSUBT:
; ----------------------------------------------------------------------------
; Commodore BASIC V2 Easter Egg
; ----------------------------------------------------------------------------
.ifdef CBM2
.ifdef CONFIG_EASTER_EGG
EASTER_EGG:
lda $11
cmp #<6502
Expand Down
2 changes: 1 addition & 1 deletion input.s
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ LCB0C:

NXIN:
.ifdef KBD
jsr LFDDA
jsr INLIN
bmi RTS20
pla
jmp LE86C
Expand Down
10 changes: 5 additions & 5 deletions kbd_extra.s
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@
OUTQUESSP:
jsr OUTQUES
jmp OUTSP
LFDDA:
INLIN:
ldy #$FF
LFDDC:
iny
LFDDD:
jsr LF43B
cmp #$03
jsr GETLN
cmp #$03 ; CTRL+C
beq LFDF7
cmp #$20
bcs LFDEC
bcs LFDEC ; no control char
sbc #$09
bne LFDDD
LFDEC:
sta INPUTBUFFER,y
tax
bne LFDDC
jsr LE882
jsr CRDO2
ldy #$06
LFDF7:
tax
Expand Down
2 changes: 1 addition & 1 deletion misc1.s
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ L2963:
lda (DSCPTR),y
sta (FORPNT),y
rts
.ifdef CONFIG_CBM_ALL
.ifdef CONFIG_FILE
PRINTH:
jsr CMD
jmp LCAD6
Expand Down
2 changes: 1 addition & 1 deletion misc3.s
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LF43A:
rts

; ----------------------------------------------------------------------------
LF43B:
GETLN:
ldx #$5D
LF43D:
txa
Expand Down
2 changes: 1 addition & 1 deletion poke.s
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ WAIT:
stx FORPNT
ldx #$00
jsr CHRGOT
.ifdef CBM2
.ifdef CONFIG_EASTER_EGG
beq EASTER_EGG
.else
beq L3628
Expand Down
4 changes: 2 additions & 2 deletions print.s
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ L29B9:
ldx #LINNUM+1
.endif
.ifdef MICROTAN
bne LE882
bne CRDO2
.endif
.endif
.ifdef CONFIG_FILE
Expand All @@ -109,7 +109,7 @@ LC9D8:
sta POSX
.endif
jsr OUTDO
LE882:
CRDO2:
lda #CRLF_2
jsr OUTDO

Expand Down
76 changes: 39 additions & 37 deletions program.s
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ RESTART:
L2351X:
jsr OKPRT
L2351:
jsr LFDDA
jsr INLIN
LE28E:
bpl RESTART
.else
Expand All @@ -85,6 +85,9 @@ L2351:
sty TXTPTR+1
jsr CHRGET
.ifdef CONFIG_11
; bug in pre-1.1: CHRGET sets Z on '\0'
; and ':' - a line starting with ':' in
; direct mode gets ignored
tax
.endif
.ifdef KBD
Expand All @@ -109,42 +112,42 @@ NUMBERED_LINE:
jsr FNDLIN2
lda JMPADRS+1
sta LOWTR
sta $96
sta Z96
lda JMPADRS+2
sta LOWTR+1
sta $97
lda $13
sta $06FE
lda $14
sta $06FF
inc $13
sta Z96+1
lda LINNUM
sta L06FE
lda LINNUM+1
sta L06FE+1
inc LINNUM
bne LE2D2
inc $14
inc LINNUM+1
bne LE2D2
jmp SYNERR
LE2D2:
jsr LF457
ldx #$96
jsr LE4D4
ldx #Z96
jsr CMPJMPADRS
bcs LE2FD
LE2DC:
ldx #$00
lda (JMPADRS+1,x)
sta ($96,x)
sta (Z96,x)
inc JMPADRS+1
bne LE2E8
inc JMPADRS+2
LE2E8:
inc $96
inc Z96
bne LE2EE
inc $97
inc Z96+1
LE2EE:
ldx #$2B
jsr LE4D4
ldx #VARTAB
jsr CMPJMPADRS
bne LE2DC
lda $96
lda Z96
sta VARTAB
lda $97
lda Z96+1
sta VARTAB+1
LE2FD:
jsr SETPTRS
Expand Down Expand Up @@ -356,8 +359,9 @@ L2423:
; ----------------------------------------------------------------------------
; READ A LINE, AND STRIP OFF SIGN BITS
; ----------------------------------------------------------------------------
.ifndef KBD
INLIN:
.ifdef APPLE
.ifdef APPLE
ldx #$DD
INLIN1:
stx $33
Expand All @@ -371,11 +375,8 @@ L0C32:
ldx #<INPUTBUFFER-1
ldy #>INPUTBUFFER-1
rts
.endif


.endif

.ifndef KBD
.ifndef APPLE
ldx #$00
INLIN2:
Expand All @@ -389,26 +390,26 @@ INLIN2:
.ifndef CONFIG_NO_LINE_EDITING
cmp #$20 ; line editing
bcc INLIN2
.ifdef MICROTAN
.ifdef MICROTAN
cmp #$80
.else
.else
cmp #$7D
.endif
.endif
bcs INLIN2
cmp #$40 ; @
beq L2423
.ifdef MICROTAN
.ifdef MICROTAN
cmp #$7F ; _
.else
.else
cmp #$5F ; _
.endif
.endif
beq L2420
L2443:
.ifdef MICROTAN
.ifdef MICROTAN
cpx #$4F
.else
.else
cpx #$47
.endif
.endif
bcs L244C
.endif
sta INPUTBUFFER,x
Expand Down Expand Up @@ -631,8 +632,8 @@ LE444:
LE461:
jmp SYNERR
LE464:
stx $13
stx $14
stx LINNUM
stx LINNUM+1
.else
lda TXTTAB
ldx TXTTAB+1
Expand Down Expand Up @@ -784,11 +785,12 @@ LE4C4:
adc #$08
sta $0504
rts
LE4D4:
lda $01,x

CMPJMPADRS:
lda 1,x
cmp JMPADRS+2
bne LE4DE
lda $00,x
lda 0,x
cmp JMPADRS+1
LE4DE:
rts
Expand Down

0 comments on commit 166063e

Please sign in to comment.