diff --git a/src/applerom.s b/src/applerom.s index d27dda9..b44a419 100644 --- a/src/applerom.s +++ b/src/applerom.s @@ -59,3 +59,15 @@ VTABZ equ $FC24 ; Sets the cursor vertical position (0) VLINE equ $F828 ; Draws a vertical line of low-resolution blocks GSROM equ $FB59 ; should be int number of rom rev on Apple IIgs + + + +* KEY EQUATES +KEY_UPARROW = $8B +KEY_DNARROW = $8A +KEY_RTARROW = $95 +KEY_LTARROW = $88 +KEY_ENTER = $8D +KEY_ESC = $9B +KEY_TAB = $89 +KEY_DEL = $FF diff --git a/src/menu.s b/src/menu.s index ebbb002..2060249 100644 --- a/src/menu.s +++ b/src/menu.s @@ -861,3 +861,4 @@ BINBCDVARDUMP rts + diff --git a/src/mmt.s b/src/mmt.s index eacf880..dc1e1fb 100644 --- a/src/mmt.s +++ b/src/mmt.s @@ -28,11 +28,7 @@ Init sei ; disable inte lda #MainMenuDefs ldx #>MainMenuDefs jsr Menu_InitMenu - ldx #Number - ldy #>Number - jsr PrintInt -Me jmp Me -Number dw #1234 + * * Main Menu loop begin * @@ -41,6 +37,9 @@ Main jsr DrawRomMessage jsr DrawRamMessages + jsr LogWelcomeMessage + jsr LogRamMessages + :menuDrawOptionsLoop jsr MenuUpdateWordSize ;always update this before draw in case of change lda #MainMenuDefs ldy #>MainMenuDefs @@ -100,89 +99,31 @@ DrawRamMessages bra :drawExpansionMessage :rom0or1 PRINTXY #55;#07;Mesg_InternalRam256 :drawExpansionMessage PRINTXY #55;#08;Mesg_ExpansionRam - lda BankExpansionRam ;number of banks - clc - xce - rep #$30 - mx %00 - and #$00FF ;clear artifacts? can't remember state of B - asl ;*2 - asl ;*4 - asl ;*8 - asl ;*16 - asl ;*32 - asl ;*64 - sta _stash - sep #$30 - ldx _stash - ldy _stash+1 - jsr BINtoBCD - phx - tya - jsr PRBYTE - pla - jsr PRBYTE + ldx #BankExpansionRamKB + ldy #>BankExpansionRamKB + jsr PrintInt lda #"K" jsr COUT rts -LOG MAC - lda #]1 - ldy #>]1 - jsr ConsoleLog - <<< - -_consoleBottom = #23 -* Write out to console window -ConsoleLog pha - phy - jsr WinConsole - lda #0 ;settings to bottom-left of window - sta $24 - lda #_consoleBottom-1 - sta $25 - jsr VTAB - lda #$8D ;pre-fix CR - jsr COUT - ply - pla - jsr PrintString +LogWelcomeMessage jsr WinConsole + LOG Mesg_Welcome jsr WinFull rts -* Set console windowing -WinConsole lda #3 - sta $20 ;left edge - lda #75 - sta $21 ;width - lda #17 - sta $22 ;top edge - lda #_consoleBottom - sta $23 ;bottom edge +LogRamMessages jsr WinConsole + LOG Mesg_DetectedBanks + + lda BankExpansionLowest + jsr PRBYTE + lda #Mesg_ToBank + ldy #>Mesg_ToBank + jsr PrintString + lda BankExpansionHighest + jsr PRBYTE + jsr WinFull rts -* Set info windowing -WinInfo lda #52 - sta $20 ;left edge - lda #26 - sta $21 ;width - lda #5 - sta $22 ;top edge - lda #16 - sta $23 ;bottom edge - rts - -* Restore full screen windowing -WinFull stz $20 - stz $22 - lda #80 - sta $21 - lda #24 - sta $23 - rts - - - @@ -386,6 +327,7 @@ _testIteration ds 8 _errorCounter ds 8 UpdateScanInterval equ #$1000 +Mesg_Welcome asc "Welcome to Mini Memory Tester v0.3 by Dagen Brock",$8D,00 Mesg_InternalRam256 asc "Built-In RAM 256K",00 Mesg_InternalRam1024 asc "Built-In RAM 1024K",00 Mesg_ExpansionRam asc "Expansion RAM ",00 @@ -399,36 +341,21 @@ Mesg_Reading asc "Reading: ",00 Mesg_Errors asc " Errors: ",$00 Mesg_TestPass asc " Pass: ",00 Mesg_Blank asc " ",00 +Mesg_DetectedBanks asc "Setting default start/end banks to detected memory expansion: $",00 +Mesg_ToBank asc " to $",00 Mesg_ConsoleTop asc $1B,'ZLLLLLLLLLLLLLLL',$18,' Console Log ',$1B,'LLLLLLLLLLLLLLLLL_',$18,$8D,00 Mesg_ConsoleMid asc $1B,'Z'," ",'_',$18,$8D,00 Mesg_ConsoleBot asc $1B,'Z',"_____________________________________________",'_',$18,$8D,00 -* x, y, a=height -PrintConsole stx _prbox_x - sta _prbox_height - jsr GoXY - lda #Mesg_ConsoleTop - ldy #>Mesg_ConsoleTop - jsr PrintString -:midloop ldx _prbox_x - stx $24 - lda #Mesg_ConsoleMid - ldy #>Mesg_ConsoleMid - jsr PrintString - dec _prbox_height - bne :midloop - - ldx _prbox_x - stx $24 - lda #Mesg_ConsoleBot - ldy #>Mesg_ConsoleBot - jsr PrintString - rts -_prbox_x db 0 -_prbox_height db 0 - +* Error message strings +Mesg_E1 asc "Bad Read - Pass ",00 +Mesg_E2 asc " Location: ",00 +Mesg_E3 asc "Wrote: $",00 +Mesg_E4 asc " ",$1B,'SU',$18," Read: $",00 +Mesg_Arrow asc $1B,'SU',$18,00 + mx %10 ;i think? * called with short M, long X PrintTestError @@ -456,7 +383,6 @@ PrintTestError jsr PRNTAX lda #$8D jsr COUT - jsr WinFull LOG Mesg_E3 lda _stash+1 jsr PRBYTE @@ -475,15 +401,11 @@ PrintTestError jsr COUT lda _stash jsr PRBIN + jsr WinFull clc xce rep $10 rts -Mesg_E1 asc "Bad Read - Pass ",00 -Mesg_E2 asc " Location: ",00 -Mesg_E3 asc "Wrote: $",00 -Mesg_E4 asc " ",$1B,'SU',$18," Read: $",00 -Mesg_Arrow asc $1B,'SU',$18,00 *Mesg_Error0 asc "Error: Bad Read Pass 0000 Location: 00/1234" *Mesg_Error0 asc "Wrote: $00 %12345678 Read: $00 %12345678" @@ -902,43 +824,43 @@ DetectRam inx bra :highloop -:done bra :findKB +:done bra :findKB :notused lda #BankNoRAM sta BankMap,x bra :continue :findKB - lda BankExpansionRam ;number of banks - clc - xce - rep #$30 - mx %00 - and #$00FF ;clear artifacts? can't remember state of B - asl ;*2 - asl ;*4 - asl ;*8 - asl ;*16 - asl ;*32 - asl ;*64 - sta BankExpansionRamKB + lda BankExpansionRam ;number of banks + clc + xce + rep #$30 + mx %00 + and #$00FF ;clear artifacts? can't remember state of B + asl ;*2 + asl ;*4 + asl ;*8 + asl ;*16 + asl ;*32 + asl ;*64 + sta BankExpansionRamKB - lda GSROM ;now check (hardcode really) build-in ram - cmp #3 - bne :notrom3 -:rom3 lda #1024 - sta BankBuiltInRamKB - rts -:notrom3 lda #256K - sta BankBuiltInRamKB - sep #$30 + lda GSROM ;now check (hardcode really) build-in ram + cmp #3 + bne :notrom3 +:rom3 lda #1024 + sta BankBuiltInRamKB + rts +:notrom3 lda #256 + sta BankBuiltInRamKB + sep #$30 - rts + rts -BankExpansionRamKB ds 2 -BankBuiltInRamKB ds 2 +BankExpansionRamKB ds 2 +BankBuiltInRamKB ds 2 BankExpansionRam ds 1 BankExpansionLowest ds 1 BankExpansionHighest ds 1 @@ -970,6 +892,9 @@ PrintInt jsr PRBYTE rts + + + MLI equ $bf00 Quit jsr MLI ; first actual command, call ProDOS vector @@ -990,3 +915,4 @@ Error brk $00 ; shouldn't be put misc put strings.s put menu.s + diff --git a/src/mt.s b/src/mt.s index 3f7248b..2e96276 100644 --- a/src/mt.s +++ b/src/mt.s @@ -12,6 +12,7 @@ MLI equ $bf00 Init + sei ; disable interrupts LDA #$A0 ;USE A BLANK SPACE TO JSR $C300 ;TURN ON THE VIDEO FIRMWARE @@ -43,6 +44,63 @@ Main :noKey bra :menuLoop * LOOOOOOOOOP ^^^^^^ +ColorizeMenu +:loop + lda #$07 + jsr WaitSCB + lda #$c0 ; green + sta $c022 + + lda #$09 + jsr WaitSCB + lda #$d0 ; yello + sta $c022 + + lda #$0A + jsr WaitSCB + lda #$90 ; orange + sta $c022 + + + lda #$0B + jsr WaitSCB + lda #$10 ; red + sta $c022 + + lda #$0C + jsr WaitSCB + lda #$30 ; purple + sta $c022 + + lda #$0D + jsr WaitSCB + lda #$60 ; bblue + sta $c022 + + lda #$0E + jsr WaitSCB + lda #$f0 ; white + sta $c022 + bra :loop + rts + +WaitSCB + sta :val+1 + ldx #2 ; to check twice +:waitloop lda $c02f + asl + lda $c02e + rol +:val cmp #$00 + bne :waitloop + dex + bne :waitloop + ; the problem is we can get the LAST + ; horizcnt even/odd right as it changes + ; and start early or something? + + rts +MAXSCB db 0 DrawMenuBackground jsr HOME lda #MainMenuStrs @@ -542,19 +600,23 @@ MainMenuDefs db MenuOption_Hex ; 1=hex input db 02 ; memory size (bytes) da EndAddr ; variable storage -:TestType hex 13,0C ; x,y +:TestSize hex 13,0C ; x,y + db MenuOption_List ; 3=list input + db 08 ; max len size (bytes), 3=option list + da TestSize ; params definition & storage +:TestType hex 13,0D ; x,y db MenuOption_List ; 3=list input db 08 ; max len size (bytes), 3=option list da TestType ; params definition & storage -:TestValue hex 13,0D ; x,y +:TestValue hex 13,0E ; x,y db MenuOption_Hex ; 1=hex input db 01 ; memory size (bytes) da TestValue ; variable storage -:TestDelay hex 13,0E ; x,y +:TestDelay hex 13,0F ; x,y db MenuOption_Hex ; 1=hex input db 01 ; memory size (bytes) da TestDelay ; variable storage -:BeginTest hex 0B,12 ; x,y +:BeginTest hex 0B,14 ; x,y db MenuOption_Action ; 2=action db MenuStr_BeginTestL ; menu string length da MenuStr_BeginTest ; string storage @@ -577,23 +639,29 @@ _TestType_3 asc "RANDWORD",$00 _TestType_4 asc "CHECKERS",$00 _TestType_5 asc "BANK",$00 +TestSize db 00 + db 02 + da _TestSize_0,_TestSize_1 +_TestSize_0 asc "BYTE",$00 +_TestSize_1 asc "WORD",$00 + MenuStr_JSR da BeginTest ; MUST PRECEDE MENU STRING! Yes, it's magicly inferred. (-2) MenuStr_BeginTest asc "BEGIN TEST" MenuStr_BeginTestL equ #*-MenuStr_BeginTest MenuStr_BeginTestE db 00 MainMenuStrs - asc " ____________________________________________________________________________",$8D,$00 - asc " ",$1B,'ZGGGGGGGGGGGGGGGGGGGGGGGGGGG\'," Mini Memory Tester ",'\GGGGGGGGGGGGG\'," v0.1a ",'\GGGGG_',$18,$8D,$00 - asc " ",$1B,'ZWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVWVW'," ReactiveMicro ",'VW_',$18,$8D,00 - asc " ",$1B,'ZLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL_',$18,$8D,00 - asc " ",$1B,'Z'," ",'Z \GGG_',"Test Settings",'ZGGG\ _'," ",'_',$18,$8D,00 - asc " ",$1B,'Z'," ",'Z'," ",'_'," ",'_',$18,$8D,00 + asc " ______________________________________________________________________________",$8D,$00 + asc $1B,'ZG', " ",'@'," ",'GGGGGGGGGGGGGGGGGG\'," Mini Memory Tester v0.2 ",'\GGGGGGGGGGG\'," UltimateMicro ",'\G_',$18,$00 + asc $1B,'ZLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL_',$18,00 + asc $1B,'Z',"",'Z \GGG_',"Test Settings",'ZGGG\ _'," ",'_',$18,00 + asc $1B,'Z'," ",'Z'," ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," Start BANK: ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," End BANK: ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," Start ADDR: ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," End ADDR: ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," ",'_'," ",'_',$18,$8D,00 + asc " ",$1B,'Z'," ",'Z'," Test Size: ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," Test Type: ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," Test Byte: ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," Test Delay: ",'_'," ",'_',$18,$8D,00 @@ -602,7 +670,6 @@ MainMenuStrs asc " ",$1B,'Z'," ",'Z'," ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z'," ",'_'," ",'_',$18,$8D,00 - asc " ",$1B,'Z'," ",'Z'," ",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z'," ",'Z',"_________________________",'_'," ",'_',$18,$8D,00 asc " ",$1B,'Z',"____________________________________________________________________________",'_',$18,$8D,00 @@ -615,7 +682,9 @@ MainMenuStrs WaitKey -:kloop lda KEY +:kloop + ;jsr ColorizeMenu + lda KEY bpl :kloop sta STROBE cmp #"b" ; REMOVE DEBUG diff --git a/src/strings.s b/src/strings.s index 2ab33ac..f59d1f2 100644 --- a/src/strings.s +++ b/src/strings.s @@ -6,76 +6,134 @@ * GoXY * PrintStringsX * PrintString - -PRINTSTRING MAC - lda #]1 - ldy #>]1 - jsr PrintString - <<< -GOXY MAC - ldx ]1 - ldy ]2 - stx $24 - sty $25 - jsr VTAB - <<< +PRINTSTRING MAC + lda #]1 + ldy #>]1 + jsr PrintString + <<< -PRINTXY MAC - ldx ]1 - ldy ]2 - stx $24 - sty $25 - jsr VTAB - lda #]3 - ldy #>]3 - jsr PrintString - <<< +GOXY MAC + ldx ]1 + ldy ]2 + stx $24 + sty $25 + jsr VTAB + <<< -GoXY stx $24 - sty $25 - jsr VTAB - rts +PRINTXY MAC + ldx ]1 + ldy ]2 + stx $24 + sty $25 + jsr VTAB + lda #]3 + ldy #>]3 + jsr PrintString + <<< + +GoXY stx $24 + sty $25 + jsr VTAB + rts * lda #MainMenuStrs * ldy #>MainMenuStrs * ldx #05 ; horiz pos -PrintStringsX stx _printstringsx_horiz +PrintStringsX stx _printstringsx_horiz - sta $0 - sty $1 -:loop lda _printstringsx_horiz - sta $24 - lda $0 ; slower, but allows API reuse - ldy $1 - jsr PrintString ; y is last val - iny - lda ($0),y - beq :done - tya ; not done so add strlen to source ptr - clc - adc $0 - sta $0 - bcc :nocarry - inc $1 -:nocarry bra :loop + sta $0 + sty $1 +:loop lda _printstringsx_horiz + sta $24 + lda $0 ; slower, but allows API reuse + ldy $1 + jsr PrintString ; y is last val + iny + lda ($0),y + beq :done + tya ; not done so add strlen to source ptr + clc + adc $0 + sta $0 + bcc :nocarry + inc $1 +:nocarry bra :loop -:done rts +:done rts -_printstringsx_horiz db 00 +_printstringsx_horiz db 00 * PrintString (A=Low Byte, Y=High Byte) -PrintString sta :loop+1 - sty :loop+2 +PrintString sta :loop+1 + sty :loop+2 - ldy #0 -:loop lda $FFFF,y ; dummy bytes - beq :done - jsr COUT - iny - bra :loop -:done rts + ldy #0 +:loop lda $FFFF,y ; dummy bytes + beq :done + jsr COUT + iny + bra :loop +:done rts + + + + + + +LOG MAC + lda #]1 + ldy #>]1 + jsr ConsoleLog + <<< + +_consoleBottom = #23 +* Write out to console window +ConsoleLog pha + phy + lda #0 ;settings to bottom-left of window + sta $24 + lda #_consoleBottom-1 + sta $25 + jsr VTAB + lda #$8D ;pre-fix CR + jsr COUT + ply + pla + jsr PrintString + rts + +* Set console windowing +WinConsole lda #3 + sta $20 ;left edge + lda #75 + sta $21 ;width + lda #17 + sta $22 ;top edge + lda #_consoleBottom + sta $23 ;bottom edge + rts + +* Set info windowing +WinInfo lda #52 + sta $20 ;left edge + lda #26 + sta $21 ;width + lda #5 + sta $22 ;top edge + lda #16 + sta $23 ;bottom edge + rts + +* Restore full screen windowing +WinFull stz $20 + stz $22 + lda #80 + sta $21 + lda #24 + sta $23 + rts