playground:playground
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
playground:playground [2015-10-03 14:43] – ftc | playground:playground [2016-02-07 23:34] – matt | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PlayGround ====== | + | ;I have slight modified the Macie' |
+ | ;this routine converts 5 digits decimal number (range 0-65535) to equivalent hex number. | ||
+ | |||
+ | |||
+ | !to " | ||
+ | |||
+ | *=$0810 | ||
+ | lda #0 | ||
+ | sta lores ; | ||
+ | sta hires ; | ||
+ | lda numA ;load units and tens byte | ||
+ | and # | ||
+ | sta lores ;units nibble | ||
+ | lda numA ;tens nibble | ||
+ | lsr | ||
+ | lsr | ||
+ | | ||
+ | lsr | ||
+ | sta addr1+1 ; | ||
+ | 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 ; | ||
+ | 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 | ||
+ | lda #$e8 ;add 1000, first add lobyte $e8 | ||
+ | sta addr2+1 | ||
+ | lda # | ||
+ | sta addr3+1 | ||
+ | jsr addr1 | ||
+ | lda numC ;load tens of thousands | ||
+ | and #$0f | ||
+ | sta addr1+1 ; | ||
+ | lda #$10 | ||
+ | sta addr2+1 | ||
+ | lda #$27 | ||
+ | sta addr3+1 | ||
+ | jsr addr1 | ||
+ | rts | ||
+ | ;adder subroutine | ||
+ | addr1 ldx # | ||
+ | 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 | ||
- | [[http:// |
playground/playground.txt · Last modified: 2024-03-15 23:51 by ftc