From 453fef0e3add9224b5c853d0e31df80fe1d672df Mon Sep 17 00:00:00 2001 From: Michael Steil Date: Thu, 16 Oct 2008 06:53:45 +0000 Subject: [PATCH] cleanup --- apple_extra.s | 2 +- defines_apple.s | 2 +- defines_cbm.s | 4 +-- defines_kbd.s | 2 +- defines_kim.s | 2 +- defines_microtan.s | 4 +-- defines_osi.s | 2 +- error.s | 7 +++--- init.s | 58 +++++++++++++++++++++--------------------- memory.s | 4 +++ message.s | 63 ++++++++++++++++++++++++++-------------------- program.s | 4 +-- token.s | 2 +- 13 files changed, 85 insertions(+), 71 deletions(-) diff --git a/apple_extra.s b/apple_extra.s index d9e9287..7e41650 100644 --- a/apple_extra.s +++ b/apple_extra.s @@ -95,7 +95,7 @@ USR_FUNC: sta FAC+5 jmp (FAC+4) L29DA: - jmp (GOSTROUT) + jmp (GOAYINT) brk brk brk diff --git a/defines_apple.s b/defines_apple.s index 7b25eaa..29f3480 100644 --- a/defines_apple.s +++ b/defines_apple.s @@ -24,7 +24,7 @@ LOWTRX = LOWTR Z00 := $0000 L0001 := $000B GOWARM := $0003 -GOSTROUT := $0006 +GOAYINT := $0006 GOGIVEAYF := $0008 USR := $000A diff --git a/defines_cbm.s b/defines_cbm.s index 8177803..b1065b2 100644 --- a/defines_cbm.s +++ b/defines_cbm.s @@ -46,7 +46,7 @@ L0001 := $0001 L0002 := $0002 GOWARM := $0003 Z03 := $0003 ; same -GOSTROUT := $0006 +GOAYINT := $0006 GOGIVEAYF := $0008 Z15 := $0004 @@ -93,7 +93,7 @@ CPRMASK := $0063-82-5 Z14 := $0064-82-5 ; Ctrl+O flag Z17 := $0006 -GOSTROUT := $0006 +GOAYINT := $0006 Z18 := $0007 GOGIVEAYF := $0008 Z03 := $000E;3 ; same diff --git a/defines_kbd.s b/defines_kbd.s index daa27bd..2877c81 100644 --- a/defines_kbd.s +++ b/defines_kbd.s @@ -19,7 +19,7 @@ Z00 := $0700 L0001 := $0001 L0002 := $0002 GOWARM := $0003 -GOSTROUT := $0006 +GOAYINT := $0006 GOGIVEAYF := $0008 USR := $000A diff --git a/defines_kim.s b/defines_kim.s index 8ebb541..0b66b82 100644 --- a/defines_kim.s +++ b/defines_kim.s @@ -21,7 +21,7 @@ Z00 := $0000 L0001 := $0001 L0002 := $0002 GOWARM := $0003 -GOSTROUT := $0006 +GOAYINT := $0006 GOGIVEAYF := $0008 CHARAC := $000A diff --git a/defines_microtan.s b/defines_microtan.s index 9ead8eb..5035f21 100644 --- a/defines_microtan.s +++ b/defines_microtan.s @@ -27,7 +27,7 @@ Z00 := $0017 L0001 := $0001 L0002 := $0002 GOWARM := $001A -GOSTROUT := $001D +GOAYINT := $001D GOGIVEAYF := $001F CHARAC := $000A+$1A @@ -55,7 +55,7 @@ MONCOUT := $E216 STACK_TOP := $FE SPACE_FOR_GOSUB := $3E -NULL_MAX := $F0 ; probably different in original version; the image I have seems to be modified; see PDF +NULL_MAX := $F0 RAMSTART2 := $0400 diff --git a/defines_osi.s b/defines_osi.s index 8ea5484..70618e9 100644 --- a/defines_osi.s +++ b/defines_osi.s @@ -17,7 +17,7 @@ Z00 := $0000 L0001 := $0001 L0002 := $0002 GOWARM := $0003 -GOSTROUT := $0006 +GOAYINT := $0006 GOGIVEAYF := $0008 USR := $000A diff --git a/error.s b/error.s index 8b813b2..aa184e2 100644 --- a/error.s +++ b/error.s @@ -36,11 +36,12 @@ define_error ERR_ZERODIV, "DIVISION BY ZERO" define_error ERR_ILLDIR, "ILLEGAL DIRECT" define_error ERR_BADTYPE, "TYPE MISMATCH" define_error ERR_STRLONG, "STRING TOO LONG" -.ifdef CBM1 +.ifdef CONFIG_FILE + .ifdef CBM1 define_error ERR_BADDATA, "BAD DATA" -.endif -.ifdef CBM2 + .else define_error ERR_BADDATA, "FILE DATA" + .endif .endif define_error ERR_FRMCPX, "FORMULA TOO COMPLEX" define_error ERR_CANTCONT, "CAN'T CONTINUE" diff --git a/init.s b/init.s index ac74fd2..8dc5623 100644 --- a/init.s +++ b/init.s @@ -43,8 +43,8 @@ COLD_START2: sty GOWARM+2 lda #AYINT - sta GOSTROUT - sty GOSTROUT+1 + sta GOAYINT + sty GOAYINT+1 lda #GIVAYF sta GOGIVEAYF @@ -104,11 +104,11 @@ COLD_START2: .endif /* KBD */ .ifdef CONFIG_SMALL -.ifdef KBD + .ifdef KBD ldx #GENERIC_CHRGET_END-GENERIC_CHRGET+4 -.else + .else ldx #GENERIC_CHRGET_END-GENERIC_CHRGET -.endif + .endif .else ldx #GENERIC_CHRGET_END-GENERIC_CHRGET-1 ; XXX .endif @@ -124,31 +124,31 @@ L4098: .ifndef KBD txa sta SHIFTSIGNEXT -.ifdef CONFIG_CBM_ALL + .ifdef CONFIG_CBM_ALL sta Z03 -.endif + .endif sta LASTPT+1 -.if .defined(CONFIG_NULL) || .defined(CONFIG_PRINTNULLS) + .if .defined(CONFIG_NULL) || .defined(CONFIG_PRINTNULLS) sta Z15 -.endif -.ifndef CONFIG_11 + .endif + .ifndef CONFIG_11 sta POSX -.endif + .endif pha sta Z14 -.ifdef CBM2_KBD + .ifdef CBM2_KBD inx stx $01FD stx $01FC -.else - .ifndef MICROTAN + .else + .ifndef MICROTAN lda #$03 sta DSCLEN - .endif -.ifndef KIM_APPLE + .endif + .ifndef KIM_APPLE lda #$2C sta LINNUM+1 -.endif + .endif jsr CRDO .endif .ifdef APPLE @@ -162,11 +162,11 @@ L4098: lda #QT_MEMORY_SIZE jsr STROUT -.ifdef APPLE + .ifdef APPLE jsr INLINX -.else + .else jsr NXIN -.endif + .endif stx TXTPTR sty TXTPTR+1 jsr CHRGET @@ -217,13 +217,13 @@ L40DD: .ifdef CONFIG_CBM_ALL beq L40D7 .else -.ifdef CONFIG_SMALL + .ifdef CONFIG_SMALL beq L40D7 bne L40FA -.else + .else bne L40FA beq L40D7 -.endif + .endif L40EE: jsr CHRGOT jsr LINGET @@ -242,17 +242,17 @@ L40FA: .endif L4106: .ifndef CONFIG_CBM_ALL -.ifdef APPLE + .ifdef APPLE lda #$FF jmp L2829 .word STROUT ; PATCH! jsr NXIN -.else + .else lda #QT_TERMINAL_WIDTH jsr STROUT jsr NXIN -.endif + .endif stx TXTPTR sty TXTPTR+1 jsr CHRGET @@ -276,7 +276,7 @@ L4129: sta Z18 L4136: .endif -.ifdef KIM +.ifdef KIM /* RAM? */ lda #QT_WANT jsr STROUT @@ -360,9 +360,9 @@ L4192: ldy #>STROUT sta GOWARM+1 sty GOWARM+2 -.if CONFIG_SCRTCH_ORDER = 3 + .if CONFIG_SCRTCH_ORDER = 3 jsr SCRTCH -.endif + .endif lda #RESTART sta Z00+1 diff --git a/memory.s b/memory.s index 711b323..c5e25cd 100644 --- a/memory.s +++ b/memory.s @@ -1,3 +1,7 @@ +; generic stack and memory management code +; this code is identical across all versions of +; BASIC + .segment "CODE" ; ---------------------------------------------------------------------------- diff --git a/message.s b/message.s index 20c5085..44c237c 100644 --- a/message.s +++ b/message.s @@ -1,55 +1,64 @@ +; global messages: "error", "in", "ready", "break" + .segment "CODE" +CR=13 +LF=10 + QT_ERROR: .ifdef KBD .byte " err" .else -.ifdef APPLE + .ifdef APPLE .byte " ERR" .byte $07,$07 -.else + .else .byte " ERROR" + .endif .endif -.endif - .byte $00 + .byte 0 + .ifndef KBD QT_IN: .byte " IN " .byte $00 -QT_OK: -.ifdef APPLE - .byte $0D,$00,$00 - .byte "K" -.else - .byte $0D,$0A -.ifdef CONFIG_CBM_ALL - .byte "READY." -.else - .byte "OK" .endif -.endif - .byte $0D,$0A,$00 -.else + +.ifdef KBD .byte $54,$D2 ; ??? OKPRT: jsr LDE42 - .byte $0D,$0D - .byte ">>" - .byte $0D,$0A,$00 + .byte CR,CR,">>",CR,LF + .byte 0 rts nop +.else +QT_OK: + .ifdef CONFIG_CBM_ALL + .byte CR,LF,"READY.",CR,LF + .else + .ifdef APPLE + ; binary patch! + .byte CR,0,0,"K",CR,LF + .else + .byte CR,LF,"OK",CR,LF + .endif + .endif + .byte 0 .endif + QT_BREAK: + .ifdef KBD - .byte $0D,$0A - .byte " Brk" - .byte $00 + .byte CR,LF," Brk" + .byte 0 .byte $54,$D0 ; ??? .else - .byte $0D,$0A .ifdef MICROTAN - .byte " " + .byte CR,LF," BREAK" + .byte 0 +.else + .byte CR,LF,"BREAK" + .byte 0 .endif - .byte "BREAK" - .byte $00 .endif diff --git a/program.s b/program.s index caf4fb5..84979ca 100644 --- a/program.s +++ b/program.s @@ -12,7 +12,7 @@ MEMERR: ; ---------------------------------------------------------------------------- ERROR: lsr Z14 -.ifdef CONFIG_CBM_ALL +.ifdef CONFIG_FILE lda Z03 ; output beq LC366 ; is screen jsr CLRCH ; otherwise redirect output back to screen @@ -950,5 +950,5 @@ L25FD: lda TOKEN_NAME_TABLE,y bmi L25CA jsr OUTDO - bne L25FD + bne L25FD ; always diff --git a/token.s b/token.s index ed2b40b..afd6ee7 100644 --- a/token.s +++ b/token.s @@ -109,7 +109,7 @@ UNFNC: keyword_addr "SGN", SGN, TOKEN_SGN keyword_addr "INT", INT keyword_addr "ABS", ABS -.ifdef KBD +.ifdef CONFIG_NO_POKE keyword_addr "VER", VER .else .ifdef KIM