From ba62ca4ac42cd814de4c8080e31151f9350fe39a Mon Sep 17 00:00:00 2001 From: Dagen Brock Date: Tue, 22 Sep 2015 22:36:33 -0500 Subject: [PATCH] fix lots of poorly chosen and/or inconsistent names --- src/menu.s | 78 +++++++++++++++++++++++++++--------------------------- src/mmt.s | 63 +++++++++++++++++++++++++------------------ 2 files changed, 76 insertions(+), 65 deletions(-) diff --git a/src/menu.s b/src/menu.s index 37c610f..6d432e1 100644 --- a/src/menu.s +++ b/src/menu.s @@ -2,7 +2,7 @@ *** MENU LIBRARY sizeof_ItemStruct = #6 *MyItem hex 19,07 ;x,y positions -* db MenuOption_List ;type of input (see Menu_Types) +* db Menu_TypeList ;type of input (see Menu_Inputs) * db 11 ;max size in bytes * da MyItemOptions ;params definition & storage @@ -246,14 +246,14 @@ Menu_GetSelectedStructPtr lda #0 ** RETURN THE SCREEN WIDTH FOR VARIOUS INPUT TYPES * X= ItemType A= SizeInBytes Menu_GetItemScreenWidth - cpx MenuOption_Char + cpx Menu_TypeChar bne :notChar rts ;size already correct for char -:notChar cpx MenuOption_Hex +:notChar cpx Menu_TypeHex bne :notHex asl ;*2 for printing 2 char per byte rts -:notHex cpx MenuOption_Bin +:notHex cpx Menu_TypeBin bne :notBin asl ; logic for binary is a little more detailed asl ; because i add spacing for readability @@ -265,16 +265,16 @@ Menu_GetItemScreenWidth :bigger inc inc ; add 2 more spaces. rts -:notBin cpx MenuOption_Int +:notBin cpx Menu_TypeInt bne :notInt rts ;input width... internally maxint = FFFF -:notInt cpx MenuOption_Action +:notInt cpx Menu_TypeAction bne :notAction rts ;should be defined in param from string length -:notAction cpx MenuOption_List +:notAction cpx Menu_TypeList bne :notList rts ;should be defined in param from string length -:notList cpx MenuOption_Bool +:notList cpx Menu_TypeBool bne :notBool lda #3 ;@todo: we'll use "off"/"on" for now.. revisit? rts ;hmm.. undefined? @TODO!!! @@ -331,15 +331,15 @@ _menuSelectedX1 db 0 _menuSelectedY db 0 * THESE ARE ALL OF THE MENU INPUT TYPES -Menu_Types -Menu_TypeTable da Menu_TypeChar,Menu_TypeHex,Menu_TypeAction,Menu_TypeList,Menu_TypeBool,Menu_TypeBin,Menu_TypeInt -MenuOption_Char equ #0 -MenuOption_Hex equ #1 -MenuOption_Bin equ #5 -MenuOption_Int equ #6 -MenuOption_Action equ #2 -MenuOption_List equ #3 -MenuOption_Bool equ #4 +Menu_Inputs +Menu_InputTable da Menu_InputChar,Menu_InputHex,Menu_InputAction,Menu_InputList,Menu_InputBool,Menu_InputBin,Menu_InputInt +Menu_TypeChar equ #0 +Menu_TypeHex equ #1 +Menu_TypeBin equ #5 +Menu_TypeInt equ #6 +Menu_TypeAction equ #2 +Menu_TypeList equ #3 +Menu_TypeBool equ #4 * $0 = ptr->MenuDefs @@ -356,16 +356,16 @@ Menu_HandleSelection tay iny ;\ iny ; \ - lda ($F0),y ; > get MenuOption_Type, set up for jmp table + lda ($F0),y ; > get Menu_TypeType, set up for jmp table asl ; / tax ;/ pla - jmp (Menu_TypeTable,x) + jmp (Menu_InputTable,x) * A= struct index for all of these. -Menu_TypeChar rts -Menu_TypeBool tay +Menu_InputChar rts +Menu_InputBool tay iny ;skip x iny ;skip y iny ;skip length @@ -382,10 +382,10 @@ Menu_TypeBool tay rts -Menu_TypeBin rts -Menu_TypeInt rts +Menu_InputBin rts +Menu_InputInt rts -Menu_TypeHex pha +Menu_InputHex pha tay lda ($F0),y tax @@ -411,7 +411,7 @@ Menu_TypeHex pha jsr GetHex rts -Menu_TypeAction iny ;skip len byte +Menu_InputAction iny ;skip len byte iny lda ($F0),y sta :ACTION+1 @@ -439,7 +439,7 @@ Menu_TypeAction iny ;skip len byte * if up then prev item \_ draw menu options * if down then next item / * if enter, done - when it gets back to menu loop, we should handle special logic there -Menu_TypeList +Menu_InputList rts *** INPUT LIBRARY FOR MENU * Pass desired length in A @@ -588,27 +588,27 @@ BCDBIN16 clc adc BIN ;add 10's back to BIN sta BIN lda BCD - and #$0f00 ;get 100's + and #$0f00 ;get 100's xba - jsr TIMES10 - jsr TIMES10 + jsr TIMES10 + jsr TIMES10 clc - adc BIN - sta BIN - lda BCD - and #$f000 ;get 1000's + adc BIN + sta BIN + lda BCD + and #$f000 ;get 1000's xba lsr lsr lsr lsr - jsr TIMES10 - jsr TIMES10 - jsr TIMES10 + jsr TIMES10 + jsr TIMES10 + jsr TIMES10 clc - adc BIN - sta BIN - sep #$30 + adc BIN + sta BIN + sep #$30 RTS * 16-bit mode!!! diff --git a/src/mmt.s b/src/mmt.s index 58cb243..1704bf0 100644 --- a/src/mmt.s +++ b/src/mmt.s @@ -12,7 +12,8 @@ MLI equ $bf00 Init - jsr BINBCD16 + + jsr BINBCD16 sei ; disable interrupts LDA #$A0 ;USE A BLANK SPACE TO JSR $C300 ;TURN ON THE VIDEO FIRMWARE @@ -23,26 +24,35 @@ Init lda #MainMenuDefs ldx #>MainMenuDefs jsr Menu_InitMenu + +* Main loop begin Main :menuLoop jsr DrawMenuBackground jsr DrawRomMessage :menuNoDrawLoop jsr MenuCheckKeyColor bcc :menuNoDrawLoop ;hmm? -:keyHit cmp #$8D ; ENTER +:keyHit cmp #KEY_ENTER ;8D bne :check1 :enter jsr Menu_HandleSelection bra :menuLoop -:check1 cmp #$8B ; UP - bne :check2 - jsr Menu_PrevItem + +:check1 cmp #KEY_UPARROW ;8B + beq :prevItem + cmp #KEY_LTARROW ;88 + beq :prevItem + cmp #KEY_DNARROW ;8A + beq :nextItem + cmp #KEY_RTARROW ;95 + beq :nextItem +:unknownKey bra :menuLoop +:prevItem jsr Menu_PrevItem bra :menuNoDrawLoop -:check2 cmp #$8A ; DOWN - bne :noKey - jsr Menu_NextItem +:nextItem jsr Menu_NextItem bra :menuNoDrawLoop -:noKey bra :menuLoop -* LOOOOOOOOOP ^^^^^^ +* Main loop end ^^^ + + ColorizeMenu :loop @@ -642,68 +652,68 @@ TestIterations dw #$00 ; int MainMenuDefs :StartBank hex 19,05 ; x,y - db MenuOption_Hex ; 1=hex input + db Menu_TypeHex ; 1=hex input db 01 ; memory size (bytes) da TestStartBank ; variable storage :EndBank hex 22,05 ; x,y - db MenuOption_Hex ; 1=hex input + db Menu_TypeHex ; 1=hex input db 01 ; memory size (bytes) da EndBank ; variable storage :StartAddr hex 19,06 ; x,y - db MenuOption_Hex ; 1=hex input + db Menu_TypeHex ; 1=hex input db 02 ; memory size (bytes) da StartAddr ; variable storage :EndAddr hex 20,06 ; x,y - db MenuOption_Hex ; 1=hex input + db Menu_TypeHex ; 1=hex input db 02 ; memory size (bytes) da EndAddr ; variable storage :TestType hex 19,07 ; x,y - db MenuOption_List ; 3=list input + db Menu_TypeList ; 3=list input db 11 ; max len size (bytes), 3=option list da TestTypeTbl ; params definition & storage :TestSize hex 28,07 ; x,y - db MenuOption_List ; 3=list input + db Menu_TypeList ; 3=list input db 6 ; max len size (bytes), 3=option list da TestSizeTbl ; params definition & storage :HexPattern hex 19,08 ; x,y - db MenuOption_Hex ; 3=list input + db Menu_TypeHex ; 3=list input db 02 ; max len size (bytes), 3=option list <- can change when 8 bit?? da HexPattern ; params definition & storage :BinPattern hex 19,09 ; x,y - db MenuOption_Bin ; 5?=bin + db Menu_TypeBin ; 5?=bin db 02 ; max len size (bytes), 3=option list <- can change when 8 bit?? da HexPattern ; params definition & storage <- uses same space as above!! just different representation :Direction hex 12,0B - db MenuOption_List + db Menu_TypeList db 2 da TestDirectionTbl :Parallel hex 28,0B - db MenuOption_Bool + db Menu_TypeBool db 2 ; could be 8-bit or 16-bit bool da TestParallel :AdjacentWrite hex 12,0C ; x,y - db MenuOption_Bool ; 1=hex input + db Menu_TypeBool ; 1=hex input db 01 ; memory size (bytes) da TestAdjacentWrite ; variable storage :TestRefreshPause hex 28,0C ; x,y - db MenuOption_Int ; 1=hex input + db Menu_TypeInt ; 1=hex input db 01 ; memory size (bytes) da TestRefreshPause ; variable storage :ReadRepeat hex 12,0D ; x,y - db MenuOption_Int ; 1=hex input + db Menu_TypeInt ; 1=hex input db 03 ; display/entry width. ints are 16-bit internally da TestReadRepeat ; variable storage :WriteRepeat hex 28,0D ; x,y - db MenuOption_Int ; 1=hex input + db Menu_TypeInt ; 1=hex input db 03 ; display/entry width. ints are 16-bit internally da TestWriteRepeat ; variable storage :TestIterations hex 12,0E ; x,y - db MenuOption_Int ; 1=hex input + db Menu_TypeInt ; 1=hex input db 03 ; display/entry width. ints are 16-bit internally da TestIterations ; variable storage :BeginTest hex 1C,0F ; x,y - db MenuOption_Action ; 2=action + db Menu_TypeAction ; 2=action db MenuStr_BeginTestL ; menu string length da MenuStr_BeginTest ; string storage MainMenuLen equ *-MainMenuDefs @@ -788,3 +798,4 @@ BorderColor db 0 ds \ _stash ds 255 ds \ +