EDASS-128-HIGH-SCORE-COUNTER {HISCORE} --------------------------------------------------------------------------------------------------- TOOL: EDASS-128, Assembler-Editor {Commodore C128} Language: Assembler Extra: none Author: Misel Zivanovic Note: (C) 19th of OCTOBER 2026 - www.lived.ch, mzretro.ch Doc Revision: 1.0 Last update: 09:03 20.10.2026 --------------------------------------------------------------------------------------------------- Disk Content: 0 "mzretro " mz 2a 0 "edass-128 " seq 0 "source code file" seq 6 "score002.asm" prg 0 "----------------" seq 0 "basic demo------" seq 1 "counter.bas" prg 1 "counter.bl" prg 0 "----------------" seq 0 "www.mzretro.ch " seq 0 "www.lived.ch " seq 0 "----------------" seq 0 "commodore c128 " seq 0 "for edass-128 " seq 0 "editor-assembler" seq 0 "----------------" seq 656 blocks free. --------------------------------------------------------------------------------------------------- BASIC EXAMPLE: --------------------------------------------------------------------------------------------------- This program will load and show the counter in action! PLEASE NOTE: This counter can be used from BASIC, but the main goal is to use it directly as a part of your assembler program/game. --------------------------------------------------------------------------------------------------- FRIENDLY WARNING: Running this BASIC program while SFK 2.1 {Set Function Keys} is installed, will make SFK corrupt because SFK 2.1 is made to be for assembly coding only! If it gets corrupted, just manually BLOAD"sfk01.bl" from EDASS-128 disk and type SYS 2048! Working again! EDASS-128 will not be effected by this corruption! You can still use it, but will need to type all commands manually. e.g. !assembler"score002.asm" --------------------------------------------------------------------------------------------------- 10 rem www.mzretro.ch www.lived.ch 20 rem score counter-demo 30 bload"counter.bl" 40 scnclr 50 char 1,0,0,"score:057750" 60 for a=1 to 250 70 sys 4864 80 for b=1 to 10:next 90 next --------------------------------------------------------------------------------------------------- SOME ADDITIONAL INFORMATION --------------------------------------------------------------------------------------------------- You'll notice how this counter is not producing any magic nor it will make you sweat extraordinary! True is only one fact: You can absolutely easy adapt it to your assembler program. So it is not EDASS-128 or C128 only! It can be used with all Commodore Computers and also with all other computers using 6502 CPU and of course the assembler itself. The last part is resetting the counter to 0! It is reborn so to speak and it will start to count from scratch {1} again! inc $d020 isn't really needed, but it is an indicator that the counter was reset! You can test it by setting the counter to score:999950 and then run the BASIC example. --------------------------------------------------------------------------------------------------- SOURCE CODE LISTING - EDASS-128 - Commodore C128 --------------------------------------------------------------------------------------------------- score002.asm -a:0010-a: -e: ; in addition to ml-score lesson, we ; will now do the same also here and ; add a few digits to have a score ; counter until score:999999 in 1 steps ; that should cover most of the games! ; ------------------------------------- ; ; www.mzretro.ch - www.lived.ch ; ; games score counter version 1.0 ; 6 digits counter! 012345 ; 000000 ; scotxt = $0400 scopos = $0406 up = $01 zero = $30 ; *= $1300 .obj m .bank 15 ; sed ;set decimal mode lda scopos+5 ;read last digit clc ;clear carry adc #up ;add up to accu sta scopos+5 ;write it to HS lda scopos+5 ;read it cmp #$40 ;is more than 9? bcs check4 ;then next digit back cld ;otherwise end ; ;decimal mode rts ;and go back call ; check4 lda scopos+4 ;load next digit clc ;clear carry adc #up ;add up to accu sta scopos+4 ;write it to HS lda #zero ;load accu with 0 sta scopos+5 ;write it to last lda scopos+4 ;read val. of 4th cmp #$40 ;digit. it's >9 bcs check3 ;then check next jmp back ;otherwise back! ; check3 lda scopos+3 ;repeat. now for clc ;the remaining adc #up ;4 digits! sta scopos+3 lda #zero sta scopos+4 lda scopos+3 cmp #$40 bcs check2 jmp back check2 lda scopos+2 clc adc #up sta scopos+2 lda #zero sta scopos+3 lda scopos+2 cmp #$40 bcs check1 jmp back check1 lda scopos+1 clc adc #up sta scopos+1 lda #zero sta scopos+2 lda scopos+1 cmp #$40 bcs check0 jmp back check0 lda scopos+0 clc adc #up sta scopos+0 lda #zero sta scopos+1 lda scopos+0 cmp #$40 bcs scratch jmp back scratch cld ;cld = mandatory lda #zero ;or otherwise sta scopos+0 ;crash! inc $d020 rts ;max counter! ; --------------------------------------------------------------------------------------------------- You probably have noticed this: The counter can be very easily extended, but i guess 999999 points is more than enough! By easily extended, i do not mean to actually change the code, but to just add a 0 or 00 behind the last 9! With one zero added it would mean when you can a counter 1x, it will add 10 to the counter. if you add 00, then it would add 100 to the counter... Examples: {Note: the active digits are always the first 6} 0000010 adding 10 to counter! 00000100 adding 100 to counter! Why would you wanna do that? Well, humans like to win big, right! Hahaha... ---------------------------------------------------------------------------------------------------