Skip to main content
13 events
when toggle format what by license comment
Oct 15, 2022 at 16:33 comment added supercat If a jump table fits within a page, and code to access it is in RAM, a sequence like txa / asl / adc #table_low / sta ijmp+1 / ijmp: jmp (target) will be more efficient than `lda table_lo,x / pha / lda table_hi,x / pha / rts". The main advantage of the latter form is that it can handle reentrant function calls, while faster approaches cannot.
Oct 21, 2018 at 17:50 comment added mannaggia mva is macro in MADS, the assembler being used in the example. I used to do some assembler on the Atari back in the day, and never saw MADS before seeing it referenced here the past few days. Must have been after my time. Looks interesting.
Oct 21, 2018 at 8:21 comment added Omar and Lorraine What is this mva opcode?
Oct 20, 2018 at 19:05 history edited Raffzahn CC BY-SA 4.0
Apropriate title, Spelling, Thank yo uremoved
Oct 20, 2018 at 18:02 comment added dirkt @Raffzahn: Ah, so the real answer is that it's a not a single vector, but part of a data structure, and that's the reason the -1 form is used (by choice), because you can't use an indirect jump anyway, and you need to use pha/rts.
Oct 20, 2018 at 17:44 comment added Raffzahn @dirkt Also, COUT itself is just a JMP (CSW), thus saving the need for an indirec jump in your own program. THis only works with a single pointer at a fixed location, not an indexed list of pointers or structures.
Oct 20, 2018 at 17:34 comment added Raffzahn @dirkt Because it's part of a list of addresses - or better list of IOCB. The Atari OS is a bit more sophisticated compared with the C64. It is based on an abstract, file based IO system called CIO, which used IO controll blocks for each open file. For BASIC there is a lisst of 8 IOCB predefined. Each has at offset 6 a pointer with the function to be called for output ($34*6* here). For outputing the routine is just called with the IOCB number times $10 in X, so instead of a fixed address, above LDA use (IOCB_list+6,X) to fetch whatever pointer is needed and uses the RTS mechanic.
Oct 20, 2018 at 17:27 comment added dirkt @Raffzahn: So why don't they just store it in addr instead of addr-1 form? It was certainly common to do that, e.g. COUT on the Apple II, and IIRC also in the C64 ROM.
Oct 20, 2018 at 17:06 comment added Raffzahn @dirkt Because the address is possibly stored in routine-1 form and ment to be used that way. An indirect Jump would require a non decremented one, So this is faster than loading and incrementing it for use with an indirect jump.
Oct 20, 2018 at 16:59 vote accept user115898
Oct 20, 2018 at 16:05 answer added Raffzahn timeline score: 18
Oct 20, 2018 at 15:59 comment added dirkt The routine does an indirect jump to the contents of putchar_ptr, because rts jump to the contents just pushed on the stack. I don't know why they are doing it that way instead of using a plain indirect jump.
Oct 20, 2018 at 15:47 history asked user115898 CC BY-SA 4.0