User Tools

Site Tools


playground:playground

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
playground:playground [2016-02-07 23:34] mattplayground:playground [2024-03-15 23:51] (current) ftc
Line 1: Line 1:
-;I have slight modified the Macie's routine that is for 3 digits decimal number. +====== PlayGround ======
-;this routine converts 5 digits decimal number (range 0-65535) to equivalent hex number.+
  
- +Here you can do whatever you want, to learn and try out the formatting features offered by dokuwikiThere is a [[wiki:syntax|separate page that describes the syntax of dokuwiki]] that you may want to have look atto see what features are availableand experiment a bit with that on this page.
-                !to "dec2hex.prg",cbm +
- +
-                *=$0810 +
- lda #0 +
-  sta lores ;result byteLo +
- sta hires ;result byteHi +
-  lda numA ;load units and tens byte +
- and #$0f ;store +
- sta lores ;units nibble +
-                lda numA ;tens nibble +
- lsr  +
- lsr +
-  lsr +
- lsr +
- sta addr1+1 ;put tens nibble after ldx in adder subroutine +
- lda #$0a ;put 10 after adc opcode in adder subroutine +
-  sta addr2+1 +
- lda #$0 ;2 byte addition +
- sta addr3+1 +
- jsr addr1  +
- lda numB ;load handreds and miles byte +
- pha +
- and #$0f  +
- sta addr1+1 ;put hundreds nibble after ldx... +
- lda #$64 ;put 100 ($64) after adc opcode...  +
-  sta addr2+1 +
- lda #$0 +
- sta addr3+1 +
- jsr addr1 +
- pla +
- lsr +
- lsr +
- lsr +
- lsr +
- sta addr1+1     ;put thousands nibble after ldx... +
- lda #$e8 ;add 1000, first add lobyte $e8 +
- sta addr2+1 +
- lda #$03 ;...after add hibyte $03 +
- sta addr3+1 +
- jsr addr1 +
- lda numC ;load tens of thousands +
- and #$0f +
- sta addr1+1 ;add 10000 ($2710) +
- lda #$10 +
- sta addr2+1 +
- lda #$27 +
- sta addr3+1 +
- jsr addr1 +
- rts +
-;adder subroutine +
-        addr1   ldx #00 ;numbers of additions +
- clc +
-        loop lda lores +
-        addr2 adc #00 ;$a, $64; $e8$10 +
- sta lores +
- lda hires +
-        addr3 adc #00 ;$0, $03, $27 +
- sta hires +
- dex +
- bne loop +
- rts +
- ;for 65535  +
-    numA !byte 00 ;numA=35  +
-    numB !byte 00 ;numB=55 +
-    numC !byte 00 ;numC=06 +
-    lores !byte 00  +
-    hires !byte 00 +
  
playground/playground.txt · Last modified: 2024-03-15 23:51 by ftc