From: Greg King Date: Fri, 26 Jul 2013 07:33:54 +0000 (-0400) Subject: Replaced number literals in source code with meaningful symbol names. X-Git-Tag: V2.15~247^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f02843f05d3478b8ef13b4cac90205dec4f204f3;p=cc65 Replaced number literals in source code with meaningful symbol names. --- diff --git a/asminc/atmos.inc b/asminc/atmos.inc index ea6669243..20bb806f1 100644 --- a/asminc/atmos.inc +++ b/asminc/atmos.inc @@ -7,6 +7,11 @@ ; --------------------------------------------------------------------------- ; Constants +SCREEN_XSIZE = 40 ; screen columns +SCREEN_YSIZE = 28 ; screen rows + +FUNCTKEY = $A5 + FNAME_LEN = 16 ; maximum length of file-name @@ -19,14 +24,22 @@ BASIC_BUF := $35 ; --------------------------------------------------------------------------- ; Low memory +MODEKEY := $0209 CAPSLOCK := $020C PATTERN := $0213 IRQVec := $0245 +JOINFLAG := $025A ; 0 = don't joiu, $4A = join BASIC programs +VERIFYFLAG := $025B ; 0 = load, 1 = verify CURS_Y := $0268 CURS_X := $0269 STATUS := $026A TIMER3 := $0276 +CFILE_NAME := $027F CFOUND_NAME := $0293 +FILESTART := $02A9 +FILEEND := $02AB +AUTORUN := $02AD ; $00 = only load, $C7 = autorun +LANGFLAG := $02AE ; $00 = BASIC, $80 = machine code KEYBUF := $02DF PARAM1 := $02E1 ; & $02E2 PARAM2 := $02E3 ; & $02E4 diff --git a/libsrc/atmos/_scrsize.s b/libsrc/atmos/_scrsize.s index 2dd58399d..7a7af33ee 100644 --- a/libsrc/atmos/_scrsize.s +++ b/libsrc/atmos/_scrsize.s @@ -1,15 +1,17 @@ ; -; Ullrich von Bassewitz, 2003-04-13 +; 2003-04-13, Ullrich von Bassewitz +; 2013-07-16, Greg King ; ; Screen size variables ; .export screensize + .include "atmos.inc" .proc screensize - ldx #40 - ldy #28 + ldx #SCREEN_XSIZE + ldy #SCREEN_YSIZE rts .endproc diff --git a/libsrc/atmos/atmos_load.s b/libsrc/atmos/atmos_load.s index 9e86373f3..b5bec3225 100644 --- a/libsrc/atmos/atmos_load.s +++ b/libsrc/atmos/atmos_load.s @@ -1,20 +1,24 @@ -; Stefan Haubenthal, 2012-05-06 -; based on code by Twilighte +; Based on code by Twilighte. +; 2012-05-06, Stefan Haubenthal +; 2013-07-22, Greg King +; ; void __fastcall__ atmos_load(const char* name); .export _atmos_load .import store_filename + .include "atmos.inc" + .proc _atmos_load sei jsr store_filename ldx #$00 - stx $02ad - stx $02ae - stx $025a - stx $025b + stx AUTORUN ; don't try to run the file + stx LANGFLAG ; BASIC + stx JOINFLAG ; don't join it to another BASIC program + stx VERIFYFLAG ; load the file jsr cload_bit cli rts diff --git a/libsrc/atmos/atmos_save.s b/libsrc/atmos/atmos_save.s index 0bd9e29cc..3d221f6fa 100644 --- a/libsrc/atmos/atmos_save.s +++ b/libsrc/atmos/atmos_save.s @@ -1,23 +1,27 @@ -; Stefan Haubenthal, 2012-05-06 -; based on code by Twilighte +; Based on code by Twilighte. +; 2012-05-06, Stefan Haubenthal +; 2013-07-22, Greg King +; ; void __fastcall__ atmos_save(const char* name, const void* start, const void* end); .export _atmos_save .import popax, store_filename + .include "atmos.inc" + .proc _atmos_save sei - sta $02ab ; file end lo - stx $02ac ; file end hi + sta FILEEND + stx FILEEND+1 jsr popax - sta $02a9 ; file start lo - stx $02aa ; file start hi + sta FILESTART + stx FILESTART+1 jsr popax jsr store_filename lda #00 - sta $02ad + sta AUTORUN jsr csave_bit cli rts diff --git a/libsrc/atmos/cgetc.s b/libsrc/atmos/cgetc.s index 38e7aa873..e13d143d2 100644 --- a/libsrc/atmos/cgetc.s +++ b/libsrc/atmos/cgetc.s @@ -1,5 +1,6 @@ ; -; Ullrich von Bassewitz, 2003-04-13 +; 2003-04-13, Ullrich von Bassewitz +; 2013-07-26, Greg King ; ; char cgetc (void); ; @@ -11,7 +12,6 @@ .include "atmos.inc" - ; ------------------------------------------------------------------------ ; @@ -41,8 +41,8 @@ @L2: and #$7F ; Mask out avail flag sta KEYBUF - ldy $209 - cpy #$A5 + ldy MODEKEY + cpy #FUNCTKEY bne @L3 ora #$80 ; FUNCT pressed diff --git a/libsrc/atmos/clrscr.s b/libsrc/atmos/clrscr.s index 9dce665e9..2230d6e0a 100644 --- a/libsrc/atmos/clrscr.s +++ b/libsrc/atmos/clrscr.s @@ -1,5 +1,6 @@ ; -; Ullrich von Bassewitz, 2003-04-13 +; 2003-04-13, Ullrich von Bassewitz +; 2013-07-16, Greg King ; .export _clrscr @@ -27,7 +28,7 @@ ; Clear full pages. Y is still zero - ldx #>(28*40) + ldx #>(SCREEN_YSIZE * SCREEN_XSIZE) lda #' ' @L1: sta (ptr2),y iny ; Bump low byte of address @@ -40,7 +41,7 @@ @L2: sta (ptr2),y iny - cpy #<(28*40) + cpy #<(SCREEN_YSIZE * SCREEN_XSIZE) bne @L2 rts diff --git a/libsrc/atmos/cputc.s b/libsrc/atmos/cputc.s index 9f65be500..a0ef14b70 100644 --- a/libsrc/atmos/cputc.s +++ b/libsrc/atmos/cputc.s @@ -1,5 +1,6 @@ ; -; Ullrich von Bassewitz, 2003-04-13 +; 2003-04-13, Ullrich von Bassewitz +; 2013-07-16, Greg King ; ; void cputcxy (unsigned char x, unsigned char y, char c); ; void cputc (char c); @@ -41,7 +42,7 @@ output: advance: iny - cpy #40 + cpy #SCREEN_XSIZE bne L3 inc CURS_Y ; new line ldy #0 ; + cr @@ -85,12 +86,12 @@ L3: sty CURS_X .rodata ScrTabLo: - .repeat 28, Line - .byte <(SCREEN + Line * 40) + .repeat SCREEN_YSIZE, Line + .byte <(SCREEN + Line * SCREEN_XSIZE) .endrep ScrTabHi: - .repeat 28, Line - .byte >(SCREEN + Line * 40) + .repeat SCREEN_YSIZE, Line + .byte >(SCREEN + Line * SCREEN_XSIZE) .endrep diff --git a/libsrc/atmos/store_filename.s b/libsrc/atmos/store_filename.s index cb6d8b933..41d1837f1 100644 --- a/libsrc/atmos/store_filename.s +++ b/libsrc/atmos/store_filename.s @@ -1,12 +1,16 @@ +; Helper function + .export store_filename .importzp ptr1 + .include "atmos.inc" + store_filename: sta ptr1 stx ptr1+1 - ldy #$0f ;store filename + ldy #FNAME_LEN - 1 ; store filename : lda (ptr1),y - sta $027f,y + sta CFILE_NAME,y dey bpl :- rts diff --git a/libsrc/atmos/tgi/atmos-240-200-2.s b/libsrc/atmos/tgi/atmos-240-200-2.s index b5e0463d7..762c7c02d 100644 --- a/libsrc/atmos/tgi/atmos-240-200-2.s +++ b/libsrc/atmos/tgi/atmos-240-200-2.s @@ -2,7 +2,7 @@ ; Graphics driver for the 240x200x2 monochrome mode on the Atmos ; ; Stefan Haubenthal -; 2013-07-15, Greg King +; 2013-07-16, Greg King ; .include "zeropage.inc" @@ -158,7 +158,7 @@ GETERROR: ; CONTROL: - sta $213 + sta PATTERN lda #TGI_ERR_OK sta ERROR rts