Linguaggio macchina VIC20
Moderator: Moderators
Linguaggio macchina VIC20
Una buona serata a tutti voi amici,
so che mi renderò un po' ridicolo, alla mia età, a giocare ancora con questo coso, ma è vero, verissimo, il primo amore non si dimentica facilmente.
Nel poco tempo che mi rimane alla fine della giornata mi dedico allo studio del linguaggio macchina del processore 6502. Studio ho detto? oh che parola grossa! diciamo una lettura impegnata... anche perchè ho materiale solo in inglese, che non mastico molto bene.
Sicchè sono qui a chiedere un piccolo aiuto, un suggerimento, se c'è qualcuno già esperto.
La domanda è: a parte il buffer della cassetta (a partire dalla locazione 828=$033C per una manciata di bytes), c'è un'area di memoria abbastanza libera e sicura da utilizzare? i miei esperimenti non sono molto buoni. Smanetto con le locazioni che riducono l'area Basic, ma non riesco a ricavare molto. Avete qualche idea? Qualche consiglio?
Soprattutto, perdonate la sfacciataggine
fr.
so che mi renderò un po' ridicolo, alla mia età, a giocare ancora con questo coso, ma è vero, verissimo, il primo amore non si dimentica facilmente.
Nel poco tempo che mi rimane alla fine della giornata mi dedico allo studio del linguaggio macchina del processore 6502. Studio ho detto? oh che parola grossa! diciamo una lettura impegnata... anche perchè ho materiale solo in inglese, che non mastico molto bene.
Sicchè sono qui a chiedere un piccolo aiuto, un suggerimento, se c'è qualcuno già esperto.
La domanda è: a parte il buffer della cassetta (a partire dalla locazione 828=$033C per una manciata di bytes), c'è un'area di memoria abbastanza libera e sicura da utilizzare? i miei esperimenti non sono molto buoni. Smanetto con le locazioni che riducono l'area Basic, ma non riesco a ricavare molto. Avete qualche idea? Qualche consiglio?
Soprattutto, perdonate la sfacciataggine
fr.
Re: Linguaggio macchina VIC20
Ciao fr.,
Dipende cosa vuio raggiungere. Il cassette buffer é perfetto per corti programmi max. 204 Bytes.
Pure utilizzabile é l'area @ 02A7-02FF dec. 679- 767. Entrambe aree non bisognano die essere dichiararti al basic.
A presto
Dipende cosa vuio raggiungere. Il cassette buffer é perfetto per corti programmi max. 204 Bytes.
Pure utilizzabile é l'area @ 02A7-02FF dec. 679- 767. Entrambe aree non bisognano die essere dichiararti al basic.
A presto
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
-._/classes instead of masses\_.-
Re: Linguaggio macchina VIC20
Grazie per la risposta Noizer,
in realtà non so cosa voglio raggiungere... presumo che tradurre alcuni miei programmini in ML sia un compito un po' arduo al mio attuale livello e che dovrò accontentarmi di brevi routine, da richiamare in un fritto misto Basic/ML. Comunque per me già aver ottenuto una comprensione di quello che sto chiedendo è abbastanza
in realtà non so cosa voglio raggiungere... presumo che tradurre alcuni miei programmini in ML sia un compito un po' arduo al mio attuale livello e che dovrò accontentarmi di brevi routine, da richiamare in un fritto misto Basic/ML. Comunque per me già aver ottenuto una comprensione di quello che sto chiedendo è abbastanza
Re: Linguaggio macchina VIC20
Hello amici,
sempre io e sempre su questo argomento
Ho approfondito il suggerimento di Noizer sul riferimento a $02A7-$02FF e ho scoperto che si tratta di un'area di memoria a disposizione dell'utente ("program indirects") per memorizzare ad esempio dei puntatori ad altre aree di memoria (realizzando una jump table? è corretto quello che ho capito?). E anche che nel VIC tale area si estende da $02A1 (mentre nel C64 solo da $02A7: per la compatibilità tra i due sistemi è meglio questa seconda soluzione).
Io utilizzerei tale area per memorizzare una serie di stringhe da richiamare nel mio programma principale (una "data table", si dice così no?)
Adesso ho alcuni problemi:
1) la tabella suddetta è in una posizione di memoria, il programma principale in un'altra. Come posso salvare le due porzioni di memoria come fossero una sola?
2) se si riesce a risolvere il punto 1, come farò, nel richiamare da disco il programma, a far sì che che il codice si collochi nelle giuste aree di memoria?
3) in alternativa ai due punti precedenti, è possibile salvare la tabella dati non in memoria ma su disco, richiamandola quando si esegue il programma principale? (e naturalmente posizionandola nell'area prescelta cioè $02A1)
4) è un'idea stupida memorizzare le stringhe come ho pensato di fare io? (cioè stringa+$00, stringa+$00, ecc. e successiva lettura sequenziale) ci sono alternative diverse?
Lo so che per voi sono banalità. Grazie per la pazienza.
fr.
sempre io e sempre su questo argomento
Ho approfondito il suggerimento di Noizer sul riferimento a $02A7-$02FF e ho scoperto che si tratta di un'area di memoria a disposizione dell'utente ("program indirects") per memorizzare ad esempio dei puntatori ad altre aree di memoria (realizzando una jump table? è corretto quello che ho capito?). E anche che nel VIC tale area si estende da $02A1 (mentre nel C64 solo da $02A7: per la compatibilità tra i due sistemi è meglio questa seconda soluzione).
Io utilizzerei tale area per memorizzare una serie di stringhe da richiamare nel mio programma principale (una "data table", si dice così no?)
Adesso ho alcuni problemi:
1) la tabella suddetta è in una posizione di memoria, il programma principale in un'altra. Come posso salvare le due porzioni di memoria come fossero una sola?
2) se si riesce a risolvere il punto 1, come farò, nel richiamare da disco il programma, a far sì che che il codice si collochi nelle giuste aree di memoria?
3) in alternativa ai due punti precedenti, è possibile salvare la tabella dati non in memoria ma su disco, richiamandola quando si esegue il programma principale? (e naturalmente posizionandola nell'area prescelta cioè $02A1)
4) è un'idea stupida memorizzare le stringhe come ho pensato di fare io? (cioè stringa+$00, stringa+$00, ecc. e successiva lettura sequenziale) ci sono alternative diverse?
Lo so che per voi sono banalità. Grazie per la pazienza.
fr.
- orion70
- VICtalian
- Posts: 4343
- Joined: Thu Feb 02, 2006 4:45 am
- Location: Piacenza, Italy
- Occupation: Biologist
Re: Linguaggio macchina VIC20
Ciao! Ogni tanto torno su questo thread per vedere se qualcuno ti ha risposto, ma secondo me qui siamo come la proverbiale particella di sodio nell'acqua minerale . Io stesso ti aiuterei volentieri, se solo non fossi un ignorante totale globale generale in LM / assembly et similia (mastico solo il BASIC al livello di un quindicenne nel 1985).
Ti suggerirei quindi di armarti di santa pazienza e di Google translator, e postare queste tue domande e considerazioni nella sezione "programming", in inglese.
Ti suggerirei quindi di armarti di santa pazienza e di Google translator, e postare queste tue domande e considerazioni nella sezione "programming", in inglese.
- chysn
- Vic 20 Scientist
- Posts: 1205
- Joined: Tue Oct 22, 2019 12:36 pm
- Website: http://www.beigemaze.com
- Location: Michigan, USA
- Occupation: Software Dev Manager
Re: Linguaggio macchina VIC20
I regret that I cannot answer your questions in Italian, and I hope that translation is adequate.
Only contiguous regions of memory may be saved to and loaded from disk or tape. So if you must span two regions of memory, you would have to use two separate files, or a single file that spans all memory between the two regions.fraural wrote: ↑Sun Oct 17, 2021 11:07 am 1) la tabella suddetta è in una posizione di memoria, il programma principale in un'altra. Come posso salvare le due porzioni di memoria come fossero una sola?
2) se si riesce a risolvere il punto 1, come farò, nel richiamare da disco il programma, a far sì che che il codice si collochi nelle giuste aree di memoria?
Of course. In this case, you would use KERNAL routines to load memory from a separate file.
That's a common way to store strings, since the VIC-20's BASIC string-printing routine ($cb1e) expects $00-terminated strings. Even if you don't use this routine, $00 is not really used for anything important in PETSCII, and thus makes a great string terminator.
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5
WIP: MIDIcast BASIC extension
he/him/his
WIP: MIDIcast BASIC extension
he/him/his
Re: Linguaggio macchina VIC20
Allora ragazzi, mi ero scordato pure io di aver fatto la mia tiritera, anche perchè nel frattempo ho studiato e provato da solo. Cosa che dà comunque una certa soddisfazione. Anzitutto Orion ti ringrazio per esserti interessato e aver avuto una parola per me La faccenda della particella di sodio la capiremo solo io e te ma non importa, la battuta era carina
Se vuoi ci mettiamo insieme a studiare questa cosa del linguaggio macchina... io mi diverto come un matto e sono passati ormai quaranta anni dal mio primo amore
Poi ringrazio moltissimo chysn per il suo post... provo a risponderti in inglese
Chysn, I try to answer you in English which is difficult for me even with a translator
Thank you very much for your patience, you perfectly understood my questions and answered them adequately. In these days I have studied a little and I too have realized the different possibilities. I have decided to do without BASIC a little, and therefore occupy the memory area starting at $1000, so I have all the contiguous space I want... This solution is perfect for me as I am learning.
I have also seen here on this forum some examples to use the Kernal SAVE and LOAD routines. It will be the next goal.
By now I'm trying, with some results, to use RND (to make it simple, through the routine in $E094).
I am grateful to you my friends, for your waste of time for me.
(glad to know my previous 4 point wasn't that silly )
One last thing:
Se vuoi ci mettiamo insieme a studiare questa cosa del linguaggio macchina... io mi diverto come un matto e sono passati ormai quaranta anni dal mio primo amore
Poi ringrazio moltissimo chysn per il suo post... provo a risponderti in inglese
Chysn, I try to answer you in English which is difficult for me even with a translator
Thank you very much for your patience, you perfectly understood my questions and answered them adequately. In these days I have studied a little and I too have realized the different possibilities. I have decided to do without BASIC a little, and therefore occupy the memory area starting at $1000, so I have all the contiguous space I want... This solution is perfect for me as I am learning.
I have also seen here on this forum some examples to use the Kernal SAVE and LOAD routines. It will be the next goal.
By now I'm trying, with some results, to use RND (to make it simple, through the routine in $E094).
I am grateful to you my friends, for your waste of time for me.
(glad to know my previous 4 point wasn't that silly )
One last thing:
I learned how to use $FFD2 to do screen printing. Did I learn badly?
- chysn
- Vic 20 Scientist
- Posts: 1205
- Joined: Tue Oct 22, 2019 12:36 pm
- Website: http://www.beigemaze.com
- Location: Michigan, USA
- Occupation: Software Dev Manager
Re: Linguaggio macchina VIC20
$ffd2 is the KERNAL's character print routine, while $cb1e is a BASIC routine that prints an entire $00-terminated string using A as the low byte and Y as the high byte of the start of the string.
Code: Select all
LDA #<str
LDY #>str
JMP $cb1e
str: "HELLO WORLD!", $00
Re: Linguaggio macchina VIC20
Thanks for your valuable suggestion!chysn wrote: ↑Wed Oct 27, 2021 3:59 pm $ffd2 is the KERNAL's character print routine, while $cb1e is a BASIC routine that prints an entire $00-terminated string using A as the low byte and Y as the high byte of the start of the string.
Both are useful, depending on what you want to do.Code: Select all
LDA #<str LDY #>str JMP $cb1e str: "HELLO WORLD!", $00
Unfortunately my monitor (VICMON) has no way to be used as in your example, so I'm organizing myself in some other way.
Anyway I got the idea!
- chysn
- Vic 20 Scientist
- Posts: 1205
- Joined: Tue Oct 22, 2019 12:36 pm
- Website: http://www.beigemaze.com
- Location: Michigan, USA
- Occupation: Software Dev Manager
Re: Linguaggio macchina VIC20
When you see assembly language code examples, you'll frequently see symbols and data that do not exactly match the syntax of any specific assembler. You'll learn to mentally translate such examples for whatever you're using. For example, < typically refers to the low byte of a 16-bit value, while > refers to the high byte of that value.
One of the legion weaknesses of VICmon is that it provides no elegant tool for entering PETSCII data. The fallback is often using BASIC to put a string somewhere and then moving it to its place. "Using" VICmon is usually the same thing as "battling" VICmon.
- orion70
- VICtalian
- Posts: 4343
- Joined: Thu Feb 02, 2006 4:45 am
- Location: Piacenza, Italy
- Occupation: Biologist
Re: Linguaggio macchina VIC20
Aren't there many other monitors in the wild?
- Mike
- Herr VC
- Posts: 4879
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Linguaggio macchina VIC20
Ciò che chysn ha scritto come esempio di codice è tipico della notazione utilizzata da un assemblatore simbolico. Invece di semplici valori e indirizzi, vengono utilizzati simboli con nomi significativi. Esistono operatori per calcolare offset o estrarre byte bassi e alti.fraural wrote:Unfortunately my monitor (VICMON) has no way to be used as in your example, [...]
Per loro stessa natura, gli assemblatori simbolici sono (per lo più) non interattivi. Scrivi il codice sorgente, lo assembli al codice oggetto (questi due passaggi non devono necessariamente essere eseguiti sulla macchina di destinazione) e quindi esegui il codice oggetto (sulla macchina di destinazione o in emulazione).
Al contrario, i monitor sono principalmente destinati all'esecuzione interattiva sulla macchina di destinazione. Non sono così a loro agio per quanto riguarda la notazione simbolica e devi ricorrere a valori, indirizzi e offset e anche disporre l'allocazione della memoria pianificando con carta e penna. I monitor dovrebbero funzionare partendo dal presupposto di base che non modificano lo stato della macchina a meno che non sia assolutamente necessario. La gestione delle coppie simbolo/valore comporterebbe notevoli requisiti di buffer RAM che qui sono semplicemente fuori discussione: chysn's wAx implementa un approccio minimo, ma potrebbe scontrarsi con l'uso del nastro da parte di altre persone o con il buffer "programma indiretto" (non ricordo bene sapere quale cera usa per questo).
VICMON e wAx sono già stati citati, poi ci sono HESMON, Micromon, C'mon - questi ultimi due in diversi gusti.orion70 wrote:Aren't there many other monitors in the wild?
E poi c'è il mio MINIMON.
Re: Linguaggio macchina VIC20
Non volevo scatenare una battaglia fra guru
Le vostre spiegazioni sono perfette e confermano quello che ho visto e che sto studiando (ho già visto tutti gli strumenti citati da Mike).
Si tratta insomma di scegliere se confezionare qualcosa con un interprete o andare più a basso livello e scrivere direttamente in memoria (ho iniziato con carta e penna e penso che continuerò così, è faticoso ma divertente).
Non sono un professionista nè un programmatore come voi... Apprezzo moltissimo che mi abbiate dedicato il tempo e l'attenzione. Naturalmente io non posso ricambiare ma avete una birra virtuale pagata
(e adesso proviamo a tradurre in inglese quanto sopra... Orion correggimi se la traduzione è cannata!)
(and now let's try to translate the above into English... Orion please correct me if the translation is wrong!)
I didn't want to start a flame between gurus...
Your explanations are perfect and confirm what I have seen and what I am studying (I have already seen the tools mentioned by Mike).
In short, it is a matter of choosing whether to write something with an interpreter or to go lower and write directly in memory (I started with pen and paper and I think I will continue like this, more tiring but more fun).
I am not a professional nor a programmer like you ... I appreciate very much that you have given me your time and attention. Of course I can't reciprocate, but you have a paid virtual beer
Le vostre spiegazioni sono perfette e confermano quello che ho visto e che sto studiando (ho già visto tutti gli strumenti citati da Mike).
Si tratta insomma di scegliere se confezionare qualcosa con un interprete o andare più a basso livello e scrivere direttamente in memoria (ho iniziato con carta e penna e penso che continuerò così, è faticoso ma divertente).
Non sono un professionista nè un programmatore come voi... Apprezzo moltissimo che mi abbiate dedicato il tempo e l'attenzione. Naturalmente io non posso ricambiare ma avete una birra virtuale pagata
(e adesso proviamo a tradurre in inglese quanto sopra... Orion correggimi se la traduzione è cannata!)
(and now let's try to translate the above into English... Orion please correct me if the translation is wrong!)
I didn't want to start a flame between gurus...
Your explanations are perfect and confirm what I have seen and what I am studying (I have already seen the tools mentioned by Mike).
In short, it is a matter of choosing whether to write something with an interpreter or to go lower and write directly in memory (I started with pen and paper and I think I will continue like this, more tiring but more fun).
I am not a professional nor a programmer like you ... I appreciate very much that you have given me your time and attention. Of course I can't reciprocate, but you have a paid virtual beer
- Mike
- Herr VC
- Posts: 4879
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Linguaggio macchina VIC20
Nessun problema. Non c'è motivo per cui qualcuno di noi vorrebbe iniziare una guerra di fiamme.fraural wrote:Non volevo scatenare una battaglia fra guru
Tuttavia, i programmatori desiderano molto utilizzare strumenti che soddisfino i loro gusti. Per essere più precisi: ho deciso per un monitor più compatto di VICMON e anche uno che non disturbasse lo spazio di lavoro del sistema operativo nella misura in cui lo fa VICMON - e ho finito per scrivere il mio, MINIMON. Con più o meno le stesse ragioni, chysn ha iniziato con wAx e ha ottenuto un risultato simile, ma ancora diverso nei dettagli di implementazione e funzione.
Come assemblatore simbolico, ho usato l'assemblatore in linea di Acorn BBC BASIC, e sono probabilmente l'unico nel forum ad usarlo. Altri usano ACME, DASM, ca65 o altri strumenti - ma nessuno si lamenta dello strumento dell'altra scelta, e siamo tutti consapevoli che la loro sintassi deve essere adattata quando il sorgente viene portato tra gli assemblatori.
Grazie!Naturalmente io non posso ricambiare ma avete una birra virtuale pagata
- chysn
- Vic 20 Scientist
- Posts: 1205
- Joined: Tue Oct 22, 2019 12:36 pm
- Website: http://www.beigemaze.com
- Location: Michigan, USA
- Occupation: Software Dev Manager
Re: Linguaggio macchina VIC20
I don't think I've ever seen a 6502 assembler flame war. There's too much diversity in 6502 assemblers and life is too short.
I just get down on VICmon because I spent six months trying to use it in earnest. I still own a VICmon cartridge.
I just get down on VICmon because I spent six months trying to use it in earnest. I still own a VICmon cartridge.
Program Indirects ($02a1-$02ff) can be used for up to 20 labels and 12 unresolved forward references. If you don't use symbolic features, and just use wAx as a regular interactive assembler, it leaves the Program Indirects space untouched.