|
Post by stiggity on Feb 9, 2021 0:24:07 GMT
Yes.. indeed. Another quick question(s)... im currently JUST dealing with strings in ML. Is there a kernal routine, to set hi/lo nybble, and store a 16bit number into a convenient area in memory. Im trying to find an integers hi/lo, setup a kernal call, and store the integers value in a segment of memory. like ac%=1234:sys(addy) and the routine i want to send the integers value to the screen. I appreciate help.
|
|
|
Post by bjonte on Feb 9, 2021 11:21:52 GMT
Im trying to find an integers hi/lo, setup a kernal call, and store the integers value in a segment of memory. like ac%=1234:sys(addy) and the routine i want to send the integers value to the screen. I appreciate help. You can feed three bytes to register A, X and Y using the SYS command. SYS ADDR,A,X,Y So you can feed the address like this. SYS ADDR, AC%AND255, INT(AC%/256)
|
|
|
Post by stiggity on Feb 9, 2021 20:06:44 GMT
thank You!! alot!!! no i mean, i want to write a routine that finds an integer's hi/low byte location in memory. like in BASIC7, if ac%=1234 id like to write something that find the #"A"+128 #"C"+128 save hi/low then using those pointers, calls a kernal routine that stores then result at, is it , location $0100?? Pretty much what im attempting to accomplish is be able to display raw integers at will, similarly how i display variables.
|
|
|
Post by bjonte on Feb 9, 2021 21:23:55 GMT
I’m still not sure what you want to do. Search the memory for something? Just print values to the screen?
Can you make a BASIC program that does what you want so we can understand how to convert it to assembler?
|
|
|
Post by stiggity on Feb 9, 2021 21:35:02 GMT
In BASIC i want to be able to output to the screen the contents of any given integer. Please bare with me. I'll post my source code (which is horrible, but you gotta start somewhere)
begin lda #"a"+128 sta var1 ;ac% lda #"c"+128 sta var2 cent
LDA $2F
STA $BB
LDA $30
STA $BC
O3 LDY #$00
jsr fetch1
CMP var1
BNE O4
INY
jsr fetch1
CMP var2
BEQ O5
O4 CLC
LDA $BB
ADC #$07
STA $BB
LDA $BC
ADC #$00
STA $BC
JMP O3
O5 INY
JSR fetch1
beq tro
;STA ny ;uplen ;start1 + 1 ;strlen
INY
JSR fetch1 ;strptr lo
pha
INY
JSR fetch1 ;strptr hi
STA $BC
pla
sta $bb
jmp getper
;===============================
getper
LDA $bc
LDx $bb
sta $64 ;high
stx $65 ;low
ldx #$90 ;exponent bias
sec ;flag positive
jsr $8c75 ;FAC = unsigned 16
jsr $8e44 ;FAC to string at $100
ldy #0
e43 lda $0100,y
beq s5
jsr $ffd2 ;output integers value to screen iny
jmp e43
s5 sty len gth rts
;============================
fetch1 LDA #$BB ;ZP pointer to use
LDX #1 ;bank index 1
JMP $FF74 ;kernal
|
|
|
Post by wendling on Feb 11, 2021 17:09:15 GMT
At label 05 in your listing you read three values instead of the two integer bytes.
|
|
|
Post by bjonte on Feb 11, 2021 20:36:22 GMT
So the problem is really to print a 16 bit decimal integer value to the screen in assembler?
|
|
|
Post by wendling on Feb 12, 2021 10:04:04 GMT
At label 05: delete iny delete jsr fetch1 delete beq tro
At label getper: change lda $bc to lda $bb change ldx $bb to ldy $bc delete sta $64 delete stx $65 delete ldx #$90 delete sec change jsr $8c75 to jsr $793c change jsr $8e44 to jsr $8e42
Change the 4 lines at label “begin” to: sta var1 stx var2
In BASIC:
10 ac%=100 20 sys (listing begin), asc(“a”)+128,asc(“c”)+128 30 print 40 ah%=-100 50 sys (listing begin), asc(“a”)+128,asc(“h”)+128
Run and result on screen: 100 -100
|
|
|
Post by stiggity on Feb 13, 2021 16:57:12 GMT
Wendling: Wow! without a firm grasp on c128 om calls, how on earth did you derive $793c? i was working in the right direction... everything is working A-1!! i really appreciate your knowledge/expertise. I knew i wasnt dealing with a string, but didnt understand simply to retrieve hi/low nybble. You're Awesome!
|
|
|
Post by stiggity on Feb 13, 2021 19:41:14 GMT
wendling: If you dot mind me asking, would this routine(s) work for non-integers? Ex. ab=123 ? instead of lda#"a"+128, sta var1, lda#"b", sta var2? i know= single letter variable "a$" is lda#"a", then lda#128.. are you aware of the setup for sending a number variable to screen? like "aa=1234", "a=157" now i'd like to send a number variable to screen.. i really need, "Mapping The 128".. are the two rom address's that replaced my non-working address's above, different when dealing with a number variable(s)??
|
|