1
0
mirror of https://github.com/stid/woz64.git synced 2024-06-06 06:29:27 +00:00
woz64/hex.asm

40 lines
1.6 KiB
NASM
Raw Normal View History

2019-11-06 04:31:17 +00:00
#importonce
2019-11-10 03:10:52 +00:00
.filenamespace Hex
2019-11-16 22:09:22 +00:00
* = * "Hex Routines"
2019-11-06 04:31:17 +00:00
//
// btohex
//
//
// preparatory ops: .a: byte to convert
//
// returned values: .a: msn ascii char
// .x: lsn ascii char
// .y: entry value
//
2019-11-10 03:10:52 +00:00
byteToHex: pha //save byte
2019-11-06 04:31:17 +00:00
and #%00001111 //extract lsn
tax //save it
pla //recover byte
lsr //extract...
lsr //msn
lsr
lsr
pha //save msn
txa //lsn
2019-11-23 02:50:25 +00:00
jsr binhex1 //generate ascii lsn
2019-11-06 04:31:17 +00:00
tax //save
pla //get msn & fall thru
//
// convert nybble to hex ascii equivalent...
binhex1: cmp #$0a
2019-11-10 03:10:52 +00:00
bcc binhex2 //in decimal range
sbc #$09 //hex compensate
rts
2019-11-06 04:31:17 +00:00
binhex2: eor #%00110000 //finalize nybble
rts //done
2019-11-23 02:50:25 +00:00
#import "mem_map.asm"